Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
esengine::MaterialStore Class Reference

Maps a material handle to its resolved record. Owned by RenderContext so it is reachable from both the SDK binding (push) and the render collect path (read). More...

#include <MaterialStore.hpp>

Public Member Functions

 MaterialStore ()=default
 ~MaterialStore ()
 MaterialStore (const MaterialStore &)=delete
MaterialStore & operator= (const MaterialStore &)=delete
void setDevice (GfxDevice *device)
 The render path uses this device to create/upload/delete per-material UBOs.
void setResourceManager (resource::ResourceManager *resources)
 Resolves texture handles at bind time; without one, texture params bind nothing.
void forgetShader (resource::ShaderHandle shader)
void setBuiltinDefaults (TextureHandle white, TextureHandle black, TextureHandle flatNormal, TextureHandle ripples)
 The context's built-in fallbacks.
TextureHandle builtinDefault (MaterialDefaultTexture which) const
void setBuiltinDefaultArrays (TextureHandle white, TextureHandle black, TextureHandle flatNormal)
 The context's layers of white, black and a flat normal: what an unset textureArray param binds.
TextureHandle builtinDefault (const MaterialTextureSlot &slot) const
 What an unset param of slot binds: its declared default, as layers for an array (ripples are white there).
void rememberSource (resource::ShaderHandle shader, std::string source, std::string features)
u32 meshProgram (u32 materialId, resource::ResourceManager &resources, bool withNormals=false, bool skinned=false, bool envMapped=false, bool lightmapped=false, bool gbuffer=false, bool tangents=false, bool tipPass=false, bool opaque=false) const
void setLightingDirect (bool on)
bool lightingDirect () const
bool programWritesGBuffer (u32 programId) const
bool programWritesAlbedo (u32 programId) const
 Of those, the ones that also write the surface's diffuse colour (location 2, fragAlbedo).
void markGBufferProgram (u32 programId, bool albedo) const
 A program that is not a material's — the engine's own mesh shader — says it writes the record.
const std::string & shaderLabel (u32 materialId) const
 The name of the shader materialId draws with, or "default" for the path's own batch shader.
float vertexBounds (u32 materialId) const
bool hasVertexHook (u32 materialId) const
 Whether materialId bends its vertices (so its shadow has to bend too).
bool hasUntrackedDepthHook (u32 materialId) const
bool castsCutoutShadow (u32 materialId) const
u32 shadowProgram (u32 materialId, resource::ResourceManager &resources, bool withNormals, bool skinned, bool tangents=false) const
u32 prepassCoverageProgram (u32 materialId, resource::ResourceManager &resources, bool withNormals, bool skinned, bool tangents=false) const
u32 particleProgram (u32 materialId, resource::ResourceManager &resources) const
void registerLayout (resource::ShaderHandle shader, MaterialUniformLayout layout)
u64 revisionOf (u32 materialId) const
 What materialId is, as a number that changes whenever it does: its state, a param, a texture, its shader's layout.
u64 revision () const
 Changes whenever any material does (revisionOf), or one is added or removed.
void define (u32 materialId, const MaterialRecord &record)
void setUniform (u32 materialId, const std::string &name, const f32 *values, u32 arity)
void setTexture (u32 materialId, const std::string &name, resource::TextureHandle texture)
void undefine (u32 materialId)
const MaterialRecord * find (u32 materialId) const
 The record for materialId, or nullptr if the handle is 0 / unregistered.
bool usesSceneColor (u32 materialId) const
void setSceneColor (TextureHandle texture)
bool usesScreenColor (u32 materialId) const
void setScreenColor (TextureHandle texture)
resource::ShaderHandle shaderOf (u32 materialId) const
bool usesSceneDepth (u32 materialId) const
bool needsScenePicture (u32 materialId) const
void setSceneDepth (TextureHandle texture)
 The copy of the opaque scene's distances the frame took, or invalid when it took none. Bound to a material's u_sceneDepthMap unit.
bool alphaIsCoverage (u32 materialId) const
bool hasTipPass (u32 materialId) const
f32 hairShadowDensity (u32 materialId) const
 The hair shadow density materialId holds (see ParsedShader::hairShadowParam), 0 when its shader has none or it is off.
