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

#include <MeshRenderer.hpp>

Public Member Functions

 MeshRenderer ()=default
bool operator== (const MeshRenderer &) const =default
 Compared member by member: what the change audit checks a write of this component against (Registry::auditChanges).

Public Attributes

resource::TextureHandle texture
 Texture sampled by the mesh UVs (invalid = untextured, vertex colors only).
resource::TextureHandle normalMap
 Tangent-space normal map, applied on top of the geometry's own normals. Needs a mesh that HAS normals; its tangent frame is derived per pixel, so the geometry carries no tangent channel.
glm::vec4 color {1.0f, 1.0f, 1.0f, 1.0f}
 Color tint multiplied with per-vertex colors (white = unchanged).
i32 layer {0}
 Sorting layer (higher = rendered on top).
bool opaque {false}
 Drawn as an opaque surface: no blending, and it takes part in depth — which is what lets one mesh hide another wherever it is nearer, rather than whichever was submitted last. A glTF's OPAQUE alpha mode.
bool cullBackfaces {false}
 Skip triangles facing away from the camera — a closed model's inside. A glTF says this with doubleSided: false, which is its default.
bool lit {false}
 Lit by the scene's 2D lights (Light). A custom material overrides this.
bool castShadows {true}
 Whether it stands in the light's way: drawn into the shadow maps (and what shelters from rain). A surface light passes through, like water, says no.
glm::vec2 parallax {1.0f, 1.0f}
 Parallax scroll factor per axis. 1 = moves with the world (default, no parallax); <1 = scrolls slower than the camera (appears farther, e.g. a background); 0 = locked to the camera (e.g. a sky). The renderer offsets the mesh by camera_center * (1 - factor).
u32 material {0}
 Custom material ID (0 = use default batch shader).
bool enabled {true}
resource::MeshHandle mesh
 Geometry from an .esmesh, drawn INSTEAD of the inline vertices.
std::vector< MeshVertex2D > vertices
 Local-space vertices (triangle list, indexed).
std::vector< u32 > indices
 Triangle-list indices into vertices (validated on upload).
glm::vec2 localMin {0.0f, 0.0f}
 Local-space AABB of vertices, recomputed on upload — cull source.
glm::vec2 localMax {0.0f, 0.0f}

Detailed Description

Definition at line 48 of file MeshRenderer.hpp.

Constructor & Destructor Documentation

◆ MeshRenderer()

esengine::ecs::MeshRenderer::MeshRenderer ( )
default

Referenced by operator==().

Member Function Documentation

◆ operator==()

bool esengine::ecs::MeshRenderer::operator== ( const MeshRenderer & ) const
default

Compared member by member: what the change audit checks a write of this component against (Registry::auditChanges).

References MeshRenderer().

Member Data Documentation

◆ castShadows

bool esengine::ecs::MeshRenderer::castShadows {true}

Whether it stands in the light's way: drawn into the shadow maps (and what shelters from rain). A surface light passes through, like water, says no.

Definition at line 85 of file MeshRenderer.hpp.

Referenced by meshrendererApplyJS(), and meshrendererToJS().

◆ color

glm::vec4 esengine::ecs::MeshRenderer::color {1.0f, 1.0f, 1.0f, 1.0f}

Color tint multiplied with per-vertex colors (white = unchanged).

Definition at line 61 of file MeshRenderer.hpp.

Referenced by esengine::MeshPlugin::collect(), meshrendererApplyJS(), and meshrendererToJS().

◆ cullBackfaces

bool esengine::ecs::MeshRenderer::cullBackfaces {false}

Skip triangles facing away from the camera — a closed model's inside. A glTF says this with doubleSided: false, which is its default.

Definition at line 76 of file MeshRenderer.hpp.

Referenced by meshrendererApplyJS(), and meshrendererToJS().

◆ enabled

bool esengine::ecs::MeshRenderer::enabled {true}

