|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
Classes | |
| struct | Cluster |
| One cluster: its run of the hierarchy's indices, its own bounds and its group's. More... | |
| struct | ClusterHierarchy |
| A mesh's clusters and the indices they name, every level together. More... | |
| struct | ClusterEye |
| An eye as a hierarchy measures from it. More... | |
| struct | LevelSet |
| The screen sizes a group hands over at, in the order it hands them over. More... | |
| struct | SelectionCounts |
| What a frame's selections came to, counted where each one is made. More... | |
| class | LodViewState |
| Levels remembered per (view, entity) pair. More... | |
Functions | |
| f32 | clusterErrorOnScreen (const ClusterEye &eye, const f32 *centre, f32 radius, f32 error) |
The size on screen of error, read at the nearest point of the sphere it belongs to. | |
| bool | clusterDrawn (const ClusterEye &eye, const Cluster &cluster) |
Whether cluster is the level of its surface that eye draws. | |
| u32 | selectClusters (const ClusterHierarchy &hierarchy, const ClusterEye &eye, std::vector< u32 > &out) |
The clusters eye draws, in the hierarchy's order, into out. Returns the indices they hold together. | |
| u64 | cutSignature (const std::vector< u32 > &picked) |
| A number that changes when the picked clusters do: two cuts with the same one are drawn from the same buffer. | |
| void | assembleCut (const ClusterHierarchy &hierarchy, const std::vector< u32 > &picked, u32 vertexBase, std::vector< u32 > &out) |
The picked clusters' indices, one run after another, into out. | |
| bool | clusterHierarchyValid (const ClusterHierarchy &hierarchy, u32 vertexCount) |
Whether hierarchy is one a cut can be assembled from: every run inside the indices, every index a vertex. | |
| void | boundingSphere (const glm::vec3 &position, const glm::quat &rotation, const glm::vec3 &scale, const glm::vec3 &localMin, const glm::vec3 &localMax, glm::vec3 &outCentre, f32 &outRadius) |
| The sphere a group is measured by: its centre in the world and its radius. | |
| f32 | screenRelativeSize (const glm::mat4 &viewProjection, const glm::vec3 ¢re, f32 radius) |
| How much of the viewport's HEIGHT a sphere covers: 1 = one screen high. | |
| u8 | selectLevel (const LevelSet &set, f32 size, u8 current) |
The level size asks for, given the one shown last. | |
Variables | |
| constexpr f32 | kClusterNearGap = 1e-6f |
| The nearest a sphere's surface is taken to be: an eye inside one sees its error as large as it can be. | |
| constexpr u8 | kMaxStandIns = 3 |
| How many stand-ins a group may declare beyond the renderer's own mesh. | |
| constexpr u8 | kCulled = 0xFFu |
| The level of an object small enough that nothing is drawn for it. | |
| constexpr f32 | kSizeAtEye = 1e30f |
| What a point at or behind the eye reports. | |
| constexpr u8 | kNoPreview = 0xFEu |
| A preview slot holding no level, so the view's own choice is drawn. | |
|
inline |
The picked clusters' indices, one run after another, into out.
vertexBase is added to each: a mesh that shares a page of vertices with others draws with indices that count from the page's first vertex, not its own.
Definition at line 117 of file ClusterSelection.hpp.
References esengine::lod::ClusterHierarchy::clusters, esengine::lod::Cluster::firstIndex, esengine::lod::Cluster::indexCount, and esengine::lod::ClusterHierarchy::indices.
|
inline |
The sphere a group is measured by: its centre in the world and its radius.
A sphere rather than the turned box, because the radius is the same at every angle — a box's projected size breathes as its owner spins, which at a boundary is a level that changes for no reason but rotation.
Definition at line 57 of file LodSelection.hpp.
Referenced by esengine::MeshPlugin::collect().
|
inline |
Whether cluster is the level of its surface that eye draws.
Definition at line 82 of file ClusterSelection.hpp.
References esengine::lod::Cluster::centre, clusterErrorOnScreen(), esengine::lod::Cluster::error, esengine::lod::Cluster::groupCentre, esengine::lod::Cluster::groupError, esengine::lod::Cluster::groupRadius, esengine::lod::Cluster::radius, and esengine::lod::ClusterEye::threshold.
Referenced by selectClusters().
|
inline |
The size on screen of error, read at the nearest point of the sphere it belongs to.
Definition at line 74 of file ClusterSelection.hpp.
References esengine::lod::ClusterEye::flat, kClusterNearGap, esengine::lod::ClusterEye::position, and esengine::lod::ClusterEye::scale.
Referenced by clusterDrawn().
|
inline |
Whether hierarchy is one a cut can be assembled from: every run inside the indices, every index a vertex.
Asked once, when the hierarchy arrives from a file, so that drawing never has to.
Definition at line 140 of file ClusterSelection.hpp.
References esengine::lod::ClusterHierarchy::clusters, esengine::lod::Cluster::error, esengine::lod::Cluster::firstIndex, esengine::lod::Cluster::groupError, esengine::lod::Cluster::indexCount, and esengine::lod::ClusterHierarchy::indices.
Referenced by esengine::resource::ResourceManager::setMeshClusters().
A number that changes when the picked clusters do: two cuts with the same one are drawn from the same buffer.
Definition at line 102 of file ClusterSelection.hpp.
|
inline |
How much of the viewport's HEIGHT a sphere covers: 1 = one screen high.
The gradient of NDC y with respect to world position, times the radius; NDC spans 2, so that ratio IS the fraction. Both projections are in the matrix, so one expression answers for both. A fraction of the height is free of the viewport's pixel count and of its aspect.
Definition at line 73 of file LodSelection.hpp.
References kSizeAtEye.
Referenced by esengine::MeshPlugin::collect().
|
inline |
The clusters eye draws, in the hierarchy's order, into out. Returns the indices they hold together.
Definition at line 88 of file ClusterSelection.hpp.
References clusterDrawn(), esengine::lod::ClusterHierarchy::clusters, and esengine::lod::Cluster::indexCount.
The level size asks for, given the one shown last.
Each boundary is asymmetric — takeOver * (1 + hysteresis) to come back toward the fine side, the bare threshold to go coarse — because a boundary that is not a wall flips every frame for a breathing camera. current biases by one band only, so a stale one costs a frame.
Definition at line 93 of file LodSelection.hpp.
References esengine::lod::LevelSet::count, esengine::lod::LevelSet::cull, esengine::lod::LevelSet::hysteresis, kCulled, kMaxStandIns, and esengine::lod::LevelSet::takeOver.
Referenced by esengine::MeshPlugin::collect().
|
inlineconstexpr |
The nearest a sphere's surface is taken to be: an eye inside one sees its error as large as it can be.
Definition at line 71 of file ClusterSelection.hpp.
Referenced by clusterErrorOnScreen().
|
inlineconstexpr |
The level of an object small enough that nothing is drawn for it.
Definition at line 26 of file LodSelection.hpp.
Referenced by esengine::MeshPlugin::collect(), esengine::lod::SelectionCounts::record(), esengine::renderer_lodInspect(), and selectLevel().
|
inlineconstexpr |
How many stand-ins a group may declare beyond the renderer's own mesh.
Definition at line 23 of file LodSelection.hpp.
Referenced by esengine::gatherLodLevels(), esengine::lod::SelectionCounts::record(), and selectLevel().
|
inlineconstexpr |
A preview slot holding no level, so the view's own choice is drawn.
Definition at line 18 of file LodViewState.hpp.
Referenced by esengine::lod::LodViewState::drawn(), esengine::lod::LodViewState::preview(), and esengine::lod::LodViewState::previewOf().
|
inlineconstexpr |
What a point at or behind the eye reports.
It has no finite projection, and the only useful answer there is the one that picks the nearest level rather than the farthest.
Definition at line 34 of file LodSelection.hpp.
Referenced by screenRelativeSize().