Convert BoneWeight to Float ?

02/25/2015 18:21 beydere#1
Hi Guys. I must convert short to float.

BoneIndex_1 = RDR.ReadByte();
BoneWeight_1 = RDR.ReadInt16(); //short
BoneIndex_2 = RDR.ReadByte();
BoneWeight_2 = RDR.ReadInt16(); //short

Help Me Please. Thanks
02/25/2015 18:24 Requi#2
I'm not familiar with SRO etc. but in the BitConverter Class of C# it's BitConverter.ToSingle();
02/25/2015 18:28 GoneUp#3
Convert.ToSingle?
02/25/2015 18:37 beydere#4
Quote:
Originally Posted by Requi View Post
I'm not familiar with SRO etc. but in the BitConverter Class of C# it's BitConverter.ToSingle();
short value is 2 byte but float is 4 byte so, not converted it.

Quote:
Originally Posted by GoneUp View Post
Convert.ToSingle?
I was Tried it. Because it is convert float. For example ;
int a = 32;
float b = Convert.ToSingle(32); // b = 32.0 but I worked out this float veriable's max value is 1 so, this veriable is 0 between 1
02/25/2015 21:16 magicanoo#5
If you're referring to SilkroadsecurityAPI, use ReadSingle() .
02/25/2015 21:34 beydere#6
I examine ReadSingle Method in SilkroadsecurityAPI. But Code is Same. :S
m_reader.ReadSingle(); this Code Read 4 bytes.

And: I'm not referring to it
03/03/2015 19:57 fakeheader#7
use cast in cpp

or memcpy