qCC_db version 2.13.alpha (Qt) - 31 May 2022
CloudCompare 3D entities
Classes | Public Member Functions | Protected Attributes | List of all members
ccDrawableObject Class Referenceabstract

Generic interface for (3D) drawable entities. More...

#include <ccDrawableObject.h>

Inheritance diagram for ccDrawableObject:
Inheritance graph
[legend]
Collaboration diagram for ccDrawableObject:
Collaboration graph
[legend]

Classes

struct  DisplayState
 Display state. More...
 

Public Member Functions

 ccDrawableObject ()
 Default constructor.
 
 ccDrawableObject (const ccDrawableObject &object)
 Copy constructor.
 
virtual void draw (CC_DRAW_CONTEXT &context)=0
 Draws entity and its children. More...
 
virtual bool isVisible () const
 Returns whether entity is visible or not.
 
virtual void setVisible (bool state)
 Sets entity visibility.
 
virtual void toggleVisibility ()
 Toggles visibility.
 
virtual bool isVisibilityLocked () const
 Returns whether visibility is locked or not.
 
virtual void lockVisibility (bool state)
 Locks/unlocks visibility. More...
 
virtual bool isSelected () const
 Returns whether entity is selected or not.
 
virtual void setSelected (bool state)
 Selects/unselects entity.
 
virtual void getDrawingParameters (glDrawParams &params) const
 Returns main OpenGL parameters for this entity. More...
 
virtual bool hasColors () const
 Returns whether colors are enabled or not. More...
 
virtual bool colorsShown () const
 Returns whether colors are shown or not.
 
virtual void showColors (bool state)
 Sets colors visibility.
 
virtual void toggleColors ()
 Toggles colors display state.
 
virtual bool hasNormals () const
 Returns whether normals are enabled or not. More...
 
virtual bool normalsShown () const
 Returns whether normals are shown or not. More...
 
virtual void showNormals (bool state)
 Sets normals visibility. More...
 
virtual void toggleNormals ()
 Toggles normals display state.
 
virtual bool hasDisplayedScalarField () const
 Returns whether an active scalar field is available or not. More...
 
virtual bool hasScalarFields () const
 Returns whether one or more scalar fields are instantiated. More...
 
virtual void showSF (bool state)
 Sets active scalarfield visibility.
 
virtual void toggleSF ()
 Toggles SF display state.
 
virtual bool sfShown () const
 Returns whether active scalar field is visible.
 
virtual void toggleMaterials ()
 Toggles material display state. More...
 
virtual void showNameIn3D (bool state)
 Sets whether name should be displayed in 3D or not.
 
virtual bool nameShownIn3D () const
 Returns whether name is displayed in 3D or not.
 
virtual void toggleShowName ()
 Toggles name in 3D display state.
 
virtual bool isColorOverridden () const
 Returns whether colors are currently overridden by a temporary (unique) color. More...
 
virtual const ccColor::RgbagetTempColor () const
 Returns current temporary (unique) color.
 
virtual void setTempColor (const ccColor::Rgba &col, bool autoActivate=true)
 Sets current temporary (unique) More...
 
virtual void setTempColor (const ccColor::Rgb &col, bool autoActivate=true)
 Sets current temporary (unique) More...
 
virtual void enableTempColor (bool state)
 Set temporary color activation state.
 
virtual void removeFromDisplay (const ccGenericGLDisplay *win)
 Unlinks entity from a GL display (only if it belongs to it of course)
 
virtual void setDisplay (ccGenericGLDisplay *win)
 Sets associated GL display.
 
virtual ccGenericGLDisplaygetDisplay () const
 Returns associated GL display.
 
virtual void redrawDisplay ()
 Redraws associated GL display.
 
virtual void prepareDisplayForRefresh ()
 Sets associated GL display 'refreshable' before global refresh. More...
 
virtual void refreshDisplay (bool only2D=false)
 Refreshes associated GL display. More...
 
virtual void setGLTransformation (const ccGLMatrix &trans)
 Associates entity with a GL transformation (rotation + translation) More...
 
virtual void enableGLTransformation (bool state)
 Enables/disables associated GL transformation. More...
 
virtual bool isGLTransEnabled () const
 Returns whether a GL transformation is enabled or not.
 
virtual const ccGLMatrixgetGLTransformation () const
 Returns associated GL transformation. More...
 
virtual void resetGLTransformation ()
 Resets associated GL transformation. More...
 
