API Documentation
Public Member Functions | Static Public Member Functions | List of all members
nkGraphics::Node Class Reference

Represents a node in a scene graph. More...

Inheritance diagram for nkGraphics::Node:
nkExport::Exportable nkGraphics::Camera

Public Member Functions

virtual ~Node ()
 
virtual void setPositionRelative (const nkMaths::Vector &value)
 
virtual void setPositionAbsolute (const nkMaths::Vector &value)
 
virtual void translateRelative (const nkMaths::Vector &value)
 
virtual void translateAbsolute (const nkMaths::Vector &value)
 
nkMaths::Vector getPositionRelative () const
 
nkMaths::Vector getPositionAbsolute ()
 
virtual void setOrientationRelative (const nkMaths::Quaternion &value)
 
virtual void setOrientationAbsolute (const nkMaths::Quaternion &value)
 
virtual void rotateRelative (const nkMaths::Quaternion &value)
 
virtual void rotateAbsolute (const nkMaths::Quaternion &value)
 
nkMaths::Quaternion getOrientationRelative () const
 
nkMaths::Quaternion getOrientationAbsolute ()
 
virtual void setScaleRelative (const nkMaths::Vector &value)
 
virtual void setScaleAbsolute (const nkMaths::Vector &value)
 
virtual void applyScale (const nkMaths::Vector &value)
 
nkMaths::Vector getScaleRelative () const
 
nkMaths::Vector getScaleAbsolute ()
 
void setRelativeTransform (const nkMaths::Matrix &value)
 
void setAbsoluteTransform (const nkMaths::Matrix &value)
 
nkMaths::Matrix getRelativeTransform ()
 
nkMaths::Matrix getAbsoluteTransform ()
 
void updateTransformations ()
 
void dispatchDirtyTransform ()
 
nkMaths::Vector getAbsoluteUp ()
 
nkMaths::Vector getAbsoluteFront ()
 
nkMaths::Vector getAbsoluteRight ()
 
void setParentNode (Node *parent)
 
NodegetParentNode () const
 
NodegetChildNode (unsigned int index) const
 
unsigned int getNumChildNode () const
 
void setName (nkMemory::StringView value)
 
nkMemory::StringView getName () const
 
bool getHidden () const
 
void setHidden (bool value)
 
void addEntityToTrack (Entity *entity)
 
void stopEntityTracking (Entity *entity)
 
unsigned int getTrackedEntityCount () const
 
EntitygetTrackedEntity (unsigned int index) const
 
void registerListener (NodeChangeListener *listener)
 
void unregisterListener (NodeChangeListener *listener)
 
virtual void exportClassToTree (nkExport::Node *rootNode) override
 
virtual void importClassFromTree (nkExport::Node *rootNode) override
 
- Public Member Functions inherited from nkExport::Exportable
 Exportable () noexcept
 
virtual ~Exportable ()
 

Static Public Member Functions

static nkMemory::UniquePtr< Nodecreate (System *system=nullptr)
 

Detailed Description

Represents a node in a scene graph.

The graph can be used whenever transformations of entities are needed.

See NodeManager::createOrRetrieve() or Node::create() for instantiation.

Constructor & Destructor Documentation

◆ ~Node()

virtual nkGraphics::Node::~Node ( )
virtual

Destructor.

Member Function Documentation

◆ setPositionRelative()

virtual void nkGraphics::Node::setPositionRelative ( const nkMaths::Vector value)
virtual

Sets the position of the node, relative to its parent.

Parameters
valueThe position to set.

Reimplemented in nkGraphics::Camera.

◆ setPositionAbsolute()

virtual void nkGraphics::Node::setPositionAbsolute ( const nkMaths::Vector value)
virtual

Sets the position of the node, absolute in the world.

Parameters
valueThe position to use.

Reimplemented in nkGraphics::Camera.

◆ translateRelative()

virtual void nkGraphics::Node::translateRelative ( const nkMaths::Vector value)
virtual

Translates the node, relative to its parent.

Parameters
valueThe offset to add.

Reimplemented in nkGraphics::Camera.

◆ translateAbsolute()

