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

Engine-side material registry — the resolved "how to draw" for a material handle. More...

#include "../../core/Types.hpp"
#include "../../core/Revision.hpp"
#include "../../resource/Handle.hpp"
#include "../draw/BlendMode.hpp"
#include "../rhi/GfxEnums.hpp"
#include <glm/vec4.hpp>
#include <algorithm>
#include <cstring>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
Include dependency graph for MaterialStore.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  esengine::MaterialParamSlot
 One scalar/vector param's slot in a shader's std140 MaterialConstants block. More...
struct  esengine::MaterialTextureSlot
 A texture param's sampler unit (>= MATERIAL_TEXTURE_UNIT_BASE, above the batch's 0..7). More...
struct  esengine::MaterialTextureBinding
 A material's bound texture at a sampler unit. More...
struct  esengine::MaterialUniformLayout
 A shader's layout: std140 block (scalar/vector params) + texture sampler slots. More...
struct  esengine::MaterialUniformLayout::Named
struct  esengine::MaterialRecord
 A material's resolved render state (P0) plus its packed std140 constants (P1). More...
class  esengine::MaterialStore
 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...

Namespaces

namespace  esengine
namespace  esengine::resource

Enumerations

enum class  esengine::CullMode : u8 { esengine::None = 0 , esengine::Back = 1 , esengine::Front = 2 }
 Triangle culling mode baked into a material's pipeline. More...
enum class  esengine::MaterialDefaultTexture : u8 { esengine::White , esengine::Black , esengine::FlatNormal , esengine::Ripples }
 Which built-in texture a param falls back to when a material leaves it unset. More...

Functions

MaterialDefaultTexture esengine::materialDefaultByName (const std::string &name)
 Maps a shader's declared default(<name>) to the built-in it names.

Detailed Description

Engine-side material registry — the resolved "how to draw" for a material handle.

A material is a first-class engine object: the SDK pushes its resolved render state here (defineMaterial) when the material is created or edited, and the render path looks it up by the handle a component carries (e.g. Sprite::material). This replaces the dead pull-callback + cache, where C++ called back into JS per material and the resolved data never reached a draw.

Per-material shader parameters live in a std140 MaterialConstants UBO (binding 1): a shader authored with #pragma param registers its layout here, and setUniform packs named values into the material's byte buffer by reflected offset. The render path uploads (when dirty) and binds that UBO per draw via bindForDraw.

Author
ESEngine Team
Date
2026

Definition in file MaterialStore.hpp.