![]() |
ImFusion SDK 4.3
|
#include <ImFusion/GL/GlBox.h>
Bounding box annotation. More...
Inheritance diagram for GlBox:Bounding box annotation.
Public Member Functions | |
| void | draw (const GlView &view) override |
| Draw the object in 3D space. | |
| void | draw2D (const GL::ViewState &viewState, Slice slice) override |
| Computes the cross-section with the slice and displays it with lines. | |
| void | configure (const Properties *p) override |
| Set one or multiple properties. | |
| void | configuration (Properties *p) const override |
| Retrieve the properties of this object. | |
| std::string | typeName () const override |
| Return unique identifier for this object class used for serialization. | |
| void | createMesh (const vec3 &topLeft, const vec3 &bottomRight, const mat3 &orientation=mat3::Identity()) |
| void | updateMesh () |
| void | clearMesh () |
| Removes the internal mesh and clears the points (resets rendering to initial state) | |
| vec3 & | boxExtent () |
| const vec3 & | boxExtent () const |
| vec3 & | boxCenter () |
| const vec3 & | boxCenter () const |
| mat3 & | orientation () |
| Returns the orientation of the box. | |
| const mat3 & | orientation () const |
| std::optional< vec4i > | isSideHit (double x, double y, const GlSliceView &view) const |
| Takes viewport coordinates as input and returns a vector of the corner indices if the side is "hit", returns a std::nullopt otherwise The 6 possible sides are: 0,1,2,3 top 4,5,6,7 bottom 0,1,4,5 left 2,3,6,7 right 0,3,4,7 back 1,2,5,6 front. | |
| bool | isCenterHit (double x, double y, const GlSliceView &view) const |
| Takes viewport coordinates as input and returns true if the center is "hit", returns false otherwise. | |
| std::optional< int > | isOutOfPlaneCornerHit (double x, double y, const GlSliceView &view) const |
| Checks if the given viewport coordinates are close to where one of the 8 corners of the box is rendered. | |
Public Member Functions inherited from GlMesh | |
| GlMesh () | |
| Creates an empty object and initializes the shader program. | |
| GlMesh (Mesh *mesh) | |
| Initializes the shader program and creates and uploads the required GPU buffers for the mesh. | |
| void | setMatrix (const mat4 &m) override |
| Set the modelview matrix of this object. | |
| const mat4 & | matrix () const override |
| Return the modelview matrix. | |
| virtual void | setMesh (Mesh *mesh) |
| Attaches a Mesh to be rendered. | |
| virtual const Mesh * | getMesh () |
| void | draw (const GlView &view) override |
| Calls draw3D for SPACE3D views and draw2D for SLICE2D views. | |
| void | draw3D (const GL::ViewState &viewState, const Slice *slice=nullptr, const GL::OrderIndependentTransparency *oit=nullptr, const GL::ObjectPicking *objectPicking=nullptr) |
| Draws the mesh in 3D with Phong-Shading. | |
| void | applyMeshDisplayOptions (const MeshDisplayOptions &mdo, bool applyRenderModes=false) |
| Assign the applicable rendering settings in mdo to this GlMesh instance. | |
| virtual void | setRenderMode2d (RenderMode2d mode) |
| Sets the 2D render mode. | |
| virtual RenderMode2d | renderMode2d () const |
| Returns the current 2D render mode. | |
| virtual void | setRenderMode3d (RenderMode3d mode) |
| Sets the 3D render mode. | |
| virtual RenderMode3d | renderMode3d () const |
| Returns the current 3D render mode. | |
| void | setRenderingDepthOffset (bool useOffset, float offsetFactor=2.f, float offsetUnits=2.f) |
| Sets the depth offset (see OpenGL glPolygonOffset for more details) | |
| bool | renderingDepthOffset (float &offsetFactor, float &offsetUnits) |
| void | setColor (const vec3 &color) override |
| Sets the color of the front and back material (ambient, diffuse and specular) | |
| void | setColor (const std::vector< vec3f > &colors) |
| Sets individual color per vertex. | |
| std::vector< vec3f > | colors () const |
| Get individual colors of vertices. | |
| void | setAlpha (double alpha) override |
| Set alpha channel. | |
| virtual void | enableLighting (bool enable, Facing side=Both) |
| Enables/Disables lighting effects. | |
| virtual void | enableLighting (const vec2i &enable) |
| virtual bool | lighting (vec2i &out) const |
| virtual void | setShininess (float shininess) |
| Sets the strength of specular reflections on the front and back faces (0.0 to disable specular reflections) | |
| virtual void | setFrontShininess (float shininess) |
| Sets the strength of specular reflections on the front faces (0.0 to disable specular reflections) | |
| virtual void | setBackShininess (float shininess) |
| Sets the strength of specular reflections on the back faces (0.0 to disable specular reflections) | |
| virtual void | setMaterialMode (MaterialMode mode) |
| Sets the material mode for the front and back facing triangles during 3D rendering. | |
| virtual void | setFrontMaterialMode (MaterialMode mode) |
| Sets the material mode for the front facing triangles during 3D rendering. | |
| virtual void | setBackMaterialMode (MaterialMode mode) |
| Sets the material mode for the back facing triangles during 3D rendering. | |
| virtual MaterialMode | frontMaterialMode () const |
| Returns the material mode for the front facing triangles during 3D rendering. | |
| virtual MaterialMode | backMaterialMode () const |
| Returns the material mode for the back facing triangles during 3D rendering. | |
| virtual MaterialMode | wireframeMaterialMode () const |
| virtual void | setMaterial (vec3f ambient, vec3f diffuse, vec3f specular, float shininess) |
| Sets the material used for the front and back facing triangles during 3D rendering. | |
| virtual void | setFrontMaterial (vec3f ambient, vec3f diffuse, vec3f specular, float shininess) |
| Sets the material used for the front facing triangles during 3D rendering. | |
| virtual void | frontMaterial (vec3f &ambient, vec3f &diffuse, vec3f &specular, float &shininess) const |
| Returns the material used for the front facing triangles during 3D rendering. | |
| virtual void | setBackMaterial (vec3f ambient, vec3f diffuse, vec3f specular, float shininess) |
| Sets the material used for the back facing triangles during 3D rendering. | |
| virtual void | backMaterial (vec3f &ambient, vec3f &diffuse, vec3f &specular, float &shininess) const |
| Returns the material used for the back facing triangles during 3D rendering. | |
| virtual void | setWireframeWidth (float width) |
| Sets the line width in 2D rendering. | |
| virtual vec4f | wireframeColor () const |
| Returns the line color in 2D rendering. | |
| virtual void | setWireframeColor (vec4f color) |
| Sets the line color in 2D rendering. | |
| virtual void | setWireframeMaterialMode (MaterialMode mode) |
| Sets the material mode for the wireframe during 3D rendering. | |
| virtual void | setLineColor (vec4f color) |
| Sets the line color in 2D rendering. | |
| virtual vec4f | lineColor () const |
| Returns the line color in 2D rendering. | |
| float | lineWidth () const override |
| Return annotation line width. | |
| void | setLineWidth (float lineWidth) override |
| Set annotation line width. | |
| std::optional< Geometry::Plane > | clipPlane () const |
| Returns the optional clip plane used during 3D rendering. | |
| void | setClipPlane (std::optional< Geometry::Plane > plane) |
| Sets an optional clip plane so that parts on the back (opposite the direction of the normal vector) are clipped during 3D rendering. | |
| vec4f | projectiveFrontColor () const |
| Returns the color used for RenderMode2d::ProjectiveDepthEncoding rendering mode in MPR views if mesh is in front of the MPR plane. | |
| void | setProjectiveFrontColor (vec4f value) |
| Sets the color used for RenderMode2d::ProjectiveDepthEncoding rendering mode in MPR views if mesh is in front of the MPR plane. | |
| vec4f | projectiveBackColor () const |
| Returns the color used for RenderMode2d::ProjectiveDepthEncoding rendering mode in MPR views if mesh is behind the MPR plane. | |
| void | setProjectiveBackColor (vec4f value) |
| Sets the color used for RenderMode2d::ProjectiveDepthEncoding rendering mode in MPR views if mesh is behind the MPR plane. | |
| double | projectiveIntersectionTolerance () const |
| Returns the tolerance (mm) during the computation whether a mesh intersects the MPR plane in projective rendering. | |
| void | setProjectiveIntersectionTolerance (double value) |
| Sets the tolerance (mm) during the computation whether a mesh intersects the MPR plane in projective rendering. | |
| double | projectiveFadeoutRange () const |
| Returns the range (mm) during which the mesh is smoothly faded out in projective rendering if not intersecting. | |
| void | setProjectiveFadeoutRange (double value) |
| Sets the range (mm) during which the mesh is smoothly faded out in projective rendering if not intersecting. | |
| void | setLineStipplePattern (uint16_t pattern) |
| Sets the stipple pattern of the rendered mesh plane intersection lines. | |
| void | setLineStippleFactor (double factor) |
| Sets the factor determining the length of the stipple pattern of the mesh plane intersection lines. | |
| virtual void | setCustomShader (GL::Program *program) |
| Sets a custom shader to be used as a replacement for the default shader in 3D. | |
| Geometry::AlignedBox | bounds () const override |
| Get the axis-aligned bounding box of this GlObject in world space. | |
| Geometry::AlignedBox | boundsSpherical () const override |
| Computes a cheap approximation of the mesh bounds in world space The mesh bounds in local space are translated to the current mesh position in world space. | |
| std::string | typeName () const override |
| Return unique identifier for this object class used for serialization. | |
| Mesh * | mesh () |
| const Mesh * | mesh () const |
| const MeshGl * | meshGl () const |
| vec3 | center () const override |
| Return the center of the object in local coordinates without considering any matrix. | |
| vec3 | extent () const override |
| Return the extent of the object in local coordinates without considering any matrix. | |
| vec3 | centerOfMass () const |
| void | setDrawIn2D (bool draw) |
| bool | drawIn2D () const |
| void | setDrawCrossSection (bool draw) |
| Specify whether to draw a filled cross-section of the mesh in the slice views Note that this will only work with closed meshes. | |
| bool | drawCrossSection () const |
| void | setCrossSectionColor (vec4f color) |
| Specify the color of the cross section. | |
| vec4f | crossSectionColor () const |
| void | setDrawNormals (bool flag) |
| Specify whether the normals should be drawn as lines (if available) | |
| bool | drawNormals () const |
| void | configure (const Properties *p) override |
| Set one or multiple properties. | |
| void | configuration (Properties *p) const override |
| Retrieve the properties of this object. | |
| virtual bool | hasCustomShader () const |
| void | setFaceNormalsEnabled (bool v) |
| bool | faceNormalsEnabled () const |
| void | setPickingMode (PickingMode v) |
| Specify the type of index picking. | |
| PickingMode | pickingMode () const |
Public Member Functions inherited from GlAnnotation | |
| virtual void | setView (const GlView *view) |
| Set the view through which this annotation is currently being manipulated. | |
| virtual const GlView * | view () const |
| Get the view through which this annotation is currently being manipulated. | |
| virtual bool | hitTest (int, int, const GlView &) const |
| Perform hit test with points of underlying object. Return true if object is hit, false otherwise. | |
| virtual void | setEditable (bool editable) |
| When a GlAnnotation is editable it may alter its visualization and render UI elements for its manipulation. | |
| virtual bool | editable () const |
| When a GlAnnotation is editable it may alter its visualization and render UI elements for its manipulation. | |
| virtual vec3 | color () const |
| Return annotation color. | |
| virtual double | alpha () const |
| Get alpha channel. | |
| virtual void | setLabelVisible (bool visible) |
| Set annotation label visibility. | |
| virtual bool | labelVisible () const |
| Return annotation label visibility. | |
| virtual void | setLabelBackgroundVisible (bool visible) |
| Set annotation label background visibility. | |
| virtual bool | labelBackgroundVisible () const |
| Return annotation label background visibility. | |
| virtual void | setLabelBackgroundColor (vec4 color) |
| Set annotation label background color. | |
| virtual vec4 | labelBackgroundColor () const |
| Return annotation label background color. | |
| virtual void | setLabelBackgroundMargin (int margin) |
| Set annotation label background margin in pixels. | |
| virtual int | labelBackgroundMargin () const |
| Return annotation label background margin in pixels. | |
| virtual void | setLabelDepthTest (bool depthTest) |
| Set annotation label depth test flag. | |
| virtual bool | labelDepthTest () const |
| Return annotation label depth test flag. | |
| virtual void | setLabelColor (const vec3 &color) |
| Set annotation label color. | |
| virtual vec3 | labelColor () const |
| Return annotation label color. | |
| virtual void | setLabelText (const std::string &label) |
| Set annotation label text. | |
| virtual std::string | labelText () const |
| Return annotation label text. | |
| virtual void | setLabelTextPrefix (const std::string &labelPrefix) |
| Set annotation label text prefix. | |
| std::string | labelTextPrefix () const |
| Return annotation label text prefix. | |
| virtual void | setLabelTextSuffix (const std::string &labelSuffix) |
| Set annotation label text suffix. | |
| std::string | labelTextSuffix () const |
| Return annotation label text suffix. | |
| virtual void | setName (const std::string &name) |
| Set annotation name. | |
| virtual std::string | name () const |
| Return annotation name. | |
| virtual void | setSelected (bool m) |
| When a GlAnnotation is selected, it may be rendered differently to distinguish it from non-selected annotations. | |
| bool | selected () const |
| When a GlAnnotation is selected, it may be rendered differently to distinguish it from non-selected annotations. | |
| virtual void | setMatrixWithoutMoving (const mat4 &m) |
| Change the matrix without moving the annotation, e.g. for linking it with an image transformation. | |
| void | copyStyle (const GlAnnotation &other) |
| Copies the settable parameters from another GlAnnotation. | |
Public Member Functions inherited from GlObject | |
| virtual void | setVisible (bool visible) |
| Set object visibility. | |
| virtual bool | visible () const |
| Return object visibility. | |
| virtual void | setAlwaysVisible (bool alwaysVisible) |
| Set if object is always visible. | |
| virtual bool | alwaysVisible () const |
| Return if object is always visible. | |
| RenderingOrderGroup | renderingOrder () const |
| Return current rendering order value for this GlObject. | |
| void | setRenderingOrder (RenderingOrderGroup group) |
| Set rendering order value for this GlObject. | |
| void | setDraw3DIn2DView (bool draw3DIn2DView) |
| void | configure (const Properties *p) override |
| Configure this object instance by de-serializing the given Properties. | |
| void | configuration (Properties *p) const override |
| Serialize the current object configuration into the given Properties object. | |
Public Member Functions inherited from Configurable | |
| virtual void | configureDefaults () |
| Retrieve the properties of this object, replaces values with their defaults and sets it again. | |
| void | registerParameter (ParameterBase *param) |
| Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration(). | |
| void | unregisterParameter (const ParameterBase *param) |
| Remove the given Parameter or SubProperty from the list of registered parameters. | |
| Configurable (const Configurable &rhs) | |
| Configurable (Configurable &&rhs) noexcept | |
| Configurable & | operator= (const Configurable &) |
| Configurable & | operator= (Configurable &&) noexcept |
Public Member Functions inherited from SignalReceiver | |
| SignalReceiver ()=default | |
| Default constructor. | |
| SignalReceiver (const SignalReceiver &other) | |
| Copy constructor, does not copy any existing signal connections from other. | |
| SignalReceiver & | operator= (SignalReceiver rhs) |
| Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs. | |
| virtual | ~SignalReceiver () |
| Virtual destructor disconnects from all connected signals. | |
Public Attributes | |
| Signal | boxChanged |
| Emitted every time the center or extent changes. | |
Public Attributes inherited from Configurable | |
| Signal | signalParametersChanged |
Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted. | |
Additional Inherited Members | |
Public Types inherited from GlMesh | |
| enum | RenderMode2d { IntersectionOnly , FullProjective , ProjectiveColorGradient , ProjectiveWireframe , Render3D } |
| enum | RenderMode3d { Surface , SurfaceAndWireframe , Wireframe , Intersection } |
| enum | MaterialMode { Uniform = 0 , Color = 1 , Texture = 2 , Shader = 3 , FaceLabel = 4 , VertexLabel = 5 } |
| enum | Facing { Both = 0 , Front = 1 , Back = 2 } |
| enum class | PickingMode { None = 0 , Face = 1 , Vertex = 2 } |
| enum class | ClipMode { Discard = 0 , Wireframe = 1 , SolidButWireframeColor = 2 } |
Public Types inherited from GlObject | |
| enum | RenderingOrderGroup { RenderingGroupRest , RenderingGroupMesh , RenderingGroupManipulator } |
| Enumeration to determine rendering order of GlObjects in GlSliceView and GlVolumeView. More... | |
Protected Member Functions inherited from GlMesh | |
| void | dataDeleted (const Data *d) |
| bool | needsSurfaceRenderer (const GlView::Type &viewType) const |
| bool | needsCustomSurfaceRenderer (const GlView::Type &viewType) const |
| bool | needsSliceRenderer (const GlView::Type &viewType) const |
| bool | needsNormalRenderer (const GlView::Type &viewType) const |
Protected Member Functions inherited from GlAnnotation | |
| void | renderLabel (const GlView &view, const vec3 &positionWorld) const |
| Render the label of the annotation at the given position. | |
| vec2i | labelSize () const |
Protected Member Functions inherited from SignalReceiver | |
| void | disconnectAll () |
| Disconnects all existing connections. | |
Protected Attributes inherited from GlMesh | |
| Mesh * | m_mesh = nullptr |
| RenderMode2d | m_renderMode2d = IntersectionOnly |
| RenderMode3d | m_renderMode3d = Surface |
| double | m_projectiveIntersectionTolerance = 0.0 |
| double | m_projectiveFadeoutRange = 10.0 |
| bool | m_drawIn2D = false |
| bool | m_drawNormals = false |
| bool | m_useDepthOffset = false |
| float | m_depthOffsetFactor = 2.f |
| float | m_depthOffsetUnits = 2.f |
Protected Attributes inherited from GlAnnotation | |
| bool | m_editable = true |
| vec4 | m_color {1, 1, 0, 1} |
| float | m_lineWidth = 1 |
| bool | m_labelVisible = true |
| bool | m_labelBackgroundVisible = false |
| vec4 | m_labelBackgroundColor {0.3, 0.3, 0.3, 0.7} |
| int | m_labelBackgroundMargin = 3 |
| bool | m_labelDepthTest = true |
| bool | m_selected = false |
| vec3 | m_labelColor {0, 1, 1} |
| std::string | m_labelText |
| std::string | m_labelTextPrefix |
| std::string | m_labelTextSuffix |
| const GlView * | m_view = nullptr |
| std::string | m_name |
Protected Attributes inherited from GlObject | |
| mat4 | m_matrix = mat4::Identity() |
| Modelview transformation matrix of this object. | |
| bool | m_visible = true |
| Object visibility. | |
| bool | m_alwaysVisible = false |
| Object always visible. | |
| bool | m_draw3DIn2DView |
| Draw 3D objects in 2D views. This is to render 3D objects in projective 2D views. Property is not serialized. | |
| RenderingOrderGroup | m_renderingOrder = RenderingGroupRest |
Protected Attributes inherited from Configurable | |
| std::vector< Param > | m_params |
| List of all registered Parameter and SubProperty instances. | |
|
overridevirtual |
Computes the cross-section with the slice and displays it with lines.
Reimplemented from GlMesh.
|
overridevirtual |
Set one or multiple properties.
Reimplemented from GlAnnotation.
|
overridevirtual |
Retrieve the properties of this object.
Reimplemented from GlAnnotation.
|
inlineoverridevirtual |
Return unique identifier for this object class used for serialization.
Implements GlObject.
|
inline |
Returns the orientation of the box.
Each column vector of the matrix is one (normalized) basis vector.
| std::optional< int > isOutOfPlaneCornerHit | ( | double | x, |
| double | y, | ||
| const GlSliceView & | view ) const |
Checks if the given viewport coordinates are close to where one of the 8 corners of the box is rendered.
If yes, returns the index of the corresponding vertex of the underlying Mesh.