virtual void nkGraphics::Node::translateAbsolute ( const nkMaths::Vector value)
virtual

Translates a node, absolute in the world.

Parameters
valueThe offset to add.

Reimplemented in nkGraphics::Camera.

◆ getPositionRelative()

nkMaths::Vector nkGraphics::Node::getPositionRelative ( ) const
Returns
The position of the node, relative to its parent.

◆ getPositionAbsolute()

nkMaths::Vector nkGraphics::Node::getPositionAbsolute ( )
Returns
The position of the node, absolute in the world.

◆ setOrientationRelative()

virtual void nkGraphics::Node::setOrientationRelative ( const nkMaths::Quaternion value)
virtual

Sets the orientation of a node, relative to its parent.

Parameters
valueThe orientation to set.

Reimplemented in nkGraphics::Camera.

◆ setOrientationAbsolute()

virtual void nkGraphics::Node::setOrientationAbsolute ( const nkMaths::Quaternion value)
virtual

Sets the orientation of a node, absolute in the world.

Parameters
valueThe orientation to set.

Reimplemented in nkGraphics::Camera.

◆ rotateRelative()

virtual void nkGraphics::Node::rotateRelative ( const nkMaths::Quaternion value)
virtual

Rotates a node, relative to its parent.

Parameters
valueThe offset to add.

Reimplemented in nkGraphics::Camera.

◆ rotateAbsolute()

virtual void nkGraphics::Node::rotateAbsolute ( const nkMaths::Quaternion value)
virtual

Rotates a node, absolute in the world.

Parameters
valueThe offset to add.

Reimplemented in nkGraphics::Camera.

◆ getOrientationRelative()

nkMaths::Quaternion nkGraphics::Node::getOrientationRelative ( ) const
Returns
The orientation of the node, relative to its parent.

◆ getOrientationAbsolute()

nkMaths::Quaternion nkGraphics::Node::getOrientationAbsolute ( )
Returns
The orientation of the node, absolute in the world.

◆ setScaleRelative()

virtual void nkGraphics::Node::setScaleRelative ( const nkMaths::Vector value)
virtual

Sets the scale of the node, relative to its parent.

Parameters
valueThe scale to set.

Reimplemented in nkGraphics::Camera.

◆ setScaleAbsolute()

virtual void nkGraphics::Node::setScaleAbsolute ( const nkMaths::Vector value)
virtual

Sets the scale of the node, absolute in the world.

Parameters
valueThe scale to set.

Reimplemented in nkGraphics::Camera.

◆ applyScale()

virtual void nkGraphics::Node::applyScale ( const nkMaths::Vector value)
virtual

Scales the node by a factor.

Parameters
valueThe offset to add.

Reimplemented in nkGraphics::Camera.

◆ getScaleRelative()

nkMaths::Vector nkGraphics::Node::getScaleRelative ( ) const
Returns
The scale of the node, relative to its parent.

◆ getScaleAbsolute()

nkMaths::Vector nkGraphics::Node::getScaleAbsolute ( )
Returns
The scale of the node, absolute in the world.

◆ setRelativeTransform()

void nkGraphics::Node::setRelativeTransform ( const nkMaths::Matrix value)

Sets the transformation of the node, relative to its parent.

Parameters
valueThe transformation to set.

◆ setAbsoluteTransform()

void nkGraphics::Node::setAbsoluteTransform ( const nkMaths::Matrix value)

Sets the absolute transformation of the node. This will set the relative transformation so that it fits the absolute transformation required.

Parameters
valueThe transformation to set.

◆ getRelativeTransform()

nkMaths::Matrix nkGraphics::Node::getRelativeTransform ( )
Returns
The full transformation of the node, relative to its parent.

◆ getAbsoluteTransform()

nkMaths::Matrix nkGraphics::Node::getAbsoluteTransform ( )
Returns
The full transformation of the node, absolute.

◆ updateTransformations()

void nkGraphics::Node::updateTransformations ( )

Updates the transformation of a node. Used internally.

◆ dispatchDirtyTransform()

void nkGraphics::Node::dispatchDirtyTransform ( )

