15#ifndef SPATIAL_H_6014714286
16#define SPATIAL_H_6014714286
54 const void* myUserData;
67 explicit Spatial(
const std::string& tag =
"" );
157 template<
typename UserDataType >
184 template<
typename UserDataType >
220 const std::string&
tag()
const;
225template<
typename UserDataType >
233template<
typename UserDataType >
237 return *
static_cast< const UserDataType*
>( myUserData );
#define LIBCARNA_ASSERT(expression)
If the given expression is false, a break point is raised in debug mode and an AssertionFailure throw...
Contains forward-declarations.
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...
Node & findRoot()
References the root node this spatial belongs to.
virtual ~Spatial()
Does nothing.
const UserDataType & userData() const
Retrieves the object previously linked with this Spatial instance.
void setMovable(bool movable)
Sets whether this spatial may be displaced w.r.t. it's parent through user interaction....
void setTag(const std::string &tag)
Sets an arbitrary tag that may be used to identify this object.
const Node & parent() const
virtual void updateWorldTransform()
Computes the transformation to world space for this spatial.
bool hasParent() const
Tells whether this spatial has a parent node.
void removeUserData()
Removes any object that has been linked with this Spatial instance through setUserData previously.
void setUserData(const UserDataType &userData)
Links an arbitrary object with this Spatial instance.
Node & parent()
References the parent node.
bool hasUserData() const
Tells whether an object has been linked with this Spatial instance through setUserData previously.
bool isMovable() const
Tells whether this spatial may be displaced w.r.t. it's parent through user interaction....
std::function< void(Spatial &) > MutableVisitor
Declares an entity that visits mutable Spatial instances.
Spatial(const std::string &tag="")
Instantiates.
Spatial * detachFromParent()
Detaches this spatial from it's parent node in where is the number of parent's children....
virtual void invalidate()
Notifies all listeners of its parent nodes that their subtrees have changed. This may include changes...
const math::Matrix4f & worldTransform() const
Tells the transformation to world space for this spatial that was last computed.
void updateParent(Node &parent)
Fixes tree consistency by updating parent of this spatial. This method is for internal usage only.
const std::string & tag() const
Tells the tag set previously.
const Node & findRoot() const
References the root node this spatial belongs to.
std::function< void(const Spatial &) > ImmutableVisitor
Declares an entity that visits mutable Spatial instances.
math::Matrix4f localTransform
Defines the location, rotation and scale of this spatial in relation to it's parent....
Defines LibCarna::base::math namespace and LIBCARNA_FOR_VECTOR3UI.
Eigen::Matrix< float, 4, 4, Eigen::ColMajor > Matrix4f
Defines matrix.
Defines LibCarna::base::noncopyable and NON_COPYABLE.
#define NON_COPYABLE
Marks the class that it is placed in as non-copyable.