Wrapper over Space Mouse data chunk within WM_INPUT event (known also as Raw Input in WinAPI). This class predefines specific list of supported devices, which does not depend on 3rdparty library provided by mouse vendor. Supported input chunks:
RAWINPUTDEVICE aRawInDevList[1];
RAWINPUTDEVICE& aRawSpace = aRawInDevList[0];
aRawSpace.usUsagePage = HID_USAGE_PAGE_GENERIC;
aRawSpace.usUsage = HID_USAGE_GENERIC_MULTI_AXIS_CONTROLLER;
aRawSpace.dwFlags = 0;
aRawSpace.hwndTarget = (HWND )theWindow->NativeHandle();
if (!::RegisterRawInputDevices (aRawInDevList, 1, sizeof(aRawInDevList[0]))) { Error; }
#define Handle(Class)
Define Handle() macro.
Definition Standard_Handle.hxx:403
Then handle WM_INPUT events within window message loop.
case WM_INPUT:
{
UINT aSize = 0;
::GetRawInputData ((HRAWINPUT )theLParam, RID_INPUT, NULL, &aSize, sizeof(RAWINPUTHEADER));
process known devices if (aSize == 0 || ::GetRawInputData ((HRAWINPUT )theLParam, RID_INPUT,
aRawData, &aSize, sizeof(RAWINPUTHEADER)) != aSize)
{
break;
}
const RAWINPUT* aRawInput = (RAWINPUT* )(BYTE* )aRawData;
if (aRawInput->header.dwType != RIM_TYPEHID)
{
break;
}
RID_DEVICE_INFO aDevInfo; aDevInfo.cbSize = sizeof(RID_DEVICE_INFO);
UINT aDevInfoSize = sizeof(RID_DEVICE_INFO);
if (::GetRawInputDeviceInfoW (aRawInput->header.hDevice, RIDI_DEVICEINFO, &aDevInfo,
&aDevInfoSize) != sizeof(RID_DEVICE_INFO)
{
break;
}
const double aTimeStamp = theViewCtrl.
EventTime();
WNT_HIDSpaceMouse aSpaceData (aDevInfo.hid.dwProductId, aRawInput->data.hid.bRawData,
aRawInput->data.hid.dwSizeHid); if (aSpaceData.IsTranslation())
{
bool isIdle = true, isQuadric = true;
}
if (aSpaceData.IsRotation()) {}
if (aSpaceData.IsKeyState()) {}
break;
}
@ Aspect_VKey_NavSlideRight
sidewalk, right
Definition Aspect_VKey.hxx:170
@ Aspect_VKey_NavSlideDown
fall down
Definition Aspect_VKey.hxx:172
@ Aspect_VKey_NavForward
go forward
Definition Aspect_VKey.hxx:167
@ Aspect_VKey_NavBackward
go backward
Definition Aspect_VKey.hxx:168
@ Aspect_VKey_NavSlideUp
lift up
Definition Aspect_VKey.hxx:171
@ Aspect_VKey_NavSlideLeft
sidewalk, left
Definition Aspect_VKey.hxx:169
NCollection_Vec3< Standard_Real > Graphic3d_Vec3d
Definition Graphic3d_Vec3.hxx:21
Auxiliary structure for handling viewer events between GUI and Rendering threads.
Definition AIS_ViewController.hxx:55
double EventTime() const
Return event time (e.g. current time).
Definition Aspect_WindowInputListener.hxx:34
Aspect_VKeySet & ChangeKeys()
Return keyboard state.
Definition Aspect_WindowInputListener.hxx:56
void KeyFromAxis(Aspect_VKey theNegative, Aspect_VKey thePositive, double theTime, double thePressure)
Simulate key up/down events from axis value.
Auxiliary class optimizing creation of array buffer (using stack allocation for small arrays).
Definition NCollection_LocalArray.hxx:25
Element_t x() const
Alias to 1st component as X coordinate in XYZ.
Definition NCollection_Vec3.hxx:113
Element_t z() const
Alias to 3rd component as Z coordinate in XYZ.
Definition NCollection_Vec3.hxx:125
Element_t y() const
Alias to 2nd component as Y coordinate in XYZ.
Definition NCollection_Vec3.hxx:119
WNT_HIDSpaceMouse(unsigned long theProductId, const Standard_Byte *theData, Standard_Size theSize)
Main constructor.
@ VENDOR_ID_3DCONNEXION
Definition WNT_HIDSpaceMouse.hxx:93
@ VENDOR_ID_LOGITECH
Definition WNT_HIDSpaceMouse.hxx:92