VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
visutwin::canvas::VertexBuffer Class Referenceabstract

#include <platform/graphics/vertexBuffer.h>

Inheritance diagram for visutwin::canvas::VertexBuffer:
[legend]

Public Member Functions

std::shared_ptr< VertexFormatformat () const
virtual void * nativeBuffer () const
int numVertices () const
bool setData (const std::vector< uint8_t > &data)
const std::vector< uint8_t > & storage () const
virtual void unlock ()=0
 VertexBuffer (GraphicsDevice *graphicsDevice, std::shared_ptr< VertexFormat > format, int numVertices, const VertexBufferOptions &options=VertexBufferOptions{})
virtual ~VertexBuffer ()

Protected Member Functions

 VertexBuffer (GraphicsDevice *device, std::shared_ptr< VertexFormat > format, int numVertices, int numBytes)

Protected Attributes

GraphicsDevice_device
std::vector< uint8_t > _storage

Detailed Description

A vertex buffer is the mechanism via which the application specifies vertex data to the graphics hardware

Definition at line 30 of file vertexBuffer.h.

Constructor & Destructor Documentation

◆ VertexBuffer() [1/2]

visutwin::canvas::VertexBuffer::VertexBuffer ( GraphicsDevice * graphicsDevice,
std::shared_ptr< VertexFormat > format,
int numVertices,
const VertexBufferOptions & options = VertexBufferOptions{} )

◆ ~VertexBuffer()

visutwin::canvas::VertexBuffer::~VertexBuffer ( )
virtual

Definition at line 52 of file vertexBuffer.cpp.

References _device.

◆ VertexBuffer() [2/2]

visutwin::canvas::VertexBuffer::VertexBuffer ( GraphicsDevice * device,
std::shared_ptr< VertexFormat > format,
int numVertices,
int numBytes )
protected

Zero-copy constructor: creates a VertexBuffer with no CPU-side _storage. Used when the GPU buffer is provided externally (e.g., compute shader output). The _storage vector remains empty — the GPU buffer is set via the subclass.

Definition at line 44 of file vertexBuffer.cpp.

References _device, visutwin::canvas::BUFFER_STATIC, format(), and numVertices().

Member Function Documentation

◆ format()

std::shared_ptr< VertexFormat > visutwin::canvas::VertexBuffer::format ( ) const
inline

◆ nativeBuffer()

virtual void * visutwin::canvas::VertexBuffer::nativeBuffer ( ) const
inlinevirtual

Reimplemented in visutwin::canvas::MetalVertexBuffer.

Definition at line 49 of file vertexBuffer.h.

◆ numVertices()

int visutwin::canvas::VertexBuffer::numVertices ( ) const
inline

◆ setData()

bool visutwin::canvas::VertexBuffer::setData ( const std::vector< uint8_t > & data)

Definition at line 69 of file vertexBuffer.cpp.

References _storage, and unlock().

◆ storage()

const std::vector< uint8_t > & visutwin::canvas::VertexBuffer::storage ( ) const
inline

CPU-side vertex data. Used by BatchManager to read vertex positions/normals for merging.

Definition at line 52 of file vertexBuffer.h.

References _storage.

◆ unlock()

virtual void visutwin::canvas::VertexBuffer::unlock ( )
pure virtual

Implemented in visutwin::canvas::MetalVertexBuffer.

Referenced by setData().

Member Data Documentation

◆ _device

GraphicsDevice* visutwin::canvas::VertexBuffer::_device
protected

◆ _storage

std::vector<uint8_t> visutwin::canvas::VertexBuffer::_storage
protected

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