Skip to content

Commit

Permalink
Deploying to gh-pages from @ 9ee6912 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
mwestphal committed Sep 2, 2024
1 parent e1a28bf commit 15c1e15
Show file tree
Hide file tree
Showing 18 changed files with 61 additions and 56 deletions.
8 changes: 4 additions & 4 deletions assets/js/search-data.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/libf3d/OPTIONS.html

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion doc/libf3d/OPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ model.material.roughness|double<br>0.3<br>render|Set the *roughness coefficient*
model.material.texture|string<br>-<br>render|Path to a texture file that sets the Occlusion, Roughness and Metallic values of the object. Multiplied with the `model.material.roughness` and `model.material.metallic`, set both of them to 1.0 to get a true result.|\-\-texture-material
model.normal.scale|double<br>1.0<br>render|Normal scale affects the strength of the normal deviation from the normal texture.|\-\-normal-scale
model.normal.texture|string<br>-<br>render|Path to a texture file that sets the normal map of the object.|\-\-texture-normal
model.scivis.enable|bool<br>false<br>render|*Color by an array* present in on the data. If `model.scivis.array_name` is set to <empty>, the first available array will be used.|\-\-scalar-coloring
model.scivis.cells|bool<br>false<br>render|Color the data with value found *on the cells* instead of points|\-\-cells
model.scivis.colormap|vector\<double\><br>\<inferno\><br>render|Set a *custom colormap for the coloring*.<br>This is a list of colors in the format `val1,red1,green1,blue1,...,valN,redN,greenN,blueN`<br>where all values are in the range (0,1).|\-\-colormap
model.scivis.component|int<br>-1<br>render|Specify the component to color with. -1 means *magnitude*. -2 means *direct values*.|\-\-comp
model.scivis.array_name|string<br>\<reserved\><br>render|*Color by a specific data array* present in on the data. Set to <empty> to let libf3d find the first available array.|\-\-scalars
model.scivis.array_name|string<br>-<br>render|Select the name of the array to color with.|\-\-coloring-array
model.scivis.range|vector\<double\><br>-<br>render|Set a *custom range for the coloring*.|\-\-range
model.point_sprites.enable|bool<br>false<br>render|Show sphere *points sprites* instead of the geometry.|\-\-point-sprites
model.point_sprites.type|string<br>sphere<br>render|Set the sprites type when showing point sprites (can be `sphere` or `gaussian`).|\-\-point-type
Expand Down
8 changes: 4 additions & 4 deletions doc/user/CONFIGURATION_FILE.html

Large diffs are not rendered by default.

33 changes: 15 additions & 18 deletions doc/user/CONFIGURATION_FILE.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
# Configuration File

Almost all the command-line options can be controlled using configuration files.
Almost all the command-line [options](OPTIONS.md) can be controlled using configuration files.
Configuration files uses the "long" version of the command-line options in a JSON
formatted file to provide values for these options.
formatted file to provide values for these options. It is also possible to use
the [libf3d options](../libf3d/OPTIONS.md) syntax.

These options can be organized by block using a regular expression for each block
in order to provide different default values for the different filetypes.

A special block, named `global`, will apply to all files.
Using a command-line option will override the corresponding value in the config file.
Using a command-line option will override similar option set in any config files.

The `global` block and command-line options are only taken into account on the first load
and not on subsequent loads, when switching between files.
The regular expression blocks are always taken into account, even when loading further files.
Please note the regular expressions are not case-sensitive.
Some options are only taken into account on the first load and not on subsequent loads,
when switching between files.

A typical config file may look like this:

```javascript
{
"global": {
".*": {
"bg-color": "0.7,0.7,0.7",
"color": "0.5,0.1,0.1",
"anti-aliasing": true,
Expand All @@ -29,7 +27,7 @@ A typical config file may look like this:
"bar": true,
"roughness": 0.2,
"grid": true,
"scalars": true
"scalar-coloring": true
},
".*vt.": {
"edges": true
Expand All @@ -44,23 +42,23 @@ A typical config file may look like this:
}
}
```
Here, the first block defines a basic global configuration with many desired options for all files.
Here, the first block defines a basic configuration with many desired options for all files.
The second block specifies that all files ending with vt., eg: vtk, vtp, vtu, ... will be shown with edges visibility turned on.
The third block specifies raytracing usage for .gltf and .glb files.
The last block specifies that volume rendering should be used with .mhd files.

