ADTF Display Toolbox
Loading...
Searching...
No Matches
cBaseObject

Base class for objects that can be managed with cBaseObjectScene. More...

#include <baseobject.h>

Inheritance diagram for cBaseObject:
[legend]

Public Member Functions

 cBaseObject (tUInt32 nId)
 Constructor.
 
virtual ~cBaseObject ()
 Destructor.
 
tUInt32 GetId ()
 Returns the id of the object.
 
tResult Update ()
 Base Implementation sets the updated property to true.
 
tBool IsUpdated ()
 Returns whether or not this object has been updated since the last Reset call.
 
tResult Reset ()
 Resets the updated property to false.
 
virtual tResult SetHistory (tBool bEnabled, tUInt32 nCount=0)
 Enables or disable the history trail of this object.
 
virtual tResult SetMotionVector (tBool bEnabled)
 Enables or disables the motion vector.
 
virtual tResult SetPosition (tFloat64 fPosX, tFloat64 fPosY, tFloat64 fPosZ)
 Sets the position of the object.
 
osg::Vec3d GetPosition ()
 Returns the current position.
 
virtual tResult SetRotation (tFloat64 fRotX, tFloat64 fRotY, tFloat64 fRotZ)
 Sets the rotation (attitude) of the object.
 
osg::Vec3d GetRotation ()
 Returns the current rotation.
 
virtual tResult SetSize (tFloat64 fSizeX, tFloat64 fSizeY, tFloat64 fSizeZ)
 Sets the dimensions of the object.
 
osg::Vec3d GetSize ()
 Returns the current size.
 
virtual tResult SetColor (tFloat64 fRed, tFloat64 fGreen, tFloat64 fBlue, tFloat64 fAlpha)
 Sets the color of the object.
 
virtual tResult SetMotion (tFloat64 fMotionX, tFloat64 fMotionY, tFloat64 fMotionZ)
 Sets the motion vector of the object.
 
osg::Vec3d GetMotion ()
 Returns the current motion vector.
 
virtual tResult SetSelected (tBool bSelected)
 Gives the object a chance to change its appearance when being selected or unselected.
 
virtual tBool IsSelected ()
 Returns the selected property of the object.
 

Protected Member Functions

virtual tResult UpdateSelection ()
 Used to update the selection sphere.
 

Protected Attributes

tUInt32 m_nId
 internal Id
 
osg::ref_ptr< osg::PositionAttitudeTransform > m_pTransform
 The transform that applies the translation and rotation to the box.
 
osg::ref_ptr< osg::ShapeDrawable > m_pDrawable
 The drawable for the box.
 
osg::ref_ptr< osg::Box > m_pBox
 The box that represents the object.
 
osg::ref_ptr< osg::Geometry > m_pHistoryGeom
 Geometry object used for rendering the history trail.
 
osg::ref_ptr< osg::DrawArrays > m_pHistoryArray
 This will do the actual drawing of the history trail.
 
osg::ref_ptr< osg::Geometry > m_pMotionGeom
 Geometry object used for rendering the motion vector.
 
osg::ref_ptr< osg::DrawArrays > m_pMotionArray
 This will do the actual drawing of the motion vector.
 
osg::Vec3d m_vPos
 The current position of the object.
 
osg::ref_ptr< osg::Vec3Array > m_pPositionHistory
 This will store old positions for drawing the history trail.
 
tUInt32 m_nHistorySize
 The maximum amount of positions in the m_pPositionHistory array.
 
osg::ref_ptr< osg::Vec3Array > m_pMotionVector
 The start and end point of the motion vector.
 
osg::ref_ptr< osg::Vec4Array > m_pColorArray
 The color array used for drawing the history trail and the motion vector.
 
tBool m_bHistory
 Whether or not to show the history trail.
 
tBool m_bMotionVector
 Whether or not to show the motion vector.
 
tBool m_bSelected
 Whether or not this object is selected.
 
tBool m_bUpdated
 Whether or not this object has been updated.
 

Detailed Description

Base class for objects that can be managed with cBaseObjectScene.

Bring newest version of base class into scope.

If you want to extend its functionality subclass this class. You can create your own nodes and add them either with addChild at the root of this object or with m_pTransform->addChild at the transformation node which manages the shapes position and rotation.

