Various settings for the unstructured grid model. More...
Public Types | |
enum | UndeformedDrawStyle { LINES, OUTLINE } |
The draw style to use for the undeformed model. More... | |
enum | SimpleTransparencyCullMode { AUTO, NO_CULLING, BACK_FACE_CULLING } |
Specify if transparent triangles seen from the back side should be rendered or not. Note: This applies only to simple TransparencyMode::SIMPLE or when using transparent fringes colors. More... | |
Public Member Functions | |
Color3f | meshColor () const |
Returns mesh color. More... | |
void | setMeshColor (const Color3f &meshColor) |
Sets mesh color. More... | |
Color3f | highlightColor () const |
Returns the color used to highlight. More... | |
void | setHighlightColor (const Color3f &color) |
Sets the color used to highlight. More... | |
float | ambientIntensity () const |
Returns the current ambient intensity (global illumination or normal-independent lighting). More... | |
void | setAmbientIntensity (float intensity) |
Sets the current ambient intensity (global illumination or normal-independent lighting). More... | |
bool | showUndeformedModel () const |
Returns true if the undeformed model will be shown (if displacements are used) More... | |
void | setShowUndeformedModel (bool show) |
Specifies to show or hide the underformed model. More... | |
UndeformedDrawStyle | undeformedModelDrawStyle () const |
Returns the current draw style used for the undeformed model. More... | |
void | setUndeformedModelDrawStyle (UndeformedDrawStyle drawStyle) |
Sets the draw style to use for the undeformed model. More... | |
Color3f | undeformedModelColor () const |
Returns the color that is used for undeformed models, given that the undeformedModelUsePartColor() is false. More... | |
void | setUndeformedModelColor (Color3f color) |
Sets the color to use for the undeformed model. More... | |
bool | undeformedModelUsePartColor () const |
Returns true if the part color will be used as the color for the undeformed model. More... | |
void | setUndeformedModelUsePartColor (bool usePartColor) |
If set to true, the undeformed model will be drawn using the source part color, and not the single color specified by undeformedModelColor(). More... | |
bool | useShaderPrograms () const |
Returns true if shader programs are used. More... | |
bool | setUseShaderPrograms (bool useShaderPrograms) |
Toggles use of shader programs. More... | |
bool | useVertexBufferObjects () const |
Returns true if Vertex Buffer Objects (VBOs) are used (default on). More... | |
void | setUseVertexBufferObjects (bool useVBOs) |
Specifies if Vertex Buffer Objects (VBOs) should be used or not. More... | |
bool | useShaderComputedFlatNormals () const |
Returns true if shader computed flat normals is used. More... | |
void | setUseShaderComputedFlatNormals (bool useShaderComputedNormals) |
Specifies if shader computed flat normals should be used or not. More... | |
bool | useShaderBasedModeShapeAnimation () const |
Returns true if shader based mode shape animation is enabled. More... | |
void | setUseShaderBasedModeShapeAnimation (bool useShaderBasedAnimation) |
Specifies if shader based mode shape animations should be used or not. More... | |
vis::Font * | colorLegendTitleFont () |
Returns the font used on the color legend titles. More... | |
void | setColorLegendTitleFont (vis::Font *font) |
Sets the font to use on the color legend titles. More... | |
vis::Font * | colorLegendDetailsFont () |
Returns the font used on the color legends tick marks. More... | |
void | setColorLegendDetailsFont (vis::Font *font) |
Sets the font to use on the color legend tick marks. More... | |
Str | colorLegendNoResultOverrideTickMarksText () const |
Returns the text to show as tick mark values if all parts of the model is out of range. More... | |
void | setColorLegendNoResultOverrideTickMarksText (const Str &overrideText) |
Sets an override text to use for the tick marks on the color legends if there are no results on the model that is within range of the legend. More... | |
bool | optimizePartRendering () const |
Returns true if optimization of the rendered parts is enabled. More... | |
void | setOptimizePartRendering (bool optimize) |
Sets if the optimization of rendered parts should be enabled or not. More... | |
bool | removeInternalSurfaces () const |
Returns true if the internal surfaces of a volume element model are removed (default true). More... | |
void | setRemoveInternalSurfaces (bool removeInternalSurfaces) |
Sets if the internal surfaces of a volume element model should be removed or not. More... | |
double | outlineMeshCreaseAngleDegrees () const |
Returns the current crease angle used to compute outline mesh. More... | |
void | setOutlineMeshCreaseAngleDegrees (double creaseAngleDegrees) |
Sets the crease angle to use when computing outline mesh. More... | |
double | maximumOutlineMeshCreaseAngleDegrees () const |
Returns the current maximum crease angle used to compute outline mesh. More... | |
void | setMaximumOutlineMeshCreaseAngleDegrees (double creaseAngleDegrees) |
Sets the maximum crease angle to use when computing outline mesh. More... | |
double | smoothSurfaceNormalsCreaseAngleDegrees () const |
Returns the crease angle used to determine if an edge is a sharp edge or not when computing normals for smooth shading. More... | |
void | setSmoothSurfaceNormalsCreaseAngleDegrees (double creaseAngleDegrees) |
Sets the crease angle to use to determine if an edge is a sharp edge or not when computing normals for smooth shading. More... | |
bool | mustBeBehindAllCuttingPlanesToClip () const |
Returns how clipping against cutting planes will be performed if more than one plane has been specified. More... | |
void | setMustBeBehindAllCuttingPlanesToClip (bool mustBeBehindAllToClip) |
Controls how clipping against cutting planes will be done if more than one plane is specified. More... | |
bool | isViewClippingIgnored () const |
Queries if model is configured to ignore view clipping. More... | |
void | setIgnoreViewClipping (bool ignore) |
Enables or disable option to ignore view clipping in this model. More... | |
bool | useFirstOrderElementNodesOnly () const |
Returns true if first order elements only is used. More... | |
void | setUseFirstOrderElementNodesOnly (bool useFirstOrderOnly) |
Sets if first order elements only should be used. More... | |
SimpleTransparencyCullMode | simpleTransparencyCullMode () const |
Returns the mode used for culling (hiding) triangles in TransparencyMode::SIMPLE or when using transparent fringes colors. More... | |
void | setSimpleTransparencyCullMode (SimpleTransparencyCullMode mode) |
Specify if (auto) back face culling should be used or not when using Simple transparency or when having transparent legend colors. More... | |
Various settings for the unstructured grid model.
Specify if transparent triangles seen from the back side should be rendered or not. Note: This applies only to simple TransparencyMode::SIMPLE or when using transparent fringes colors.
float cee::ug::ModelSettings::ambientIntensity | ( | ) | const |
Returns the current ambient intensity (global illumination or normal-independent lighting).
Default is 0.2
vis::Font * cee::ug::ModelSettings::colorLegendDetailsFont | ( | ) |
Returns the font used on the color legends tick marks.
cee::Str cee::ug::ModelSettings::colorLegendNoResultOverrideTickMarksText | ( | ) | const |
Returns the text to show as tick mark values if all parts of the model is out of range.
Returns an empty string if this feature is disabled (default)
vis::Font * cee::ug::ModelSettings::colorLegendTitleFont | ( | ) |
Returns the font used on the color legend titles.
Color3f cee::ug::ModelSettings::highlightColor | ( | ) | const |
Returns the color used to highlight.
bool cee::ug::ModelSettings::isViewClippingIgnored | ( | ) | const |
Queries if model is configured to ignore view clipping.
double cee::ug::ModelSettings::maximumOutlineMeshCreaseAngleDegrees | ( | ) | const |
Returns the current maximum crease angle used to compute outline mesh.
Color3f cee::ug::ModelSettings::meshColor | ( | ) | const |
Returns mesh color.
bool cee::ug::ModelSettings::mustBeBehindAllCuttingPlanesToClip | ( | ) | const |
Returns how clipping against cutting planes will be performed if more than one plane has been specified.
bool cee::ug::ModelSettings::optimizePartRendering | ( | ) | const |
Returns true if optimization of the rendered parts is enabled.
double cee::ug::ModelSettings::outlineMeshCreaseAngleDegrees | ( | ) | const |
Returns the current crease angle used to compute outline mesh.
bool cee::ug::ModelSettings::removeInternalSurfaces | ( | ) | const |
Returns true if the internal surfaces of a volume element model are removed (default true).
void cee::ug::ModelSettings::setAmbientIntensity | ( | float | intensity | ) |
Sets the current ambient intensity (global illumination or normal-independent lighting).
Default is 0.2. A higher value (e.g. 0.8) will make the shaded objects look brighter overall with less shadow effect.
void cee::ug::ModelSettings::setColorLegendDetailsFont | ( | vis::Font * | font | ) |
Sets the font to use on the color legend tick marks.
void cee::ug::ModelSettings::setColorLegendNoResultOverrideTickMarksText | ( | const Str & | overrideText | ) |
Sets an override text to use for the tick marks on the color legends if there are no results on the model that is within range of the legend.
By setting a non-empty string, the model will be analyzed and the given text will be shown on all tick marks of the color legend if there are no values on the model that is within the range of the legend.
A typical value to set would be "N/A" to indicate that the legend does not apply to the current visualization.
This feature is off by default as the default string is "".
void cee::ug::ModelSettings::setColorLegendTitleFont | ( | vis::Font * | font | ) |
Sets the font to use on the color legend titles.
void cee::ug::ModelSettings::setHighlightColor | ( | const Color3f & | color | ) |
Sets the color used to highlight.
void cee::ug::ModelSettings::setIgnoreViewClipping | ( | bool | ignore | ) |
Enables or disable option to ignore view clipping in this model.
void cee::ug::ModelSettings::setMaximumOutlineMeshCreaseAngleDegrees | ( | double | creaseAngleDegrees | ) |
Sets the maximum crease angle to use when computing outline mesh.
This is useful for handling models where surfaces might have opposing normals due to surface winding, but you would not like an outline edge to be shown.
void cee::ug::ModelSettings::setMeshColor | ( | const Color3f & | meshColor | ) |
Sets mesh color.
void cee::ug::ModelSettings::setMustBeBehindAllCuttingPlanesToClip | ( | bool | mustBeBehindAllToClip | ) |
Controls how clipping against cutting planes will be done if more than one plane is specified.
Useful for creating "bounded clipping planes" for cutting planes where you define multiple planes in a way that only fragments rejected by all (e.g. inside a box) will be rejected. This allows for "cutting into" a model without removing everything one one side of a plane.
By default an object/fragment will be clipped if it is behind (on the opposite side of the plane normal) at least one of the specified planes. Setting mustBeBehindAllCuttingPlanesToClip to true will require that an object/fragment be behind all the specified planes in order to be clipped.
Example
Model with 4 clipping planes defining the bottom, right, back, and left cutting plane with clipping enabled. setMustBeBehindAllCuttingPlanesToClip(true) is used to create bounded clipping planes.
void cee::ug::ModelSettings::setOptimizePartRendering | ( | bool | optimize | ) |
Sets if the optimization of rendered parts should be enabled or not.
If set to true, the UnstructGridModel will combine all parts with equal visual appearance (color, draw style, line width, results, etc) into a single part on the graphics card in order to speed up the rendering. This VBO batching will give better and better results as the number of parts increase, and for 20 000+ parts this is essential in order to get good performance.
void cee::ug::ModelSettings::setOutlineMeshCreaseAngleDegrees | ( | double | creaseAngleDegrees | ) |
Sets the crease angle to use when computing outline mesh.
void cee::ug::ModelSettings::setRemoveInternalSurfaces | ( | bool | removeInternalSurfaces | ) |
Sets if the internal surfaces of a volume element model should be removed or not.
The default is true and will give the best performance, as only the surfaces on the hull of the model are rendered.
Set this to false to include inner surfaces if you would like to show something like internal wire frame mode.
void cee::ug::ModelSettings::setShowUndeformedModel | ( | bool | show | ) |
Specifies to show or hide the underformed model.
If displacements are used, you can enable this setting to show the original (undisplaced) model as either lines or outline together with the displaced model.
void cee::ug::ModelSettings::setSimpleTransparencyCullMode | ( | SimpleTransparencyCullMode | mode | ) |
Specify if (auto) back face culling should be used or not when using Simple transparency or when having transparent legend colors.
If set to auto, CDC will try to determine if the object is a closed volume or a shell model. If determined to be a closed volume, back face culling will be enabled.
void cee::ug::ModelSettings::setSmoothSurfaceNormalsCreaseAngleDegrees | ( | double | creaseAngleDegrees | ) |
Sets the crease angle to use to determine if an edge is a sharp edge or not when computing normals for smooth shading.
Node normals on the edge shared by the two triangles will be averaged unless the angle between the face normal of the two triangles is greater that the specified angle.
void cee::ug::ModelSettings::setUndeformedModelColor | ( | Color3f | color | ) |
Sets the color to use for the undeformed model.
Note that this setting is only used if undeformedModelUsePartColor() is false.
void cee::ug::ModelSettings::setUndeformedModelDrawStyle | ( | UndeformedDrawStyle | drawStyle | ) |
Sets the draw style to use for the undeformed model.
void cee::ug::ModelSettings::setUndeformedModelUsePartColor | ( | bool | usePartColor | ) |
If set to true, the undeformed model will be drawn using the source part color, and not the single color specified by undeformedModelColor().
void cee::ug::ModelSettings::setUseFirstOrderElementNodesOnly | ( | bool | useFirstOrderOnly | ) |
Sets if first order elements only should be used.
For instance, a quad8 is visualized as quad4, dropping the mid-nodes.
void cee::ug::ModelSettings::setUseShaderBasedModeShapeAnimation | ( | bool | useShaderBasedAnimation | ) |
Specifies if shader based mode shape animations should be used or not.
If set to true, the node and normal will be computed in the vertex shader based on the displaced and undisplaced geometry. This greatly reduces the GPU memory needed to show the mode shape animation.
void cee::ug::ModelSettings::setUseShaderComputedFlatNormals | ( | bool | useShaderComputedNormals | ) |
Specifies if shader computed flat normals should be used or not.
If set to true, flat normals will be computed in the fragment shader. This greatly reduces the GPU memory needed to render the model.
Note: This technique has some artifacts when combined with ZOOM navigation. When you zoom into with a large factor the model will start to show a pattern and not smooth colors anymore. This artifact can be avoided by using WALK navigation.
bool cee::ug::ModelSettings::setUseShaderPrograms | ( | bool | useShaderPrograms | ) |
Toggles use of shader programs.
The OpenGL context must support shaders to enable this. Also the OpenGL context must support fixed function if you want to disable the use of shaders.
Note: If you disable use of shader programs, only SIMPLE transparency is supported. All the other modes require shader support. See View::setTransparencyMode().
Note: The Qt OpenGL backings (cee::qt::OpenGLFunctionsBackend_qt5) do NOT support fixed function and requires shader usage to be on.
void cee::ug::ModelSettings::setUseVertexBufferObjects | ( | bool | useVBOs | ) |
Specifies if Vertex Buffer Objects (VBOs) should be used or not.
VBOs are on by default and will then be used if the graphics hardware supports it. This will upload all vertex data to the GPU and thus make the rendering a lot faster.
However, on large models with many time steps and changing vertex data for each step (e.g. displacements), VBOs might cause a performance decrease when the needed VBO memory exceeds the available memory on the graphics card.
So we recommend setting VBOs to false if you are doing large animations with displacements and many time steps.
bool cee::ug::ModelSettings::showUndeformedModel | ( | ) | const |
Returns true if the undeformed model will be shown (if displacements are used)
ModelSettings::SimpleTransparencyCullMode cee::ug::ModelSettings::simpleTransparencyCullMode | ( | ) | const |
Returns the mode used for culling (hiding) triangles in TransparencyMode::SIMPLE or when using transparent fringes colors.
double cee::ug::ModelSettings::smoothSurfaceNormalsCreaseAngleDegrees | ( | ) | const |
Returns the crease angle used to determine if an edge is a sharp edge or not when computing normals for smooth shading.
Color3f cee::ug::ModelSettings::undeformedModelColor | ( | ) | const |
Returns the color that is used for undeformed models, given that the undeformedModelUsePartColor() is false.
ModelSettings::UndeformedDrawStyle cee::ug::ModelSettings::undeformedModelDrawStyle | ( | ) | const |
Returns the current draw style used for the undeformed model.
bool cee::ug::ModelSettings::undeformedModelUsePartColor | ( | ) | const |
Returns true if the part color will be used as the color for the undeformed model.
bool cee::ug::ModelSettings::useFirstOrderElementNodesOnly | ( | ) | const |
Returns true if first order elements only is used.
bool cee::ug::ModelSettings::useShaderBasedModeShapeAnimation | ( | ) | const |
Returns true if shader based mode shape animation is enabled.
bool cee::ug::ModelSettings::useShaderComputedFlatNormals | ( | ) | const |
Returns true if shader computed flat normals is used.
bool cee::ug::ModelSettings::useShaderPrograms | ( | ) | const |
Returns true if shader programs are used.
bool cee::ug::ModelSettings::useVertexBufferObjects | ( | ) | const |
Returns true if Vertex Buffer Objects (VBOs) are used (default on).