const MaterialUniformLayout * layoutFor (resource::ShaderHandle shader) const
void bindForDraw (u32 materialId, u32 samplerUnits=0xFFFFFFFFu)
bool bindThrough (u32 materialId, resource::ShaderHandle shader, const std::vector< std::pair< std::string, glm::vec4 > > &overrides, u32 scratch)
 Binds a material's values for a draw through another shader (a bake into a texture, a material drawn to a render target).
void setWorldUnitsPerMeter (f32 unitsPerMeter)
void clear ()
u32 builtVariantCount () const
 How many material program variants have been built. A prewarm counts what it caused by the difference, rather than by asking again.

Static Public Member Functions

static void seedSamplers (Shader &shader, const resource::ParsedShader &parsed)
 Point each of shader's texture params at its unit.
static MaterialUniformLayout layoutOf (const resource::ParsedShader &parsed)
static f32 paramValue (const MaterialRecord &m, const MaterialUniformLayout &layout, i32 index)

Detailed Description

Maps a material handle to its resolved record. Owned by RenderContext so it is reachable from both the SDK binding (push) and the render collect path (read).

Definition at line 203 of file MaterialStore.hpp.

Constructor & Destructor Documentation

◆ MaterialStore() [1/2]

esengine::MaterialStore::MaterialStore ( )
default

◆ ~MaterialStore()

esengine::MaterialStore::~MaterialStore ( )

Definition at line 23 of file MaterialStore.cpp.

References clear().

◆ MaterialStore() [2/2]

esengine::MaterialStore::MaterialStore ( const MaterialStore & )
delete

References MaterialStore().

Member Function Documentation

◆ alphaIsCoverage()

bool esengine::MaterialStore::alphaIsCoverage ( u32 materialId) const
inline

Whether materialId's output alpha is coverage now: its shader names a coverage param and this material holds it above zero.

Definition at line 511 of file MaterialStore.hpp.

References esengine::MaterialUniformLayout::Named::coverage, find(), layoutFor(), esengine::MaterialUniformLayout::named, paramValue(), and esengine::MaterialRecord::shaderRef.

Referenced by castsCutoutShadow(), and esengine::DrawList::execute().

◆ bindForDraw()

void esengine::MaterialStore::bindForDraw ( u32 materialId,
u32 samplerUnits = 0xFFFFFFFFu )

Uploads (when dirty) and binds the material's MaterialConstants UBO at binding 1. No-op for materials whose shader declares no params (uboBytes stays empty). Binds the material's block and its textures; a texture only where samplerUnits says the bound program reads its unit.

Definition at line 477 of file MaterialStore.cpp.

References builtinDefault(), esengine::resource::Handle< T >::id(), esengine::Invalid, esengine::MATERIAL_CONSTANTS_BINDING, esengine::GfxContent::retained(), esengine::MaterialRecord::shaderRef, esengine::MaterialRecord::textures, esengine::MaterialRecord::ubo, esengine::MaterialRecord::uboBytes, esengine::MaterialRecord::uboDirty, and esengine::Uniform.

Referenced by esengine::DrawList::execute().

◆ bindThrough()

bool esengine::MaterialStore::bindThrough ( u32 materialId,
resource::ShaderHandle shader,
const std::vector< std::pair< std::string, glm::vec4 > > & overrides,
u32 scratch )

Binds a material's values for a draw through another shader (a bake into a texture, a material drawn to a render target).

Matched by NAME, so the two need not lay their params out alike: each param of shader takes the material's value of the param of the same name (else its own default), each texture the material's texture of the same name (else its default). overrides then replace vec4 params for this draw alone. The block goes into scratch buffer scratch, one per draw of a frame: on WebGPU a buffer rewritten between draws of one frame holds its last contents for all of them.

Returns
False when the material or the shader's layout is unknown.

Definition at line 532 of file MaterialStore.cpp.