You can find the implementation of this class in src/3dscenedisplay/mixinlib/baseobject.cpp

Definition at line 41 of file baseobject.h.

Constructor & Destructor Documentation

◆ cBaseObject()

cBaseObject ( tUInt32 nId)
inline

Constructor.

Parameters
nId[in] The id of the object

Definition at line 107 of file baseobject.h.

◆ ~cBaseObject()

virtual ~cBaseObject ( )
inlinevirtual

Destructor.

Definition at line 191 of file baseobject.h.

Member Function Documentation

◆ GetId()

tUInt32 GetId ( )
inline

Returns the id of the object.

Returns
The id of the object.

Definition at line 199 of file baseobject.h.

◆ GetMotion()

osg::Vec3d GetMotion ( )
inline

Returns the current motion vector.

Returns
The current motion vector.

Definition at line 425 of file baseobject.h.

◆ GetPosition()

osg::Vec3d GetPosition ( )
inline

Returns the current position.

Returns
The current position.

Definition at line 312 of file baseobject.h.

◆ GetRotation()

osg::Vec3d GetRotation ( )
inline

Returns the current rotation.

Returns
The current rotation.

Definition at line 333 of file baseobject.h.

◆ GetSize()

osg::Vec3d GetSize ( )
inline

Returns the current size.

Returns
The current size.

Definition at line 367 of file baseobject.h.

◆ IsSelected()

virtual tBool IsSelected ( )
inlinevirtual

Returns the selected property of the object.

Returns
The selected property of the object.

Definition at line 453 of file baseobject.h.

◆ IsUpdated()

tBool IsUpdated ( )
inline

Returns whether or not this object has been updated since the last Reset call.

Returns
Whether or not this object has been updated since the last Reset call.

Definition at line 219 of file baseobject.h.

◆ Reset()

tResult Reset ( )
inline

Resets the updated property to false.

Returns
Standard result.

Definition at line 228 of file baseobject.h.

◆ SetColor()

virtual tResult SetColor ( tFloat64 fRed,
tFloat64 fGreen,
tFloat64 fBlue,
tFloat64 fAlpha )
inlinevirtual

Sets the color of the object.

If you draw opaque objects, make sure that fAlpha is exactly 1.0.

Parameters
fRed/fGreen/fBlue/fAlpha[in] The color components.
Returns
Standard result.

Definition at line 378 of file baseobject.h.

◆ SetHistory()

virtual tResult SetHistory ( tBool bEnabled,
tUInt32 nCount = 0 )
inlinevirtual

Enables or disable the history trail of this object.

By default the history is enabled.

Parameters
bEnabled[in] Whether to enable or disable the history trail.
nCount[in] The amount of history positions to remember. If the array grows larger then this value, the oldest ones will be removed. Please mind that this comes at a performance cost since osg holds its vertices in a vector that has O(N) complexity for removing a single element. By default (0) no positions will be removed.
Returns
Standard result.

Definition at line 245 of file baseobject.h.

◆ SetMotion()

virtual tResult SetMotion ( tFloat64 fMotionX,
tFloat64 fMotionY,
tFloat64 fMotionZ )
inlinevirtual

Sets the motion vector of the object.

Note that the rotation specified with SetRotation is not applied to this vector.

Parameters
fMotionX/fMotionY/fMotionZ[in] The motion vector.
Returns
Standard result.

Definition at line 410 of file baseobject.h.

◆ SetMotionVector()

virtual tResult SetMotionVector ( tBool bEnabled)
inlinevirtual

Enables or disables the motion vector.

Parameters
bEnabled[in] Whether to enable or disable the motion vector.
Returns
Standard result.

Definition at line 267 of file baseobject.h.

◆ SetPosition()

virtual tResult SetPosition ( tFloat64 fPosX,
tFloat64 fPosY,
tFloat64 fPosZ )
inlinevirtual

Sets the position of the object.

Parameters
fPosX/fPosY/fPosZ[in] The coordinates.
Returns
Standard result.

Definition at line 279 of file baseobject.h.

◆ SetRotation()

virtual tResult SetRotation ( tFloat64 fRotX,
tFloat64 fRotY,
tFloat64 fRotZ )
inlinevirtual

