esp::gfx::PbrDrawable class

Base classes

class Drawable
Drawable for use with DrawableGroup.

Public types

struct PBRMaterialCache
struct PBRShaderConfig

Constructors, destructors, conversion operators

PbrDrawable(scene::SceneNode& node, Mn::GL::Mesh* mesh, gfx::Drawable::Flags& meshAttributeFlags, ShaderManager& shaderManager, DrawableConfiguration& cfg) explicit
Constructor, to create a PbrDrawable for the given object using shader and mesh. Adds drawable to given group and uses provided texture, and color for textured buffer and color shader output respectively.

Public functions

void setLightSetup(const Mn::ResourceKey& lightSetupKey) override
Set the light info.
void setShaderAttributesValues(const std::shared_ptr<metadata::attributes::PbrShaderAttributes>& _pbrShaderConfig)
Set the ref::metadata::attributes::PbrShaderAttributes, which controls the program flow and functionality of the shader. NOTE : changing boolean values will require the shader to be rebuilt before rendering can occur.

Protected functions

void draw(const Mn::Matrix4& transformationMatrix, Mn::SceneGraph::Camera3D& camera) override
overload draw function, see here for more details: https://doc.magnum.graphics/magnum/classMagnum_1_1SceneGraph_1_1Drawable.html#aca0d0a219aa4d7712316de55d67f2134
void updateShader()
Update the shader so it can correctly handle the current material, light setup, etc.

Protected variables

PbrShader::Flags flags_
ShaderManager& shaderManager_
Mn::Resource<Mn::GL::AbstractShaderProgram, PbrShader> shader_
std::shared_ptr<PbrIBLHelper> pbrIbl_
PBRMaterialCache matCache
PBRShaderConfig shaderConfig_
const gfx::Drawable::Flags meshAttributeFlags_

Function documentation

void esp::gfx::PbrDrawable::setLightSetup(const Mn::ResourceKey& lightSetupKey) override

Set the light info.

Parameters
lightSetupKey the key value for the light resource

void esp::gfx::PbrDrawable::draw(const Mn::Matrix4& transformationMatrix, Mn::SceneGraph::Camera3D& camera) override protected

overload draw function, see here for more details: https://doc.magnum.graphics/magnum/classMagnum_1_1SceneGraph_1_1Drawable.html#aca0d0a219aa4d7712316de55d67f2134

Parameters
transformationMatrix the transformation of the object (to which the drawable is attached) relative to camera
camera the camera that views and renders the world

Variable documentation

PBRMaterialCache esp::gfx::PbrDrawable::matCache protected

Local cache of material quantities to speed up access in draw

PBRShaderConfig esp::gfx::PbrDrawable::shaderConfig_ protected

Local cache of shader control values

const gfx::Drawable::Flags esp::gfx::PbrDrawable::meshAttributeFlags_ protected

Creation attributes of this drawable