References esengine::MaterialParamSlot::arity, esengine::MaterialUniformLayout::blockSize, builtinDefault(), esengine::MaterialUniformLayout::find(), esengine::MaterialUniformLayout::findTexture(), esengine::resource::Handle< T >::id(), esengine::Invalid, esengine::MATERIAL_CONSTANTS_BINDING, esengine::MaterialParamSlot::offset, esengine::MaterialUniformLayout::params, esengine::MaterialRecord::shaderRef, esengine::MaterialRecord::textures, esengine::MaterialUniformLayout::textures, esengine::GfxContent::transient(), esengine::MaterialRecord::uboBytes, esengine::Uniform, and esengine::MaterialTextureSlot::unit.

◆ builtinDefault() [1/2]

TextureHandle esengine::MaterialStore::builtinDefault ( const MaterialTextureSlot & slot) const
inline

What an unset param of slot binds: its declared default, as layers for an array (ripples are white there).

Definition at line 234 of file MaterialStore.hpp.

References esengine::Black, builtinDefault(), esengine::MaterialTextureSlot::defaultTexture, esengine::FlatNormal, and esengine::MaterialTextureSlot::layered.

◆ builtinDefault() [2/2]

TextureHandle esengine::MaterialStore::builtinDefault ( MaterialDefaultTexture which) const

The context's current fallback for a declared default(...). One authority, so the post-process pipeline's params fall back to the same textures.

Definition at line 586 of file MaterialStore.cpp.

References esengine::Black, esengine::FlatNormal, esengine::Ripples, and esengine::White.

Referenced by bindForDraw(), bindThrough(), and builtinDefault().

◆ builtVariantCount()

u32 esengine::MaterialStore::builtVariantCount ( ) const
inline

How many material program variants have been built. A prewarm counts what it caused by the difference, rather than by asking again.

Definition at line 656 of file MaterialStore.hpp.

◆ castsCutoutShadow()

bool esengine::MaterialStore::castsCutoutShadow ( u32 materialId) const
inline

Whether materialId's caster has to be cut out by its alpha: its alpha is coverage now and the coverage param is the one the depth shader reads.

Definition at line 327 of file MaterialStore.hpp.

References alphaIsCoverage(), esengine::MaterialUniformLayout::Named::coverageIsCutoff, find(), layoutFor(), esengine::MaterialUniformLayout::named, and esengine::MaterialRecord::shaderRef.

◆ clear()

void esengine::MaterialStore::clear ( )

Frees every per-material GPU UBO and clears all records/layouts. Call while the device is still valid (RenderContext::shutdown).

Definition at line 58 of file MaterialStore.cpp.

References esengine::Invalid.

Referenced by ~MaterialStore(), and setResourceManager().

◆ define()

void esengine::MaterialStore::define ( u32 materialId,
const MaterialRecord & record )
inline

Pushes a material's resolved render state. Preserves any already-packed constants (an edit such as setBlendMode re-pushes state without clobbering uniforms); a shader change invalidates the old constants since the layout differs.

Definition at line 383 of file MaterialStore.hpp.

References esengine::MaterialRecord::revision, esengine::MaterialRecord::shaderRef, esengine::MaterialRecord::textures, esengine::MaterialRecord::ubo, esengine::MaterialRecord::uboBytes, and esengine::MaterialRecord::uboDirty.

◆ find()

const MaterialRecord * esengine::MaterialStore::find ( u32 materialId) const
inline

◆ forgetShader()

void esengine::MaterialStore::forgetShader ( resource::ShaderHandle shader)

Definition at line 37 of file MaterialStore.cpp.

References esengine::resource::Handle< T >::id().

Referenced by setResourceManager().

◆ hairShadowDensity()

f32 esengine::MaterialStore::hairShadowDensity ( u32 materialId) const
inline

The hair shadow density materialId holds (see ParsedShader::hairShadowParam), 0 when its shader has none or it is off.

Definition at line 528 of file MaterialStore.hpp.

References find(), esengine::MaterialUniformLayout::Named::hairShadow, layoutFor(), esengine::MaterialUniformLayout::named, paramValue(), and esengine::MaterialRecord::shaderRef.

◆ hasTipPass()

