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

Per-draw uniform for flat shaders.

Together with the generic TransformationProjectionUniform2D / TransformationProjectionUniform3D contains parameters that are specific to each draw call. Texture transformation, if needed, is supplied separately in a TextureTransformationUniform; material-related properties are expected to be shared among multiple draw calls and thus are provided in a separate FlatMaterialUniform structure, referenced by materialId.

Constructors, destructors, conversion operators

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

Public variables

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 setMaterialId(UnsignedInt id) -> FlatDrawUniform&
Set the materialId field.
auto setObjectId(UnsignedInt id) -> FlatDrawUniform&
Set the objectId field.
auto setJointOffset(UnsignedInt offset) -> FlatDrawUniform&
Set the jointOffset field.
auto setPerInstanceJointCount(UnsignedInt count) -> FlatDrawUniform&
Set the perInstanceJointCount field.

Function documentation

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

Set the materialId field.

Returns Reference to self (for method chaining)

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

Set the objectId field.

Returns Reference to self (for method chaining)

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

Set the jointOffset field.

Returns Reference to self (for method chaining)

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

Set the perInstanceJointCount field.

Returns Reference to self (for method chaining)

Variable documentation

UnsignedShort Magnum::Shaders::FlatDrawUniform::materialId

Material ID.

References a particular material from a FlatMaterialUniform 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 FlatGL::Configuration::setMaterialCount(), if material count is 1, this field is assumed to be 0 and isn't even read by the shader. Default value is 0, meaning the first material gets used.

UnsignedInt Magnum::Shaders::FlatDrawUniform::objectId

Object ID.

Used only for the object ID framebuffer output, not to access any other uniform data. Default value is 0.

Used only if FlatGL::Flag::ObjectId is enabled, ignored otherwise. If FlatGL::Flag::InstancedObjectId and/or FlatGL::Flag::ObjectIdTexture is enabled as well, this value is added to the ID coming from the FlatGL::ObjectId attribute and/or the texture.

UnsignedShort Magnum::Shaders::FlatDrawUniform::jointOffset

Joint offset.

Offset added to joint IDs in the FlatGL::JointIds and FlatGL::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 FlatGL::Configuration::setJointCount(). Default value is 0, meaning no offset is added to joint IDs.

UnsignedShort Magnum::Shaders::FlatDrawUniform::perInstanceJointCount

Per-instance joint count.

Offset added to joint IDs in the FlatGL::JointIds and FlatGL::SecondaryJointIds atttributes in instanced draws. Should be less than the joint count passed to FlatGL::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.