Dispatches a dirty transform flag to the children. Used internally.

◆ getAbsoluteUp()

nkMaths::Vector nkGraphics::Node::getAbsoluteUp ( )
Returns
The up vector, absolute in the world.

◆ getAbsoluteFront()

nkMaths::Vector nkGraphics::Node::getAbsoluteFront ( )
Returns
The front vector, absolute in the world.

◆ getAbsoluteRight()

nkMaths::Vector nkGraphics::Node::getAbsoluteRight ( )
Returns
The right vector, absolute in the world.

◆ setParentNode()

void nkGraphics::Node::setParentNode ( Node parent)

Sets the parent node for a given node. A child node will inherit all of its parent tree's transformations before applying its own.

Parameters
parentThe parent node to set. Can be set to nullptr to detach the node from any parent tree.

◆ getParentNode()

Node* nkGraphics::Node::getParentNode ( ) const
Returns
The parent node.

◆ getChildNode()

Node* nkGraphics::Node::getChildNode ( unsigned int  index) const
Parameters
indexThe index of the child to retrieve.
Returns
The child node if available, nullptr else.

◆ getNumChildNode()

unsigned int nkGraphics::Node::getNumChildNode ( ) const
Returns
The number of children nodes.

◆ setName()

void nkGraphics::Node::setName ( nkMemory::StringView  value)

Sets the name under which the node should be identified.

Parameters
valueThe name to assign.

◆ getName()

nkMemory::StringView nkGraphics::Node::getName ( ) const
Returns
The name of the node.

◆ getHidden()

bool nkGraphics::Node::getHidden ( ) const
Returns
Whether the node is hidden from project exporting (true) or not (false).

◆ setHidden()

void nkGraphics::Node::setHidden ( bool  value)

Sets whether the node should not export itself during a project (resource set) export. This can be used to hide programmatically generated resources from duplicating in the export.

Parameters
valueWhether the node should be hidden (true) or not (false).

◆ addEntityToTrack()

void nkGraphics::Node::addEntityToTrack ( Entity entity)

Tracks entity for changes. Used internally, in theory external code should not used it. Rather, see Entity::setParentNode().

◆ stopEntityTracking()

void nkGraphics::Node::stopEntityTracking ( Entity entity)

Stops tracking an entity for its changes. Used internally, in theory external code should not used it. Rather, see Entity::setParentNode().

◆ getTrackedEntityCount()

unsigned int nkGraphics::Node::getTrackedEntityCount ( ) const
Returns
The number of entities currently tracked by the node.

◆ getTrackedEntity()

Entity* nkGraphics::Node::getTrackedEntity ( unsigned int  index) const
Parameters
indexThe index of the tracked entity to retrieve.
Returns
Requested entity if available, nullptr else.

◆ registerListener()

void nkGraphics::Node::registerListener ( NodeChangeListener listener)

Register a listener.

Parameters
listenerThe listener to register.

◆ unregisterListener()

void nkGraphics::Node::unregisterListener ( NodeChangeListener listener)

Unregister a listener.

Parameters
listenerThe listener to unregister.

◆ exportClassToTree()

virtual void nkGraphics::Node::exportClassToTree ( nkExport::Node rootNode)
overridevirtual

Exports an item into a tree describing its structure and its data.

Parameters
rootNodeThe node into which the object has to write its related information.

Implements nkExport::Exportable.

Reimplemented in nkGraphics::Camera.

◆ importClassFromTree()

virtual void nkGraphics::Node::importClassFromTree ( nkExport::Node rootNode)
overridevirtual

Imports information from a tree which is supposed to describe its structure and data.

Parameters
rootNodeThe root node of the tree holding the information.

Implements nkExport::Exportable.

Reimplemented in nkGraphics::Camera.

◆ create()

static nkMemory::UniquePtr<Node> nkGraphics::Node::create ( System system = nullptr)
static

Creates a standalone resource, linking it to a system, but no manager. This method can be used to allocate a resource and manually manage its lifetime.

Parameters
systemThe system to create the resource into. If left to nullptr, then the Singleton instance will be used.
Returns
The created resource instance.

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