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

Function WriteCamera

IO/Export/vtkGLTFExporter.cxx:346–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344}
345
346void WriteCamera(nlohmann::json& cameras, vtkRenderer* ren)
347{
348 vtkCamera* cam = ren->GetActiveCamera();
349 nlohmann::json acamera;
350 nlohmann::json camValues;
351 camValues["znear"] = cam->GetClippingRange()[0];
352 camValues["zfar"] = cam->GetClippingRange()[1];
353 if (cam->GetParallelProjection())
354 {
355 acamera["type"] = "orthographic";
356 camValues["xmag"] = cam->GetParallelScale() * ren->GetTiledAspectRatio();
357 camValues["ymag"] = cam->GetParallelScale();
358 acamera["orthographic"] = camValues;
359 }
360 else
361 {
362 acamera["type"] = "perspective";
363 camValues["yfov"] = vtkMath::RadiansFromDegrees(cam->GetViewAngle());
364 camValues["aspectRatio"] = ren->GetTiledAspectRatio();
365 acamera["perspective"] = camValues;
366 }
367 cameras.emplace_back(acamera);
368}
369
370void WriteTexture(nlohmann::json& buffers, nlohmann::json& bufferViews, nlohmann::json& textures,
371 nlohmann::json& samplers, nlohmann::json& images, vtkPolyData* pd, vtkActor* aPart,

Callers 1

WriteToStreamMethod · 0.70

Calls 3

GetActiveCameraMethod · 0.80
GetTiledAspectRatioMethod · 0.80
emplace_backMethod · 0.45

Tested by

no test coverage detected