12#ifndef SPATIAL_H_6014714286
13#define SPATIAL_H_6014714286
15#include <Carna/Carna.h>
51 const void* myUserData;
64 explicit Spatial(
const std::string& tag =
"" );
154 template<
typename UserDataType >
181 template<
typename UserDataType >
217 const std::string&
tag()
const;
222template<
typename UserDataType >
230template<
typename UserDataType >
234 return *
static_cast< const UserDataType*
>( myUserData );
#define CARNA_ASSERT(expression)
If the given expression is false, a break point is raised in debug mode and an AssertionFailure throw...
Represents an association.
Defines the inner node of a scene graph. Implements a spatial scene element that is allowed to have c...
Represents a spatial scene element. It's location is determined relatively to another spatial that is...
void updateParent(Node &parent)
Fixes tree consistency by updating parent of this spatial. This method is for internal usage only.
void setMovable(bool movable)
Sets whether this spatial may be displaced w.r.t. it's parent through user interaction....
virtual void invalidate()
Notifies all listeners of its parent nodes that their subtrees have changed. This may include changes...
void setUserData(const UserDataType &userData)
Links an arbitrary object with this Spatial instance.
bool hasParent() const
Tells whether this spatial has a parent node.
bool hasUserData() const
Tells whether an object has been linked with this Spatial instance through setUserData previously.
virtual ~Spatial()
Does nothing.
std::function< void(Spatial &) > MutableVisitor
Declares an entity that visits mutable Spatial instances.
const UserDataType & userData() const
Retrieves the object previously linked with this Spatial instance.
bool isMovable() const
Tells whether this spatial may be displaced w.r.t. it's parent through user interaction....
Node & parent()
References the parent node.
const Node & findRoot() const
References the root node this spatial belongs to.
void removeUserData()
Removes any object that has been linked with this Spatial instance through setUserData previously.
std::function< void(const Spatial &) > ImmutableVisitor
Declares an entity that visits mutable Spatial instances.
Spatial(const std::string &tag="")
Instantiates.
virtual void updateWorldTransform()
Computes the transformation to world space for this spatial.
Spatial * detachFromParent()
Detaches this spatial from it's parent node in where is the number of parent's children....
const std::string & tag() const
Tells the tag set previously.
const math::Matrix4f & worldTransform() const
Tells the transformation to world space for this spatial that was last computed.
Node & findRoot()
References the root node this spatial belongs to.
const Node & parent() const
math::Matrix4f localTransform
Defines the location, rotation and scale of this spatial in relation to it's parent....
void setTag(const std::string &tag)
Sets an arbitrary tag that may be used to identify this object.
Defines Carna::base::math namespace and CARNA_FOR_VECTOR3UI.
Eigen::Matrix< float, 4, 4, Eigen::ColMajor > Matrix4f
Defines matrix.
#define NON_COPYABLE
Features class it is placed in as non-copyable.