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

Function WriteCamera

IO/Geometry/vtkGLTFWriter.cxx:719–741  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

717}
718
719void WriteCamera(nlohmann::json& cameras, vtkRenderer* ren)
720{
721 vtkCamera* cam = ren->GetActiveCamera();
722 nlohmann::json acamera;
723 nlohmann::json camValues;
724 camValues["znear"] = cam->GetClippingRange()[0];
725 camValues["zfar"] = cam->GetClippingRange()[1];
726 if (cam->GetParallelProjection())
727 {
728 acamera["type"] = "orthographic";
729 camValues["xmag"] = cam->GetParallelScale() * ren->GetTiledAspectRatio();
730 camValues["ymag"] = cam->GetParallelScale();
731 acamera["orthographic"] = camValues;
732 }
733 else
734 {
735 acamera["type"] = "perspective";
736 camValues["yfov"] = vtkMath::RadiansFromDegrees(cam->GetViewAngle());
737 camValues["aspectRatio"] = ren->GetTiledAspectRatio();
738 acamera["perspective"] = camValues;
739 }
740 cameras.emplace_back(acamera);
741}
742
743void WriteTexture(nlohmann::json& buffers, nlohmann::json& bufferViews, nlohmann::json& textures,
744 nlohmann::json& samplers, nlohmann::json& images, bool inlineData, bool copyTextures,

Callers 1

Calls 3

GetActiveCameraMethod · 0.80
GetTiledAspectRatioMethod · 0.80
emplace_backMethod · 0.45

Tested by

no test coverage detected