| 717 | } |
| 718 | |
| 719 | void 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 | |
| 743 | void WriteTexture(nlohmann::json& buffers, nlohmann::json& bufferViews, nlohmann::json& textures, |
| 744 | nlohmann::json& samplers, nlohmann::json& images, bool inlineData, bool copyTextures, |
no test coverage detected