| 344 | } |
| 345 | |
| 346 | void 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 | |
| 370 | void WriteTexture(nlohmann::json& buffers, nlohmann::json& bufferViews, nlohmann::json& textures, |
| 371 | nlohmann::json& samplers, nlohmann::json& images, vtkPolyData* pd, vtkActor* aPart, |
no test coverage detected