Definition at line 99 of file MeshRenderer.hpp.

Referenced by meshrendererApplyJS(), and meshrendererToJS().

◆ indices

std::vector<u32> esengine::ecs::MeshRenderer::indices

Triangle-list indices into vertices (validated on upload).

Definition at line 121 of file MeshRenderer.hpp.

◆ layer

i32 esengine::ecs::MeshRenderer::layer {0}

Sorting layer (higher = rendered on top).

Definition at line 65 of file MeshRenderer.hpp.

Referenced by meshrendererApplyJS(), and meshrendererToJS().

◆ lit

bool esengine::ecs::MeshRenderer::lit {false}

Lit by the scene's 2D lights (Light). A custom material overrides this.

Definition at line 80 of file MeshRenderer.hpp.

Referenced by meshrendererApplyJS(), and meshrendererToJS().

◆ localMax

glm::vec2 esengine::ecs::MeshRenderer::localMax {0.0f, 0.0f}

Definition at line 125 of file MeshRenderer.hpp.

◆ localMin

glm::vec2 esengine::ecs::MeshRenderer::localMin {0.0f, 0.0f}

Local-space AABB of vertices, recomputed on upload — cull source.

Definition at line 124 of file MeshRenderer.hpp.

◆ material

u32 esengine::ecs::MeshRenderer::material {0}

Custom material ID (0 = use default batch shader).

Definition at line 96 of file MeshRenderer.hpp.

Referenced by meshrendererApplyJS(), and meshrendererToJS().

◆ mesh

resource::MeshHandle esengine::ecs::MeshRenderer::mesh

Geometry from an .esmesh, drawn INSTEAD of the inline vertices.

The difference is where the vertices live: the inline payload is rewritten into every frame, which is a re-upload of anything that does not change every frame.

Definition at line 108 of file MeshRenderer.hpp.

Referenced by esengine::meshRenderer_setMeshAll(), meshrendererApplyJS(), and meshrendererToJS().

◆ normalMap

resource::TextureHandle esengine::ecs::MeshRenderer::normalMap

Tangent-space normal map, applied on top of the geometry's own normals. Needs a mesh that HAS normals; its tangent frame is derived per pixel, so the geometry carries no tangent channel.

Definition at line 57 of file MeshRenderer.hpp.

Referenced by meshrendererApplyJS(), and meshrendererToJS().

◆ opaque

bool esengine::ecs::MeshRenderer::opaque {false}

Drawn as an opaque surface: no blending, and it takes part in depth — which is what lets one mesh hide another wherever it is nearer, rather than whichever was submitted last. A glTF's OPAQUE alpha mode.

Definition at line 71 of file MeshRenderer.hpp.

Referenced by meshrendererApplyJS(), and meshrendererToJS().

◆ parallax

glm::vec2 esengine::ecs::MeshRenderer::parallax {1.0f, 1.0f}

Parallax scroll factor per axis. 1 = moves with the world (default, no parallax); <1 = scrolls slower than the camera (appears farther, e.g. a background); 0 = locked to the camera (e.g. a sky). The renderer offsets the mesh by camera_center * (1 - factor).

Definition at line 92 of file MeshRenderer.hpp.

Referenced by meshrendererApplyJS(), and meshrendererToJS().

◆ texture

resource::TextureHandle esengine::ecs::MeshRenderer::texture

Texture sampled by the mesh UVs (invalid = untextured, vertex colors only).

Definition at line 51 of file MeshRenderer.hpp.

Referenced by esengine::MeshPlugin::collect(), meshrendererApplyJS(), and meshrendererToJS().

◆ vertices

std::vector<MeshVertex2D> esengine::ecs::MeshRenderer::vertices

Local-space vertices (triangle list, indexed).

Definition at line 118 of file MeshRenderer.hpp.


The documentation for this struct was generated from the following file:
  • /home/runner/work/estella/estella/src/esengine/ecs/components/MeshRenderer.hpp