Quaternion values and 2.x: Difference between revisions

From wowdev
Jump to navigation Jump to search
(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...)
 
mNo edit summary
Line 17: Line 17:
  }
  }
  };
  };
-- WoWModelViewer - animated.h

Revision as of 01:18, 19 August 2008

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);
	}
};


-- WoWModelViewer - animated.h