Workspace 6.21.5
Public Member Functions | List of all members
SceneItemInstance Class Reference

Creates an instance of a SceneItem in a scene, including all of its children. More...

#include <Rendering/SceneComponents/sceneiteminstance.h>

Inheritance diagram for SceneItemInstance:
[legend]

Public Member Functions

 SceneItemInstance (const QString &id="")
 
 SceneItemInstance (const SceneItemInstance &other)
 
 ~SceneItemInstance () override
 
SceneItemInstanceclone () const override
 
Mesh::TransformMatrix getMatrixGlobal () const override
 
const QString & getSceneItemId () const
 
const Mesh::TransformMatrixgetTransformMatrix () const
 
SceneItemInstanceoperator= (const SceneItemInstance &rhs)
 
void setSceneItemId (const QString &id)
 
void setTransformMatrix (const Mesh::TransformMatrix &transform)
 
void updateGlobalMatrix () override
 
bool visit (SceneProcessor &processor) override
 
- Public Member Functions inherited from SceneItem
 ~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
 

Additional Inherited Members

- Protected Member Functions inherited from SceneItem
 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 &)
 

Detailed Description

Often when building a scene for visualisation, it is necessary to duplicate objects which are comprised of many components, transforms and shaders. Take, for example, a model of a car. The car may have a component for its chassis, a component for each of its windows, and wheels, and a component for its interior. Each of the components may also have a shader associated with it in order to ensure that it has the desired appearance when visualised. This can be built up in the Workspace by constructing a Scene with a number of MeshModelInstances (one for each component), and a Shader attached to each component.

If a scene was comprised of multiple cars, it would be wasteful to duplicate this entire hierarchy of components multiple times. The SceneItemInstance class allows the user to avoid copying large sub-branches of their Scene by allowing them to refer to a named sub-branch stored in a SceneItemLibrary.

SceneItemInstances can be added to a Scene just like any other SceneItem. A SceneItemInstance can ever refer to a SceneItem that has SceneItemInstances as other children (though care must be taken to avoid recursive relationships).

Constructor & Destructor Documentation

◆ SceneItemInstance() [1/2]

SceneItemInstance ( const QString &  id = "")

◆ SceneItemInstance() [2/2]

◆ ~SceneItemInstance()

~SceneItemInstance ( )
override

Member Function Documentation

◆ clone()

SceneItemInstance * clone ( ) const
overridevirtual
Returns

Implements SceneItem.

◆ getMatrixGlobal()

Mesh::TransformMatrix getMatrixGlobal ( ) const
overridevirtual
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 from SceneItem.

◆ getSceneItemId()

const QString & getSceneItemId ( ) const

◆ getTransformMatrix()

const Mesh::TransformMatrix & getTransformMatrix ( ) const

◆ operator=()

SceneItemInstance & operator= ( const SceneItemInstance rhs)
Parameters
rhs

◆ setSceneItemId()

void setSceneItemId ( const QString &  id)

◆ setTransformMatrix()

void setTransformMatrix ( const Mesh::TransformMatrix transform)

◆ updateGlobalMatrix()

void updateGlobalMatrix ( )
overridevirtual

Reimplemented from SceneItem.

◆ visit()

bool visit ( SceneProcessor processor)
overridevirtual

Implements SceneItem.