Sign in to follow this  
jor1980

[SlimDx]Write half variable into a file

Recommended Posts

Hi i am trying to write a half variable into a file with a binarywriter in visualbasic but when i do it the binarywriter writes into the file four bytes.Are there any other method to write halfs into files?

Share this post


Link to post
Share on other sites
There isn't any way at the moment. Half support is meant only for use in vertex declarations, as an optimization. There isn't much reason to avoid writing out four bytes when dealing with disk space.

On the other hand, if you think you really need it, you're free to modify the source to make the internal UInt16 value available for you to write out.

Share this post


Link to post
Share on other sites
Quote:
Original post by Mike.Popoloski
There isn't any way at the moment. Half support is meant only for use in vertex declarations, as an optimization. There isn't much reason to avoid writing out four bytes when dealing with disk space.

On the other hand, if you think you really need it, you're free to modify the source to make the internal UInt16 value available for you to write out.




I was thinking that way, put the bits of the half into an int16, but i don´t know how could i do that

Share this post


Link to post
Share on other sites
It's already done; that's how it's stored internally. If you do a check-out of the source and look in source/math/Half.h, you'll see that there's a UInt16 holding the value, it's just marked private. Make it public and you'll be able to use it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Mike.Popoloski
It's already done; that's how it's stored internally. If you do a check-out of the source and look in source/math/Half.h, you'll see that there's a UInt16 holding the value, it's just marked private. Make it public and you'll be able to use it.


i am using the SlimDx dll, have i do that in the code and then build a new dll or can i make it using only the dll?

Share this post


Link to post
Share on other sites
Quote:
Original post by Mike.Popoloski
It's already done; that's how it's stored internally. If you do a check-out of the source and look in source/math/Half.h, you'll see that there's a UInt16 holding the value, it's just marked private. Make it public and you'll be able to use it.


in the folder of slimdx i don´t have that, i have to look in the directx sdk?

Share this post


Link to post
Share on other sites
Quote:
Original post by Mike.Popoloski
It's already done; that's how it's stored internally. If you do a check-out of the source and look in source/math/Half.h, you'll see that there's a UInt16 holding the value, it's just marked private. Make it public and you'll be able to use it.


Please anyone coul tell where is that directory source/math/Half.h?Or where could i downnload it?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this