vtkVRRenderer: Fix hard coded translation when resetting camera

In VR, resetting the camera would place the object at floor level. For
this reason, a translation was added to bring the object closer to eye level.
However, this translation only worked if the view up direction (the
direction of the top of the head) was +Y.
This commit takes into account the current view up direction to always
bring the object to eye level.
Tiffany Chhim 2 months ago
parent cf5e428883
commit 68ea612430

@ -237,10 +237,11 @@ void vtkVRRenderer::ResetCamera(const double bounds[6])
// be done in the actors but then it requires every actor
// to be adjusted. It cannot be done with the camera model
// matrix as that is broken.
// The +distance in the Y translation is because we want
// the center of the world to be 1 meter up
// The additional distance translation in the view up direction is because we
// want the center of the world to be above the physical floor instead of at its level.
vtkVRRenderWindow* win = static_cast<vtkVRRenderWindow*>(this->GetRenderWindow());
win->SetPhysicalTranslation(-center[0], -center[1] + distance, -center[2]);
-center[0] + vup[0] * distance, -center[1] + vup[1] * distance, -center[2] + vup[2] * distance);