libdonut
2.3.2
Application framework for cross-platform game development in C++20
|
Configuration of a 2D sprite instance from a SpriteAtlas, for drawing as part of a RenderPass. More...
#include <donut/graphics/RenderPass.hpp>
Public Attributes | |
Shader2D * | shader = Shader2D::PLAIN |
Non-owning pointer to the shader to use when rendering this sprite. More... | |
const SpriteAtlas * | atlas |
Non-owning pointer to the texture atlas in which the sprite resides. More... | |
SpriteAtlas::SpriteId | id |
Identifier of the specific sprite in the SpriteInstance::atlas that is to be drawn. More... | |
vec2 | position {0.0f, 0.0f} |
Position, in world coordinates, to render the sprite at, with respect to its SpriteInstance::origin. More... | |
vec2 | scale {1.0f, 1.0f} |
Coefficients to scale the size of the sprite by. More... | |
float | angle = 0.0f |
Angle, in radians, to rotate the sprite by, around its SpriteInstance::origin. More... | |
vec2 | origin {0.0f, 0.0f} |
Offset, in texture coordinates, specifying the origin relative to the bottom left of the sprite. More... | |
Color | tintColor = Color::WHITE |
Tint color to use in the shader. More... | |
Configuration of a 2D sprite instance from a SpriteAtlas, for drawing as part of a RenderPass.
Required fields:
Shader2D* donut::graphics::SpriteInstance::shader = Shader2D::PLAIN |
Non-owning pointer to the shader to use when rendering this sprite.
const SpriteAtlas* donut::graphics::SpriteInstance::atlas |
Non-owning pointer to the texture atlas in which the sprite resides.
SpriteAtlas::SpriteId donut::graphics::SpriteInstance::id |
Identifier of the specific sprite in the SpriteInstance::atlas that is to be drawn.
vec2 donut::graphics::SpriteInstance::position {0.0f, 0.0f} |
Position, in world coordinates, to render the sprite at, with respect to its SpriteInstance::origin.
vec2 donut::graphics::SpriteInstance::scale {1.0f, 1.0f} |
Coefficients to scale the size of the sprite by.
The resulting textured quad will have the size of the original sprite, multiplied by this value.
float donut::graphics::SpriteInstance::angle = 0.0f |
Angle, in radians, to rotate the sprite by, around its SpriteInstance::origin.
vec2 donut::graphics::SpriteInstance::origin {0.0f, 0.0f} |
Offset, in texture coordinates, specifying the origin relative to the bottom left of the sprite.
For example, a value of (0.5, 0.5) would represent the middle of the sprite.
Color donut::graphics::SpriteInstance::tintColor = Color::WHITE |
Tint color to use in the shader.