Oxygen Engine
Modern C++ 3D Engine using OpenGL
Loading...
Searching...
No Matches
oe::render::Mesh Class Reference

GPU mesh wrapper. More...

#include <OxygenEngine/render/mesh.h>

Inheritance diagram for oe::render::Mesh:
[legend]
Collaboration diagram for oe::render::Mesh:
[legend]

Public Member Functions

template<typename M >
 Mesh (const M &mesh, const MeshUsage usage=MeshUsage::STATIC)
 
void render (const uint32_t sub_mesh=0, const uint32_t mode=0x0004, const uint32_t offset=0)
 
- Public Member Functions inherited from oe::render::CommonMesh
void renderArrays (const uint32_t count, const uint32_t offset=0, const uint32_t mode=0x0004)
 
void setSubBufferData (const uint32_t size, const void *data, const uint32_t offset=0)
 
template<typename V >
void bindVertexAttributes ()
 
void enableVertexAttribPointer (uint32_t index, size_t offset, size_t total, int32_t componentCount)
 
void enableVertexAttribIPointer (uint32_t index, size_t offset, size_t total, int32_t componentCount)
 
template<typename VertexType , typename T >
void bindVertexAttributeToPointer (const uint32_t index, const size_t offset) noexcept
 
template<typename ComponentType >
void bindVertexAttributeToPointer (uint32_t index, size_t offset, size_t total) noexcept
 

Protected Attributes

std::vector< std::pair< uint32_t, uint32_t > > _ebos
 
- Protected Attributes inherited from oe::render::CommonMesh
uint32_t _vao = 0
 
uint32_t _vbo = 0
 
MeshUsage _usage
 

Additional Inherited Members

- Protected Member Functions inherited from oe::render::CommonMesh
 CommonMesh (MeshUsage usage)
 
void _prepare_mesh_vao (const size_t vertex_size, const size_t count, const void *data, const bool editable=false)
 
uint32_t _prepare_mesh_ebo (const size_t size, const void *data, const bool editable=false)
 

Detailed Description

GPU mesh wrapper.

Represents the mesh that will be uploaded to the GPU

If you want to use your own vertex layout, you need to specialize bindVertexAttributes() with your vertex type

For example :

Constructor & Destructor Documentation

◆ Mesh()

template<typename M >
oe::render::Mesh::Mesh ( const M mesh,
const MeshUsage  usage = MeshUsage::STATIC 
)
inline

Prepare buffers for the mesh

Note
will call bindVertexAttributes<VertexType> to bind vertex attributes to locations

Member Function Documentation

◆ render()

void oe::render::Mesh::render ( const uint32_t  sub_mesh = 0,
const uint32_t  mode = 0x0004,
const uint32_t  offset = 0 
)

Ask the GPU to render the mesh

Parameters
sub_meshMesh part to render
modeMeshDrawMode to specify how to render the mesh (default are triangles)

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