virtual void rotateGL (const ccGLMatrix &rotMat)
 Multiplies (left) current GL transformation by a rotation matrix. More...
 
virtual void translateGL (const CCVector3 &trans)
 Translates current GL transformation by a rotation matrix. More...
 
virtual void removeAllClipPlanes ()
 Removes all clipping planes (if any)
 
virtual bool addClipPlanes (const ccClipPlane &plane)
 Registers a new clipping plane. More...
 
virtual void toggleClipPlanes (CC_DRAW_CONTEXT &context, bool enable)
 Enables or disables clipping planes (OpenGL) More...
 
virtual bool pushDisplayState ()
 Pushes the current display state. More...
 
virtual void popDisplayState (bool apply=true)
 Pops the last pushed display state. More...
 
virtual void applyDisplayState (const DisplayState &state)
 Applies a display state.
 

Protected Attributes

bool m_visible
 Specifies whether the object is visible or not. More...
 
bool m_selected
 Specifies whether the object is selected or not.
 
bool m_lockedVisibility
 Specifies whether the visibility can be changed by user or not.
 
bool m_colorsDisplayed
 Specifies whether colors should be displayed.
 
bool m_normalsDisplayed
 Specifies whether normals should be displayed.
 
bool m_sfDisplayed
 Specifies whether scalar field should be displayed.
 
ccColor::Rgba m_tempColor
 Temporary (unique) color.
 
bool m_colorIsOverridden
 Temporary (unique) color activation state.
 
ccGLMatrix m_glTrans
 Current GL transformation. More...
 
bool m_glTransEnabled
 Current GL transformation activation state. More...
 
bool m_showNameIn3D
 Whether name is displayed in 3D or not.
 
CCVector3d m_nameIn3DPos
 Last 2D position of the '3D' name.
 
bool m_nameIn3DPosIsValid
 Whether the last 2D position of the '3D' name is valid or not.
 
ccGenericGLDisplaym_currentDisplay
 Currently associated GL display.
 
ccClipPlaneSet m_clipPlanes
 Active clipping planes (used for display only)
 
std::vector< DisplayState::Shared > m_displayStateStack
 The stack of pushed display states.
 

Detailed Description

Generic interface for (3D) drawable entities.

Member Function Documentation

◆ addClipPlanes()

bool ccDrawableObject::addClipPlanes ( const ccClipPlane plane)
virtual

Registers a new clipping plane.

Returns
false if the planes couldn't be added (not enough memory)

◆ draw()

virtual void ccDrawableObject::draw ( CC_DRAW_CONTEXT context)
pure virtual

Draws entity and its children.

Implemented in ccHObject.

◆ enableGLTransformation()

void ccDrawableObject::enableGLTransformation ( bool  state)
virtual

Enables/disables associated GL transformation.

See ccDrawableObject::setGLTransformation.

◆ getDrawingParameters()

void ccDrawableObject::getDrawingParameters ( glDrawParams params) const
virtual

Returns main OpenGL parameters for this entity.

These parameters are deduced from the visibility states of its different features (points, normals, etc.).

Parameters
paramsa glDrawParams structure

◆ getGLTransformation()

virtual const ccGLMatrix & ccDrawableObject::getGLTransformation ( ) const
inlinevirtual

Returns associated GL transformation.

See ccDrawableObject::setGLTransformation.

◆ hasColors()

virtual bool ccDrawableObject::hasColors ( ) const
inlinevirtual

Returns whether colors are enabled or not.

Reimplemented in ccMesh, ccPolyline, and ccSubMesh.

◆ hasDisplayedScalarField()

virtual bool ccDrawableObject::hasDisplayedScalarField ( ) const
inlinevirtual

Returns whether an active scalar field is available or not.

Reimplemented in ccMesh, and ccSubMesh.

◆ hasNormals()

virtual bool ccDrawableObject::hasNormals ( ) const
inlinevirtual

Returns whether normals are enabled or not.

Reimplemented in ccMesh, and ccSubMesh.

◆ hasScalarFields()

virtual bool ccDrawableObject::hasScalarFields ( ) const
inlinevirtual

Returns whether one or more scalar fields are instantiated.

Warning
doesn't mean a scalar field is currently displayed (see ccDrawableObject::hasDisplayedScalarField).

Reimplemented in ccMesh, and ccSubMesh.

◆ isColorOverridden()

virtual bool ccDrawableObject::isColorOverridden ( ) const
inlinevirtual

Returns whether colors are currently overridden by a temporary (unique) color.

