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

Texture transformation uniform common for all shaders.

Expands upon TransformationUniform2D / TransformationUniform3D with texture-related parameters.

Used only if DistanceFieldVectorGL::Flag::TextureTransformation, FlatGL::Flag::TextureTransformation, PhongGL::Flag::TextureTransformation or VectorGL::Flag::TextureTransformation is enabled.

Constructors, destructors, conversion operators

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

Public variables

Matrix2x2 rotationScaling
Texture rotation and scaling.
Vector2 offset
Texture offset.
UnsignedInt layer
Texture layer.

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 setTextureMatrix(const Matrix3& transformation) -> TextureTransformationUniform&
Set the rotationScaling and offset fields.
auto setLayer(UnsignedInt layer) -> TextureTransformationUniform&
Set the layer field.

Function documentation

TextureTransformationUniform& Magnum::Shaders::TextureTransformationUniform::setTextureMatrix(const Matrix3& transformation)

Set the rotationScaling and offset fields.

Returns Reference to self (for method chaining)

The rotationScaling field is set to the upper left 2x2 corner of transformation, offset to the two upper elements of the rightmost column of transformation. Bottom row is ignored, as it's expected to be always {0.0f, 0.0f, 1.0f}.

TextureTransformationUniform& Magnum::Shaders::TextureTransformationUniform::setLayer(UnsignedInt layer)

Set the layer field.

Returns Reference to self (for method chaining)

Variable documentation

Matrix2x2 Magnum::Shaders::TextureTransformationUniform::rotationScaling

Texture rotation and scaling.

The top left part of a 3x3 texture transformation matrix. The transformation is split between rotationScaling and offset to make it occupy just two vec4 slots in the uniform buffer instead of three. Default value is an identity matrix.

If FlatGL::Flag::InstancedTextureOffset / PhongGL::Flag::InstancedTextureOffset is enabled, the per-instance offset coming from the FlatGL::TextureOffset / PhongGL::TextureOffset attribute is applied first, before this transformation.

Vector2 Magnum::Shaders::TextureTransformationUniform::offset

Texture offset.

Top two elements of the rightmost column of a 3x3 texture transformation matrix. The transformation is split between rotationScaling and offset to make it occupy just two vec4 slots in the uniform buffer instead of three. Default value is a zero vector.

If FlatGL::Flag::InstancedTextureOffset / PhongGL::Flag::InstancedTextureOffset is enabled, the per-instance offset coming from the FlatGL::TextureOffset / PhongGL::TextureOffset attribute is applied first, before this transformation.

UnsignedInt Magnum::Shaders::TextureTransformationUniform::layer

Texture layer.

Descibes which layer of a texture array to use. Default value is 0.5f.

Used only if FlatGL::Flag::TextureArrays / PhongGL::Flag::TextureArrays is enabled, ignored otherwise. If FlatGL::Flag::InstancedTextureOffset / PhongGL::Flag::InstancedTextureOffset is enabled as well, the per-instance layer coming from the FlatGL::TextureOffsetLayer / PhongGL::TextureOffsetLayer attribute is added to this value.