Skip to content

Commit

Permalink
Option naming rework (#1801)
Browse files Browse the repository at this point in the history
* Rename bg-color into background-color

* Rename blur and blur_coc into blur.enable and blur.coc

* Rename `--comp` into `--coloring-component`

* Rename interactor.axis into ui.axis
  • Loading branch information
mwestphal authored Dec 18, 2024
2 parents 792c67b + 53af362 commit 4b133bc
Show file tree
Hide file tree
Showing 25 changed files with 105 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .github/actions/generic-ci/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ runs:
shell: bash
working-directory: ${{github.workspace}}/install
run: |
${{ env.F3D_BIN_PATH }} ../source/testing/data/dragon.vtu --output=output/install_output.png --ref=../source/.github/baselines/install_output.png --resolution=300,300 --colormap-file=viridis --comp=0 --verbose --rendering-backend=${{ inputs.rendering_backend }}
${{ env.F3D_BIN_PATH }} ../source/testing/data/dragon.vtu --output=output/install_output.png --ref=../source/.github/baselines/install_output.png --resolution=300,300 --colormap-file=viridis --coloring-component=0 --verbose --rendering-backend=${{ inputs.rendering_backend }}
- name: Check Install plugins
if: |
Expand Down
6 changes: 3 additions & 3 deletions application/F3DOptionsTools.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static inline const std::array<CLIGroup, 8> CLIOptions = {{
{"texture-normal", "", "Path to a texture file that sets the normal map of the object", "<file path>", ""},
{"normal-scale", "", "Normal scale affects the strength of the normal deviation from the normal texture", "<normalScale>", ""} } },
{"Window",
{ {"bg-color", "", "Background color", "<R,G,B>", ""},
{ {"background-color", "", "Background color", "<R,G,B>", ""},
{"resolution", "", "Window resolution", "<width,height>", ""},
{"position", "", "Window position", "<x,y>", ""},
{"fps", "z", "Display rendering frame per second", "<bool>", "1"},
Expand All @@ -133,7 +133,7 @@ static inline const std::array<CLIGroup, 8> CLIOptions = {{
{"Scientific visualization",
{ {"scalar-coloring", "s", "Color by a scalar array", "<bool>", "1" },
{"coloring-array", "", "Name of the array to color with", "<array_name>", "" },
{"comp", "y", "Component from the array to color with. -1 means magnitude, -2 or the short option, -y, means direct scalars", "<comp_index>", "-2"},
{"coloring-component", "y", "Component from the array to color with. -1 means magnitude, -2 or the short option, -y, means direct scalars", "<comp_index>", "-2"},
{"cells", "c", "Use an array from the cells", "<bool>", "1"},
{"range", "", "Custom range for the coloring by array, automatically computed by default", "<min,max>", ""},
{"bar", "b", "Show scalar bar", "<bool>", "1" },
Expand Down Expand Up @@ -200,7 +200,7 @@ void PrintHelp(const std::string& execName, const cxxopts::Options& cxxOptions)
"View a unstructured mesh in a typical nice looking sciviz style" },
{ execName + " file.glb -tuqap --hdri-file=file.hdr --hdri-ambient --hdri-skybox",
"View a gltf file in a realistic environment" },
{ execName + " file.ply -so --point-size=0 --comp=-2",
{ execName + " file.ply -so --point-size=0 --coloring-component=-2",
"View a point cloud file with direct scalars rendering" },
{ execName + " folder", "View all files in folder" },
}};
Expand Down
10 changes: 5 additions & 5 deletions application/F3DOptionsTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static inline const std::map<std::string_view, std::string_view> LibOptionsNames
{ "progress", "ui.loader_progress" },
{ "animation-progress", "ui.animation_progress" },
{ "up", "scene.up_direction" },
{ "axis", "interactor.axis" },
{ "axis", "ui.axis" },
{ "grid", "render.grid.enable" },
{ "grid-absolute", "render.grid.absolute" },
{ "grid-unit", "render.grid.unit" },
Expand Down Expand Up @@ -100,16 +100,16 @@ static inline const std::map<std::string_view, std::string_view> LibOptionsNames
{ "emissive-factor", "model.emissive.factor" },
{ "texture-normal", "model.normal.texture" },
{ "normal-scale", "model.normal.scale" },
{ "bg-color", "render.background.color" },
{ "background-color", "render.background.color" },
{ "fps", "ui.fps" },
{ "filename", "ui.filename" },
{ "metadata", "ui.metadata" },
{ "blur-background", "render.background.blur" },
{ "blur-coc", "render.background.blur_coc" },
{ "blur-background", "render.background.blur.enable" },
{ "blur-coc", "render.background.blur.coc" },
{ "scalar-coloring", "model.scivis.enable" },
{ "coloring-array", "model.scivis.array_name" },
{ "light-intensity", "render.light.intensity" },
{ "comp", "model.scivis.component" },
{ "coloring-component", "model.scivis.component" },
{ "cells", "model.scivis.cells" },
{ "range", "model.scivis.range" },
{ "bar", "ui.scalar_bar" },
Expand Down
2 changes: 1 addition & 1 deletion application/F3DStarter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,7 @@ void F3DStarter::SaveScreenshot(const std::string& filenameTemplate, bool minima
options.ui.fps = false;
options.ui.metadata = false;
options.ui.animation_progress = false;
options.interactor.axis = false;
options.ui.axis = false;
options.render.grid.enable = false;
noBackground = true;
}
Expand Down
66 changes: 33 additions & 33 deletions application/testing/CMakeLists.txt

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions doc/GALLERY.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Images and videos displayed below use public datasets, you can download them [he

<img src="https://user-images.githubusercontent.com/3129530/194735272-5bcd3e7c-a333-41f5-8066-9b0bec9885e8.png" width="700">

*Direct scalars rendering of a point cloud*: `f3d Carola_PointCloud.ply --point-size=0 --comp=-2 -sofj --coloring-array=RGBA --up=+Z --hdri-file=venice_sunset_8k.hdr`
*Direct scalars rendering of a point cloud*: `f3d Carola_PointCloud.ply --point-size=0 --coloring-component=-2 -sofj --coloring-array=RGBA --up=+Z --hdri-file=venice_sunset_8k.hdr`

<img src="https://user-images.githubusercontent.com/3129530/194735378-b8be4df2-e030-4d13-b12f-24806cbb385b.png" width="700">

Expand All @@ -37,7 +37,7 @@ Images and videos displayed below use public datasets, you can download them [he

<img src="https://user-images.githubusercontent.com/3129530/194735416-3f386437-456c-4145-9b5e-6bb6451d7e9a.png" width="700">

*Showcase of interactive widgets*: `f3d dragon.vtu -xtganse --comp=0`
*Showcase of interactive widgets*: `f3d dragon.vtu -xtganse --coloring-component=0`

<img src="https://user-images.githubusercontent.com/3129530/194735370-4d1f067c-704c-4118-9d94-c1adf4039c39.png" width="700">

Expand Down
7 changes: 4 additions & 3 deletions doc/libf3d/OPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ scene.camera.orthographic|bool<br>optional<br>load|Set to true to force orthogra

Option|Type<br>Default<br>Trigger|Description|F3D option
:---:|:---:|:---|:---:
interactor.axis|bool<br>false<br>render|Show *axes* as a trihedron in the scene.|\-\-axis
interactor.trackball|bool<br>false<br>render|Enable trackball interaction.|\-\-trackball
interactor.invert_zoom|bool<br>false<br>render|Invert the zoom direction.|\-\-invert-zoom

## Model Options

Expand Down Expand Up @@ -87,16 +87,17 @@ render.raytracing.samples|int<br>5<br>render|The number of *samples per pixel*.|
render.raytracing.denoise|bool<br>false<br>render|*Denoise* the raytracing rendering.|\-\-denoise
render.hdri.file|string<br>optional<br>render|Set the *HDRI* image that can be used for ambient lighting and skybox.<br>Valid file format are hdr, exr, png, jpg, pnm, tiff, bmp.<br>If not set, a default is provided.|\-\-hdri-file
render.hdri.ambient|bool<br>false<br>render|Light the scene using the *HDRI* image as ambient lighting<br>The environment act as a light source and is reflected on the material.|\-\-hdri-ambient
render.background.color|vector\<double\><br>0.2,0.2,0.2<br>render|Set the window *background color*.<br>Ignored if a *hdri* skybox is used.|\-\-bg-color
render.background.color|vector\<double\><br>0.2,0.2,0.2<br>render|Set the window *background color*.<br>Ignored if a *hdri* skybox is used.|\-\-background-color
render.background.skybox|bool<br>false<br>render|Show the *HDRI* image as a skybox<br>Overrides the the background color if any|\-\-hdri-skybox
render.background.blur|bool<br>false<br>render|Blur background, useful with a skybox.|\-\-blur-background
render.background.blur.enable|bool<br>false<br>render|Blur background, useful with a skybox.|\-\-blur-background
render.background.blur.coc|double<br>20.0<br>render|Blur background circle of confusion radius.|\-\-blur-coc
render.light.intensity|double<br>1.0<br>render|Adjust the intensity of every light in the scene.|\-\-light-intensity

## UI Options

Option|Type<br>Default<br>Trigger|Description|F3D option
:---:|:---:|:---|:---:
ui.axis|bool<br>false<br>render|Show *axes* as a trihedron in the scene.|\-\-axis
ui.scalar_bar|bool<br>false<br>render|Show *scalar bar* of the coloring by data array.|\-\-bar
ui.cheatsheet|bool<br>false<br>render|Show a interactor cheatsheet
ui.console|bool<br>false<br>render|Show the console
Expand Down
2 changes: 1 addition & 1 deletion doc/user/COMMANDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The libf3d provides a few commands, many related to manipulating libf3d (options

`toggle option.name`: A command to toggle a boolean libf3d option, eg: `toggle ui.scalar_bar`.

`reset option.name`: A command to reset a libf3d option to its default values, eg: `reset render.background.blur_coc`.
`reset option.name`: A command to reset a libf3d option to its default values, eg: `reset render.background.blur.coc`.

`print option.name`: A command to print the value of an libf3d option, eg: `print scene.up.direction`.

Expand Down
4 changes: 2 additions & 2 deletions doc/user/CONFIGURATION_FILE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ A typical config file with options may look like this:
{
"options":
{
"bg-color": "0.7,0.7,0.7",
"background-color": "0.7,0.7,0.7",
"color": "0.5,0.1,0.1",
"anti-aliasing": true,
"timer": true,
Expand Down Expand Up @@ -98,7 +98,7 @@ A typical config file with bindings may look like this:
"Any+3": "roll_camera 90",
"Shift+O": "toggle model.point_sprites.enable",
"Ctrl+O": ["toggle render.grid.enable", "toggle scene.camera.orthographic"],
"None+I": "toggle interactor.axis"
"None+I": "toggle ui.axis"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions doc/user/OPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ Options|Default|Description

Options|Default|Description
------|------|------
\-\-bg-color=\<R,G,B\>|0.2, 0.2, 0.2|Set the window *background color*.<br>Ignored if *hdri* is set.
\-\-background-color=\<R,G,B\>|0.2, 0.2, 0.2|Set the window *background color*.<br>Ignored if *hdri* is set.
\-\-resolution=\<width,height\>|1000, 600|Set the *window resolution*.
\-\-position=\<x,y\>||Set the *window position* (top left corner) , in pixels, starting from the top left of your screens.
-z, \-\-fps||Display a rendering *frame per second counter*.
-n, \-\-filename||Display the *name of the file* on top of the window.
-m, \-\-metadata||Display the *metadata*.
\-\-hdri-skybox||Show the HDRI as a skybox. Overrides \-\-bg-color and \-\-no-background.
\-\-hdri-skybox||Show the HDRI as a skybox. Overrides \-\-background-color and \-\-no-background.
-u, \-\-blur-background||Blur background.<br>Useful with a HDRI skybox.
\-\-blur-coc|20|Blur circle of confusion radius.
\-\-light-intensity|1.0|*Adjust the intensity* of every light in the scene.
Expand Down
18 changes: 10 additions & 8 deletions library/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,14 @@
"default_value": "false"
},
"blur": {
"type": "bool",
"default_value": "false"
},
"blur_coc": {
"enable": {
"type": "bool",
"default_value": "false"
},
"coc": {
"type": "double",
"default_value": "20.0"
}
}
},
"light": {
Expand All @@ -131,6 +133,10 @@
}
},
"ui": {
"axis": {
"type": "bool",
"default_value": "false"
},
"scalar_bar": {
"type": "bool",
"default_value": "false"
Expand Down Expand Up @@ -273,10 +279,6 @@
}
},
"interactor": {
"axis": {
"type": "bool",
"default_value": "false"
},
"trackball": {
"type": "bool",
"default_value": "false"
Expand Down
4 changes: 2 additions & 2 deletions library/src/interactor_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ interactor& interactor_impl::initBindings()
this->addBinding({mod_t::NONE, "A"}, "toggle render.effect.anti_aliasing","Scene", std::bind(docTgl, "Toggle anti-aliasing", std::cref(opts.render.effect.anti_aliasing)));
this->addBinding({mod_t::NONE, "T"}, "toggle render.effect.tone_mapping","Scene", std::bind(docTgl, "Toggle tone mapping", std::cref(opts.render.effect.tone_mapping)));
this->addBinding({mod_t::NONE, "E"}, "toggle render.show_edges","Scene", std::bind(docTglOpt, "Toggle edges display", std::cref(opts.render.show_edges)));
this->addBinding({mod_t::NONE, "X"}, "toggle interactor.axis","Scene", std::bind(docTgl, "Toggle axes display", std::cref(opts.interactor.axis)));
this->addBinding({mod_t::NONE, "X"}, "toggle ui.axis","Scene", std::bind(docTgl, "Toggle axes display", std::cref(opts.ui.axis)));
this->addBinding({mod_t::NONE, "G"}, "toggle render.grid.enable","Scene", std::bind(docTgl, "Toggle grid display", std::cref(opts.render.grid.enable)));
#if F3D_MODULE_UI
this->addBinding({mod_t::NONE, "N"}, "toggle ui.filename","Scene", std::bind(docTgl, "Toggle filename display", std::cref(opts.ui.filename)));
Expand All @@ -912,7 +912,7 @@ interactor& interactor_impl::initBindings()
this->addBinding({mod_t::NONE, "V"}, "toggle_volume_rendering","Scene", std::bind(docTgl, "Toggle volume rendering", std::cref(opts.model.volume.enable)));
this->addBinding({mod_t::NONE, "I"}, "toggle model.volume.inverse","Scene", std::bind(docTgl, "Toggle inverse volume opacity", std::cref(opts.model.volume.inverse)));
this->addBinding({mod_t::NONE, "O"}, "toggle model.point_sprites.enable","Scene", std::bind(docTgl, "Toggle point sprites rendering", std::cref(opts.model.point_sprites.enable)));
this->addBinding({mod_t::NONE, "U"}, "toggle render.background.blur","Scene", std::bind(docTgl, "Toggle blur background", std::cref(opts.render.background.blur)));
this->addBinding({mod_t::NONE, "U"}, "toggle render.background.blur.enable","Scene", std::bind(docTgl, "Toggle blur background", std::cref(opts.render.background.blur.enable)));
this->addBinding({mod_t::NONE, "K"}, "toggle interactor.trackball","Scene", std::bind(docTgl, "Toggle trackball interaction", std::cref(opts.interactor.trackball)));
this->addBinding({mod_t::NONE, "F"}, "toggle render.hdri.ambient","Scene", std::bind(docTgl, "Toggle HDRI ambient lighting", std::cref(opts.render.hdri.ambient)));
this->addBinding({mod_t::NONE, "J"}, "toggle render.background.skybox","Scene", std::bind(docTgl, "Toggle HDRI skybox", std::cref(opts.render.background.skybox)));
Expand Down
6 changes: 3 additions & 3 deletions library/src/window_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ void window_impl::UpdateDynamicOptions()
renderer->UpdateLights();

const options& opt = this->Internals->Options;
renderer->ShowAxis(opt.interactor.axis);
renderer->ShowAxis(opt.ui.axis);
renderer->SetUseTrackball(opt.interactor.trackball);
renderer->SetInvertZoom(opt.interactor.invert_zoom);

Expand Down Expand Up @@ -413,8 +413,8 @@ void window_impl::UpdateDynamicOptions()
renderer->SetFinalShader(opt.render.effect.final_shader);

renderer->SetBackground(opt.render.background.color.data());
renderer->SetUseBlurBackground(opt.render.background.blur);
renderer->SetBlurCircleOfConfusionRadius(opt.render.background.blur_coc);
renderer->SetUseBlurBackground(opt.render.background.blur.enable);
renderer->SetBlurCircleOfConfusionRadius(opt.render.background.blur.coc);
renderer->SetLightIntensity(opt.render.light.intensity);

renderer->SetHDRIFile(opt.render.hdri.file);
Expand Down
2 changes: 1 addition & 1 deletion library/testing/TestSDKInteractorCallBack.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int TestSDKInteractorCallBack(int argc, char* argv[])
inter.removeBinding({ mod_t::NONE, "Z" });

// Check that an binding can be added
inter.addBinding({ mod_t::NONE, "S" }, "toggle interactor.axis");
inter.addBinding({ mod_t::NONE, "S" }, "toggle ui.axis");

// Check CTRL modifier and that another interaction can be added on the same key with another
// modifier
Expand Down
8 changes: 4 additions & 4 deletions plugins/native/configs/config.d/10_native.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
{
"scalar-coloring": true,
"up": "-Y",
"comp": "-2",
"coloring-component": "-2",
"camera-direction": "-1,0.5,1"
}
},
Expand All @@ -44,7 +44,7 @@
"options":
{
"scalar-coloring": true,
"comp": "-2",
"coloring-component": "-2",
"translucency-support": true
}
},
Expand All @@ -57,8 +57,8 @@
"point-sprites-type": "gaussian",
"scalar-coloring": true,
"coloring-array": "color",
"comp": "-2",
"bg-color": "0, 0, 0",
"coloring-component": "-2",
"background-color": "0, 0, 0",
"up": "-Y",
"trackball": true,
"camera-position": "0,1,-5.2",
Expand Down
4 changes: 2 additions & 2 deletions plugins/native/configs/thumbnail.d/10_native.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"options":
{
"scalar-coloring": true,
"comp": "-2",
"coloring-component": "-2",
"translucency-support": true
}
},
Expand All @@ -40,7 +40,7 @@
"point-sprites-type": "gaussian",
"scalar-coloring": true,
"coloring-array": "color",
"comp": "-2",
"coloring-component": "-2",
"up": "-Y",
"camera-position": "0,1,-5.2",
"camera-focal-point": "0,1,0",
Expand Down
2 changes: 1 addition & 1 deletion plugins/occt/configs/config.d/10_occt.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"load-plugins": "occt",
"up": "+Z",
"ambient-occlusion": true,
"comp": "-2",
"coloring-component": "-2",
"cells": true,
"camera-direction": "-1,1,-0.5"
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/occt/configs/thumbnail.d/10_occt.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"load-plugins": "occt",
"up": "+Z",
"ambient-occlusion": true,
"comp": "-2",
"coloring-component": "-2",
"cells": true,
"camera-direction": "-1,1,-0.5"
}
Expand Down
Loading

0 comments on commit 4b133bc

Please sign in to comment.