Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add custom alpha value for mesh display #451

Merged
merged 4 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
some simplications of the option --doSnapShotAndExit. (Bertrand
Kerautret
[#448](https://github.com/DGtal-team/DGtalTools/pull/448))

- meshViewer: new option to set alpha channel of the mesh color.
(Bertrand Kerautret
[#451](https://github.com/DGtal-team/DGtalTools/pull/451))
- *volumetric*
- volReSample: fix the impossibility to export to vol when ITK is activated
(Bertrand Kerautret [#445](https://github.com/DGtal-team/DGtalTools/pull/445))
Expand Down
11 changes: 10 additions & 1 deletion visualisation/meshViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ using namespace DGtal;
-z,--scaleZ FLOAT set the scale value in the z direction (default 1.0)
--minLineWidth FLOAT=1.5 set the min line width of the mesh faces (default 1.5)
--customColorMesh UINT ... set the R, G, B, A components of the colors of the mesh faces and eventually the color R, G, B, A of the mesh edge lines (set by default to black).
--customAlphaMesh UINT ... set the alpha components of the colors of the mesh faces (can be applied for each mesh).
--customColorSDP UINT x 4 set the R, G, B, A components of the colors of the sdp view
-f,--displayVectorField TEXT display a vector field from a simple sdp file (two points per line)
--vectorFieldIndex UINT x 6 specify special indices for the two point coordinates (instead usinf the default indices: 0 1, 2, 3, 4, 5)
Expand Down Expand Up @@ -188,7 +189,7 @@ int main( int argc, char** argv )
bool useLastCamSet {false};
bool fixLightToScene {false};
float ambiantLight {0.0};

std::vector<unsigned int> customAlphaMesh;

// parse command line using CLI ----------------------------------------------
CLI::App app;
Expand All @@ -203,6 +204,7 @@ int main( int argc, char** argv )
app.add_option("-z,--scaleZ", sz, "set the scale value in the z direction (default 1.0)");
app.add_option("--minLineWidth", lineWidth, "set the min line width of the mesh faces (default 1.5)", true);
app.add_option("--customColorMesh", customColorMesh, "set the R, G, B, A components of the colors of the mesh faces and eventually the color R, G, B, A of the mesh edge lines (set by default to black).");
app.add_option("--customAlphaMesh", customAlphaMesh, "set the alpha components of the colors of the mesh faces (can be applied for each mesh).");

app.add_option("--customColorSDP", customColorSDP, "set the R, G, B, A components of the colors of the sdp view")
->expected(4);
Expand Down Expand Up @@ -292,7 +294,14 @@ int main( int argc, char** argv )
for (unsigned int j = 0; j < aMesh.nbFaces(); j++){
aMesh.setFaceColor(j, Color(meshColorR, meshColorG, meshColorB, meshColorA));
}
}else if (customAlphaMesh.size() > 0 ) {
for (unsigned int j = 0; j < aMesh.nbFaces(); j++){
auto c = aMesh.getFaceColor(j);
aMesh.setFaceColor(j, Color(c.red(), c.green(), c.blue(), customAlphaMesh.at(i<customAlphaMesh.size() ? i: 0)));
}

}

vectMesh.push_back(aMesh);
}
DGtal::Z3i::RealPoint centerMeshes;
Expand Down
Loading