Single .json file for configuration is supported, as well a config directory containing multiple .json config files.
In the case of config directory, .json file are read in alphabetical order and an option in a block can be overridden
by the same option being set in the same block in another .json file read after.
by the same option being set in another block in another .json file read after.

F3D provides a default config directory for generic usage (`config.d`) and a thumbnail specific config directory (`thumbnail.d`).
You can edit the file contained in these directory or copy then into specific locations (see below) in order to customize F3D behavior.
You can edit the file contained in these directory or add your own in specific directories (see below).

The following command-line options <b> cannot </b> be set via config file:
`help`, `version`, `readers-list`, `config`, `dry-run`.
`help`, `version`, `readers-list`, `config`, `dry-run` and `input`.

The following command-line options <b>can only</b> be set in the global block of the config file:
`no-render`, `inputs`, `output`, `verbose`, `resolution`, `position` and all testing options.
The following command-line options <b>are only taken on the first load</b>:
`no-render`, `output`, and all testing options.

Boolean options that have been turned on in the configuration file can be turned
off on the command line if needed, eg: `--point-sprites=false`.
Expand All @@ -80,5 +78,4 @@ On Linux, they will be installed in `[install_dir]/share/f3d/configs/`, on Windo
Please note there is a command line option to control the configuration file to read. Using it, one can specify an absolute/relative path for the configuration path, but also
only the filename or filestem (`.json` and `.d` will be added) to look for in the locations listed above, , eg: `f3d --config=custom_config` will look
for `custom_config.json` and `custom_config.d` in locations listed above.

Please note <b>only one</b> config file or directory will be found and parsed.
When specifying an absolute/relative path for the configuration file, a single file is read. If not, all files from locations listed above, with the overriding logic specified above.
2 changes: 1 addition & 1 deletion doc/user/INTERACTIONS.html

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions doc/user/INTERACTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ Other hotkeys are available:
* <kbd>F12</kbd>: take a screenshot, ie. render the current view to an image file.
* <kbd>F11</kbd>: take a "minimal" screenshot, ie. render the current view with no grid and no overlays to an image file with a transparent background.

When loading another file or reloading, options that have been changed interactively are kept but can be overridden
if a dedicated regular expression block in the configuration file is present, see the [configuration file](CONFIGURATION_FILE.md)
documentation for more info.
When loading another file or reloading, options that have been changed interactively are kept as is.

## Cycling Coloring

Expand Down
2 changes: 1 addition & 1 deletion doc/user/OPTIONS.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions doc/user/OPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ F3D behavior can be fully controlled from the command line using the following o

