I have hooked up the 3Dconnexion API to our rendering system and everything works as expected apart from the fact that the magnitude of translations and rotations that I see on screen differ from application instance to instance (or possibly on windows boot to boot).
My windowing system logic is abstracted from my rendering logic and so I am not using the 3Dconnexion maths library. I am normalising the translations of the axes in the range -1 to 1 but this is done using a maximum that I discerned by observing the data structure in the watch window:
Code: Select all
#define MAX_3D_MOUSE_DISP 4650.0f
SiSpwEvent Event;
SiGetEventData Data;
SiGetEventWinInit(&Data, WM_3DXWARE, wParam, lParam);
SpwRetVal Val = SiGetEvent(m_3DMouseHandle, WM_3DXWARE, &Data, &Event);
if(Val == SI_IS_EVENT)
{
switch(Event.type)
{
case SI_MOTION_EVENT:
{
// Convert the data to a normalised
// floating point representation.
float Data[6];
for(unsigned int i = 0; i < 6; ++i)
{
Data[i] = (float)Event.u.spwData.mData[i];
Data[i] = Data[i] < -MAX_3D_MOUSE_DISP ? -MAX_3D_MOUSE_DISP : Data[i];
Data[i] = Data[i] > MAX_3D_MOUSE_DISP ? MAX_3D_MOUSE_DISP : Data[i];
Data[i] /= MAX_3D_MOUSE_DISP;
}
Handle3DMouseData(Data, (float)Event.u.spwData.period);
break;
}