Magnum::Trade::ObjectData3D class

Three-dimensional object data.

Provides access to object transformation and hierarchy.

Derived classes

class MeshObjectData3D
Three-dimensional mesh object data.

Constructors, destructors, conversion operators

ObjectData3D(std::vector<UnsignedInt> children, const Matrix4& transformation, ObjectInstanceType3D instanceType, UnsignedInt instance, const void* importerState = nullptr) explicit
Construct with combined transformation.
ObjectData3D(std::vector<UnsignedInt> children, const Vector3& translation, const Quaternion& rotation, const Vector3& scaling, ObjectInstanceType3D instanceType, UnsignedInt instance, const void* importerState = nullptr) explicit
Construct with separate transformations.
ObjectData3D(std::vector<UnsignedInt> children, const Matrix4& transformation, const void* importerState = nullptr) explicit
Construct empty instance with combined transformation.
ObjectData3D(std::vector<UnsignedInt> children, const Vector3& translation, const Quaternion& rotation, const Vector3& scaling, const void* importerState = nullptr) explicit
Construct empty instance with separate transformations.
ObjectData3D(const ObjectData3D&) deleted
Copying is not allowed.
ObjectData3D(ObjectData3D&&) noexcept
Move constructor.
~ObjectData3D() virtual
Destructor.

Public functions

auto operator=(const ObjectData3D&) -> ObjectData3D& deleted
Copying is not allowed.
auto operator=(ObjectData3D&&) -> ObjectData3D& noexcept
Move assignment.
auto children() -> std::vector<UnsignedInt>&
Child objects.
auto children() const -> const std::vector<UnsignedInt>&
auto flags() const -> ObjectFlags3D
Flags.
auto translation() const -> Vector3
Translation (relative to parent)
auto rotation() const -> Quaternion
Rotation (relative to parent)
auto scaling() const -> Vector3
Scaling (relative to parent)
auto transformation() const -> Matrix4
Transformation (relative to parent)
auto instanceType() const -> ObjectInstanceType3D
Instance type.
auto instance() const -> Int
Instance ID.
auto importerState() const -> const void*
Importer-specific state.

Function documentation

Magnum::Trade::ObjectData3D::ObjectData3D(std::vector<UnsignedInt> children, const Matrix4& transformation, ObjectInstanceType3D instanceType, UnsignedInt instance, const void* importerState = nullptr) explicit

Construct with combined transformation.

Parameters
children Child objects
transformation Transformation (relative to parent)
instanceType Instance type
instance Instance ID
importerState Importer-specific state

Magnum::Trade::ObjectData3D::ObjectData3D(std::vector<UnsignedInt> children, const Vector3& translation, const Quaternion& rotation, const Vector3& scaling, ObjectInstanceType3D instanceType, UnsignedInt instance, const void* importerState = nullptr) explicit

Construct with separate transformations.

Parameters
children Child objects
translation Translation (relative to parent)
rotation Rotation (relative to parent)
scaling Scaling (relative to parent)
instanceType Instance type
instance Instance ID
importerState Importer-specific state

Magnum::Trade::ObjectData3D::ObjectData3D(std::vector<UnsignedInt> children, const Matrix4& transformation, const void* importerState = nullptr) explicit

Construct empty instance with combined transformation.

Parameters
children Child objects
transformation Transformation (relative to parent)
importerState Importer-specific state

Magnum::Trade::ObjectData3D::ObjectData3D(std::vector<UnsignedInt> children, const Vector3& translation, const Quaternion& rotation, const Vector3& scaling, const void* importerState = nullptr) explicit

Construct empty instance with separate transformations.

Parameters
children Child objects
translation Translation (relative to parent)
rotation Rotation (relative to parent)
scaling Scaling (relative to parent)
importerState Importer-specific state

const std::vector<UnsignedInt>& Magnum::Trade::ObjectData3D::children() const

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

Vector3 Magnum::Trade::ObjectData3D::translation() const

Translation (relative to parent)

Available only if ObjectFlag3D::HasTranslationRotationScaling is set, use transformation() otherwise. Applied as last in the final transformation, see transformation() for more information.

Quaternion Magnum::Trade::ObjectData3D::rotation() const

Rotation (relative to parent)

Available only if ObjectFlag3D::HasTranslationRotationScaling is set, use transformation() otherwise. Applied second in the final transformation, see transformation() for more information.

Vector3 Magnum::Trade::ObjectData3D::scaling() const

Scaling (relative to parent)

Available only if ObjectFlag3D::HasTranslationRotationScaling is set, use transformation() otherwise. Applied as first in the final transformation, see transformation() for more information.

Matrix4 Magnum::Trade::ObjectData3D::transformation() const

Transformation (relative to parent)

If ObjectFlag3D::HasTranslationRotationScaling is not set, returns the imported object transformation matrix. Otherwise calculates the final transformation matrix $ \boldsymbol{M} $ from translation, rotation and scaling matrices $ \boldsymbol{T} $ , $ \boldsymbol{R} $ , $ \boldsymbol{S} $ created from translation(), rotation() and scaling() in the following order:

\[ \boldsymbol{M} = \boldsymbol{T} \boldsymbol{R} \boldsymbol{S} \]

The corresponding code is as follows:

Matrix4 transformation =
    Matrix4::from(data.rotation().toMatrix(), data.translation())*
    Matrix4::scaling(data.scaling());

ObjectInstanceType3D Magnum::Trade::ObjectData3D::instanceType() const

Instance type.

Int Magnum::Trade::ObjectData3D::instance() const

Instance ID.

Returns ID of given camera / light / mesh etc., specified by instanceType()

const void* Magnum::Trade::ObjectData3D::importerState() const

Importer-specific state.

See AbstractImporter::importerState() for more information.