bool esengine::MaterialStore::hasTipPass ( u32 materialId) const
inline

Whether materialId draws a blended pass over its opaque one: its shader names a tip param and this material holds it above zero.

Definition at line 520 of file MaterialStore.hpp.

References find(), layoutFor(), esengine::MaterialUniformLayout::named, paramValue(), esengine::MaterialRecord::shaderRef, and esengine::MaterialUniformLayout::Named::tip.

◆ hasUntrackedDepthHook()

bool esengine::MaterialStore::hasUntrackedDepthHook ( u32 materialId) const
inline

An arbitrary vertex hook can depend on time or GPU state. A declared depth input lets a light-space capture track its silhouette through the instance and material instead.

Definition at line 319 of file MaterialStore.hpp.

References find(), and layoutFor().

◆ hasVertexHook()

bool esengine::MaterialStore::hasVertexHook ( u32 materialId) const
inline

Whether materialId bends its vertices (so its shadow has to bend too).

Definition at line 311 of file MaterialStore.hpp.

References find(), layoutFor(), esengine::MaterialRecord::shaderRef, and esengine::MaterialUniformLayout::vertexHook.

◆ layoutFor()

const MaterialUniformLayout * esengine::MaterialStore::layoutFor ( resource::ShaderHandle shader) const
inline

The registered #pragma-param layout for a shader program, or nullptr. The post-process pipeline reads it to pack pass params through the same reflected MaterialConstants block a material would use.

Definition at line 539 of file MaterialStore.hpp.

References esengine::resource::Handle< T >::id().

Referenced by alphaIsCoverage(), castsCutoutShadow(), hairShadowDensity(), hasTipPass(), hasUntrackedDepthHook(), hasVertexHook(), needsScenePicture(), shaderLabel(), usesSceneColor(), usesSceneDepth(), usesScreenColor(), and vertexBounds().

◆ layoutOf()

MaterialUniformLayout esengine::MaterialStore::layoutOf ( const resource::ParsedShader & parsed)
static

The layout a parsed shader's #pragma param reflection describes: the std140 block for the scalar and vector params (declared order is offset order) and a sampler slot for each texture param, at the unit the parser gave it. Material shaders and the chain's own last pass read their parameters through the same one.

Definition at line 392 of file MaterialStore.cpp.

References esengine::MaterialParamSlot::arity, esengine::MaterialUniformLayout::blockSize, esengine::MaterialUniformLayout::coverageParam, esengine::resource::ParsedShader::coverageParam, esengine::MaterialParamSlot::defaults, esengine::resource::ParsedShader::depthInput, esengine::MaterialUniformLayout::depthInputUnit, esengine::MaterialUniformLayout::findTexture(), esengine::MaterialUniformLayout::hairShadowParam, esengine::resource::ParsedShader::hairShadowParam, esengine::MaterialUniformLayout::highPrecision, esengine::resource::ParsedShader::highPrecision, esengine::resource::ParsedShader::materialBlockSize, esengine::materialDefaultByName(), esengine::MaterialUniformLayout::name, esengine::resource::ParsedShader::name, esengine::MaterialUniformLayout::params, esengine::resource::ParsedShader::properties, esengine::resource::Texture, esengine::MaterialUniformLayout::textures, esengine::MaterialUniformLayout::tipParam, esengine::resource::ParsedShader::tipParam, esengine::MaterialUniformLayout::usesGBuffer, esengine::resource::ParsedShader::usesGBuffer, esengine::MaterialUniformLayout::usesLights, esengine::resource::ParsedShader::usesLights, esengine::MaterialUniformLayout::vertexBounds, esengine::resource::ParsedShader::vertexBounds, esengine::MaterialUniformLayout::vertexHook, esengine::resource::ParsedShader::vertexHook, and esengine::MaterialParamSlot::worldUnits.

Referenced by esengine::material_compileEsshader().

◆ lightingDirect()

bool esengine::MaterialStore::lightingDirect ( ) const
inline

Definition at line 276 of file MaterialStore.hpp.

◆ markGBufferProgram()