Options|Default|Description
------|------|------
\-\-input=\<input file\>||The input file or files to read, can also be provided as a positional argument.
\-\-output=\<png file\>||Instead of showing a render view and render into it, *render directly into a png file*. When used with \-\-ref option, only outputs on failure. If `-` is specified instead of a filename, the PNG file is streamed to the stdout. Can use [template variables](#filename-templating).
\-\-no-background||Use with \-\-output to output a png file with a transparent background.
-h, \-\-help||Print *help* and exit. Ignore `--verbose`.
Expand Down Expand Up @@ -85,7 +86,8 @@ Options|Default|Description

Options|Default|Description
------|------|------
-s, \-\-scalars=\<array_name\>||Specify an array to *Color* with if present in the file. If no array_name is provided, the first in alphabetical order will be picked if any are available. <br>Requires a default scene.<br>Use \-\-verbose to recover the usable array names.
-s, \-\-scalar-coloring||Enable scalar coloring if present in the file. If no `--coloring-array` is provided, the first in alphabetical order will be picked if any are available. <br>Requires a default scene.
\-\-coloring-array=\<array_name\>||The coloring array name to use when coloring.<br>Use \-\-verbose to recover the usable array names.
-y, \-\-comp=\<comp_index\>|-1|Specify the *component from the scalar* array to color with.<br>Use with the scalar option. -1 means *magnitude*. -2 or the short option, -y, means *direct values*.<br>When using *direct values*, components are used as L, LA, RGB, RGBA values depending on the number of components.
-c, \-\-cells||Specify that the scalar array is to be found *on the cells* instead of on the points.<br>Use with the scalar option.
\-\-range=\<min,max\>||Set a *custom range for the coloring* by the array.<br>Use with the scalar option.
Expand Down Expand Up @@ -146,8 +148,7 @@ Some rendering options are not compatible between them, here is the precedence o

## Options syntax

The `--options=value` syntax is used everywhere in this documentation, however, the syntax `--options value` can also be used, with the exception of options that have implicit values,
`--verbose`, `--comp` and `--scalars`.
As documented, only the `--options=value` syntax is supported. The syntax `--options value` is not supported.

## Filename templating

Expand All @@ -167,4 +168,3 @@ The destination filename used by `--output` or to save screenshots can use the f

For example the screenshot filename is configured as `{app}/{model}_{n}.png` by default, meaning that, assuming the model `hello.glb` is being viewed,
consecutive screenshots are going to be saved as `F3D/hello_1.png`, `F3D/hello_2.png`, `F3D/hello_3.png`, ...

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"global":
".*":
{
"axis": true,
"tone-mapping": true,
"grid": true,
"progress": true,
"anti-aliasing": true,
"filename": true,
"scalars": "",
"scalar-coloring": true,
"camera-direction": "-1,-0.5,-1",
"hdri-ambient": true,
"translucency-support": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"global":
".*":
{
"anti-aliasing": true,
"camera-direction": "-1,-0.5,-1",
"hdri-ambient": true,
"max-size":100,
"no-background": true,
"verbose": "quiet",
"scalars": "",
"scalar-coloring": true,
"tone-mapping": true,
"translucency-support": true
}
Expand Down
6 changes: 3 additions & 3 deletions vtkext/private/module/Testing/TestF3DRendererWithColoring.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int TestF3DRendererWithColoring(int argc, char* argv[])
renderer->ShowGrid(true);

// Check error paths
if (renderer->GetColoringArrayName() != F3D_RESERVED_STRING)
if (!renderer->GetColoringArrayName().empty())
{
std::cerr << "Unexpected coloring information without an importer" << std::endl;
return EXIT_FAILURE;
Expand All @@ -37,7 +37,7 @@ int TestF3DRendererWithColoring(int argc, char* argv[])
importer->Update();

// Check invalid array code path
renderer->SetColoring(false, "Invalid", 0);
renderer->SetColoring(true, false, "Invalid", 0);
renderer->SetUseVolume(false);
renderer->UpdateActors();
renderer->CycleScalars(vtkF3DRendererWithColoring::CycleType::COMPONENT);
Expand All @@ -51,7 +51,7 @@ int TestF3DRendererWithColoring(int argc, char* argv[])
}

// Check invalid component code path
renderer->SetColoring(false, "Momentum", 5);
renderer->SetColoring(true, false, "Momentum", 5);
renderer->UpdateActors();
renderer->SetUseVolume(true);
renderer->UpdateActors();
Expand Down
1 change: 0 additions & 1 deletion vtkext/private/module/vtkF3DConfigure.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <string>

static const std::string F3D_RESERVED_STRING = "f3d_reserved";
static const std::string F3D_EXIT_HOTKEY_SYM = "Escape";

// TODO: Use CMake definitions and get rid of these
Expand Down
25 changes: 16 additions & 9 deletions vtkext/private/module/vtkF3DRendererWithColoring.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ vtkF3DRendererWithColoring::CycleType vtkF3DRendererWithColoring::CheckColoring(
assert(this->Importer);

// Never force change of anything if we are currently not coloring
if (this->ArrayIndexForColoring == -1)
if (this->ArrayIndexForColoring < 0)
{
return CycleType::NONE;
}
Expand Down Expand Up @@ -501,7 +501,7 @@ vtkF3DRendererWithColoring::CycleType vtkF3DRendererWithColoring::CheckColoring(
}

//----------------------------------------------------------------------------
void vtkF3DRendererWithColoring::SetColoring(
void vtkF3DRendererWithColoring::SetColoring(bool enable,
bool useCellData, const std::string& arrayName, int component)
{
if (!this->Importer)
Expand All @@ -511,13 +511,16 @@ void vtkF3DRendererWithColoring::SetColoring(

// XXX This should be reworked to avoid handling multiple information in one parameters
// while still being future-proof and flexible enough.
if (this->GetColoringUseCell() != useCellData || this->GetColoringArrayName() != arrayName ||
this->GetColoringComponent() != component)
if (enable != (this->ArrayIndexForColoring >= 0)
|| useCellData != this->UseCellColoring
|| component != this->ComponentForColoring
|| arrayName != this->GetColoringArrayName())
{
this->UseCellColoring = useCellData;
this->ComponentForColoring = component;

int nIndexes = this->Importer->GetNumberOfIndexesForColoring(this->UseCellColoring);
if (arrayName == F3D_RESERVED_STRING)
if (!enable)
{
// Not coloring
this->ArrayIndexForColoring = -1;
Expand All @@ -544,8 +547,6 @@ void vtkF3DRendererWithColoring::SetColoring(
}
}

this->ComponentForColoring = component;

this->ColorTransferFunctionConfigured = false;
this->GeometryMappersConfigured = false;
this->PointSpritesMappersConfigured = false;
Expand All @@ -555,6 +556,12 @@ void vtkF3DRendererWithColoring::SetColoring(
}
}

//----------------------------------------------------------------------------
bool vtkF3DRendererWithColoring::GetColoringEnabled()
{
return this->ArrayIndexForColoring >= 0;
}

//----------------------------------------------------------------------------
bool vtkF3DRendererWithColoring::GetColoringUseCell()
{
Expand All @@ -566,7 +573,7 @@ std::string vtkF3DRendererWithColoring::GetColoringArrayName()
{
if (!this->Importer)
{
return F3D_RESERVED_STRING;
return "";
}

vtkF3DGenericImporter::ColoringInfo info;
Expand All @@ -576,7 +583,7 @@ std::string vtkF3DRendererWithColoring::GetColoringArrayName()
}
else
{
return F3D_RESERVED_STRING;
return "";
}
}

Expand Down
5 changes: 3 additions & 2 deletions vtkext/private/module/vtkF3DRendererWithColoring.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,18 @@ class vtkF3DRendererWithColoring : public vtkF3DRenderer
void SetImporter(vtkF3DGenericImporter* importer);

/**
* Set the coloring, call after SetColoringAttributes.
* Set coloring information.
* This method will try to find the corresponding array in the coloring attributes and will
* position ArrayIndexForColoring and DataForColoring accordingly.
*/
void SetColoring(bool useCellData, const std::string& arrayName, int component);
void SetColoring(bool enable, bool useCellData, const std::string& arrayName, int component);

///@{
/**
* Get current coloring information,
* Useful after using Cycle methods
*/
bool GetColoringEnabled();
bool GetColoringUseCell();
std::string GetColoringArrayName();
int GetColoringComponent();
Expand Down
Binary file modified web/f3d.wasm
Binary file not shown.
1 change: 1 addition & 0 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ <h1 class="title">F3D Web</h1>
options.set_color('render.background.color', 0, 0, 0);

// setup coloring
options.toggle('model.scivis.enable');
options.set_string('model.scivis.array_name', 'Colors');
options.set_integer('model.scivis.component', -2);
options.toggle('model.scivis.cells');
Expand Down
1 change: 1 addition & 0 deletions webassembly/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ <h1 class="title">F3D Web</h1>
options.set_color('render.background.color', 0, 0, 0);

// setup coloring
options.toggle('model.scivis.enable');
options.set_string('model.scivis.array_name', 'Colors');
options.set_integer('model.scivis.component', -2);
options.toggle('model.scivis.cells');
Expand Down

0 comments on commit 15c1e15

Please sign in to comment.