29 extern int Openvr_QUIT_CB;
30 extern int Openvr_IPD_CB;
33 int64 getTickCount(
void)
35 #if defined WIN32 || defined _WIN32 || defined WINCE 36 LARGE_INTEGER counter;
37 QueryPerformanceCounter(&counter);
38 return (int64)counter.QuadPart;
39 #elif defined __linux || defined __linux__ 41 clock_gettime(CLOCK_MONOTONIC, &tp);
42 return (int64)tp.tv_sec * 1000000000 + tp.tv_nsec;
43 #elif defined __MACH__ && defined __APPLE__ 44 return (int64)mach_absolute_time();
48 gettimeofday(&tv, &tz);
49 return (int64)tv.tv_sec * 1000000 + tv.tv_usec;
61 mCameraFrameBufferSize = 0;
62 mCameraFrameBuffer = NULL;
63 mCameraLastFrameId = 0;
64 mCameraEnable =
false;
67 mInputPath = inpuPath;
68 mActionSet = vr::k_ulInvalidActionSetHandle;
71 mTrackedCameraHandle = INVALID_TRACKED_CAMERA_HANDLE;
73 mTexturesBounds[0].uMin = 0;
74 mTexturesBounds[0].uMax = 1;
75 mTexturesBounds[0].vMin = 1;
76 mTexturesBounds[0].vMax = 0;
78 mTexturesBounds[1].uMin = 0;
79 mTexturesBounds[1].uMax = 1;
80 mTexturesBounds[1].vMin = 1;
81 mTexturesBounds[1].vMax = 0;
83 for (
unsigned int i = 0; i < MAX_VR_CONTROLLERS; i++)
86 #ifdef USE_VIVE_GESTURE 87 mGestureInterface =
true;
88 UseExternalTransform(
false);
89 mLastGestureFrameIndex = -1;
98 bool sOpenvr::IsConnected()
103 bool sOpenvr::Connect()
108 #ifdef USE_VIVE_GESTURE 111 mGestureOption.mode = GestureModeSkeleton;
114 GestureFailure result = StartGestureDetection(&mGestureOption);
115 if (result != GestureFailureNone)
116 mGestureInterface =
false;
118 mGestureInterface =
true;
121 mHMDSystem = VR_Init(&mHMDError, vr::EVRApplicationType::VRApplication_Scene);
122 if (mHMDError != vr::VRInitError_None)
127 MMechostr(MSKRUNTIME,
"OpenVR Error: failed OpenVR VR_Init, Non described error when initializing the OpenVR Render object.\n");
130 case vr::VRInitError_Init_HmdNotFound:
131 case vr::VRInitError_Init_HmdNotFoundPresenceFailed:
132 MMechostr(MSKRUNTIME,
"OpenVR Error: cannot find HMD, Please install SteamVR and launch it, and verify HMD USB and HDMI connection\n");
140 MMechostr(MSKRUNTIME,
"OpenVR Error: failed to init VRsystem, Non described error when initializing the OpenVR Render object.\n");
145 if (!vr::VRCompositor())
147 MMechostr(MSKRUNTIME,
"OpenVR Error: failed to init OpenVR VRCompositor\n");
153 int bufflen = mHMDSystem->GetStringTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_TrackingSystemName_String, 0, 0, 0);
156 char* buff =
new char[bufflen];
157 mHMDSystem->GetStringTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_TrackingSystemName_String, buff, bufflen, 0);
162 MMechostr(MSKRUNTIME,
"OpenVR HMD name: %s\n", sdevice.c_str());
165 bufflen = mHMDSystem->GetStringTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_SerialNumber_String, 0, 0, 0);
168 char* buff =
new char[bufflen];
169 mHMDSystem->GetStringTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_SerialNumber_String, buff, bufflen, 0);
174 MMechostr(MSKRUNTIME,
"OpenVR HMD serial: %s\n", sserial.c_str());
179 for (
unsigned int i = 0; i < MAX_VR_CONTROLLERS; i++)
185 mCamera = vr::VRTrackedCamera();
188 MMechostr(MSKRUNTIME,
"OpenVR No camera found\n");
191 bool bHasCamera =
false;
192 vr::EVRTrackedCameraError nCameraError = mCamera->HasCamera(vr::k_unTrackedDeviceIndex_Hmd, &bHasCamera);
193 if (nCameraError != vr::VRTrackedCameraError_None || !bHasCamera)
195 MMechostr(MSKRUNTIME,
"OpenVR No tracked camera available: %s\n", mCamera->GetCameraErrorNameFromEnum(nCameraError));
201 vr::VRInput()->SetActionManifestPath(mInputPath.c_str());
202 vr::VRInput()->GetActionSetHandle(
"/actions/scol", &mActionSet);
209 std::string sOpenvr::GetHmdName()
215 int bufflen = mHMDSystem->GetStringTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_TrackingSystemName_String, 0, 0, 0);
218 char* buff =
new char[bufflen];
219 mHMDSystem->GetStringTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_TrackingSystemName_String, buff, bufflen, 0);
226 void sOpenvr::Disconnect()
229 for (
unsigned int i = 0; i < MAX_VR_CONTROLLERS; i++)
230 SAFE_DELETE(mControllers[i]);
234 mCamera->ReleaseVideoStreamingService(mTrackedCameraHandle);
236 mCameraEnable =
false;
239 if (mCameraFrameBuffer)
241 delete[] mCameraFrameBuffer;
242 mCameraFrameBuffer = NULL;
255 #ifdef USE_VIVE_GESTURE 256 if (mGestureInterface)
257 StopGestureDetection();
261 void sOpenvr::ResetHmd()
264 mHMDSystem->ResetSeatedZeroPose();
267 bool sOpenvr::IsVisible()
272 inline Matrix4 sOpenvr::getMatrix4FromSteamVRMatrix34(
const vr::HmdMatrix34_t& mat)
276 mat.m[0][0], mat.m[0][1], mat.m[0][2], mat.m[0][3],
277 mat.m[1][0], mat.m[1][1], mat.m[1][2], mat.m[1][3],
278 mat.m[2][0], mat.m[2][1], mat.m[2][2], mat.m[2][3],
279 0.0f, 0.0f, 0.0f, 1.0f
283 bool sOpenvr::GetHmdOrientation(
Quaternion &quat)
288 vr::TrackedDevicePose_t hmdPose;
289 if ((hmdPose = mTrackedPoses[vr::k_unTrackedDeviceIndex_Hmd]).bPoseIsValid)
291 const vr::HmdMatrix34_t mat = hmdPose.mDeviceToAbsoluteTracking;
292 Matrix4 cmat(mat.m[0][0], mat.m[0][1], mat.m[0][2], mat.m[0][3],
293 mat.m[1][0], mat.m[1][1], mat.m[1][2], mat.m[1][3],
294 mat.m[2][0], mat.m[2][1], mat.m[2][2], mat.m[2][3],
295 0.0f, 0.0f, 0.0f, 1.0f);
297 quat = cmat.extractQuaternion();
298 mPreviousHmdQuat = quat;
302 quat = mPreviousHmdQuat;
308 bool sOpenvr::GetHmdPosition(
Vector3 &vec)
313 vr::TrackedDevicePose_t hmdPose;
314 if ((hmdPose = mTrackedPoses[vr::k_unTrackedDeviceIndex_Hmd]).bPoseIsValid)
316 const vr::HmdMatrix34_t mat = hmdPose.mDeviceToAbsoluteTracking;
317 Matrix4 cmat(mat.m[0][0], mat.m[0][1], mat.m[0][2], mat.m[0][3],
318 mat.m[1][0], mat.m[1][1], mat.m[1][2], mat.m[1][3],
319 mat.m[2][0], mat.m[2][1], mat.m[2][2], mat.m[2][3],
320 0.0f, 0.0f, 0.0f, 1.0f);
322 vec = cmat.getTrans();
323 mPreviousHmdPos = vec;
327 vec = mPreviousHmdPos;
333 bool sOpenvr::GetProjectionMatrix(vr::EVREye eye,
float nearclip,
float farclip,
Matrix4 &mat)
338 vr::HmdMatrix44_t vrmat = mHMDSystem->GetProjectionMatrix(eye, nearclip, farclip);
339 for (
unsigned int x : { 0, 1, 2, 3 })
340 for (
unsigned int y : { 0, 1, 2, 3 })
341 mat[x][y] = vrmat.m[x][y];
346 bool sOpenvr::GetStereoTextureSize(
unsigned int &w,
unsigned int &h)
351 mHMDSystem->GetRecommendedRenderTargetSize(&w, &h);
354 w = (
unsigned int)((
float)w * 1.25f);
355 h = (
unsigned int)((
float)h * 1.25f);
369 float sOpenvr::GetStereoConfigAspect()
374 float sOpenvr::GetStereoConfigFovY()
379 float sOpenvr::GetStereoIPD()
383 return mHMDSystem->GetFloatTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_UserIpdMeters_Float);
389 bool sOpenvr::Update()
393 vr::VRCompositor()->WaitGetPoses(mTrackedPoses, vr::k_unMaxTrackedDeviceCount, 0, 0);
400 ProcessTrackedDevices();
408 void sOpenvr::UpdateTextures(
void* leftTexture,
void* rightTexture, vr::ETextureType type)
412 mTextures[0] = { leftTexture, type, vr::ColorSpace_Gamma };
413 mTextures[1] = { rightTexture, type, vr::ColorSpace_Gamma };
415 if (type == vr::TextureType_DirectX)
417 mTexturesBounds[0].uMin = 0;
418 mTexturesBounds[0].uMax = 1;
419 mTexturesBounds[0].vMin = 0;
420 mTexturesBounds[0].vMax = 1;
422 mTexturesBounds[1].uMin = 0;
423 mTexturesBounds[1].uMax = 1;
424 mTexturesBounds[1].vMin = 0;
425 mTexturesBounds[1].vMax = 1;
429 mTexturesBounds[0].uMin = 0;
430 mTexturesBounds[0].uMax = 1;
431 mTexturesBounds[0].vMin = 1;
432 mTexturesBounds[0].vMax = 0;
434 mTexturesBounds[1].uMin = 0;
435 mTexturesBounds[1].uMax = 1;
436 mTexturesBounds[1].vMin = 1;
437 mTexturesBounds[1].vMax = 0;
439 vr::VRCompositor()->Submit(vr::Eye_Left, &mTextures[0], &mTexturesBounds[0]);
440 vr::VRCompositor()->Submit(vr::Eye_Right, &mTextures[1], &mTexturesBounds[1]);
444 void sOpenvr::ProcessEvents()
448 while (mHMDSystem && mHMDSystem->PollNextEvent(&event,
sizeof event))
switch (event.eventType)
451 case vr::VREvent_DriverRequestedQuit:
452 case vr::VREvent_Quit:
453 vr::VRSystem()->AcknowledgeQuit_Exiting();
455 OBJpostEvent(Openvr_QUIT_CB, SCOL_PTR
this, 0);
459 case vr::VREvent_IpdChanged:
460 OBJpostEvent(Openvr_IPD_CB, SCOL_PTR
this, 0);
466 void sOpenvr::ProcessTrackedDevices()
468 if (mTrackedPoses[vr::k_unTrackedDeviceIndex_Hmd].bPoseIsValid)
474 vr::VRActiveActionSet_t actionSet = { 0 };
475 actionSet.ulActionSet = mActionSet;
476 vr::VRInput()->UpdateActionState(&actionSet,
sizeof(actionSet), 1);
480 for (
unsigned int trackedDevice = vr::k_unTrackedDeviceIndex_Hmd + 1; trackedDevice < vr::k_unMaxTrackedDeviceCount; trackedDevice++)
485 if (!mHMDSystem || (mHMDSystem->GetTrackedDeviceClass(trackedDevice) != vr::TrackedDeviceClass_Controller && mHMDSystem->GetTrackedDeviceClass(trackedDevice) != vr::TrackedDeviceClass_GenericTracker))
490 VrControllerSide side = VrControllerSide::Undefined;
491 switch (mHMDSystem->GetControllerRoleForTrackedDeviceIndex(trackedDevice))
493 case vr::ETrackedControllerRole::TrackedControllerRole_LeftHand:
494 side = VrControllerSide::Left;
497 case vr::ETrackedControllerRole::TrackedControllerRole_RightHand:
498 side = VrControllerSide::Right;
501 case vr::ETrackedControllerRole::TrackedControllerRole_Invalid:
506 if (side != VrControllerSide::Undefined)
507 mControllers[side]->Update(mTrackedPoses, trackedDevice);
508 else if (((
id + 2) < MAX_VR_CONTROLLERS) && (mControllers[
id + 2] != 0))
510 mControllers[
id + 2]->Update(mTrackedPoses, trackedDevice);
515 #ifdef USE_VIVE_GESTURE 516 if (mGestureInterface)
518 const GestureResult* points = NULL;
521 int size = GetGestureResult(&points, &frameIndex);
523 if ((frameIndex >= 0) && (frameIndex != mLastGestureFrameIndex))
527 mControllers[8]->SetState(
false);
528 mControllers[9]->SetState(
false);
532 mLastGestureFrameIndex = frameIndex;
533 for (
int i = 0; i < size; i++)
535 unsigned int id = (points[i].isLeft) ? 8 : 9;
536 mControllers[id]->UpdateGesture(points[i],
id);
546 return (mCamera) ? true :
false;
549 bool sOpenvr::IsCameraEnable()
551 return mCameraEnable;
554 bool sOpenvr::StartCamera()
556 uint32_t nCameraFrameBufferSize = 0;
557 if (mCamera->GetCameraFrameSize(vr::k_unTrackedDeviceIndex_Hmd, vr::VRTrackedCameraFrameType_Undistorted, &mCameraWidth, &mCameraHeight, &nCameraFrameBufferSize) != vr::VRTrackedCameraError_None)
559 MMechostr(MSKRUNTIME,
"OpenVR Start camera failed\n");
563 if (nCameraFrameBufferSize && nCameraFrameBufferSize != mCameraFrameBufferSize)
565 if (mCameraFrameBufferSize)
566 delete[] mCameraFrameBuffer;
568 mCameraFrameBufferSize = nCameraFrameBufferSize;
569 mCameraFrameBuffer =
new uint8_t[mCameraFrameBufferSize];
570 memset(mCameraFrameBuffer, 0, mCameraFrameBufferSize);
573 mCameraLastFrameId = 0;
575 mCamera->AcquireVideoStreamingService(vr::k_unTrackedDeviceIndex_Hmd, &mTrackedCameraHandle);
576 if (mTrackedCameraHandle == INVALID_TRACKED_CAMERA_HANDLE)
578 MMechostr(MSKRUNTIME,
"OpenVR Acquire camera failed\n");
582 mCameraEnable =
true;
586 void sOpenvr::StopCamera()
589 mCamera->ReleaseVideoStreamingService(mTrackedCameraHandle);
590 mTrackedCameraHandle = INVALID_TRACKED_CAMERA_HANDLE;
591 mCameraEnable =
false;
594 void sOpenvr::GetCameraSize(uint32_t &w, uint32_t &h)
600 bool sOpenvr::GetCameraFrame(PtrObjBitmap scolBitmap)
606 vr::CameraVideoStreamFrameHeader_t frameHeader;
607 vr::EVRTrackedCameraError nCameraError = mCamera->GetVideoStreamFrameBuffer(mTrackedCameraHandle, vr::VRTrackedCameraFrameType_Undistorted,
nullptr, 0, &frameHeader,
sizeof(frameHeader));
608 if (nCameraError != vr::VRTrackedCameraError_None)
611 if (frameHeader.nFrameSequence == mCameraLastFrameId)
618 nCameraError = mCamera->GetVideoStreamFrameBuffer(mTrackedCameraHandle, vr::VRTrackedCameraFrameType_Undistorted, mCameraFrameBuffer, mCameraFrameBufferSize, &frameHeader,
sizeof(frameHeader));
619 if (nCameraError != vr::VRTrackedCameraError_None)
622 mCameraLastFrameId = frameHeader.nFrameSequence;
627 if (scolBitmap->TailleW != mCameraWidth || scolBitmap->TailleH != mCameraHeight)
631 int sbpl = mCameraWidth * 4;
632 int dbpl = scolBitmap->BPL;
635 memcpy(scolBitmap->bits, mCameraFrameBuffer, scolBitmap->TailleW * scolBitmap->TailleH * scolBitmap->BytesPP);
638 int numthreads = (scolBitmap->TailleH <= 8) ? 1 : boost::thread::hardware_concurrency();
639 int rows = scolBitmap->TailleH / numthreads;
640 int extra = scolBitmap->TailleH % numthreads;
644 ConversionTools::SConvertBuffer conv(mCameraFrameBuffer, 0, scolBitmap->bits, scolBitmap->TailleW, scolBitmap->TailleH, sbpl, 1, dbpl, scolBitmap->BytesPP);
646 boost::thread_group thgroup;
647 for (
int t = 1; t <= numthreads; t++)
666 if (
id >= MAX_VR_CONTROLLERS)
669 return mControllers[id];
674 mHmdSystem = hmdSystem;
677 mSide = (
id > 1) ? VrControllerSide::Undefined : (VrControllerSide)id;
678 mType = (
id > 7) ? HANDS_CONTROLLER : (
id > 1) ? TRACKER_CONTROLLER : CLASSIC_CONTROLLER;
680 mMatrix = Matrix4::IDENTITY;
681 mAxisValues = Vector3::ZERO;
682 mVelocity = Vector3::ZERO;
683 mAngularVelocity = Vector3::ZERO;
686 mSource = vr::k_ulInvalidInputValueHandle;
687 mActionPose = vr::k_ulInvalidActionHandle;
688 mActionHaptic = vr::k_ulInvalidActionHandle;
689 mPadAxis = vr::k_ulInvalidActionHandle;
690 mTriggerAxis = vr::k_ulInvalidActionHandle;
692 std::string sSide =
"left";
696 sSide =
"tracker" + std::to_string(
id - 1);
698 vr::VRInput()->GetInputSourceHandle((std::string(
"/user/hand/") + sSide).c_str(), &mSource);
699 vr::VRInput()->GetActionHandle((std::string(
"/actions/scol/out/") + sSide +
"_haptic").c_str(), &mActionHaptic);
700 vr::VRInput()->GetActionHandle((std::string(
"/actions/scol/in/") + sSide +
"_pose").c_str(), &mActionPose);
702 vr::VRInput()->GetActionHandle((std::string(
"/actions/scol/in/") + sSide +
"_axis0_value").c_str(), &mPadAxis);
703 vr::VRInput()->GetActionHandle((std::string(
"/actions/scol/in/") + sSide +
"_axis1_value").c_str(), &mTriggerAxis);
705 vr::VRActionHandle_t act = vr::k_ulInvalidActionHandle;
706 vr::VRInput()->GetActionHandle((std::string(
"/actions/scol/in/") + sSide +
"_applicationmenu_press").c_str(), &act);
707 mActionsToHandle.push_back(act);
709 act = vr::k_ulInvalidActionHandle;
710 vr::VRInput()->GetActionHandle((std::string(
"/actions/scol/in/") + sSide +
"_grip_press").c_str(), &act);
711 mActionsToHandle.push_back(act);
713 act = vr::k_ulInvalidActionHandle;
714 vr::VRInput()->GetActionHandle((std::string(
"/actions/scol/in/") + sSide +
"_system_press").c_str(), &act);
715 mActionsToHandle.push_back(act);
717 act = vr::k_ulInvalidActionHandle;
718 vr::VRInput()->GetActionHandle((std::string(
"/actions/scol/in/") + sSide +
"_axis0_press").c_str(), &act);
719 mActionsToHandle.push_back(act);
721 act = vr::k_ulInvalidActionHandle;
722 vr::VRInput()->GetActionHandle((std::string(
"/actions/scol/in/") + sSide +
"_axis1_press").c_str(), &act);
723 mActionsToHandle.push_back(act);
726 mButtonsToHandle.push_back(vr::k_EButton_ApplicationMenu);
727 mButtonsToHandle.push_back(vr::k_EButton_Grip);
728 mButtonsToHandle.push_back(vr::k_EButton_A);
729 mButtonsToHandle.push_back(vr::k_EButton_Axis0);
730 mButtonsToHandle.push_back(vr::k_EButton_Axis1);
732 mButtonsStates.resize(mButtonsToHandle.size(),
false);
739 void sOpenvrController::Update(vr::TrackedDevicePose_t* trackedPoses,
unsigned int deviceId)
741 mDeviceId = deviceId;
743 if (!trackedPoses[mDeviceId].bDeviceIsConnected || !trackedPoses[mDeviceId].bPoseIsValid)
754 mMatrix = sOpenvr::getMatrix4FromSteamVRMatrix34(trackedPoses[mDeviceId].mDeviceToAbsoluteTracking);
757 vr::InputDigitalActionData_t actionData;
758 for (uint8_t i = 0; i < mButtonsToHandle.size(); i++)
760 vr::VRInput()->GetDigitalActionData(mActionsToHandle[i], &actionData,
sizeof(actionData), vr::k_ulInvalidInputValueHandle);
761 mButtonsStates[i] = (actionData.bActive && actionData.bState) ?
true :
false;
766 mHmdSystem->GetControllerState(mDeviceId, &mControllerState,
sizeof mControllerState);
768 for (uint8_t i = 0; i < mButtonsToHandle.size(); i++)
770 mButtonsStates[i] = ((mControllerState.ulButtonPressed & vr::ButtonMaskFromId(mButtonsToHandle[i])) != 0) ? true :
false;
775 vr::InputAnalogActionData_t analogData;
776 if (vr::VRInput()->GetAnalogActionData(mPadAxis, &analogData,
sizeof(analogData), vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None && analogData.bActive)
778 mAxisValues.x = analogData.x;
779 mAxisValues.y = analogData.y;
782 if (vr::VRInput()->GetAnalogActionData(mTriggerAxis, &analogData,
sizeof(analogData), vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None && analogData.bActive)
784 mAxisValues.z = analogData.x;
788 mAxisValues.x = mControllerState.rAxis[vr::k_EButton_Axis0 - vr::k_EButton_Axis0].x;
789 mAxisValues.y = mControllerState.rAxis[vr::k_EButton_Axis0 - vr::k_EButton_Axis0].y;
790 mAxisValues.z = mControllerState.rAxis[vr::k_EButton_Axis1 - vr::k_EButton_Axis0].x;
793 float* vel = trackedPoses[mDeviceId].vVelocity.v;
794 mVelocity =
Vector3(vel[0], vel[1], vel[2]);
796 vel = trackedPoses[mDeviceId].vAngularVelocity.v;
797 mAngularVelocity =
Vector3(vel[0], vel[1], vel[2]);
800 #ifdef USE_VIVE_GESTURE 801 GestureType sOpenvrController::GetLastGesture()
806 void sOpenvrController::UpdateGesture(GestureResult result,
unsigned int deviceId)
808 mDeviceId = deviceId;
811 mLastGesture = result.gesture;
815 mMatrix[0][3] = result.points[0];
816 mMatrix[1][3] = result.points[1];
817 mMatrix[2][3] = result.points[2];
819 #endif // USE_VIVE_GESTURE 821 bool sOpenvrController::IsVisible()
826 void sOpenvrController::SetState(
bool state)
831 void sOpenvrController::SetSide(VrControllerSide side)
836 VrControllerSide sOpenvrController::GetSide()
841 void sOpenvrController::SetType(ControllerType type)
846 sOpenvrController::ControllerType sOpenvrController::GetType()
851 Vector3 sOpenvrController::GetPosition()
853 return mMatrix.getTrans();
856 Vector3 sOpenvrController::GetVelocity()
861 Vector3 sOpenvrController::GetAngularVelocity()
863 return mAngularVelocity;
866 Quaternion sOpenvrController::GetOrientation()
868 return mMatrix.extractQuaternion();
871 void sOpenvrController::Rumble(
float value)
873 int64 current = getTickCount();
876 if (current - mLastRumble > 50)
878 mLastRumble = current;
880 mHmdSystem->TriggerHapticPulse(mDeviceId, 0, static_cast<unsigned short>(value * 3500));
884 std::vector<bool> sOpenvrController::GetButtonsState()
886 return mButtonsStates;
889 Vector3 sOpenvrController::GetAxisValues()
899 unsigned int srcByte;
900 unsigned int destByte;
903 for (y = start; y < end; y++)
905 for (x = 0; x < conv.width; x++)
907 srcByte = (x * 4) + (conv.sbpl * y);
908 destByte = (x * conv.bpp) + (conv.dbpl * y);
910 ((uint8_t*)conv.dstBuff)[destByte] = conv.srcBuff[srcByte + 2];
911 ((uint8_t*)conv.dstBuff)[destByte + 1] = conv.srcBuff[srcByte + 1];
912 ((uint8_t*)conv.dstBuff)[destByte + 2] = conv.srcBuff[srcByte];
sOpenvrController(vr::IVRSystem *hmdSystem, unsigned int id)
sOpenvr(const char *inpuPath)