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

Custom geometry for user-defined mesh rendering. More...

#include <CustomGeometry.hpp>

Public Member Functions

 CustomGeometry ()=default
 ~CustomGeometry ()=default
 CustomGeometry (const CustomGeometry &)=delete
CustomGeometry & operator= (const CustomGeometry &)=delete
 CustomGeometry (CustomGeometry &&)=default
CustomGeometry & operator= (CustomGeometry &&)=default
void init (GfxDevice &device, const f32 *vertices, u32 vertexCount, const VertexLayout &layout, bool dynamic=false)
 Initializes geometry with vertex data and layout.
void setIndices (const u16 *indices, u32 indexCount)
 Sets indices for indexed rendering.
void setIndices (const u32 *indices, u32 indexCount)
 Sets indices for indexed rendering (32-bit).
void updateVertices (const f32 *vertices, u32 vertexCount, u32 offset=0)
 Updates vertex data (only for dynamic geometry).
void bind (GfxDevice &device) const
 Binds the geometry's buffers for the next draw.
VertexLayoutHandle layoutHandle () const
 The device vertex layout a pipeline drawing this geometry must reference.
const IndexBuffer * indexBuffer () const
 Gets the index buffer (null when non-indexed).
u32 getIndexCount () const
 Gets the index count.
u32 getVertexCount () const
 Gets the vertex count.
u32 getVertexStride () const
 Byte stride of one vertex (0 before init) — boundary-validation source.
bool hasIndices () const
 Checks if geometry uses indices.
bool isDynamic () const
 Checks if geometry is dynamic.
bool isValid () const
 Checks if geometry is initialized.

Detailed Description

Custom geometry for user-defined mesh rendering.

Manages vertex buffer and index buffer with support for dynamic updates. Used for custom shapes, particles, trails, and other procedural geometry.

Definition at line 30 of file CustomGeometry.hpp.

Constructor & Destructor Documentation

◆ CustomGeometry() [1/3]

esengine::CustomGeometry::CustomGeometry ( )
default

◆ ~CustomGeometry()

esengine::CustomGeometry::~CustomGeometry ( )
default

◆ CustomGeometry() [2/3]

esengine::CustomGeometry::CustomGeometry ( const CustomGeometry & )
delete

References CustomGeometry().

◆ CustomGeometry() [3/3]

esengine::CustomGeometry::CustomGeometry ( CustomGeometry && )
default

References CustomGeometry().

Member Function Documentation

◆ bind()

void esengine::CustomGeometry::bind ( GfxDevice & device) const

Binds the geometry's buffers for the next draw.

Definition at line 105 of file CustomGeometry.cpp.

References esengine::Invalid, isValid(), esengine::GfxDevice::setIndexBuffer(), and esengine::GfxDevice::setVertexBuffer().

Referenced by esengine::drawGeometry().

◆ getIndexCount()

u32 esengine::CustomGeometry::getIndexCount ( ) const

Gets the index count.

Definition at line 111 of file CustomGeometry.cpp.

Referenced by esengine::drawGeometry().

◆ getVertexCount()

u32 esengine::CustomGeometry::getVertexCount ( ) const
inline

Gets the vertex count.

Definition at line 94 of file CustomGeometry.hpp.

Referenced by esengine::drawGeometry().

◆ getVertexStride()

u32 esengine::CustomGeometry::getVertexStride ( ) const
inline

Byte stride of one vertex (0 before init) — boundary-validation source.

Definition at line 97 of file CustomGeometry.hpp.

◆ hasIndices()

bool esengine::CustomGeometry::hasIndices ( ) const

Checks if geometry uses indices.

Definition at line 118 of file CustomGeometry.cpp.

Referenced by esengine::drawGeometry().

◆ indexBuffer()

const IndexBuffer * esengine::CustomGeometry::indexBuffer ( ) const
inline

Gets the index buffer (null when non-indexed).

Definition at line 84 of file CustomGeometry.hpp.

Referenced by esengine::drawGeometry().

◆ init()

◆ isDynamic()

bool esengine::CustomGeometry::isDynamic ( ) const
inline

Checks if geometry is dynamic.

Definition at line 107 of file CustomGeometry.hpp.

◆ isValid()

bool esengine::CustomGeometry::isValid ( ) const
inline

Checks if geometry is initialized.

Definition at line 112 of file CustomGeometry.hpp.

References esengine::Invalid.

Referenced by bind(), setIndices(), and setIndices().

◆ layoutHandle()

VertexLayoutHandle esengine::CustomGeometry::layoutHandle ( ) const
inline

The device vertex layout a pipeline drawing this geometry must reference.

Definition at line 79 of file CustomGeometry.hpp.

Referenced by esengine::applyMeshPipeline().

◆ operator=() [1/2]

CustomGeometry & esengine::CustomGeometry::operator= ( const CustomGeometry & )
delete

References CustomGeometry().

◆ operator=() [2/2]

CustomGeometry & esengine::CustomGeometry::operator= ( CustomGeometry && )
default

References CustomGeometry().

◆ setIndices() [1/2]

void esengine::CustomGeometry::setIndices ( const u16 * indices,
u32 indexCount )

Sets indices for indexed rendering.

Parameters
indicesPointer to index data
indexCountNumber of indices

Definition at line 80 of file CustomGeometry.cpp.

References esengine::IndexBuffer::create(), isValid(), and esengine::GfxContent::retained().

◆ setIndices() [2/2]

void esengine::CustomGeometry::setIndices ( const u32 * indices,
u32 indexCount )

Sets indices for indexed rendering (32-bit).

Parameters
indicesPointer to index data
indexCountNumber of indices

Definition at line 85 of file CustomGeometry.cpp.

References esengine::IndexBuffer::create(), isValid(), and esengine::GfxContent::retained().

◆ updateVertices()

void esengine::CustomGeometry::updateVertices ( const f32 * vertices,
u32 vertexCount,
u32 offset = 0 )

Updates vertex data (only for dynamic geometry).

Parameters
verticesPointer to new vertex data
vertexCountNumber of floats
offsetOffset in floats from start

Definition at line 90 of file CustomGeometry.cpp.

References ES_LOG_WARN.


The documentation for this class was generated from the following files: