Lugdunum  0.1.0
Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
lug::Graphics::Node Class Reference

#include <Node.hpp>

Inheritance diagram for lug::Graphics::Node:
[legend]
Collaboration diagram for lug::Graphics::Node:
[legend]

Public Types

enum  TransformSpace : uint8_t { TransformSpace::Local, TransformSpace::Parent, TransformSpace::World }
 

Public Member Functions

 Node (const std::string &name)
 
 Node (const Node &)=delete
 
 Node (Node &&)=delete
 
Nodeoperator= (const Node &)=delete
 
Nodeoperator= (Node &&)=delete
 
virtual ~Node ()=default
 
void setParent (Node *parent)
 
NodegetParent () const
 
const std::string & getName () const
 
NodegetNode (const std::string &name)
 
const NodegetNode (const std::string &name) const
 
const Math::Vec3f & getAbsolutePosition ()
 
const Math::QuatfgetAbsoluteRotation ()
 
const Math::Vec3f & getAbsoluteScale ()
 
const Math::Mat4x4f & getTransform ()
 
const std::vector< Node * > & getChildren () const
 
void attachChild (Node &child)
 
void translate (const Math::Vec3f &direction, TransformSpace space=TransformSpace::Local)
 
void rotate (float angle, const Math::Vec3f &axis, TransformSpace space=TransformSpace::Local)
 
void rotate (const Math::Quatf &quat, TransformSpace space=TransformSpace::Local)
 
void scale (const Math::Vec3f &scale)
 
void setPosition (const Math::Vec3f &position, TransformSpace space=TransformSpace::Local)
 
void setRotation (float angle, const Math::Vec3f &axis, TransformSpace space=TransformSpace::Local)
 
void setRotation (const Math::Quatf &rotation, TransformSpace space=TransformSpace::Local)
 
void setDirection (const Math::Vec3f &spaceTargetDirection, const Math::Vec3f &localDirectionVector, const Math::Vec3f &localUpVector, TransformSpace space=TransformSpace::Local)
 Rotates the node according to the direction given in parameter. More...
 
void lookAt (const Math::Vec3f &targetPosition, const Math::Vec3f &localDirectionVector, const Math::Vec3f &localUpVector, TransformSpace space=TransformSpace::Local)
 Rotates the node in order to look at the target position. More...
 
virtual void needUpdate ()
 

Protected Attributes

Node_parent {nullptr}
 
std::string _name
 
std::vector< Node * > _children
 

Private Member Functions

void update ()
 

Private Attributes

Math::Vec3f _position {Math::Vec3f(0.0f)}
 
Math::Quatf _rotation {Math::Quatf::identity()}
 
Math::Vec3f _scale {Math::Vec3f(1.0f)}
 
Math::Vec3f _absolutePosition {Math::Vec3f(0.0f)}
 
Math::Quatf _absoluteRotation {Math::Quatf::identity()}
 
Math::Vec3f _absoluteScale {Math::Vec3f(1.0f)}
 
Math::Mat4x4f _transform {Math::Mat4x4f::identity()}
 
bool _needUpdate {true}
 

Detailed Description

Definition at line 13 of file Node.hpp.

Member Enumeration Documentation

◆ TransformSpace

enum lug::Graphics::Node::TransformSpace : uint8_t
strong
Enumerator
Local 
Parent 
World 

Definition at line 15 of file Node.hpp.

Constructor & Destructor Documentation

◆ Node() [1/3]

lug::Graphics::Node::Node ( const std::string &  name)

Definition at line 7 of file Node.cpp.

◆ Node() [2/3]

lug::Graphics::Node::Node ( const Node )
delete

◆ Node() [3/3]

lug::Graphics::Node::Node ( Node &&  )
delete

◆ ~Node()

virtual lug::Graphics::Node::~Node ( )
virtualdefault

Reimplemented in lug::Graphics::Scene::Node.

Member Function Documentation

◆ operator=() [1/2]

Node& lug::Graphics::Node::operator= ( const Node )
delete

◆ operator=() [2/2]

Node& lug::Graphics::Node::operator= ( Node &&  )
delete

◆ setParent()

void Node::setParent ( Node parent)
inline

Definition at line 1 of file Node.inl.

◆ getParent()

Node * Node::getParent ( ) const
inline

Definition at line 6 of file Node.inl.

◆ getName()

const std::string & Node::getName ( ) const
inline

Definition at line 10 of file Node.inl.

◆ getNode() [1/2]

Node * lug::Graphics::Node::getNode ( const std::string &  name)

Definition at line 9 of file Node.cpp.

◆ getNode() [2/2]

const Node * lug::Graphics::Node::getNode ( const std::string &  name) const

Definition at line 25 of file Node.cpp.

◆ getAbsolutePosition()

const Math::Vec3f & Node::getAbsolutePosition ( )
inline

Definition at line 14 of file Node.inl.

◆ getAbsoluteRotation()

const Math::Quatf & Node::getAbsoluteRotation ( )
inline

Definition at line 22 of file Node.inl.

◆ getAbsoluteScale()

