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

Configuration of a 2D rectangle instance, optionally textured, 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 rectangle, or nullptr to use a fully white texture.
vec2 position {0.0f, 0.0f}
 Position, in world coordinates, to draw the rectangle at, with respect to its RectangleInstance2D::origin.
float angle = 0.0f
 Angle, in radians, to rotate the rectangle counter-clockwise by, around its RectangleInstance2D::origin.
vec2 size {1.0f, 1.0f}
 Size of the rectangle, in world coordinates.
vec2 origin {0.0f, 0.0f}
 Offset, in local vertex coordinates, specifying the origin relative to the bottom left of the rectangle.
vec2 textureOffset {0.0f, 0.0f}
 Offset, in texture coordinates, to apply to the texture coordinates before sampling the texture.
float textureAngle = 0.0f
 Angle, in radians, to rotate the texture coordinates by before sampling the texture.
vec2 textureScale {1.0f, 1.0f}
 Coefficients to scale 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 2D rectangle instance, optionally textured, to draw.

Member Data Documentation

◆ texture

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

Non-owning pointer to a texture to apply to the rectangle, 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::RectangleInstance2D::position {0.0f, 0.0f}

Position, in world coordinates, to draw the rectangle at, with respect to its RectangleInstance2D::origin.

◆ angle

float grem::graphics::RectangleInstance2D::angle = 0.0f

Angle, in radians, to rotate the rectangle counter-clockwise by, around its RectangleInstance2D::origin.

◆ size

vec2 grem::graphics::RectangleInstance2D::size {1.0f, 1.0f}

Size of the rectangle, in world coordinates.

◆ origin

vec2 grem::graphics::RectangleInstance2D::origin {0.0f, 0.0f}

Offset, in local vertex coordinates, specifying the origin relative to the bottom left of the rectangle.

For example, a value of (0.5, 0.5) corresponds to the middle of the rectangle.

◆ textureOffset

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

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

Note
The texture coordinates are transformed in the following order:
  1. Scale by RectangleInstance2D::textureScale.
  2. Rotate by RectangleInstance2D::textureAngle.
  3. Translate by RectangleInstance2D::textureOffset.

◆ textureAngle

float grem::graphics::RectangleInstance2D::textureAngle = 0.0f

Angle, in radians, to rotate the texture coordinates by before sampling the texture.

Note
The texture coordinates are transformed in the following order:
  1. Scale by RectangleInstance2D::textureScale.
  2. Rotate by RectangleInstance2D::textureAngle.
  3. Translate by RectangleInstance2D::textureOffset.

◆ textureScale

vec2 grem::graphics::RectangleInstance2D::textureScale {1.0f, 1.0f}

Coefficients to scale the texture coordinates by before sampling the texture.

Note
The texture coordinates are transformed in the following order:
  1. Scale by RectangleInstance2D::textureScale.
  2. Rotate by RectangleInstance2D::textureAngle.
  3. Translate by RectangleInstance2D::textureOffset.

◆ color

Color grem::graphics::RectangleInstance2D::color = Color::WHITE

Tint color to use in the shader.

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

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::RectangleInstance2D::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: