Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
esengine::resource::MeshArena Class Reference

#include <MeshArena.hpp>

Classes

struct  Slot
struct  Binding

Public Member Functions

void init (GfxDevice &device)
void shutdown ()
bool place (const VertexLayoutDesc &layout, GfxContent content, ConstSpan< u8 > vertexBytes, u32 stride, ConstSpan< u32 > indices, Slot &slot, Binding &binding)
 Places a mesh: its vertices copied into a page of its shape, its indices rebased onto the page's.
void free (const Slot &slot)
u32 pageCount () const
u64 pageBytes () const

Static Public Member Functions

static bool sameLayout (const VertexLayoutDesc &a, const VertexLayoutDesc &b)

Static Public Attributes

static constexpr u32 kFirstPageBytes = 1u << 20
static constexpr u32 kMaxPageBytes = 32u << 20

Detailed Description

Definition at line 33 of file MeshArena.hpp.

Member Function Documentation

◆ free()

void esengine::resource::MeshArena::free ( const Slot & slot)
inline

◆ init()

void esengine::resource::MeshArena::init ( GfxDevice & device)
inline

Definition at line 56 of file MeshArena.hpp.

◆ pageBytes()

u64 esengine::resource::MeshArena::pageBytes ( ) const
inline

Definition at line 144 of file MeshArena.hpp.

◆ pageCount()

u32 esengine::resource::MeshArena::pageCount ( ) const
inline

Pages standing, for a profiler: how many and the bytes they hold on the GPU.

Definition at line 139 of file MeshArena.hpp.

◆ place()

bool esengine::resource::MeshArena::place ( const VertexLayoutDesc & layout,
GfxContent content,
ConstSpan< u8 > vertexBytes,
u32 stride,
ConstSpan< u32 > indices,
Slot & slot,
Binding & binding )
inline

Places a mesh: its vertices copied into a page of its shape, its indices rebased onto the page's.

Returns
false when it is not placed (bigger than a page may be, or the device refused a page); the caller then gives the mesh buffers of its own.

Definition at line 70 of file MeshArena.hpp.

References esengine::resource::MeshArena::Slot::firstIndex, esengine::resource::MeshArena::Slot::firstVertex, esengine::resource::MeshArena::Binding::indexBuffer, esengine::resource::MeshArena::Slot::indexCount, kFirstPageBytes, kMaxPageBytes, esengine::resource::MeshArena::Binding::layout, esengine::resource::MeshArena::Slot::page, sameLayout(), esengine::resource::MeshArena::Binding::vertexBuffer, and esengine::resource::MeshArena::Slot::vertexCount.

◆ sameLayout()

◆ shutdown()

void esengine::resource::MeshArena::shutdown ( )
inline

Deletes every page. The meshes in them are gone already, or are about to be.

Definition at line 59 of file MeshArena.hpp.

Member Data Documentation

◆ kFirstPageBytes

u32 esengine::resource::MeshArena::kFirstPageBytes = 1u << 20
staticconstexpr

The first page of a shape holds this much, and each one after it twice the last, up to kMaxPageBytes: a game with one small model does not pay for a page sized for a city.

Definition at line 53 of file MeshArena.hpp.

Referenced by place().

◆ kMaxPageBytes

u32 esengine::resource::MeshArena::kMaxPageBytes = 32u << 20
staticconstexpr

Definition at line 54 of file MeshArena.hpp.

Referenced by place().


The documentation for this class was generated from the following file:
  • /home/runner/work/estella/estella/src/esengine/resource/MeshArena.hpp