See ccDrawableObject::setTempColor.

◆ lockVisibility()

virtual void ccDrawableObject::lockVisibility ( bool  state)
inlinevirtual

Locks/unlocks visibility.

If visibility is locked, the user won't be able to modify it (via the properties tree for instance).

◆ normalsShown()

virtual bool ccDrawableObject::normalsShown ( ) const
inlinevirtual

Returns whether normals are shown or not.

Reimplemented in ccMesh, and ccSubMesh.

◆ popDisplayState()

void ccDrawableObject::popDisplayState ( bool  apply = true)
virtual

Pops the last pushed display state.

Reimplemented in ccHObject.

◆ prepareDisplayForRefresh()

void ccDrawableObject::prepareDisplayForRefresh ( )
virtual

Sets associated GL display 'refreshable' before global refresh.

Only tagged displays will be refreshed when ccGenericGLDisplay::refresh is called (see also MainWindow::RefreshAllGLWindow, MainWindow::refreshAll and ccDrawableObject::refreshDisplay).

◆ pushDisplayState()

bool ccDrawableObject::pushDisplayState ( )
virtual

Pushes the current display state.

Reimplemented in ccHObject.

◆ refreshDisplay()

void ccDrawableObject::refreshDisplay ( bool  only2D = false)
virtual

Refreshes associated GL display.

See ccGenericGLDisplay::refresh. The display will only be updated if it has been 'prepared for refresh' (see prepareDisplayForRefresh).

◆ resetGLTransformation()

void ccDrawableObject::resetGLTransformation ( )
virtual

Resets associated GL transformation.

GL transformation is reset to identity. Note: GL transformation is automatically disabled. See ccDrawableObject::setGLTransformation.

◆ rotateGL()

void ccDrawableObject::rotateGL ( const ccGLMatrix rotMat)
virtual

Multiplies (left) current GL transformation by a rotation matrix.

'GLtrans = M * GLtrans' Note: GL transformation is automatically enabled. See ccDrawableObject::setGLTransformation.

◆ setGLTransformation()

void ccDrawableObject::setGLTransformation ( const ccGLMatrix trans)
virtual

Associates entity with a GL transformation (rotation + translation)

Warning
FOR DISPLAY PURPOSE ONLY (i.e. should only be temporary) If the associated GL transformation is enabled (see ccDrawableObject::enableGLTransformation), it will be applied before displaying this entity. However it will not be taken into account by any CCCoreLib algorithm (distance computation, etc.) for instance. Note: GL transformation is automatically enabled.

◆ setTempColor() [1/2]

void ccDrawableObject::setTempColor ( const ccColor::Rgb col,
bool  autoActivate = true 
)
virtual

Sets current temporary (unique)

Parameters
colrgb color
autoActivateauto activates temporary color

◆ setTempColor() [2/2]

void ccDrawableObject::setTempColor ( const ccColor::Rgba col,
bool  autoActivate = true 
)
virtual

Sets current temporary (unique)

Parameters
colrgba color
autoActivateauto activates temporary color

◆ showNormals()

virtual void ccDrawableObject::showNormals ( bool  state)
inlinevirtual

Sets normals visibility.

Reimplemented in ccGenericMesh.

◆ toggleClipPlanes()

void ccDrawableObject::toggleClipPlanes ( CC_DRAW_CONTEXT context,
bool  enable 
)
virtual

Enables or disables clipping planes (OpenGL)

Warning
If enabling the clipping planes, be sure to call this method AFTER the modelview matrix has been set.

◆ toggleMaterials()

virtual void ccDrawableObject::toggleMaterials ( )
inlinevirtual

Toggles material display state.

Reimplemented in ccMesh.

◆ translateGL()

void ccDrawableObject::translateGL ( const CCVector3 &  trans)
virtual

Translates current GL transformation by a rotation matrix.

'GLtrans = GLtrans + T' Note: GL transformation is automatically enabled. See ccDrawableObject::setGLTransformation.

Member Data Documentation

◆ m_glTrans

ccGLMatrix ccDrawableObject::m_glTrans
protected

Current GL transformation.

See ccDrawableObject::setGLTransformation.

◆ m_glTransEnabled

bool ccDrawableObject::m_glTransEnabled
protected

Current GL transformation activation state.

See ccDrawableObject::setGLTransformation.

◆ m_visible

bool ccDrawableObject::m_visible
protected

Specifies whether the object is visible or not.

Note: this does not influence the children visibility


The documentation for this class was generated from the following files: