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

Method GetTransformParameters

Rendering/GL2PSOpenGL2/vtkOpenGLGL2PSHelperImpl.cxx:664–698  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

662
663//------------------------------------------------------------------------------
664void vtkOpenGLGL2PSHelperImpl::GetTransformParameters(vtkRenderer* ren, vtkMatrix4x4* actorMatrix,
665 vtkMatrix4x4* xform, double vpOrigin[2], double halfSize[2], double zFact[2])
666{
667 // figure out the same aspect ratio used by the render engine
668 // (see vtkOpenGLCamera::Render())
669 int lowerLeft[2];
670 int usize, vsize;
671 double aspect1[2];
672 double aspect2[2];
673 ren->GetTiledSizeAndOrigin(&usize, &vsize, lowerLeft, lowerLeft + 1);
674 ren->ComputeAspect();
675 ren->GetAspect(aspect1);
676 ren->vtkViewport::ComputeAspect();
677 ren->vtkViewport::GetAspect(aspect2);
678 double aspectModification = (aspect1[0] * aspect2[1]) / (aspect1[1] * aspect2[0]);
679 double aspect = aspectModification * usize / vsize;
680
681 vtkCamera* cam = ren->GetActiveCamera();
682 xform->DeepCopy(cam->GetCompositeProjectionTransformMatrix(aspect, -1, 1));
683
684 if (actorMatrix)
685 {
686 vtkMatrix4x4::Multiply4x4(xform, actorMatrix, xform);
687 }
688
689 vpOrigin[0] = static_cast<double>(lowerLeft[0]);
690 vpOrigin[1] = static_cast<double>(lowerLeft[1]);
691 halfSize[0] = static_cast<double>(usize) * 0.5;
692 halfSize[1] = static_cast<double>(vsize) * 0.5;
693
694 double depthRange[2];
695 glGetDoublev(GL_DEPTH_RANGE, depthRange);
696 zFact[0] = (depthRange[1] - depthRange[0]) * 0.5;
697 zFact[1] = (depthRange[1] + depthRange[0]) * 0.5;
698}
699
700//------------------------------------------------------------------------------
701void vtkOpenGLGL2PSHelperImpl::ProjectPoint(

Callers

nothing calls this directly

Calls 5

ComputeAspectMethod · 0.80
GetActiveCameraMethod · 0.80
GetTiledSizeAndOriginMethod · 0.45
DeepCopyMethod · 0.45

Tested by

no test coverage detected