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

Many placements of the one mesh a MeshRenderer draws, as ONE renderable. More...

#include <MeshRenderer.hpp>

Public Member Functions

 MeshInstances ()=default

Public Attributes

resource::MeshHandle lod1Mesh
 The cheaper mesh that stands in past lodDistance; invalid = the mesh itself at every distance. It must carry the same channels as the entity's mesh, or it is not used.
f32 lodDistance {0.0f}
 Metres from the eye past which lod1Mesh is drawn; 0 = never.
f32 minDistance {0.0f}
 Metres from the eye BEFORE which an instance is not drawn; 0 = from the eye outward. A far version of a plant is a set with this at the distance the near one ends, so the two hand over per instance without anything choosing between them.
f32 drawDistance {0.0f}
 Metres from the eye past which an instance is not drawn; 0 = at any distance. A shadow map is cut by the distance from the CAMERA, not from the light, so a caster too far to be seen does not cast.
f32 shadowDistance {0.0f}
 Metres from the eye past which an instance casts no shadow; 0 = as far as it is drawn. A tree far off still draws, but the shadow it casts is too small to be worth drawing it again into every shadow map.
std::vector< f32 > transforms
 Sixteen floats an instance: the model's three rows (translation in .w) then its tint RGBA, which is multiplied into the renderer's colour. Set by meshInstances_set, not by reflection.
glm::vec3 originMin {0.0f}
 The corners of the instances' ORIGINS and the greatest scale among them: with the mesh's own reach, what bounds the set. Recomputed on upload.
glm::vec3 originMax {0.0f}
f32 maxScale {1.0f}

Detailed Description

Many placements of the one mesh a MeshRenderer draws, as ONE renderable.

The mesh stays one and resident; this holds where each copy stands. The collect culls each copy against the view, picks its mesh by its distance from the eye and writes the survivors as the instances of one draw per mesh. The entity's Transform places the whole set: an instance is relative to it.

Definition at line 208 of file MeshRenderer.hpp.

Constructor & Destructor Documentation

◆ MeshInstances()

esengine::ecs::MeshInstances::MeshInstances ( )
default

Member Data Documentation

◆ drawDistance

f32 esengine::ecs::MeshInstances::drawDistance {0.0f}

Metres from the eye past which an instance is not drawn; 0 = at any distance. A shadow map is cut by the distance from the CAMERA, not from the light, so a caster too far to be seen does not cast.

Definition at line 226 of file MeshRenderer.hpp.

Referenced by meshinstancesApplyJS(), and meshinstancesToJS().

◆ lod1Mesh

resource::MeshHandle esengine::ecs::MeshInstances::lod1Mesh

The cheaper mesh that stands in past lodDistance; invalid = the mesh itself at every distance. It must carry the same channels as the entity's mesh, or it is not used.

Definition at line 212 of file MeshRenderer.hpp.

Referenced by meshinstancesApplyJS(), meshinstancesToJS(), and esengine::placementCoarseMesh().

◆ lodDistance

f32 esengine::ecs::MeshInstances::lodDistance {0.0f}

Metres from the eye past which lod1Mesh is drawn; 0 = never.

Definition at line 216 of file MeshRenderer.hpp.

Referenced by meshinstancesApplyJS(), and meshinstancesToJS().

◆ maxScale

f32 esengine::ecs::MeshInstances::maxScale {1.0f}

Definition at line 241 of file MeshRenderer.hpp.

Referenced by esengine::MeshPlugin::collect().

◆ minDistance

f32 esengine::ecs::MeshInstances::minDistance {0.0f}

Metres from the eye BEFORE which an instance is not drawn; 0 = from the eye outward. A far version of a plant is a set with this at the distance the near one ends, so the two hand over per instance without anything choosing between them.

Definition at line 221 of file MeshRenderer.hpp.

Referenced by meshinstancesApplyJS(), and meshinstancesToJS().

◆ originMax

glm::vec3 esengine::ecs::MeshInstances::originMax {0.0f}

Definition at line 240 of file MeshRenderer.hpp.

Referenced by esengine::MeshPlugin::collect().

◆ originMin

glm::vec3 esengine::ecs::MeshInstances::originMin {0.0f}

The corners of the instances' ORIGINS and the greatest scale among them: with the mesh's own reach, what bounds the set. Recomputed on upload.

Definition at line 239 of file MeshRenderer.hpp.

Referenced by esengine::MeshPlugin::collect().

◆ shadowDistance

f32 esengine::ecs::MeshInstances::shadowDistance {0.0f}

Metres from the eye past which an instance casts no shadow; 0 = as far as it is drawn. A tree far off still draws, but the shadow it casts is too small to be worth drawing it again into every shadow map.

Definition at line 231 of file MeshRenderer.hpp.

Referenced by meshinstancesApplyJS(), and meshinstancesToJS().

◆ transforms

std::vector<f32> esengine::ecs::MeshInstances::transforms

Sixteen floats an instance: the model's three rows (translation in .w) then its tint RGBA, which is multiplied into the renderer's colour. Set by meshInstances_set, not by reflection.

Definition at line 235 of file MeshRenderer.hpp.

Referenced by esengine::MeshPlugin::collect().


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