void esengine::MaterialStore::markGBufferProgram ( u32 programId,
bool albedo ) const
inline

A program that is not a material's — the engine's own mesh shader — says it writes the record.

Definition at line 289 of file MaterialStore.hpp.

Referenced by meshProgram().

◆ meshProgram()

u32 esengine::MaterialStore::meshProgram ( u32 materialId,
resource::ResourceManager & resources,
bool withNormals = false,
bool skinned = false,
bool envMapped = false,
bool lightmapped = false,
bool gbuffer = false,
bool tangents = false,
bool tipPass = false,
bool opaque = false ) const

The program that draws materialId on resident geometry of this shape, compiled once and cached; 0 when the source was never kept or the variant fails, so the caller falls back rather than drawing it wrong.

Definition at line 104 of file MaterialStore.cpp.

References find(), esengine::Shader::getProgramId(), esengine::resource::ResourceManager::getShader(), esengine::resource::Handle< T >::id(), esengine::resource::Handle< T >::isValid(), markGBufferProgram(), and esengine::MaterialRecord::shaderRef.

◆ needsScenePicture()

bool esengine::MaterialStore::needsScenePicture ( u32 materialId) const
inline

Whether materialId is nothing without that copy: it fades into what is behind it, where water only falls back to a plainer look. Seeing one is why a frame with no chain of its own takes one.

Definition at line 501 of file MaterialStore.hpp.

References esengine::MaterialUniformLayout::Named::blendDistance, find(), layoutFor(), esengine::MaterialUniformLayout::named, and esengine::MaterialRecord::shaderRef.

Referenced by esengine::DrawList::anyNeedsScenePicture().

◆ operator=()

MaterialStore & esengine::MaterialStore::operator= ( const MaterialStore & )
delete

References MaterialStore().

◆ paramValue()

f32 esengine::MaterialStore::paramValue ( const MaterialRecord & m,
const MaterialUniformLayout & layout,
i32 index )
inlinestatic

A float param of m by its layout index, or 0 when there is none or it is not packed.

Definition at line 457 of file MaterialStore.hpp.

References esengine::MaterialParamSlot::offset, esengine::MaterialUniformLayout::params, and esengine::MaterialRecord::uboBytes.

Referenced by alphaIsCoverage(), hairShadowDensity(), hasTipPass(), and usesSceneColor().

◆ particleProgram()

u32 esengine::MaterialStore::particleProgram ( u32 materialId,
resource::ResourceManager & resources ) const

The program that draws materialId on PARTICLE geometry — the instanced quad an emitter streams. Same source, same author's fragment, a different engine vertex stage; 0 on the same terms as meshProgram.

Definition at line 284 of file MaterialStore.cpp.

◆ prepassCoverageProgram()

u32 esengine::MaterialStore::prepassCoverageProgram ( u32 materialId,
resource::ResourceManager & resources,
bool withNormals,
bool skinned,
bool tangents = false ) const

◆ programWritesAlbedo()

bool esengine::MaterialStore::programWritesAlbedo ( u32 programId) const
inline

Of those, the ones that also write the surface's diffuse colour (location 2, fragAlbedo).

Definition at line 285 of file MaterialStore.hpp.

Referenced by esengine::DrawList::execute().

◆ programWritesGBuffer()

bool esengine::MaterialStore::programWritesGBuffer ( u32 programId) const
inline

Whether programId is a variant that writes the surface record's second output — set when it was compiled for a pass that has one AND the material's shader has something to write (it mentions ES_GBUFFER). The draw list asks per command, so a pipeline says what its shader does.

Definition at line 281 of file MaterialStore.hpp.

Referenced by esengine::DrawList::execute().

◆ registerLayout()

void esengine::MaterialStore::registerLayout ( resource::ShaderHandle shader,
MaterialUniformLayout layout )
inline

Registers (or replaces) a shader's MaterialConstants layout — called when a shader authored with #pragma param is compiled, so materials on it can pack their uniforms. Filed under the HANDLE, not the program id: rebuilding the program (a device loss, a shader reload) changes the id, and a layout filed under the old one would be unreachable from the material that still names it.

