libdonut  2.3.2
Application framework for cross-platform game development in C++20
Public Attributes | List of all members
donut::graphics::QuadInstance Struct Reference

Configuration of an arbitrarily shaded/transformed 2D quad instance, optionally textured, for drawing as part of a RenderPass. More...

#include <donut/graphics/RenderPass.hpp>

Public Attributes

Shader2Dshader = Shader2D::PLAIN
 Non-owning pointer to the shader to use when rendering this quad. More...
 
const Texturetexture = Texture::WHITE
 Non-owning pointer to a texture to apply to the quad. More...
 
mat3 transformation = identity<mat3>()
 Transformation matrix to apply to every corner of the quad. More...
 
vec2 textureOffset {0.0f, 0.0f}
 Offset, in texture coordinates, to apply to the texture coordinates before sampling the texture. More...
 
vec2 textureScale {1.0f, 1.0f}
 Coefficients to scale the texture coordinates by before sampling the texture. More...
 
Color tintColor = Color::WHITE
 Tint color to use in the shader. More...
 

Detailed Description

Configuration of an arbitrarily shaded/transformed 2D quad instance, optionally textured, for drawing as part of a RenderPass.

Note
Consecutive 2D instances with the same shader and texture will be batched and rendered together.
See also
TextureInstance
RectangleInstance
SpriteInstance

Member Data Documentation

◆ shader

Shader2D* donut::graphics::QuadInstance::shader = Shader2D::PLAIN

Non-owning pointer to the shader to use when rendering this quad.

Warning
The pointed-to shader must remain valid for the duration of its use in the RenderPass, and must not be nullptr.

◆ texture

const Texture* donut::graphics::QuadInstance::texture = Texture::WHITE

Non-owning pointer to a texture to apply to the quad.

Warning
The pointed-to texture must remain valid for the duration of its use in the RenderPass, and must not be nullptr.

◆ transformation

mat3 donut::graphics::QuadInstance::transformation = identity<mat3>()

Transformation matrix to apply to every corner of the quad.

◆ textureOffset

vec2 donut::graphics::QuadInstance::textureOffset {0.0f, 0.0f}

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

Note
This unscaled offset is applied after scaling the texture coordinates by the QuadInstance::textureScale.

◆ textureScale

vec2 donut::graphics::QuadInstance::textureScale {1.0f, 1.0f}

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

Note
The texture coordinates are scaled before applying the unscaled QuadInstance::textureOffset.

◆ tintColor

Color donut::graphics::QuadInstance::tintColor = Color::WHITE

Tint color to use in the shader.

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

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.

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