Skip to content

Commit

Permalink
Orthographic projection cli option (#1315)
Browse files Browse the repository at this point in the history
Includes

 - The command line option
 - The test case for the command line option
 - Document correction in OPTIONS.md
  • Loading branch information
kidharb authored Mar 17, 2024
1 parent a8f6289 commit 68ce157
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions application/F3DOptionsParser.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ void ConfigurationOptions::GetOptions(F3DAppOptions& appOptions, f3d::options& o
this->DeclareOption(grpCamera, "camera-zoom-factor", "", "Camera zoom factor (non-zero)", appOptions.CameraZoomFactor, HasDefault::YES, MayHaveConfig::YES, "<factor>");
this->DeclareOption(grpCamera, "camera-azimuth-angle", "", "Camera azimuth angle (in degrees), performed after other camera options", appOptions.CameraAzimuthAngle, HasDefault::YES, MayHaveConfig::YES, "<angle>");
this->DeclareOption(grpCamera, "camera-elevation-angle", "", "Camera elevation angle (in degrees), performed after other camera options", appOptions.CameraElevationAngle, HasDefault::YES, MayHaveConfig::YES, "<angle>");
this->DeclareOption(grpCamera, "camera-orthographic", "", "Use an orthographic camera", options.getAsBoolRef("scene.camera.orthographic"), HasDefault::YES, MayHaveConfig::YES);

#if F3D_MODULE_RAYTRACING
auto grp5 = cxxOptions.add_options("Raytracing");
Expand Down
1 change: 1 addition & 0 deletions application/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ f3d_test(NAME TestColormap DATA IM-0001-1983.dcm ARGS --scalars --roughness=1 --
f3d_test(NAME TestCameraConfiguration DATA suzanne.obj ARGS --camera-position=0,0,-10 -x --camera-view-up=1,0,0 --camera-focal-point=1,0,0 --camera-view-angle=20 --camera-azimuth-angle=40 --camera-elevation-angle=-80 --camera-direction=12,34,56 --camera-zoom-factor=78)
f3d_test(NAME TestCameraDirection DATA suzanne.obj ARGS --camera-direction=-1,-1,1 DEFAULT_LIGHTS)
f3d_test(NAME TestCameraClipping DATA checkerboard_colorful.obj CONFIG ${F3D_SOURCE_DIR}/testing/configs/checkerboard_colorful.json RESOLUTION 800,600)
f3d_test(NAME TestCameraOrthographic ARGS --camera-orthographic DATA cow.vtp DEFAULT_LIGHTS)
f3d_test(NAME TestToneMapping DATA suzanne.ply ARGS -t DEFAULT_LIGHTS)
f3d_test(NAME TestDepthPeelingToneMapping DATA suzanne.ply ARGS --opacity=0.9 -pt DEFAULT_LIGHTS)
f3d_test(NAME TestVolume DATA HeadMRVolume.mhd ARGS -v --camera-position=127.5,-400,127.5 --camera-view-up=0,0,1 LONG_TIMEOUT THRESHOLD 300 DEFAULT_LIGHTS) # Using default lights because of ResetCamera, High threshold for volume as it is dependent on the OpenGL implementation
Expand Down
2 changes: 1 addition & 1 deletion doc/libf3d/OPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ scene.animation.speed-factor|double<br>1<br>render|Set the animation speed facto
scene.animation.frame-rate|double<br>60<br>render|Set the animation frame rate used to play the animation interactively.|\-\-animation-frame-rate
scene.camera.index|int<br>-1<br>load|Select the scene camera to use when available in the file.<br>Any negative value means automatic camera.<br>The default scene always uses automatic camera.|\-\-camera-index
scene.up-direction|string<br>+Y<br>load|Define the Up direction|\-\-up
camera.orthographic|bool<br>false<br>load|Toggles between orthographic projection and parallel mode.|\-\-orthographic
scene.camera.orthographic|bool<br>false<br>load|Toggles between orthographic projection and parallel mode.|\-\-camera\-orthographic

## Interactor Options

Expand Down
1 change: 1 addition & 0 deletions doc/user/OPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Options|Default|Description
\-\-camera-zoom-factor=\<factor\>||Set the camera zoom factor relative to the autozoom on data, a strictly positive value.
\-\-camera-azimuth-angle=\<angle\>|0.0|Apply an azimuth transformation to the camera, in degrees, added after other camera options.
\-\-camera-elevation-angle=\<angle\>|0.0|Apply an elevation transformation to the camera, in degrees, added after other camera options.
\-\-camera-orthographic||Set the camera to use the orthographic projection.

## Raytracing options

Expand Down
2 changes: 1 addition & 1 deletion library/src/interactor_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ class interactor_impl::internals
render = true;
break;
case '5':
self->Options.toggle("camera.orthographic");
self->Options.toggle("scene.camera.orthographic");
render = true;
break;
case '7':
Expand Down
2 changes: 1 addition & 1 deletion library/src/options.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ options::options()
this->Internals->init("model.volume.inverse", false);

// Camera projection
this->Internals->init("camera.orthographic", false);
this->Internals->init("scene.camera.orthographic", false);

// Interactor
this->Internals->init("interactor.axis", false);
Expand Down
2 changes: 1 addition & 1 deletion library/src/window_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ void window_impl::UpdateDynamicOptions()
if (this->Internals->Options.getAsInt("scene.camera.index") == -1)
{
this->Internals->Renderer->SetUseOrthographicProjection(
this->Internals->Options.getAsBool("camera.orthographic"));
this->Internals->Options.getAsBool("scene.camera.orthographic"));
}

if (this->Internals->WithColoring)
Expand Down
3 changes: 3 additions & 0 deletions testing/baselines/TestCameraOrthographic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 68ce157

Please sign in to comment.