GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::graphics::ModelInstance2D Struct Reference

Configuration of a Model2D instance to draw. More...

#include <GREM/graphics_2d/Instances2D.hpp>

Public Attributes

const Texture * texture = nullptr
 Non-owning pointer to a texture to apply to the model, or nullptr to use a fully white texture.
vec2 position {0.0f, 0.0f}
 Offset to apply to every vertex position of the model, in world space.
mat2 basis {1.0f}
 Basis to scale/rotate/shear the vertex positions of the model by.
vec2 textureOffset {0.0f, 0.0f}
 Offset, in texture coordinates, to apply to the texture coordinates before sampling the texture.
mat2 textureBasis {1.0f}
 Texture coordinate basis to scale/rotate/shear the texture coordinates by before sampling the texture.
Color color = Color::WHITE
 Tint color to use in the shader.
Color emissiveColor = Color::INVISIBLE
 Emissive color to use in the shader.

Detailed Description

Configuration of a Model2D instance to draw.

Member Data Documentation

◆ texture

const Texture* grem::graphics::ModelInstance2D::texture = nullptr

Non-owning pointer to a texture to apply to the model, or nullptr to use a fully white texture.

Warning
If not nullptr, the pointed-to texture must be a valid 2D texture.

◆ position

vec2 grem::graphics::ModelInstance2D::position {0.0f, 0.0f}

Offset to apply to every vertex position of the model, in world space.

Note
This offset is applied after transforming the vertex positions by the ModelInstance2D::basis.

◆ basis

mat2 grem::graphics::ModelInstance2D::basis {1.0f}

Basis to scale/rotate/shear the vertex positions of the model by.

Note
The vertex positions are transformed by this matrix before applying the ModelInstance2D::offset.

◆ textureOffset

vec2 grem::graphics::ModelInstance2D::textureOffset {0.0f, 0.0f}

Offset, in texture coordinates, to apply to the texture coordinates before sampling the texture.

Note
This offset is applied after transforming the texture coordinates by the ModelInstance2D::textureBasis.

◆ textureBasis

mat2 grem::graphics::ModelInstance2D::textureBasis {1.0f}

Texture coordinate basis to scale/rotate/shear the texture coordinates by before sampling the texture.

Note
The texture coordinates are transformed by this matrix before applying the ModelInstance2D::textureOffset.

◆ color

Color grem::graphics::ModelInstance2D::color = Color::WHITE

Tint color to use in the shader.

When no texture is specified, this effectively controls the base color of the model.

Note
In the default shader, the output color is multiplied by this value, meaning that a value of Color::WHITE, i.e. RGBA(1, 1, 1, 1) in linear color, represents no modification to the original texture color.

◆ emissiveColor

Color grem::graphics::ModelInstance2D::emissiveColor = Color::INVISIBLE

Emissive color to use in the shader.

Note
In the default shader, the output color has this value added to it, meaning that a value of Color::INVISIBLE, i.e. RGBA(0, 0, 0, 0) in linear color, represents no modification to the original texture color.

The documentation for this struct was generated from the following file: