Workspace 6.21.5
Public Member Functions | Protected Member Functions | List of all members
SceneItem Class Referenceabstract

Base class for all types that can be added as a child of a Transform.

#include <Rendering/SceneComponents/sceneitem.h>

Inheritance diagram for SceneItem:
[legend]

Public Member Functions

 ~SceneItem () override
 
SceneItemclone () const override=0
 
bool getEnabled () const
 
const QString & getId () const
 
const Mesh::BoundingBoxMinimalgetLocalBoundingBox () const
 
virtual Mesh::TransformMatrix getMatrixGlobal () const
 
virtual Mesh::TransformMatrix getMatrixLocal () const
 
const QString & getName () const
 
Mesh::TransformMatrix getParentMatrixGlobal () const
 
TransformgetParentTransform ()
 
void setEnabled (bool b)
 
void setId (const QString &itemId)
 
virtual void setLocalBoundingBox (const Mesh::BoundingBoxMinimal &bb)
 
void setName (const QString &name)
 
virtual TransformtoTransform ()
 
virtual const TransformtoTransform () const
 
virtual void updateGlobalMatrix ()
 
virtual bool visit (SceneProcessor &processor)=0
 
- Public Member Functions inherited from Observable
virtual ~Observable ()
 
void attachObserver (Observer &observer)
 
void destroy ()
 
void detachObserver (Observer &observer)
 
void notifyEvent (const ObservableEvent &event)
 
- Public Member Functions inherited from Clonable
virtual ~Clonable ()=default
 
virtual Clonableclone () const =0
 

Protected Member Functions

 SceneItem (const QString &id)
 
 SceneItem (const SceneItem &item)
 
virtual void addToScene (Scene &scene, const QString &opIdPath="")
 
bool isTransformModified () const
 
SceneItemoperator= (const SceneItem &item)
 
void setTransformModified (bool b)
 
- Protected Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 

Constructor & Destructor Documentation

◆ SceneItem() [1/2]

SceneItem ( const QString &  id)
protected

◆ SceneItem() [2/2]

SceneItem ( const SceneItem item)
protected
Parameters
itemThe scene item to be copied.

The parent transform of item is not copied to this object. The parent of the new item must be explicitly set by calling the parent's Transform::addChild() function if it should have the same parent as item.

◆ ~SceneItem()

~SceneItem ( )
override

Member Function Documentation

◆ addToScene()

void addToScene ( Scene scene,
const QString &  opIdPath = "" 
)
protectedvirtual

◆ clone()

SceneItem * clone ( ) const
overridepure virtual
Returns
A clone of this object.
Note
Subclasses would normally return their own type rather than the Clonable type. The C++ language rules allow a more derived type to be returned from a virtual function and the compiler will still treat it as a valid override.

Implements Clonable.

Implemented in Annotation, Camera, AmbientLight, DirectionalLight, PointLight, SpotLight, ClipRegion, MeshModelInstance, SceneItemInstance, Transform, and Light.

◆ getEnabled()

bool getEnabled ( ) const
Returns
True if this scene item is enabled, meaning that it should be processed by scene processors.

When a scene item is not enabled, all scene processors must ignore it as though it was not even present.

See also
setEnabled()

◆ getId()

const QString & getId ( ) const
Returns
itemId A unique ID for each SceneItem in a scene, typically the opIdPath that matches the Operation that generated it (so that it stays consistent after save and re-load of a workflow) but may have an additional suffix for ops that return a hierarchy of SceneItems.

◆ getLocalBoundingBox()

const Mesh::BoundingBoxMinimal & getLocalBoundingBox ( ) const
Returns
The bounding box which encapsulates the model instance's geometry (in local (to the source) coordinates).

◆ getMatrixGlobal()

Mesh::TransformMatrix getMatrixGlobal ( ) const
virtual
Returns
The global transformation matrix for the object itself. This is equivalent to multiplying together all of the parent transforms' matrices, and this item's own local matrix. Since most SceneItems don't have their own local transform matrices, the result of this function is usually the same as the result of getParentMatrixGlobal().
See also
getParentMatrixGlobal

Reimplemented in Camera, ClipRegion, SceneItemInstance, and Transform.

◆ getMatrixLocal()

Mesh::TransformMatrix getMatrixLocal ( ) const
virtual
Returns
If the scene item has its own local transform matrix, this will function will return it. If not, it will return the identity matrix.

Reimplemented in Camera, and Transform.

◆ getName()

const QString & getName ( ) const
Returns
The name of the item. It is up to clients how they use this name and what meaning they assign to it.

◆ getParentMatrixGlobal()

TransformMatrix getParentMatrixGlobal ( ) const
Returns
The global transformation matrix for the parent of this object. This is equivalent to multiplying together all of the parent transforms' matrices.
Note
If this scene item is itself a transform, the global transform returned will not include the local transform too. Thus, if F is a transform in the scene and M is the return value of this function, the global transform matrix that will be applied to all children of F is (MF), not just M. To get the world transform of the item itself, call getMatrixGlobal()
See also
getMatrixGlobal

◆ getParentTransform()

Transform * getParentTransform ( )
Returns
The parent transform for this scene item. If it has no parent then a null pointer will be returned.

◆ isTransformModified()

bool isTransformModified ( ) const
protected
Returns
Whether or not the transform information has been modified or not. This is generally used to detect whether an update of the global transform information is required.

◆ operator=()

SceneItem & operator= ( const SceneItem item)
protected
Parameters
itemThe scene item to be copied.

The parent transform of item is not copied to this object. The parent of this item must be explicitly set by calling the parent's Transform::addChild() function if it should have the same parent as item.

◆ setEnabled()

void setEnabled ( bool  b)
Parameters
bSpecifies whether or not this particular scene item should be processed by scene processors.

When a scene item is not enabled, all scene processors must ignore it as though it was not even present. For Transform scene items, this implies that all children of the transform must also be ignored. For lights, it implies that the light is off.

Scene items are enabled by default.

See also
getEnabled()

◆ setId()

void setId ( const QString &  itemId)
Parameters
itemIdA unique ID for each SceneItem in a scene, typically the opIdPath that matches the Operation that generated it (so that it stays consistent after save and re-load of a workflow) but may have an additional suffix for ops that return a hierarchy of SceneItems.

◆ setLocalBoundingBox()

void setLocalBoundingBox ( const Mesh::BoundingBoxMinimal bb)
virtual
Parameters
bbThe bounding box we are assigning to this model instance (in local (to the source) coordinates).

Reimplemented in MeshModelInstance.

◆ setName()

void setName ( const QString &  name)
Parameters
nameThe name to give this item. Any previous name is discarded.

◆ setTransformModified()

void setTransformModified ( bool  b)
protected
Parameters
bWhether or not the local transform has been modified.

Protected function for indicating that the transform information of this scene item has been modified. Only derived classes may set this, as not all derived classes posess transform information.

See also
isTransformModified

◆ toTransform() [1/2]

Transform * toTransform ( )
virtual
Returns
This SceneItem as a Transform or null if it's not a type of Transform

Reimplemented in Transform.

◆ toTransform() [2/2]

const Transform * toTransform ( ) const
virtual

Reimplemented in Transform.

◆ updateGlobalMatrix()

void updateGlobalMatrix ( )
virtual

Reimplemented in Camera, ClipRegion, SceneItemInstance, and Transform.

◆ visit()

virtual bool visit ( SceneProcessor processor)
pure virtual