const Math::Vec3f & Node::getAbsoluteScale ( )
inline

Definition at line 30 of file Node.inl.

◆ getTransform()

const Math::Mat4x4f & Node::getTransform ( )
inline

Definition at line 38 of file Node.inl.

◆ getChildren()

const std::vector< Node * > & Node::getChildren ( ) const
inline

Definition at line 45 of file Node.inl.

◆ attachChild()

void lug::Graphics::Node::attachChild ( Node child)

Definition at line 41 of file Node.cpp.

◆ translate()

void lug::Graphics::Node::translate ( const Math::Vec3f &  direction,
TransformSpace  space = TransformSpace::Local 
)

Definition at line 46 of file Node.cpp.

◆ rotate() [1/2]

void lug::Graphics::Node::rotate ( float  angle,
const Math::Vec3f &  axis,
TransformSpace  space = TransformSpace::Local 
)

Definition at line 62 of file Node.cpp.

◆ rotate() [2/2]

void lug::Graphics::Node::rotate ( const Math::Quatf quat,
TransformSpace  space = TransformSpace::Local 
)

Definition at line 66 of file Node.cpp.

◆ scale()

void lug::Graphics::Node::scale ( const Math::Vec3f &  scale)

Definition at line 78 of file Node.cpp.

◆ setPosition()

void lug::Graphics::Node::setPosition ( const Math::Vec3f &  position,
TransformSpace  space = TransformSpace::Local 
)

Definition at line 83 of file Node.cpp.

◆ setRotation() [1/2]

void lug::Graphics::Node::setRotation ( float  angle,
const Math::Vec3f &  axis,
TransformSpace  space = TransformSpace::Local 
)

Definition at line 116 of file Node.cpp.

◆ setRotation() [2/2]

void lug::Graphics::Node::setRotation ( const Math::Quatf rotation,
TransformSpace  space = TransformSpace::Local 
)

Definition at line 99 of file Node.cpp.

◆ setDirection()

void lug::Graphics::Node::setDirection ( const Math::Vec3f &  spaceTargetDirection,
const Math::Vec3f &  localDirectionVector,
const Math::Vec3f &  localUpVector,
TransformSpace  space = TransformSpace::Local 
)

Rotates the node according to the direction given in parameter.

Parameters
[in]spaceTargetDirectionThe direction we want the local direction point to (will be normalized), in local space
[in]localDirectionVectorThe local direction vector
[in]localUpVectorThe local up vector
[in]spaceThe space, defaults to local

Definition at line 120 of file Node.cpp.

◆ lookAt()

void lug::Graphics::Node::lookAt ( const Math::Vec3f &  targetPosition,
const Math::Vec3f &  localDirectionVector,
const Math::Vec3f &  localUpVector,
TransformSpace  space = TransformSpace::Local 
)

Rotates the node in order to look at the target position.

Parameters
[in]targetPositionThe target position
[in]localDirectionVectorThe local direction vector
[in]localUpVectorThe local up vector
[in]spaceThe space, defaults to local

Definition at line 154 of file Node.cpp.

◆ needUpdate()

void lug::Graphics::Node::needUpdate ( )
virtual

Reimplemented in lug::Graphics::Scene::Node.

Definition at line 168 of file Node.cpp.

◆ update()

void lug::Graphics::Node::update ( )
private

Definition at line 176 of file Node.cpp.

Member Data Documentation

◆ _parent

Node* lug::Graphics::Node::_parent {nullptr}
protected

Definition at line 84 of file Node.hpp.

◆ _name

std::string lug::Graphics::Node::_name
protected

Definition at line 86 of file Node.hpp.

◆ _children

std::vector<Node*> lug::Graphics::Node::_children
protected

Definition at line 87 of file Node.hpp.

◆ _position

Math::Vec3f lug::Graphics::Node::_position {Math::Vec3f(0.0f)}
private

Definition at line 90 of file Node.hpp.

◆ _rotation

Math::Quatf lug::Graphics::Node::_rotation {Math::Quatf::identity()}
private

Definition at line 91 of file Node.hpp.

◆ _scale

Math::Vec3f lug::Graphics::Node::_scale {Math::Vec3f(1.0f)}
private

Definition at line 92 of file Node.hpp.

◆ _absolutePosition

Math::Vec3f lug::Graphics::Node::_absolutePosition {Math::Vec3f(0.0f)}
private

Definition at line 94 of file Node.hpp.

◆ _absoluteRotation

Math::Quatf lug::Graphics::Node::_absoluteRotation {Math::Quatf::identity()}
private

Definition at line 95 of file Node.hpp.

◆ _absoluteScale

Math::Vec3f lug::Graphics::Node::_absoluteScale {Math::Vec3f(1.0f)}
private

Definition at line 96 of file Node.hpp.

◆ _transform

Math::Mat4x4f lug::Graphics::Node::_transform {Math::Mat4x4f::identity()}
private

Definition at line 98 of file Node.hpp.

◆ _needUpdate

bool lug::Graphics::Node::_needUpdate {true}
private

Definition at line 100 of file Node.hpp.


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