MCPcopy Create free account
hub / github.com/Kitware/VTK / RenderModels

Method RenderModels

Rendering/OpenVR/vtkOpenVRRenderWindow.cxx:87–130  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

85
86//------------------------------------------------------------------------------
87void vtkOpenVRRenderWindow::RenderModels()
88{
89 vtkOpenGLState* ostate = this->GetState();
90 ostate->vtkglEnable(GL_DEPTH_TEST);
91
92 // for each device
93 for (uint32_t unTrackedDevice = vr::k_unTrackedDeviceIndex_Hmd + 1;
94 unTrackedDevice < vr::k_unMaxTrackedDeviceCount; unTrackedDevice++)
95 {
96 // is it not connected?
97 if (!this->HMD->IsTrackedDeviceConnected(unTrackedDevice))
98 {
99 continue;
100 }
101
102 if (!this->BaseStationVisibility &&
103 this->HMD->GetTrackedDeviceClass(unTrackedDevice) == vr::TrackedDeviceClass_TrackingReference)
104 {
105 continue;
106 }
107
108 // do we not have a model loaded yet? try loading one
109 auto handle = this->GetDeviceHandleForOpenVRHandle(unTrackedDevice);
110 auto* pRenderModel = this->GetModelForDeviceHandle(handle);
111 if (!pRenderModel)
112 {
113 std::string sRenderModelName =
114 this->GetTrackedDeviceString(this->HMD, unTrackedDevice, vr::Prop_RenderModelName_String);
115 vtkSmartPointer<vtkOpenVRModel> newModel;
116 newModel.TakeReference(this->FindOrLoadRenderModel(sRenderModelName.c_str()));
117 if (newModel)
118 {
119 this->SetModelForDeviceHandle(handle, newModel);
120 }
121 pRenderModel = newModel;
122 }
123 // if we have a model and it is visible
124 vtkMatrix4x4* deviceToPhysical = this->GetDeviceToPhysicalMatrixForDeviceHandle(handle);
125 if (deviceToPhysical && pRenderModel && pRenderModel->GetVisibility())
126 {
127 pRenderModel->Render(this, deviceToPhysical);
128 }
129 }
130}
131
132//------------------------------------------------------------------------------
133void vtkOpenVRRenderWindow::UpdateHMDMatrixPose()

Callers 2

StereoMidpointMethod · 0.95
StereoRenderCompleteMethod · 0.95

Calls 12

FindOrLoadRenderModelMethod · 0.95
vtkglEnableMethod · 0.80
RenderMethod · 0.65
GetStateMethod · 0.45
TakeReferenceMethod · 0.45
c_strMethod · 0.45
GetVisibilityMethod · 0.45

Tested by

no test coverage detected