Definition at line 356 of file MaterialStore.hpp.

References esengine::resource::Handle< T >::id(), esengine::resource::Handle< T >::isValid(), and esengine::MaterialUniformLayout::resolveNamed().

◆ rememberSource()

void esengine::MaterialStore::rememberSource ( resource::ShaderHandle shader,
std::string source,
std::string features )
inline

Keeps a material shader's SOURCE beside its handle, so the same material can be compiled for another vertex source later. Without it the store holds only the assembled program and a variant would need the author's file again.

Definition at line 257 of file MaterialStore.hpp.

References esengine::resource::Handle< T >::id(), and esengine::resource::Handle< T >::isValid().

◆ revision()

u64 esengine::MaterialStore::revision ( ) const
inline

Changes whenever any material does (revisionOf), or one is added or removed.

A reader that kept what it derived from many materials, or a pointer to a record, asks this once rather than revisionOf each: while it holds, every record kept is the one it was.

Definition at line 378 of file MaterialStore.hpp.

◆ revisionOf()

u64 esengine::MaterialStore::revisionOf ( u32 materialId) const
inline

What materialId is, as a number that changes whenever it does: its state, a param, a texture, its shader's layout.

Returns
0 for no material. A reader that derived something from a material keeps this beside it (see core/Revision.hpp).

Definition at line 368 of file MaterialStore.hpp.

References find(), and esengine::MaterialRecord::revision.

◆ seedSamplers()

void esengine::MaterialStore::seedSamplers ( Shader & shader,
const resource::ParsedShader & parsed )
static

◆ setBuiltinDefaultArrays()

void esengine::MaterialStore::setBuiltinDefaultArrays ( TextureHandle white,
TextureHandle black,
TextureHandle flatNormal )
inline

The context's layers of white, black and a flat normal: what an unset textureArray param binds.

Definition at line 228 of file MaterialStore.hpp.

◆ setBuiltinDefaults()

void esengine::MaterialStore::setBuiltinDefaults ( TextureHandle white,
TextureHandle black,
TextureHandle flatNormal,
TextureHandle ripples )
inline

The context's built-in fallbacks.

Definition at line 217 of file MaterialStore.hpp.

◆ setDevice()

void esengine::MaterialStore::setDevice ( GfxDevice * device)
inline

The render path uses this device to create/upload/delete per-material UBOs.

Definition at line 210 of file MaterialStore.hpp.

◆ setLightingDirect()

void esengine::MaterialStore::setLightingDirect ( bool on)
inline

Definition at line 275 of file MaterialStore.hpp.

◆ setResourceManager()

void esengine::MaterialStore::setResourceManager ( resource::ResourceManager * resources)

Resolves texture handles at bind time; without one, texture params bind nothing.

Definition at line 28 of file MaterialStore.cpp.

References MaterialStore(), clear(), forgetShader(), and esengine::resource::ResourceManager::setShaderRetiredCallback().

◆ setSceneColor()

void esengine::MaterialStore::setSceneColor ( TextureHandle texture)
inline

The copy of the opaque scene the frame took for the draws above, or invalid when it took none. Bound to a material's u_sceneColor unit unless the material was given a texture of its own there.

Definition at line 479 of file MaterialStore.hpp.

◆ setSceneDepth()

void esengine::MaterialStore::setSceneDepth ( TextureHandle texture)
inline

The copy of the opaque scene's distances the frame took, or invalid when it took none. Bound to a material's u_sceneDepthMap unit.

Definition at line 507 of file MaterialStore.hpp.

◆ setScreenColor()

void esengine::MaterialStore::setScreenColor ( TextureHandle texture)
inline

Definition at line 486 of file MaterialStore.hpp.

◆ setTexture()

void esengine::MaterialStore::setTexture ( u32 materialId,
const std::string & name,
resource::TextureHandle texture )
inline

Binds a texture to a named texture param's sampler unit. No-op if the material, its layout, or the texture param is unknown. Render path resolves it in bindForDraw.

Definition at line 429 of file MaterialStore.hpp.

References esengine::MaterialTextureSlot::unit.

◆ setUniform()

