Skip to content

Commit

Permalink
[PoC][Part02]: Add CLI option to discretize colormap
Browse files Browse the repository at this point in the history
  • Loading branch information
gapry committed Oct 25, 2024
1 parent 6af9340 commit 9f9a2e9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions application/F3DOptionsTools.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ static inline const std::array<CLIGroup, 8> CLIOptions = {{
{"bar", "b", "Show scalar bar", "<bool>", "1" },
{"colormap-file", "", "Specify a colormap image", "<filePath/filename/fileStem>", ""},
{"colormap", "", "Specify a custom colormap (ignored if \"colormap-file\" is specified)", "<color_list>", ""},
{"colormap-discretization", "", "test", "<bool>", "1"},
{"volume", "v", "Show volume if the file is compatible", "<bool>", "1"},
{"inverse", "i", "Inverse opacity function for volume rendering", "<bool>", "1"} } },
{"Camera",
Expand Down
4 changes: 4 additions & 0 deletions library/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@
"type": "double_vector",
"default_value": "0.0, 0.0, 0.0, 0.0, 0.4, 0.9, 0.0, 0.0, 0.8, 0.9, 0.9, 0.0, 1.0, 1.0, 1.0, 1.0"
},
"discretization" : {
"type": "bool",
"default_value": "false"
},
"range": {
"type": "double_vector"
}
Expand Down
1 change: 1 addition & 0 deletions library/src/window_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ void window_impl::UpdateDynamicOptions()
opt.model.scivis.array_name, opt.model.scivis.component);
renderer->SetScalarBarRange(opt.model.scivis.range);
renderer->SetColormap(opt.model.scivis.colormap);
renderer->SetColorDiscretization(opt.model.scivis.discretization);
renderer->ShowScalarBar(opt.ui.scalar_bar);

renderer->SetUsePointSprites(opt.model.point_sprites.enable);
Expand Down
5 changes: 5 additions & 0 deletions vtkext/private/module/vtkF3DRenderer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2230,6 +2230,11 @@ void vtkF3DRenderer::SetColormap(const std::vector<double>& colormap)
}
}

void vtkF3DRenderer::SetColorDiscretization(const bool discretization) {
auto logMsg = std::string("[Gapry PoC][Add CLI Options] " + std::string(__PRETTY_FUNCTION__));
F3DLog::Print(F3DLog::Severity::Warning, logMsg);
}

//----------------------------------------------------------------------------
void vtkF3DRenderer::CycleScalars(CycleType type)
{
Expand Down
2 changes: 2 additions & 0 deletions vtkext/private/module/vtkF3DRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ class vtkF3DRenderer : public vtkOpenGLRenderer
*/
void SetColormap(const std::vector<double>& colormap);

void SetColorDiscretization(const bool discretization);

enum class CycleType
{
NONE,
Expand Down

0 comments on commit 9f9a2e9

Please sign in to comment.