Magnum::Shaders::MeshVisualizerDrawUniform3D struct new in Git master

Per-draw uniform for 3D mesh visualizer shaders.

Together with the generic TransformationUniform3D contains parameters that are specific to each draw call. Material-related properties are expected to be shared among multiple draw calls and thus are provided in a separate MeshVisualizerMaterialUniform structure, referenced by materialId.

Constructors, destructors, conversion operators

MeshVisualizerDrawUniform3D(DefaultInitT = DefaultInit) explicit constexpr noexcept
Construct with default parameters.
MeshVisualizerDrawUniform3D(NoInitT) explicit noexcept
Construct without initializing the contents.

Public variables

Matrix3x4 normalMatrix
Normal matrix.
UnsignedShort materialId
Material ID.
UnsignedInt objectId
Object ID.
UnsignedShort jointOffset
Joint offset.
UnsignedShort perInstanceJointCount
Per-instance joint count.

Convenience setters

Provided to allow the use of method chaining for populating a structure in a single expression, otherwise equivalent to accessing the fields directly. Also guaranteed to provide backwards compatibility when packing of the actual fields changes.

auto setNormalMatrix(const Matrix3x3& matrix) -> MeshVisualizerDrawUniform3D&
Set the normalMatrix field.
auto setMaterialId(UnsignedInt id) -> MeshVisualizerDrawUniform3D&
Set the materialId field.
auto setObjectId(UnsignedInt id) -> MeshVisualizerDrawUniform3D&
Set the objectId field.
auto setJointOffset(UnsignedInt offset) -> MeshVisualizerDrawUniform3D&
Set the jointOffset field.
auto setPerInstanceJointCount(UnsignedInt count) -> MeshVisualizerDrawUniform3D&
Set the perInstanceJointCount field.

Function documentation

MeshVisualizerDrawUniform3D& Magnum::Shaders::MeshVisualizerDrawUniform3D::setNormalMatrix(const Matrix3x3& matrix)

Set the normalMatrix field.

Returns Reference to self (for method chaining)

The matrix is expanded to Matrix3x4, with the bottom row being zeros.

MeshVisualizerDrawUniform3D& Magnum::Shaders::MeshVisualizerDrawUniform3D::setMaterialId(UnsignedInt id)

Set the materialId field.

Returns Reference to self (for method chaining)

MeshVisualizerDrawUniform3D& Magnum::Shaders::MeshVisualizerDrawUniform3D::setObjectId(UnsignedInt id)

Set the objectId field.

Returns Reference to self (for method chaining)

MeshVisualizerDrawUniform3D& Magnum::Shaders::MeshVisualizerDrawUniform3D::setJointOffset(UnsignedInt offset)

Set the jointOffset field.

Returns Reference to self (for method chaining)

MeshVisualizerDrawUniform3D& Magnum::Shaders::MeshVisualizerDrawUniform3D::setPerInstanceJointCount(UnsignedInt count)

Set the perInstanceJointCount field.

Returns Reference to self (for method chaining)

Variable documentation

Matrix3x4 Magnum::Shaders::MeshVisualizerDrawUniform3D::normalMatrix

Normal matrix.

Default value is an identity matrix. The bottom row is unused and acts only as a padding to match uniform buffer packing rules.

UnsignedShort Magnum::Shaders::MeshVisualizerDrawUniform3D::materialId

Material ID.

References a particular material from a MeshVisualizerMaterialUniform array. Useful when an UBO with more than one material is supplied or in a multi-draw scenario. Should be less than the material count passed to MeshVisualizerGL2D / MeshVisualizerGL3D constructor. Default value is 0, meaning the first material gets used.

UnsignedInt Magnum::Shaders::MeshVisualizerDrawUniform3D::objectId

Object ID.

Unlike materialId, this index is used only for the object ID visualization, not to access any other uniform data. Default value is 0.

Used only if MeshVisualizerGL3D::Flag::ObjectId is enabled, ignored otherwise. If MeshVisualizerGL3D::Flag::InstancedObjectId is enabled as well, this value is added to the ID coming from the MeshVisualizerGL3D::ObjectId attribute.

UnsignedShort Magnum::Shaders::MeshVisualizerDrawUniform3D::jointOffset

Joint offset.

Offset added to joint IDs in the MeshVisualizerGL2D::JointIds and MeshVisualizerGL2D::SecondaryJointIds attributes. Useful when a UBO with joint matrices for more than one skin is supplied or in a multi-draw scenario. Should be less than the joint count passed to MeshVisualizerGL2D::Configuration::setJointCount(). Default value is 0, meaning no offset is added to joint IDs.

UnsignedShort Magnum::Shaders::MeshVisualizerDrawUniform3D::perInstanceJointCount

Per-instance joint count.

Offset added to joint IDs in the MeshVisualizerGL2D::JointIds and MeshVisualizerGL2D::SecondaryJointIds atttributes in instanced draws. Should be less than the joint count passed to MeshVisualizerGL2D::Configuration::setJointCount(). Default value is 0, meaning every instance will use the same joint matrices, setting it to a non-zero value causes the joint IDs to be interpreted as gl_InstanceID*count + jointId.