-
Notifications
You must be signed in to change notification settings - Fork 1
/
VirtualMotionGloveDevice.cpp
41 lines (33 loc) · 1.57 KB
/
VirtualMotionGloveDevice.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "VirtualMotionGloveDevice.h"
#include "org_osvr_VirtualMotion_json.h"
using namespace OSVRVirtualMotion;
using namespace osvr::pluginkit;
////////////////////////////////////////////////////////////////////////////////////////////////////////
/*----------------------------------------------------------------------------------------------------*/
VirtualMotionGloveDevice::VirtualMotionGloveDevice(OSVR_PluginRegContext pContext, const std::vector<VML_GLOVE*>& gloves) :
mGloves(gloves),
mVirtualMotionData(NULL), mAnalog(NULL), mTracker(NULL), mConfigure(NULL)
{
OSVR_DeviceInitOptions options = osvrDeviceCreateInitOptions(pContext);
mVirtualMotionData = new VirtualMotionData(gloves);
mAnalog = new Analog(mDeviceToken, options, *mVirtualMotionData);
mTracker = new Tracker(mDeviceToken, *mAnalog, options, *mVirtualMotionData);
mConfigure = new Configure(mDeviceToken, options, *mVirtualMotionData);
mDeviceToken.initAsync(pContext, "Controller", options);
mDeviceToken.sendJsonDescriptor(org_osvr_VirtualMotion_json);
mDeviceToken.registerUpdateCallback(this);
}
/*----------------------------------------------------------------------------------------------------*/
VirtualMotionGloveDevice::~VirtualMotionGloveDevice() {
delete mVirtualMotionData;
delete mAnalog;
delete mTracker;
delete mConfigure;
}
/*----------------------------------------------------------------------------------------------------*/
OSVR_ReturnCode VirtualMotionGloveDevice::update() {
mVirtualMotionData->update();
mAnalog->update();
mTracker->update();
return OSVR_RETURN_SUCCESS;
}