Sets the rotation (attitude) of the object.

Parameters
fRotX/fRotY/fRotZ[in] The rotation values.
Returns
Standard result.

Definition at line 322 of file baseobject.h.

◆ SetSelected()

virtual tResult SetSelected ( tBool bSelected)
inlinevirtual

Gives the object a chance to change its appearance when being selected or unselected.

Parameters
bSelected[in] whether ot not the object is selected.
Returns
Standard result.

Definition at line 435 of file baseobject.h.

◆ SetSize()

virtual tResult SetSize ( tFloat64 fSizeX,
tFloat64 fSizeY,
tFloat64 fSizeZ )
inlinevirtual

Sets the dimensions of the object.

Parameters
fSizeX/fSizeY/fSizeZ[in] The dimensions.
Returns
Standard result.

Definition at line 343 of file baseobject.h.

◆ Update()

tResult Update ( )
inline

Base Implementation sets the updated property to true.

Call this whenever you modified the object and/or need to modify the nodes inside your object.

Returns
Standard result.

Definition at line 209 of file baseobject.h.

◆ UpdateSelection()

virtual tResult UpdateSelection ( )
inlineprotectedvirtual

Used to update the selection sphere.

Returns
Standard result.

Definition at line 463 of file baseobject.h.

Member Data Documentation

◆ m_bHistory

tBool m_bHistory
protected

Whether or not to show the history trail.

Definition at line 94 of file baseobject.h.

◆ m_bMotionVector

tBool m_bMotionVector
protected

Whether or not to show the motion vector.

Definition at line 96 of file baseobject.h.

◆ m_bSelected

tBool m_bSelected
protected

Whether or not this object is selected.

Definition at line 98 of file baseobject.h.

◆ m_bUpdated

tBool m_bUpdated
protected

Whether or not this object has been updated.

Definition at line 100 of file baseobject.h.

◆ m_nHistorySize

tUInt32 m_nHistorySize
protected

The maximum amount of positions in the m_pPositionHistory array.

Definition at line 75 of file baseobject.h.

◆ m_nId

tUInt32 m_nId
protected

internal Id

Definition at line 45 of file baseobject.h.

◆ m_pBox

osg::ref_ptr<osg::Box> m_pBox
protected

The box that represents the object.

Definition at line 53 of file baseobject.h.

◆ m_pColorArray

osg::ref_ptr<osg::Vec4Array> m_pColorArray
protected

The color array used for drawing the history trail and the motion vector.

Definition at line 83 of file baseobject.h.

◆ m_pDrawable

osg::ref_ptr<osg::ShapeDrawable> m_pDrawable
protected

The drawable for the box.

Definition at line 51 of file baseobject.h.

◆ m_pHistoryArray

osg::ref_ptr<osg::DrawArrays> m_pHistoryArray
protected

This will do the actual drawing of the history trail.

Definition at line 59 of file baseobject.h.

◆ m_pHistoryGeom

osg::ref_ptr<osg::Geometry> m_pHistoryGeom
protected

Geometry object used for rendering the history trail.

Definition at line 57 of file baseobject.h.

◆ m_pMotionArray

osg::ref_ptr<osg::DrawArrays> m_pMotionArray
protected

This will do the actual drawing of the motion vector.

Definition at line 65 of file baseobject.h.

◆ m_pMotionGeom

osg::ref_ptr<osg::Geometry> m_pMotionGeom
protected

Geometry object used for rendering the motion vector.

Definition at line 63 of file baseobject.h.

◆ m_pMotionVector

osg::ref_ptr<osg::Vec3Array> m_pMotionVector
protected

The start and end point of the motion vector.

Definition at line 79 of file baseobject.h.

◆ m_pPositionHistory

osg::ref_ptr<osg::Vec3Array> m_pPositionHistory
protected

This will store old positions for drawing the history trail.

Definition at line 73 of file baseobject.h.

◆ m_pTransform

osg::ref_ptr<osg::PositionAttitudeTransform> m_pTransform
protected

The transform that applies the translation and rotation to the box.

Definition at line 49 of file baseobject.h.

◆ m_vPos

osg::Vec3d m_vPos
protected

The current position of the object.

Definition at line 69 of file baseobject.h.