Monad Engine da02fba2
> Undercity Codex_
Loading...
Searching...
No Matches
Material.h File Reference

Container that pairs a ShaderProgram with typed uniform parameters. More...

#include <memory>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#include <glm/mat4x4.hpp>
#include "Types.h"
#include "graphics/Texture.h"
+ Include dependency graph for Material.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  mnd::Material
 Shader + uniform storage that defines how a surface is rendered. More...
 

Namespaces

namespace  mnd
 

Detailed Description

Container that pairs a ShaderProgram with typed uniform parameters.

A Material answers the question "how should this surface look?". It holds:

  • A ShaderProgram (the GLSL pipeline to execute).
  • Named float / vec2 / vec3 / vec4 parameters → uploaded as uniforms.
  • Named Texture parameters → bound to texture units before each draw.

Typical per-frame usage

material->SetParam("uTime", iTime);
material->SetParam("uColor", 1.0f, 0.5f, 0.2f);
material->SetParam("uAlbedo", myTexture);
// Then submit a RenderCommand — RenderQueue calls Bind() internally.
std::shared_ptr< Material > material

Material::Bind() uploads all stored params to the active ShaderProgram. It is called by RenderQueue::Draw() just before each draw call.

Note
Material does not own a Mesh. The two are coupled only at submit time through a RenderCommand. This allows the same material to be reused across different meshes without duplication.
See also
RenderCommand, RenderQueue, ShaderProgram, Texture

Definition in file Material.h.