Quaternion values and 2.x

From wowdev
Revision as of 01:09, 19 August 2008 by Schlumpf (talk | contribs) (New page: In WoW 2.0+ Blizzard are now storing rotation data in 16bit values instead of 32bit. I don't really understand why as its only a very minor saving in model sizes and adds extra overhead in...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

In WoW 2.0+ Blizzard are now storing rotation data in 16bit values instead of 32bit. I don't really understand why as its only a very minor saving in model sizes and adds extra overhead in processing the models. Need this structure to read the data into.

struct PACK_QUATERNION {   
	__int16 x,y,z,w;  
}; 


class Quat16ToQuat32 {
public: 
	static const Quaternion conv(const PACK_QUATERNION t)
	{
		return Quaternion(
			float(t.x < 0? t.x + 32768 : t.x - 32767)/ 32767.0f, 
			float(t.y < 0? t.y + 32768 : t.y - 32767)/ 32767.0f,
			float(t.z < 0? t.z + 32768 : t.z - 32767)/ 32767.0f,
			float(t.w < 0? t.w + 32768 : t.w - 32767)/ 32767.0f);
	}
};