void esengine::MaterialStore::setUniform ( u32 materialId,
const std::string & name,
const f32 * values,
u32 arity )
inline

Writes a named param's float components into the material's std140 buffer at the offset its shader's layout reflects. No-op if the material/layout/param is unknown.

Definition at line 412 of file MaterialStore.hpp.

References esengine::MaterialParamSlot::arity, esengine::resource::Handle< T >::id(), esengine::MaterialParamSlot::offset, esengine::MaterialRecord::revision, esengine::MaterialRecord::shaderRef, esengine::MaterialRecord::uboBytes, and esengine::MaterialRecord::uboDirty.

◆ setWorldUnitsPerMeter()

void esengine::MaterialStore::setWorldUnitsPerMeter ( f32 unitsPerMeter)

Says what a world unit is (the project's units per metre). A param a material left at its default follows the change; one it set, to anything else, is the material's and stays.

Definition at line 454 of file MaterialStore.cpp.

References esengine::resource::Handle< T >::id(), esengine::MaterialRecord::revision, esengine::MaterialRecord::shaderRef, esengine::MaterialRecord::uboBytes, and esengine::MaterialRecord::uboDirty.

◆ shaderLabel()

const std::string & esengine::MaterialStore::shaderLabel ( u32 materialId) const
inline

The name of the shader materialId draws with, or "default" for the path's own batch shader.

Definition at line 295 of file MaterialStore.hpp.

References find(), layoutFor(), esengine::MaterialUniformLayout::name, and esengine::MaterialRecord::shaderRef.

Referenced by esengine::DrawList::execute().

◆ shaderOf()

resource::ShaderHandle esengine::MaterialStore::shaderOf ( u32 materialId) const
inline

Definition at line 487 of file MaterialStore.hpp.

References find(), and esengine::MaterialRecord::shaderRef.

◆ shadowProgram()

u32 esengine::MaterialStore::shadowProgram ( u32 materialId,
resource::ResourceManager & resources,
bool withNormals,
bool skinned,
bool tangents = false ) const

◆ undefine()

void esengine::MaterialStore::undefine ( u32 materialId)

Definition at line 50 of file MaterialStore.cpp.

References esengine::Invalid.

◆ usesSceneColor()

bool esengine::MaterialStore::usesSceneColor ( u32 materialId) const
inline

Whether materialId's shader reads the picture of what is behind it (declares u_sceneColor): refraction, a lens, anything that has to see the opaque scene as it stood before this draw. Such a draw is made after a copy of that picture is taken.

Definition at line 468 of file MaterialStore.hpp.

References find(), layoutFor(), esengine::MaterialUniformLayout::named, paramValue(), esengine::MaterialUniformLayout::Named::sceneColor, esengine::MaterialRecord::shaderRef, and esengine::MaterialUniformLayout::Named::transmission.

Referenced by esengine::DrawList::anyBlendedWithoutSceneColor(), esengine::DrawList::anyUsesSceneColor(), and esengine::DrawList::execute().

◆ usesSceneDepth()

bool esengine::MaterialStore::usesSceneDepth ( u32 materialId) const
inline

Whether materialId's shader reads how far the opaque scene behind it is (declares u_sceneDepthMap): water measuring its own depth, a fade where a surface meets what it lies on. Such a draw is also made after the scene's copy.

Definition at line 494 of file MaterialStore.hpp.

References find(), layoutFor(), esengine::MaterialUniformLayout::named, esengine::MaterialUniformLayout::Named::sceneDepth, and esengine::MaterialRecord::shaderRef.

Referenced by esengine::DrawList::anyUsesSceneDepth().

◆ usesScreenColor()

◆ vertexBounds()

float esengine::MaterialStore::vertexBounds ( u32 materialId) const
inline

How far materialId's vertex hook can move a vertex from the mesh's own bounds, in the mesh's local units; 0 for a material without one.

Definition at line 304 of file MaterialStore.hpp.

References find(), layoutFor(), esengine::MaterialRecord::shaderRef, and esengine::MaterialUniformLayout::vertexBounds.


The documentation for this class was generated from the following files: