13 #include "vtkOpenGLState.h" 14 #include "vtkOpenVROverlay.h" 15 #include "vtkOpenVRRenderWindow.h" 16 #include "imstkVtkOpenVRRenderWindowInteractorImstk.h" 17 #include "vtkRendererCollection.h" 18 #include "vtkVRRenderWindow.h" 20 #include "vtkEventData.h" 23 #include "vtkCommand.h" 24 #include "vtkMatrix4x4.h" 26 #include "vtkObjectFactory.h" 27 #include "vtkOpenVRCamera.h" 28 #include "vtkOpenVRInteractorStyle.h" 29 #include "vtkTextureObject.h" 30 #include "vtkTransform.h" 31 #include <vtksys/SystemTools.hxx> 36 void* vtkOpenVRRenderWindowInteractorImstk::ClassExitMethodArg = (
void*)
nullptr;
37 void(*vtkOpenVRRenderWindowInteractorImstk::ClassExitMethodArgDelete)(
38 void*) = (
void (*)(
void*))
nullptr;
42 vtkOpenVRRenderWindowInteractorImstk::vtkOpenVRRenderWindowInteractorImstk()
44 vtkNew<vtkOpenVRInteractorStyle> style;
45 this->SetInteractorStyle(style);
47 for (
int i = 0; i < vtkEventDataNumberOfDevices; i++)
51 this->ActionManifestFileName =
"./vtk_openvr_actions.json";
52 this->ActionSetName =
"/actions/vtk";
56 vtkOpenVRRenderWindowInteractorImstk::~vtkOpenVRRenderWindowInteractorImstk() =
default;
59 vtkOpenVRRenderWindowInteractorImstk::SetPhysicalScale(
double scale)
61 vtkVRRenderWindow* win = vtkVRRenderWindow::SafeDownCast(this->RenderWindow);
62 win->SetPhysicalScale(scale);
66 vtkOpenVRRenderWindowInteractorImstk::GetPhysicalScale()
68 vtkVRRenderWindow* win = vtkVRRenderWindow::SafeDownCast(this->RenderWindow);
69 return win->GetPhysicalScale();
74 vtkCamera*,
double t1,
double t2,
double t3)
76 vtkVRRenderWindow* win = vtkVRRenderWindow::SafeDownCast(this->RenderWindow);
77 win->SetPhysicalTranslation(t1, t2, t3);
81 vtkOpenVRRenderWindowInteractorImstk::GetPhysicalTranslation(vtkCamera*)
83 vtkVRRenderWindow* win = vtkVRRenderWindow::SafeDownCast(this->RenderWindow);
84 return win->GetPhysicalTranslation();
88 vtkOpenVRRenderWindowInteractorImstk::ConvertOpenVRPoseToMatrices(
89 const vr::TrackedDevicePose_t& tdPose, vtkMatrix4x4* poseMatrixWorld,
90 vtkMatrix4x4* poseMatrixPhysical )
92 if (!poseMatrixWorld && !poseMatrixPhysical)
97 vtkNew<vtkMatrix4x4> poseMatrixPhysicalTemp;
98 for (
int row = 0; row < 3; ++row)
100 for (
int col = 0; col < 4; ++col)
102 poseMatrixPhysicalTemp->SetElement(row, col, tdPose.mDeviceToAbsoluteTracking.m[row][col]);
105 if (poseMatrixPhysical)
107 poseMatrixPhysical->DeepCopy(poseMatrixPhysicalTemp);
112 vtkVRRenderWindow* win = vtkVRRenderWindow::SafeDownCast(this->RenderWindow);
113 vtkNew<vtkMatrix4x4> physicalToWorldMatrix;
114 win->GetPhysicalToWorldMatrix(physicalToWorldMatrix);
115 vtkMatrix4x4::Multiply4x4(physicalToWorldMatrix, poseMatrixPhysicalTemp, poseMatrixWorld);
120 vtkOpenVRRenderWindowInteractorImstk::ConvertPoseToWorldCoordinates(
121 const vr::TrackedDevicePose_t& tdPose,
129 this->ConvertPoseMatrixToWorldCoordinates(
130 tdPose.mDeviceToAbsoluteTracking.m, pos, wxyz, ppos, wdir);
134 vtkOpenVRRenderWindowInteractorImstk::ConvertPoseMatrixToWorldCoordinates(
135 const float poseMatrix[3][4],
142 vtkVRRenderWindow* win = vtkVRRenderWindow::SafeDownCast(this->RenderWindow);
143 double physicalScale = win->GetPhysicalScale();
144 double* trans = win->GetPhysicalTranslation();
147 double* vup = win->GetPhysicalViewUp();
148 double* dop = win->GetPhysicalViewDirection();
150 vtkMath::Cross(dop, vup, vright);
154 hvright[0] = poseMatrix[0][0];
155 hvright[1] = poseMatrix[1][0];
156 hvright[2] = poseMatrix[2][0];
158 hvup[0] = poseMatrix[0][1];
159 hvup[1] = poseMatrix[1][1];
160 hvup[2] = poseMatrix[2][1];
164 for (
int i = 0; i < 3; i++)
166 ppos[i] = poseMatrix[i][3];
169 pos[0] = ppos[0] * vright[0] + ppos[1] * vup[0] - ppos[2] * dop[0];
170 pos[1] = ppos[0] * vright[1] + ppos[1] * vup[1] - ppos[2] * dop[1];
171 pos[2] = ppos[0] * vright[2] + ppos[1] * vup[2] - ppos[2] * dop[2];
173 for (
int i = 0; i < 3; i++)
175 pos[i] = pos[i] * physicalScale - trans[i];
180 fvright[0] = hvright[0] * vright[0] + hvright[1] * vup[0] - hvright[2] * dop[0];
181 fvright[1] = hvright[0] * vright[1] + hvright[1] * vup[1] - hvright[2] * dop[1];
182 fvright[2] = hvright[0] * vright[2] + hvright[1] * vup[2] - hvright[2] * dop[2];
184 fvup[0] = hvup[0] * vright[0] + hvup[1] * vup[0] - hvup[2] * dop[0];
185 fvup[1] = hvup[0] * vright[1] + hvup[1] * vup[1] - hvup[2] * dop[1];
186 fvup[2] = hvup[0] * vright[2] + hvup[1] * vup[2] - hvup[2] * dop[2];
187 vtkMath::Cross(fvup, fvright, wdir);
190 for (
int i = 0; i < 3; i++)
192 ortho[i][0] = fvright[i];
193 ortho[i][1] = fvup[i];
194 ortho[i][2] = -wdir[i];
197 vtkMath::Matrix3x3ToQuaternion(ortho, wxyz);
200 double mag = sqrt(wxyz[1] * wxyz[1] + wxyz[2] * wxyz[2] + wxyz[3] * wxyz[3]);
204 wxyz[0] = 2.0 * vtkMath::DegreesFromRadians(atan2(mag, wxyz[0]));
222 GetDigitalActionState(
223 vr::VRActionHandle_t action, vr::VRInputValueHandle_t* pDevicePath =
nullptr)
225 vr::InputDigitalActionData_t actionData;
226 vr::VRInput()->GetDigitalActionData(
227 action, &actionData,
sizeof(actionData), vr::k_ulInvalidInputValueHandle);
230 *pDevicePath = vr::k_ulInvalidInputValueHandle;
231 if (actionData.bActive)
233 vr::InputOriginInfo_t originInfo;
234 if (vr::VRInputError_None ==
235 vr::VRInput()->GetOriginTrackedDeviceInfo(
236 actionData.activeOrigin, &originInfo,
sizeof(originInfo)))
238 *pDevicePath = originInfo.devicePath;
242 return actionData.bActive && actionData.bState;
249 this->StartedMessageLoop = 1;
252 vtkOpenVRRenderWindow* renWin = vtkOpenVRRenderWindow::SafeDownCast(this->RenderWindow);
254 static_cast<vtkRenderer*
>(renWin->GetRenderers()->GetItemAsObject(0));
265 vtkOpenVRRenderWindow* renWin = vtkOpenVRRenderWindow::SafeDownCast(this->RenderWindow);
267 vtkRenderer* ren =
static_cast<vtkRenderer*
>(renWin->GetRenderers()->GetItemAsObject(0));
278 vr::IVRSystem* pHMD = renWin->GetHMD();
288 vtkOpenVROverlay* ovl = renWin->GetDashboardOverlay();
291 if (vr::VROverlay() && vr::VROverlay()->IsOverlayVisible(ovl->GetOverlayHandle()))
294 vr::VROverlay()->PollNextOverlayEvent(ovl->GetOverlayHandle(), &event,
sizeof(vr::VREvent_t));
298 int height = ovl->GetOverlayTexture()->GetHeight();
299 switch (event.eventType)
301 case vr::VREvent_MouseButtonDown:
303 if (event.data.mouse.button == vr::VRMouseButton_Left)
305 ovl->MouseButtonPress(event.data.mouse.x, height - event.data.mouse.y - 1);
310 case vr::VREvent_MouseButtonUp:
312 if (event.data.mouse.button == vr::VRMouseButton_Left)
314 ovl->MouseButtonRelease(event.data.mouse.x, height - event.data.mouse.y - 1);
319 case vr::VREvent_MouseMove:
321 ovl->MouseMoved(event.data.mouse.x, height - event.data.mouse.y - 1);
325 case vr::VREvent_OverlayShown:
327 renWin->RenderOverlay();
331 case vr::VREvent_Quit:
338 while (pHMD->PollNextEvent(&event,
sizeof(vr::VREvent_t)))
344 result = pHMD->PollNextEvent(&event,
sizeof(vr::VREvent_t));
349 result = pHMD->PollNextEvent(&event,
sizeof(vr::VREvent_t));
356 vr::VRActiveActionSet_t actionSet = { 0 };
357 actionSet.ulActionSet = this->ActionsetVTK;
358 vr::VRInput()->UpdateActionState(&actionSet,
sizeof(actionSet), 1);
360 for (
int tracker = 0; tracker < vtkOpenVRRenderWindowInteractorImstk::NumberOfTrackers; tracker++)
362 vr::InputOriginInfo_t originInfo;
363 vr::EVRInputError evriError = vr::VRInput()->GetOriginTrackedDeviceInfo(
364 this->Trackers[tracker].Source, &originInfo,
sizeof(vr::InputOriginInfo_t));
365 if (evriError != vr::VRInputError_None)
371 vr::EVRCompositorError evrcError = vr::VRCompositor()->GetLastPoseForTrackedDeviceIndex(
372 originInfo.trackedDeviceIndex, &this->Trackers[tracker].LastPose,
nullptr);
373 if (evrcError != vr::VRCompositorError_None)
375 vtkErrorMacro(
"Error in GetLastPoseForTrackedDeviceIndex: " << evrcError);
379 if (this->Trackers[tracker].LastPose.bPoseIsValid)
381 double pos[3] = { 0.0 };
382 double ppos[3] = { 0.0 };
383 double wxyz[4] = { 0.0 };
384 double wdir[3] = { 0.0 };
385 this->ConvertPoseToWorldCoordinates(
386 this->Trackers[tracker].LastPose, pos, wxyz, ppos, wdir);
387 vtkNew<vtkEventDataDevice3D> ed;
388 ed->SetWorldPosition(pos);
389 ed->SetWorldOrientation(wxyz);
390 ed->SetWorldDirection(wdir);
395 ed->SetDevice(vtkEventDataDevice::LeftController);
398 ed->SetDevice(vtkEventDataDevice::RightController);
401 ed->SetDevice(vtkEventDataDevice::HeadMountedDisplay);
404 ed->SetType(vtkCommand::Move3DEvent);
410 this->SetPointerIndex(static_cast<int>(ed->GetDevice()));
411 this->SetPhysicalEventPosition(ppos[0], ppos[1], ppos[2], this->PointerIndex);
412 this->SetWorldEventPosition(pos[0], pos[1], pos[2], this->PointerIndex);
413 this->SetWorldEventOrientation(wxyz[0], wxyz[1], wxyz[2], wxyz[3], this->PointerIndex);
417 this->InvokeEvent(vtkCommand::Move3DEvent, ed);
423 for (
auto& it : this->ActionMap)
425 vr::VRActionHandle_t& actionHandle = it.second.ActionHandle;
426 vtkEventDataDevice3D* edp =
nullptr;
427 vr::VRInputValueHandle_t activeOrigin = 0;
429 if (it.second.IsAnalog)
431 vr::InputAnalogActionData_t analogData;
432 if (vr::VRInput()->GetAnalogActionData(actionHandle, &analogData,
sizeof(analogData),
433 vr::k_ulInvalidInputValueHandle) == vr::VRInputError_None
434 && analogData.bActive)
437 edp = vtkEventDataDevice3D::New();
438 edp->SetTrackPadPosition(analogData.x, analogData.y);
439 activeOrigin = analogData.activeOrigin;
444 vr::InputDigitalActionData_t actionData;
445 auto vrresult = vr::VRInput()->GetDigitalActionData(
446 actionHandle, &actionData,
sizeof(actionData), vr::k_ulInvalidInputValueHandle);
447 if (vrresult == vr::VRInputError_None && actionData.bActive && actionData.bChanged)
449 edp = vtkEventDataDevice3D::New();
451 actionData.bState ? vtkEventDataAction::Press : vtkEventDataAction::Release);
452 activeOrigin = actionData.activeOrigin;
458 double pos[3] = { 0.0 };
459 double ppos[3] = { 0.0 };
460 double wxyz[4] = { 0.0 };
461 double wdir[3] = { 0.0 };
463 vr::InputBindingInfo_t inBindingInfo;
464 uint32_t returnedBindingInfoCount = 0;
465 vr::VRInput()->GetActionBindingInfo(
466 actionHandle, &inBindingInfo,
sizeof(inBindingInfo), 1, &returnedBindingInfoCount);
468 std::string inputSource = inBindingInfo.rchInputSourceType;
469 if (inputSource ==
"trackpad")
471 edp->SetInput(vtkEventDataDeviceInput::TrackPad);
473 else if (inputSource ==
"joystick")
475 edp->SetInput(vtkEventDataDeviceInput::Joystick);
477 else if (inputSource ==
"trigger")
479 edp->SetInput(vtkEventDataDeviceInput::Trigger);
481 else if (inputSource ==
"grip")
483 edp->SetInput(vtkEventDataDeviceInput::Grip);
487 edp->SetInput(vtkEventDataDeviceInput::Unknown);
490 vr::InputOriginInfo_t originInfo;
491 if (vr::VRInputError_None ==
492 vr::VRInput()->GetOriginTrackedDeviceInfo(activeOrigin, &originInfo,
sizeof(originInfo)))
494 if (originInfo.devicePath == this->Trackers[LeftHand].Source)
496 edp->SetDevice(vtkEventDataDevice::LeftController);
497 this->ConvertPoseToWorldCoordinates(this->Trackers[0].LastPose, pos, wxyz, ppos, wdir);
499 if (originInfo.devicePath == this->Trackers[RightHand].Source)
501 edp->SetDevice(vtkEventDataDevice::RightController);
502 this->ConvertPoseToWorldCoordinates(this->Trackers[1].LastPose, pos, wxyz, ppos, wdir);
506 edp->SetWorldPosition(pos);
507 edp->SetWorldOrientation(wxyz);
508 edp->SetWorldDirection(wdir);
509 edp->SetType(it.second.EventId);
511 if (it.second.UseFunction)
513 it.second.Function(edp);
517 this->InvokeEvent(it.second.EventId, edp);
523 if (this->RecognizeGestures)
525 this->RecognizeComplexGesture(
nullptr);
529 this->InvokeEvent(vtkCommand::RenderEvent);
530 auto ostate = renWin->GetState();
531 renWin->MakeCurrent();
541 vtkOpenVRRenderWindowInteractorImstk::HandleGripEvents(vtkEventData* ed)
543 vtkEventDataDevice3D* edata = ed->GetAsEventDataDevice3D();
549 this->PointerIndex =
static_cast<int>(edata->GetDevice());
550 if (edata->GetAction() == vtkEventDataAction::Press)
554 this->StartingPhysicalEventPositions[this->PointerIndex][0] =
555 this->PhysicalEventPositions[this->PointerIndex][0];
556 this->StartingPhysicalEventPositions[this->PointerIndex][1] =
557 this->PhysicalEventPositions[this->PointerIndex][1];
558 this->StartingPhysicalEventPositions[this->PointerIndex][2] =
559 this->PhysicalEventPositions[this->PointerIndex][2];
561 vtkVRRenderWindow* renWin = vtkVRRenderWindow::SafeDownCast(this->RenderWindow);
569 this->CurrentGesture = vtkCommand::StartEvent;
574 if (edata->GetAction() == vtkEventDataAction::Release)
578 if (edata->GetInput() == vtkEventDataDeviceInput::Grip)
580 if (this->CurrentGesture == vtkCommand::PinchEvent)
582 this->EndPinchEvent();
584 if (this->CurrentGesture == vtkCommand::PanEvent)
588 if (this->CurrentGesture == vtkCommand::RotateEvent)
590 this->EndRotateEvent();
592 this->CurrentGesture = vtkCommand::NoEvent;
600 vtkOpenVRRenderWindowInteractorImstk::RecognizeComplexGesture(vtkEventDataDevice3D*)
603 int lhand =
static_cast<int>(vtkEventDataDevice::LeftController);
604 int rhand =
static_cast<int>(vtkEventDataDevice::RightController);
609 this->CurrentGesture = vtkCommand::NoEvent;
614 double* startVals[2];
615 posVals[0] = this->PhysicalEventPositions[lhand];
616 posVals[1] = this->PhysicalEventPositions[rhand];
618 startVals[0] = this->StartingPhysicalEventPositions[lhand];
619 startVals[1] = this->StartingPhysicalEventPositions[rhand];
624 if (this->CurrentGesture != vtkCommand::NoEvent)
627 double originalDistance = sqrt(vtkMath::Distance2BetweenPoints(startVals[0], startVals[1]));
628 double newDistance = sqrt(vtkMath::Distance2BetweenPoints(posVals[0], posVals[1]));
632 t0[0] = posVals[0][0] - startVals[0][0];
633 t0[1] = posVals[0][1] - startVals[0][1];
634 t0[2] = posVals[0][2] - startVals[0][2];
637 t1[0] = posVals[1][0] - startVals[1][0];
638 t1[1] = posVals[1][1] - startVals[1][1];
639 t1[2] = posVals[1][2] - startVals[1][2];
642 trans[0] = (t0[0] + t1[0]) / 2.0;
643 trans[1] = (t0[1] + t1[1]) / 2.0;
644 trans[2] = (t0[2] + t1[2]) / 2.0;
647 double originalAngle = vtkMath::DegreesFromRadians(
648 atan2((
double)startVals[1][2] - startVals[0][2], (
double)startVals[1][0] - startVals[0][0]));
649 double newAngle = vtkMath::DegreesFromRadians(
650 atan2((
double)posVals[1][2] - posVals[0][2], (
double)posVals[1][0] - posVals[0][0]));
653 if (newAngle - originalAngle > 180.0)
657 if (newAngle - originalAngle < -180.0)
661 double angleDeviation = newAngle - originalAngle;
665 if (this->CurrentGesture == vtkCommand::StartEvent)
672 double thresh = 0.05;
674 double pinchDistance = fabs(newDistance - originalDistance);
675 double panDistance = sqrt(trans[0] * trans[0] + trans[1] * trans[1] + trans[2] * trans[2]);
676 double rotateDistance = originalDistance * 3.1415926 * fabs(angleDeviation) / 180.0;
678 if (pinchDistance > thresh && pinchDistance > panDistance && pinchDistance > rotateDistance)
680 this->CurrentGesture = vtkCommand::PinchEvent;
682 this->StartPinchEvent();
684 else if (rotateDistance > thresh && rotateDistance > panDistance)
686 this->CurrentGesture = vtkCommand::RotateEvent;
687 this->Rotation = 0.0;
688 this->StartRotateEvent();
690 else if (panDistance > thresh)
692 this->CurrentGesture = vtkCommand::PanEvent;
693 this->Translation3D[0] = 0.0;
694 this->Translation3D[1] = 0.0;
695 this->Translation3D[2] = 0.0;
696 this->StartPanEvent();
701 if (this->CurrentGesture == vtkCommand::RotateEvent)
703 this->SetRotation(angleDeviation);
706 if (this->CurrentGesture == vtkCommand::PinchEvent)
708 this->SetScale(newDistance / originalDistance);
711 if (this->CurrentGesture == vtkCommand::PanEvent)
714 vtkVRRenderWindow* win = vtkVRRenderWindow::SafeDownCast(this->RenderWindow);
715 double* vup = win->GetPhysicalViewUp();
716 double* dop = win->GetPhysicalViewDirection();
717 double physicalScale = win->GetPhysicalScale();
719 vtkMath::Cross(dop, vup, vright);
724 for (
int i = 0; i < 3; i++)
726 wtrans[i] = trans[0] * vright[i] + trans[1] * vup[i] - trans[2] * dop[i];
727 wtrans[i] = wtrans[i] * physicalScale;
730 this->SetTranslation3D(wtrans);
739 std::string path, vtkCommand::EventIds eid,
bool isAnalog)
741 auto& am = this->ActionMap[path];
743 am.UseFunction =
false;
744 am.IsAnalog = isAnalog;
745 if (this->Initialized)
747 vr::VRInput()->GetActionHandle(path.c_str(), &am.ActionHandle);
755 std::string path,
bool isAnalog, std::function<
void(vtkEventData*)> func)
757 auto& am = this->ActionMap[path];
758 am.UseFunction =
true;
760 am.IsAnalog = isAnalog;
761 if (this->Initialized)
763 vr::VRInput()->GetActionHandle(path.c_str(), &am.ActionHandle);
772 if (!this->RenderWindow)
774 vtkErrorMacro(<<
"No renderer defined!");
777 if (this->Initialized)
782 vtkVRRenderWindow* ren = vtkVRRenderWindow::SafeDownCast(this->RenderWindow);
785 this->Initialized = 1;
788 size = ren->GetSize();
791 this->Size[0] = size[0];
792 this->Size[1] = size[1];
794 std::string fullpath = vtksys::SystemTools::CollapseFullPath(this->ActionManifestFileName);
795 vr::VRInput()->SetActionManifestPath(fullpath.c_str());
796 vr::VRInput()->GetActionSetHandle(this->ActionSetName.c_str(), &this->ActionsetVTK);
799 vr::VRInput()->GetInputSourceHandle(
"/user/hand/left", &this->Trackers[LeftHand].Source);
802 vr::VRInput()->GetInputSourceHandle(
"/user/hand/right", &this->Trackers[RightHand].Source);
805 vr::VRInput()->GetInputSourceHandle(
"/user/head", &this->Trackers[Head].Source);
808 this->
AddAction(
"/actions/vtk/in/LeftGripAction",
false,
809 [
this](vtkEventData* ed) { this->HandleGripEvents(ed); });
810 this->
AddAction(
"/actions/vtk/in/RightGripAction",
false,
811 [
this](vtkEventData* ed) { this->HandleGripEvents(ed); });
814 for (
auto& it : this->ActionMap)
816 vr::VRInput()->GetActionHandle(it.first.c_str(), &it.second.ActionHandle);
823 int vtkNotUsed(timerId),
int vtkNotUsed(timerType),
unsigned long vtkNotUsed(duration))
831 vtkOpenVRRenderWindowInteractorImstk::InternalDestroyTimer(
int vtkNotUsed(platformTimerId))
844 || arg != vtkOpenVRRenderWindowInteractorImstk::ClassExitMethodArg)
847 if ((vtkOpenVRRenderWindowInteractorImstk::ClassExitMethodArg)
848 && (vtkOpenVRRenderWindowInteractorImstk::ClassExitMethodArgDelete))
850 (*vtkOpenVRRenderWindowInteractorImstk::ClassExitMethodArgDelete)(
851 vtkOpenVRRenderWindowInteractorImstk::ClassExitMethodArg);
854 vtkOpenVRRenderWindowInteractorImstk::ClassExitMethodArg = arg;
863 vtkOpenVRRenderWindowInteractorImstk::SetClassExitMethodArgDelete(
void (* f)(
void*))
865 if (f != vtkOpenVRRenderWindowInteractorImstk::ClassExitMethodArgDelete)
867 vtkOpenVRRenderWindowInteractorImstk::ClassExitMethodArgDelete = f;
875 vtkOpenVRRenderWindowInteractorImstk::PrintSelf(ostream& os, vtkIndent indent)
877 this->Superclass::PrintSelf(os, indent);
878 os << indent <<
"StartedMessageLoop: " << this->StartedMessageLoop << endl;
885 if (this->HasObserver(vtkCommand::ExitEvent))
887 this->InvokeEvent(vtkCommand::ExitEvent,
nullptr);
891 (*vtkOpenVRRenderWindowInteractorImstk::ClassExitMethod)(
892 vtkOpenVRRenderWindowInteractorImstk::ClassExitMethodArg);
895 this->TerminateApp();
900 vtkOpenVRRenderWindowInteractorImstk::GetPointerDevice()
902 if (this->PointerIndex == 0)
904 return vtkEventDataDevice::RightController;
906 if (this->PointerIndex == 1)
908 return vtkEventDataDevice::LeftController;
910 return vtkEventDataDevice::Unknown;
916 vtkMatrix4x4* startingPhysicalToWorldMatrix)
918 if (!startingPhysicalToWorldMatrix)
virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration)
virtual void SetPhysicalTranslation(vtkCamera *, double, double, double)
void ProcessEvents() override
static void SetClassExitMethod(void(*f)(void *), void *arg)
vtkNew< vtkMatrix4x4 > StartingPhysicalToWorldMatrix
virtual void StartEventLoop()
virtual void ExitCallback()
void GetStartingPhysicalToWorldMatrix(vtkMatrix4x4 *startingPhysicalToWorldMatrix)
int DeviceInputDownCount[vtkEventDataNumberOfDevices]
virtual void Initialize()
void AddAction(std::string path, vtkCommand::EventIds, bool isAnalog)
static void(* ClassExitMethod)(void *)
virtual void DoOneEvent(vtkOpenVRRenderWindow *renWin, vtkRenderer *ren, bool doRender)