|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
Meshes of one vertex shape sharing a vertex buffer, an index buffer and a layout. More...
#include "../core/Types.hpp"#include "../renderer/rhi/GfxDevice.hpp"#include "../renderer/rhi/GfxEnums.hpp"#include "../renderer/rhi/GfxContent.hpp"#include <algorithm>#include <cstring>#include <vector>

Go to the source code of this file.
Classes | |
| class | esengine::resource::MeshArena |
| struct | esengine::resource::MeshArena::Slot |
| struct | esengine::resource::MeshArena::Binding |
Namespaces | |
| namespace | esengine |
| namespace | esengine::resource |
Meshes of one vertex shape sharing a vertex buffer, an index buffer and a layout.
A mesh realized with buffers of its own is drawn with a vertex array of its own, and a scene of five hundred meshes switched vertex arrays five hundred times a frame (and pipelines with them, since a layout is part of a pipeline's key) though most of them have the same few shapes of vertex. Here the meshes of one shape take ranges of the same page: one layout, one vertex buffer, one index buffer, so a run of them is drawn without switching any of the three.
Indices are rebased when a mesh is placed (an index names a vertex of the page, not of the mesh): WebGL2 has no base vertex. Which is why a mesh that reads its own vertex number (a morph target's deltas are looked up by gl_VertexID) is not placed here, and keeps buffers of its own.
Pages belong to the device generation they were made on. After a loss, every page is owed, so every mesh in it is owed; its source rebuilds it, and the rebuild places it in a page of the new generation. A page whose last mesh has left is deleted.
Definition in file MeshArena.hpp.