1#ifndef DONUT_GRAPHICS_RENDER_PASS_HPP 
    2#define DONUT_GRAPHICS_RENDER_PASS_HPP 
  735        : memoryResource(initialMemory) {}
 
 
  841    struct CommandUseShader3D {
 
  845    struct CommandUseShader2D {
 
  849    struct CommandUseModel {
 
  851        const Texture* diffuseMapOverride;
 
  852        const Texture* specularMapOverride;
 
  853        const Texture* normalMapOverride;
 
  854        const Texture* emissiveMapOverride;
 
  857    struct CommandUseTexture {
 
  858        const Texture* texture;
 
  861    struct CommandUseSpriteAtlas {
 
  862        const SpriteAtlas* atlas;
 
  865    struct CommandUseFont {
 
  869    struct CommandDrawModelInstance {
 
  878    struct CommandDrawQuadInstance {
 
  885    struct CommandDrawTextureInstance {
 
  895    struct CommandDrawRectangleInstance {
 
  905    struct CommandDrawSpriteInstance {
 
  911        SpriteAtlas::SpriteId id;
 
  914    struct CommandDrawTextInstance {
 
  920    struct CommandDrawTextCopyInstance {
 
  922        std::span<const Text::ShapedGlyph> shapedGlyphs;
 
  926    struct CommandDrawTextStringInstance {
 
  928        std::string_view string;
 
  935    LinearMemoryResource memoryResource{};
 
  941        CommandUseSpriteAtlas,         
 
  943        CommandDrawModelInstance,      
 
  944        CommandDrawQuadInstance,       
 
  945        CommandDrawTextureInstance,    
 
  946        CommandDrawRectangleInstance,  
 
  947        CommandDrawSpriteInstance,     
 
  948        CommandDrawTextInstance,       
 
  949        CommandDrawTextCopyInstance,   
 
  950        CommandDrawTextStringInstance, 
 
  954    std::vector<Font*, LinearAllocator<Font*>> fonts{&memoryResource};
 
  955    Shader3D* previousShader3D = 
nullptr;
 
  956    Shader2D* previousShader2D = 
nullptr;
 
  957    const Model* previousModel = 
nullptr;
 
  958    const Texture* previousDiffuseMapOverride = 
nullptr;
 
  959    const Texture* previousSpecularMapOverride = 
nullptr;
 
  960    const Texture* previousNormalMapOverride = 
nullptr;
 
  961    const Texture* previousEmissiveMapOverride = 
nullptr;
 
  962    const Texture* previousTexture = 
nullptr;
 
  963    const SpriteAtlas* previousSpriteAtlas = 
nullptr;
 
  964    Font* previousFont = 
nullptr;
 
 
Normalized floating-point RGBA color type with 32 bits per component.
Definition Color.hpp:11
 
static const Color WHITE
Definition Color.hpp:158
 
std::size_t getRemainingCapacity() const noexcept
Definition LinearAllocator.hpp:49
 
Typeface describing an assortment of character glyphs that may be rendered on-demand into an expandin...
Definition Font.hpp:42
 
Graphics drawing queue for batch rendering using a Renderer.
Definition RenderPass.hpp:718
 
RenderPass & draw(const TextCopyInstance &text)
Enqueue a TextCopyInstance to be drawn when the render pass is rendered.
 
RenderPass & draw(const TextInstance &text)
Enqueue a TextInstance to be drawn when the render pass is rendered.
 
RenderPass & draw(const RectangleInstance &rectangle)
Enqueue a RectangleInstance to be drawn when the render pass is rendered.
 
RenderPass() noexcept=default
Construct an empty RenderPass.
 
RenderPass & draw(const ModelInstance &model)
Enqueue a ModelInstance to be drawn when the render pass is rendered.
 
RenderPass & draw(const QuadInstance &quad)
Enqueue a QuadInstance to be drawn when the render pass is rendered.
 
RenderPass & draw(const SpriteInstance &sprite)
Enqueue a SpriteInstance to be drawn when the render pass is rendered.
 
RenderPass & draw(const TextureInstance &texture)
Enqueue a TextureInstance to be drawn when the render pass is rendered.
 
RenderPass & draw(const TextStringInstance &text)
Enqueue a TextStringInstance to be drawn when the render pass is rendered.
 
RenderPass & draw(const TextUTF8StringInstance &text)
Enqueue a TextUTF8StringInstance to be drawn when the render pass is rendered.
 
Persistent system for rendering the batched draw commands of a RenderPass onto a Framebuffer,...
Definition Renderer.hpp:38
 
ShaderProgram specialized for rendering TexturedQuad instances in 2D.
Definition Shader2D.hpp:29
 
static Shader2D *const PLAIN
Pointer to the statically allocated storage for the built-in plain shader.
Definition Shader2D.hpp:58
 
static Shader2D *const ALPHA
Pointer to the statically allocated storage for the built-in alpha shader.
Definition Shader2D.hpp:68
 
ShaderProgram specialized for rendering Model instances in 3D.
Definition Shader3D.hpp:25
 
static Shader3D *const BLINN_PHONG
Pointer to the statically allocated storage for the built-in blinn-phong shader.
Definition Shader3D.hpp:74
 
Expandable texture atlas for packing 2D images into a spritesheet to enable batch rendering.
Definition SpriteAtlas.hpp:34
 
Facility for shaping text, according to a Font, into renderable glyphs.
Definition Text.hpp:19
 
Storage for multidimensional data, such as 2D images, on the GPU, combined with a sampler configurati...
Definition Texture.hpp:75
 
static const Texture *const WHITE
Pointer to the statically allocated storage for the built-in white 2D texture.
Definition Texture.hpp:105
 
Configuration of a 3D Model instance, for drawing as part of a RenderPass.
Definition RenderPass.hpp:32
 
const Model * model
Non-owning pointer to the model to be drawn.
Definition RenderPass.hpp:47
 
const Texture * diffuseMapOverride
Non-owning pointer to the texture to use for the base color, or nullptr to use the original textures ...
Definition RenderPass.hpp:56
 
vec3 specularFactor
Specular factor to use in the shader.
Definition RenderPass.hpp:126
 
const Texture * normalMapOverride
Non-owning pointer to the texture to use for normal mapping, or nullptr to use the original textures ...
Definition RenderPass.hpp:74
 
vec2 textureScale
Coefficients to scale the texture coordinates by before sampling textures.
Definition RenderPass.hpp:107
 
Color tintColor
Tint color to use in the shader.
Definition RenderPass.hpp:117
 
const Texture * specularMapOverride
Non-owning pointer to the texture to use for specular highlights, or nullptr to use the original text...
Definition RenderPass.hpp:65
 
vec3 emissiveFactor
Emissive factor to use in the shader.
Definition RenderPass.hpp:135
 
Shader3D * shader
Non-owning pointer the shader to use when rendering this model.
Definition RenderPass.hpp:39
 
mat4 transformation
Transformation matrix to apply to every vertex position of the model, in world space.
Definition RenderPass.hpp:89
 
const Texture * emissiveMapOverride
Non-owning pointer to the texture to use for emissive mapping, or nullptr to use the original texture...
Definition RenderPass.hpp:83
 
vec2 textureOffset
Offset, in texture coordinates, to apply to the texture coordinates before sampling textures.
Definition RenderPass.hpp:98
 
Container for a set of 3D triangle meshes stored on the GPU, combined with associated materials.
Definition Model.hpp:20
 
Configuration of an arbitrarily shaded/transformed 2D quad instance, optionally textured,...
Definition RenderPass.hpp:149
 
Color tintColor
Tint color to use in the shader.
Definition RenderPass.hpp:199
 
mat3 transformation
Transformation matrix to apply to every corner of the quad.
Definition RenderPass.hpp:169
 
Shader2D * shader
Non-owning pointer to the shader to use when rendering this quad.
Definition RenderPass.hpp:156
 
vec2 textureScale
Coefficients to scale the texture coordinates by before sampling the texture.
Definition RenderPass.hpp:187
 
vec2 textureOffset
Offset, in texture coordinates, to apply to the texture coordinates before sampling the texture.
Definition RenderPass.hpp:178
 
const Texture * texture
Non-owning pointer to a texture to apply to the quad.
Definition RenderPass.hpp:164
 
Configuration of a 2D rectangle instance, optionally textured, for drawing as part of a RenderPass.
Definition RenderPass.hpp:300
 
const Texture * texture
Non-owning pointer to a texture to apply to the rectangle.
Definition RenderPass.hpp:315
 
Color tintColor
Tint color to use in the shader.
Definition RenderPass.hpp:370
 
vec2 position
Position, in world coordinates, to render the rectangle at, with respect to its RectangleInstance::or...
Definition RenderPass.hpp:321
 
vec2 origin
Offset, in texture coordinates, specifying the origin relative to the bottom left of the rectangle.
Definition RenderPass.hpp:339
 
vec2 textureScale
Coefficients to scale the texture coordinates by before sampling the texture.
Definition RenderPass.hpp:357
 
Shader2D * shader
Non-owning pointer to the shader to use when rendering this rectangle.
Definition RenderPass.hpp:307
 
vec2 textureOffset
Offset, in texture coordinates, to apply to the texture coordinates before sampling the texture.
Definition RenderPass.hpp:348
 
vec2 size
Size of the rectangle, in world coordinates.
Definition RenderPass.hpp:326
 
float angle
Angle, in radians, to rotate the rectangle by, around its RectangleInstance::origin.
Definition RenderPass.hpp:332
 
Identifier for a specific image in the spritesheet.
Definition SpriteAtlas.hpp:53
 
Configuration of a 2D sprite instance from a SpriteAtlas, for drawing as part of a RenderPass.
Definition RenderPass.hpp:388
 
float angle
Angle, in radians, to rotate the sprite by, around its SpriteInstance::origin.
Definition RenderPass.hpp:432
 
const SpriteAtlas * atlas
Non-owning pointer to the texture atlas in which the sprite resides.
Definition RenderPass.hpp:403
 
vec2 position
Position, in world coordinates, to render the sprite at, with respect to its SpriteInstance::origin.
Definition RenderPass.hpp:418
 
vec2 scale
Coefficients to scale the size of the sprite by.
Definition RenderPass.hpp:426
 
vec2 origin
Offset, in texture coordinates, specifying the origin relative to the bottom left of the sprite.
Definition RenderPass.hpp:439
 
Color tintColor
Tint color to use in the shader.
Definition RenderPass.hpp:449
 
SpriteAtlas::SpriteId id
Identifier of the specific sprite in the SpriteInstance::atlas that is to be drawn.
Definition RenderPass.hpp:412
 
Shader2D * shader
Non-owning pointer to the shader to use when rendering this sprite.
Definition RenderPass.hpp:395
 
Configuration of a copied 2D instance of Text shaped from a Font, for drawing as part of a RenderPass...
Definition RenderPass.hpp:514
 
Shader2D * shader
Non-owning pointer to the shader to use when rendering the glyphs of this text.
Definition RenderPass.hpp:522
 
Color color
Base text color.
Definition RenderPass.hpp:542
 
vec2 position
Starting position, in world coordinates, to render the text at.
Definition RenderPass.hpp:537
 
const Text * text
Non-owning read-only pointer to the shaped text to copy, and later draw.
Definition RenderPass.hpp:531
 
Configuration of a 2D instance of Text shaped from a Font, for drawing as part of a RenderPass.
Definition RenderPass.hpp:466
 
Color color
Base text color.
Definition RenderPass.hpp:494
 
const Text * text
Non-owning read-only pointer to the shaped text to draw.
Definition RenderPass.hpp:483
 
vec2 position
Starting position, in world coordinates, to render the text at.
Definition RenderPass.hpp:489
 
Shader2D * shader
Non-owning pointer to the shader to use when rendering the glyphs of this text.
Definition RenderPass.hpp:474
 
Configuration of a 2D instance of a string of text with a Font, for drawing as part of a RenderPass.
Definition RenderPass.hpp:644
 
vec2 scale
Scaling to apply to the size of the shaped glyphs.
Definition RenderPass.hpp:684
 
Shader2D * shader
Non-owning pointer to the shader to use when rendering the glyphs of this text.
Definition RenderPass.hpp:652
 
Font * font
Non-owning pointer to the font from which to shape the text.
Definition RenderPass.hpp:660
 
vec2 origin
Offset, in normalized coordinates, specifying the origin relative to the baseline of the first line o...
Definition RenderPass.hpp:693
 
vec2 position
Starting position, in world coordinates, to render the text at.
Definition RenderPass.hpp:671
 
u32 characterSize
Character size to shape the glyphs at.
Definition RenderPass.hpp:665
 
std::string_view string
String to shape the text from.
Definition RenderPass.hpp:712
 
Color color
Base text color.
Definition RenderPass.hpp:698
 
Configuration of a 2D instance of a UTF-8 string of text with a Font, for drawing as part of a Render...
Definition RenderPass.hpp:560
 
Color color
Base text color.
Definition RenderPass.hpp:614
 
vec2 origin
Offset, in normalized coordinates, specifying the origin relative to the baseline of the first line o...
Definition RenderPass.hpp:609
 
std::u8string_view string
UTF8-encoded string to shape the text from.
Definition RenderPass.hpp:626
 
vec2 position
Starting position, in world coordinates, to render the text at.
Definition RenderPass.hpp:587
 
vec2 scale
Scaling to apply to the size of the shaped glyphs.
Definition RenderPass.hpp:600
 
u32 characterSize
Character size to shape the glyphs at.
Definition RenderPass.hpp:581
 
Font * font
Non-owning pointer to the font from which to shape the text.
Definition RenderPass.hpp:576
 
Shader2D * shader
Non-owning pointer to the shader to use when rendering the glyphs of this text.
Definition RenderPass.hpp:568
 
Configuration of a 2D textured quad instance, for drawing as part of a RenderPass.
Definition RenderPass.hpp:216
 
vec2 textureOffset
Offset, in texture coordinates, to apply to the texture coordinates before sampling the texture.
Definition RenderPass.hpp:267
 
vec2 scale
Coefficients to scale the size of the texture by.
Definition RenderPass.hpp:245
 
Color tintColor
Tint color to use in the shader.
Definition RenderPass.hpp:286
 
vec2 textureScale
Coefficients to scale the texture coordinates by before sampling the texture.
Definition RenderPass.hpp:276
 
float angle
Angle, in radians, to rotate the texture by, around its TextureInstance::origin.
Definition RenderPass.hpp:251
 
Shader2D * shader
Non-owning pointer to the shader to use when rendering this texture.
Definition RenderPass.hpp:223
 
vec2 position
Position, in world coordinates, to render the texture at, with respect to its TextureInstance::origin...
Definition RenderPass.hpp:237
 
const Texture * texture
Non-owning pointer to the texture to be drawn.
Definition RenderPass.hpp:231
 
vec2 origin
Offset, in texture coordinates, specifying the origin relative to the bottom left of the texture.
Definition RenderPass.hpp:258