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

Configuration of a 3D Model instance, for drawing as part of a RenderPass. More...

#include <donut/graphics/RenderPass.hpp>

Public Attributes

Shader3Dshader = Shader3D::BLINN_PHONG
 Non-owning pointer the shader to use when rendering this model. More...
 
const Modelmodel
 Non-owning pointer to the model to be drawn. More...
 
const TexturediffuseMapOverride = nullptr
 Non-owning pointer to the texture to use for the base color, or nullptr to use the original textures specified by the model. More...
 
const TexturespecularMapOverride = nullptr
 Non-owning pointer to the texture to use for specular highlights, or nullptr to use the original textures specified by the model. More...
 
const TexturenormalMapOverride = nullptr
 Non-owning pointer to the texture to use for normal mapping, or nullptr to use the original textures specified by the model. More...
 
const TextureemissiveMapOverride = nullptr
 Non-owning pointer to the texture to use for emissive mapping, or nullptr to use the original textures specified by the model. More...
 
mat4 transformation = identity<mat4>()
 Transformation matrix to apply to every vertex position of the model, in world space. More...
 
vec2 textureOffset {0.0f, 0.0f}
 Offset, in texture coordinates, to apply to the texture coordinates before sampling textures. More...
 
vec2 textureScale {1.0f, 1.0f}
 Coefficients to scale the texture coordinates by before sampling textures. More...
 
Color tintColor = Color::WHITE
 Tint color to use in the shader. More...
 
vec3 specularFactor {1.0f, 1.0f, 1.0f}
 Specular factor to use in the shader. More...
 
vec3 emissiveFactor {1.0f, 1.0f, 1.0f}
 Emissive factor to use in the shader. More...
 

Detailed Description

Configuration of a 3D Model instance, for drawing as part of a RenderPass.

Required fields:

Note
Consecutive 3D instances with the same shader and model will be batched and rendered together.
Examples
example_game.cpp.

Member Data Documentation

◆ shader

Shader3D* donut::graphics::ModelInstance::shader = Shader3D::BLINN_PHONG

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

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

◆ model

const Model* donut::graphics::ModelInstance::model

Non-owning pointer to the model to be drawn.

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

◆ diffuseMapOverride

const Texture* donut::graphics::ModelInstance::diffuseMapOverride = nullptr

Non-owning pointer to the texture to use for the base color, or nullptr to use the original textures specified by the model.

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

◆ specularMapOverride

const Texture* donut::graphics::ModelInstance::specularMapOverride = nullptr

Non-owning pointer to the texture to use for specular highlights, or nullptr to use the original textures specified by the model.

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

◆ normalMapOverride

const Texture* donut::graphics::ModelInstance::normalMapOverride = nullptr

Non-owning pointer to the texture to use for normal mapping, or nullptr to use the original textures specified by the model.

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

◆ emissiveMapOverride

const Texture* donut::graphics::ModelInstance::emissiveMapOverride = nullptr

Non-owning pointer to the texture to use for emissive mapping, or nullptr to use the original textures specified by the model.

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

◆ transformation

mat4 donut::graphics::ModelInstance::transformation = identity<mat4>()

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

◆ textureOffset

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

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

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

◆ textureScale

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

Coefficients to scale the texture coordinates by before sampling textures.

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

◆ tintColor

Color donut::graphics::ModelInstance::tintColor = Color::WHITE

Tint color to use in the shader.

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.

◆ specularFactor

vec3 donut::graphics::ModelInstance::specularFactor {1.0f, 1.0f, 1.0f}

Specular factor to use in the shader.

Note
In the default shader, the specular color is multiplied by this value, meaning that a value of (1, 1, 1) represents no modification to the original specular map color.

◆ emissiveFactor

vec3 donut::graphics::ModelInstance::emissiveFactor {1.0f, 1.0f, 1.0f}

Emissive factor to use in the shader.

Note
In the default shader, the emissive color is multiplied by this value, meaning that a value of (1, 1, 1) represents no modification to the original emissive map color.

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