template<UnsignedInt dimensions, class T>
Magnum::SceneGraph::AbstractObject class

Base for objects.

Provides minimal interface for features, not depending on object transformation implementation. This class is not directly instantiatable, use Object subclass instead. See also Using scene graph for more information.

Uses Corrade::Containers::LinkedList for efficient feature management. Traversing through the feature list can be done using range-based for:

AbstractObject3D object;
for(AbstractFeature3D& feature: object.features()) {
    // ...
}

Or, if you need more flexibility, like in the following code. It is also possible to go in reverse order using Corrade::Containers::LinkedList::last() and AbstractFeature::previousFeature().

for(AbstractFeature3D* feature = object.features().first(); feature; feature = feature->nextFeature()) {
    // ...
}

Explicit template specializations

The following specializations are explicitly compiled into SceneGraph library. For other specializations (e.g. using Double type) you have to use Object.hpp implementation file to avoid linker errors. See also relevant sections in Object and AbstractTransformation class documentation or Template headers and implementation files for more information.

Public types

using MatrixType = MatrixTypeFor<dimensions, T>
Matrix type.
using FeatureType = AbstractFeature<dimensions, T>
Feature object type.

Public functions

auto features() -> Containers::LinkedList<AbstractFeature<dimensions, T>>&
Object features.
auto features() const -> const Containers::LinkedList<AbstractFeature<dimensions, T>>&
template<class U, class ... Args>
auto addFeature(Args... args) -> U&
Add a feature.
auto scene() -> AbstractObject<dimensions, T>*
Scene.
auto scene() const -> const AbstractObject<dimensions, T>*
auto parent() -> AbstractObject<dimensions, T>*
Parent object or nullptr, if this is root object.
auto parent() const -> const AbstractObject<dimensions, T>*

Object transformation

auto transformationMatrix() const -> MatrixType
Transformation matrix.
auto absoluteTransformationMatrix() const -> MatrixType
Transformation matrix relative to root object.
auto transformationMatrices(const std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>& objects, const MatrixType& initialTransformationMatrix = MatrixType()) const -> std::vector<MatrixType>
Transformation matrices of given set of objects relative to this object.

Transformation caching

See Transformation caching in features for more information.

auto isDirty() const -> bool
Whether absolute transformation is dirty.
void setDirty()
Set object absolute transformation as dirty.
void setClean()
Clean object absolute transformation.
static void setClean(const std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>& objects)
Clean absolute transformations of given set of objects.

Function documentation

template<UnsignedInt dimensions, class T>
Containers::LinkedList<AbstractFeature<dimensions, T>>& Magnum::SceneGraph::AbstractObject<dimensions, T>::features()

Object features.

template<UnsignedInt dimensions, class T>
const Containers::LinkedList<AbstractFeature<dimensions, T>>& Magnum::SceneGraph::AbstractObject<dimensions, T>::features() const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<UnsignedInt dimensions, class T> template<class U, class ... Args>
U& Magnum::SceneGraph::AbstractObject<dimensions, T>::addFeature(Args... args)

Add a feature.

Calling object.addFeature<MyFeature>(args...) is equivalent to new MyFeature{object, args...}.

template<UnsignedInt dimensions, class T>
AbstractObject<dimensions, T>* Magnum::SceneGraph::AbstractObject<dimensions, T>::scene()

Scene.

Returns Scene or nullptr, if the object is not part of any scene.

template<UnsignedInt dimensions, class T>
const AbstractObject<dimensions, T>* Magnum::SceneGraph::AbstractObject<dimensions, T>::scene() const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<UnsignedInt dimensions, class T>
const AbstractObject<dimensions, T>* Magnum::SceneGraph::AbstractObject<dimensions, T>::parent() const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<UnsignedInt dimensions, class T>
MatrixType Magnum::SceneGraph::AbstractObject<dimensions, T>::transformationMatrix() const

Transformation matrix.

See also transformation() function of various transformation classes.

template<UnsignedInt dimensions, class T>
MatrixType Magnum::SceneGraph::AbstractObject<dimensions, T>::absoluteTransformationMatrix() const

Transformation matrix relative to root object.

template<UnsignedInt dimensions, class T>
std::vector<MatrixType> Magnum::SceneGraph::AbstractObject<dimensions, T>::transformationMatrices(const std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>& objects, const MatrixType& initialTransformationMatrix = MatrixType()) const

Transformation matrices of given set of objects relative to this object.

All transformations are premultiplied with initialTransformationMatrix, if specified.

template<UnsignedInt dimensions, class T>
bool Magnum::SceneGraph::AbstractObject<dimensions, T>::isDirty() const

Whether absolute transformation is dirty.

Returns true if transformation of the object or any parent has changed since last call to setClean(), false otherwise. All objects are dirty by default.

template<UnsignedInt dimensions, class T>
void Magnum::SceneGraph::AbstractObject<dimensions, T>::setDirty()

Set object absolute transformation as dirty.

Calls AbstractFeature::markDirty() on all object features and recursively calls setDirty() on every child object which is not already dirty. If the object is already marked as dirty, the function does nothing.

template<UnsignedInt dimensions, class T>
void Magnum::SceneGraph::AbstractObject<dimensions, T>::setClean()

Clean object absolute transformation.

Calls AbstractFeature::clean() and/or AbstractFeature::cleanInverted() on all object features which have caching enabled and recursively calls setClean() on every parent which is not already clean. If the object is already clean, the function does nothing.

See also setClean(const std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>&), which cleans given set of objects more efficiently than when calling setClean() on each object individually.

template<UnsignedInt dimensions, class T>
static void Magnum::SceneGraph::AbstractObject<dimensions, T>::setClean(const std::vector<std::reference_wrapper<AbstractObject<dimensions, T>>>& objects)

Clean absolute transformations of given set of objects.

Only dirty objects in the list are cleaned.