Visual Computing Library  devel
Loading...
Searching...
No Matches
vcl::MeshRenderBuffers< Mesh > Class Template Reference
Inheritance diagram for vcl::MeshRenderBuffers< Mesh >:

Public Member Functions

void bindIndexBuffers (const MeshRenderSettings &mrs, uint chunkToBind=UINT_NULL) const
 
uint64_t bindMaterials (const MeshRenderSettings &mrs, uint chunkNumber, const MeshType &m) const
 Sets and binds the material uniforms for the given triangle chunk, and returns the render state associated to the material that must be set for the draw call.
 
void bindTextures (const MeshRenderSettings &mrs, uint chunkNumber, const MeshType &m) const
 
void bindUniforms () const
 
void bindVertexBuffers (const MeshRenderSettings &mrs) const
 
void bindVertexQuadBuffer () const
 
void computeQuadVertexBuffers (const MeshType &mesh, const bgfx::ViewId viewId) const
 
void drawEdgeLines (uint viewId) const
 
void drawWireframeLines (uint viewId) const
 
 MeshRenderBuffers (const MeshRenderBuffers &other)=delete
 
 MeshRenderBuffers (const MeshType &mesh, MRI::BuffersBitSet buffersToFill=MRI::BUFFERS_ALL)
 
 MeshRenderBuffers (MeshRenderBuffers &&other)
 
MeshRenderBuffersoperator= (const MeshRenderBuffers &other)=delete
 
MeshRenderBuffersoperator= (MeshRenderBuffers &&other)
 
void swap (MeshRenderBuffers &other)
 
uint triangleChunksNumber () const
 
void updateEdgeSettings (const MeshRenderSettings &mrs)
 
void updateWireframeSettings (const MeshRenderSettings &mrs)
 
- Public Member Functions inherited from vcl::MeshRenderData< MeshRenderBuffers< Mesh > >
void update (const MeshConcept auto &mesh, MRI::BuffersBitSet buffersToUpdate=MRI::BUFFERS_ALL)
 Update the buffers used to render the mesh.
 

Private Types

using Base = MeshRenderData< MeshRenderBuffers< MeshType > >
 
using MeshType = Mesh
 
using MRI = MeshRenderInfo
 

Private Member Functions

void computeEdgeLines (const MeshType &mesh)
 
void computeWireframeLines (const MeshType &mesh)
 
void createTextureSamplerUniforms ()
 
template<typename T >
std::pair< T *, bgfx::ReleaseFn > getAllocatedBufferAndReleaseFn (uint size)
 
void setEdgeIndicesBuffer (const MeshType &mesh)
 
void setMeshUniforms (const MeshType &mesh)
 
void setTextures (const MeshType &mesh)
 
void setTriangleColorsBuffer (const MeshType &mesh)
 
void setTriangleIndicesBuffer (const MeshType &mesh)
 
void setTriangleNormalsBuffer (const MeshType &mesh)
 
void setVertexColorsBuffer (const MeshType &mesh)
 
void setVertexNormalsBuffer (const MeshType &mesh)
 
void setVertexPositionsBuffer (const MeshType &mesh)
 
void setVertexQuadIndexBuffer (const MeshType &mesh)
 The function allocates and fills a GPU index buffer to render a quad for each vertex of the mesh.
 
void setVertexTangentsBuffer (const MeshType &mesh)
 
void setVertexTexCoordsBuffer (const MeshType &mesh)
 
void setWedgeTexCoordsBuffer (const MeshType &mesh)
 
void setWireframeIndicesBuffer (const MeshType &mesh)
 

Private Attributes

friend Base
 
Lines mEdgeLines
 
std::map< std::string, TexturemMaterialTextures
 
MaterialUniforms mMaterialUniforms
 
Color mMeshColor
 
DrawableMeshUniforms mMeshUniforms
 
std::array< Uniform, N_TEXTURE_TYPES > mTextureSamplerUniforms
 
IndexBuffer mTriangleColorBuffer
 
IndexBuffer mTriangleIndexBuffer
 
IndexBuffer mTriangleNormalBuffer
 
VertexBuffer mVertexColorsBuffer
 
VertexBuffer mVertexNormalsBuffer
 
VertexBuffer mVertexPositionsBuffer
 
DynamicVertexBuffer mVertexQuadBuffer
 
bool mVertexQuadBufferGenerated = false
 
IndexBuffer mVertexQuadIndexBuffer
 
VertexBuffer mVertexTangentsBuffer
 
VertexBuffer mVertexUVBuffer
 
VertexBuffer mVertexWedgeUVBuffer
 
Lines mWireframeLines
 

Static Private Attributes

static const uint N_TEXTURE_TYPES
 

Friends

void swap (MeshRenderBuffers &a, MeshRenderBuffers &b)
 

Additional Inherited Members

- Protected Member Functions inherited from vcl::MeshRenderData< MeshRenderBuffers< Mesh > >
void fillEdgeColors (const EdgeMeshConcept auto &mesh, auto *buffer, Color::Format fmt)
 Given the mesh and a pointer to a buffer, fills the buffer with the edge colors of the mesh (each color is packed in a single uint).
 
void fillEdgeIndices (const EdgeMeshConcept auto &mesh, auto *buffer)
 Given the mesh and a pointer to a buffer, fills the buffer with the edge indices of the mesh.
 
void fillEdgeNormals (const EdgeMeshConcept auto &mesh, auto *buffer)
 Given the mesh and a pointer to a buffer, fills the buffer with the edge normals of the mesh.
 
void fillFaceMaterialIndices (const FaceMeshConcept auto &mesh, auto *buffer)
 Given the mesh and a pointer to a buffer, fills the buffer with the wedge texture indices of the mesh.
 
void fillTriangleColors (const FaceMeshConcept auto &mesh, auto *buffer, Color::Format fmt)
 Given the mesh and a pointer to a buffer, fills the buffer with the triangle colors of the mesh (each color is packed in a single uint).
 
void fillTriangleIndices (const FaceMeshConcept auto &mesh, auto *buffer)
 Given the mesh and a pointer to a buffer, fills the buffer with the triangle indices of the mesh.
 
void fillTriangleNormals (const FaceMeshConcept auto &mesh, auto *buffer)
 Given the mesh and a pointer to a buffer, fills the buffer with the triangle normals of the mesh.
 
void fillVertexColors (const MeshConcept auto &mesh, auto *buffer, Color::Format fmt)
 Given the mesh and a pointer to a buffer, fills the buffer with the vertex colors of the mesh (each color is packed in a single uint).
 
void fillVertexMaterialIndices (const FaceMeshConcept auto &mesh, auto *buffer)
 Given the mesh and a pointer to a buffer, fills the buffer with the vertex material indices of the mesh.
 
void fillVertexNormals (const MeshConcept auto &mesh, auto *buffer)
 Given the mesh and a pointer to a buffer, fills the buffer with the vertex normals of the mesh.
 
void fillVertexPositions (const MeshConcept auto &mesh, auto *buffer)
 Given the mesh and a pointer to a buffer, fills the buffer with the vertex positions of the mesh.
 
void fillVertexQuadIndices (const MeshConcept auto &mesh, auto *buffer)
 Given the mesh and a pointer to a buffer, fills the buffer with the vertex quad indices of the mesh (6 indices per vertex, 2 triangles per quad).
 
void fillVertexTangents (const MeshConcept auto &mesh, auto *buffer)
 Given the mesh and a pointer to a buffer, fills the buffer with the vertex tangent of the mesh.
 
void fillVertexTexCoords (const MeshConcept auto &mesh, auto *buffer)
 Given the mesh and a pointer to a buffer, fills the buffer with the vertex texcoords of the mesh.
 
void fillWedgeTexCoords (const FaceMeshConcept auto &mesh, auto *buffer)
 Given the mesh and a pointer to a buffer, fills the buffer with the wedge texcoors of the mesh.
 
void fillWireframeIndices (const FaceMeshConcept auto &mesh, auto *buffer)
 Given the mesh and a pointer to a buffer, fills the buffer with the wireframe indices of the mesh.
 
uint materialIndex (const MeshRenderSettings &mrs, uint chunkNumber) const
 Returns the material index for the given triangle chunk, according to the current render settings.
 
 MeshRenderData (MRI::BuffersBitSet buffersToFill)
 
uint numEdges () const
 Returns the number of edges that will be used to render the mesh.
 
uint numTris () const
 Returns the number of triangles that will be used to render the mesh.
 
uint numVerts () const
 Returns the number of vertices that will be used to render the mesh.
 
uint numWireframeLines () const
 Returns the number of wireframe lines that will be used to render the mesh.
 
void setEdgeColorsBuffer (const EdgeMeshConcept auto &)
 Function that sets the content of edge colors buffer and sends the data to the GPU.
 
void setEdgeIndicesBuffer (const EdgeMeshConcept auto &)
 Function that sets the content of edge indices buffer and sends the data to the GPU.
 
void setEdgeNormalsBuffer (const EdgeMeshConcept auto &)
 Function that sets the content of edge normals buffer and sends the data to the GPU.
 
void setFaceMaterialIndicesBuffer (const FaceMeshConcept auto &)
 Function that sets the content of face material indices buffer and sends the data to the GPU.
 
void setMeshUniforms (const MeshConcept auto &)
 Function that sets the mesh uniforms from the mesh.
 
void setTextures (const MeshConcept auto &)
 Function that sets the textures from the mesh and sends the data to the GPU.
 
void setTriangleColorsBuffer (const FaceMeshConcept auto &)
 Function that sets the content of triangle colors buffer and sends the data to the GPU.
 
void setTriangleIndicesBuffer (const FaceMeshConcept auto &)
 Function that sets the content of triangle indices buffer and sends the data to the GPU.
 
void setTriangleNormalsBuffer (const FaceMeshConcept auto &)
 Function that sets the content of triangle normals buffer and sends the data to the GPU.
 
void setVertexColorsBuffer (const MeshConcept auto &)
 Function that sets the content of vertex colors buffer and sends the data to the GPU.
 
void setVertexMaterialIndicesBuffer (const FaceMeshConcept auto &)
 Function that sets the content of vertex material indices buffer and sends the data to the GPU.
 
void setVertexNormalsBuffer (const MeshConcept auto &)
 Function that sets the content of vertex normals buffer and sends the data to the GPU.
 
void setVertexPositionsBuffer (const MeshConcept auto &)
 Function that sets the content of vertex positions buffer and sends the data to the GPU.
 
void setVertexTangentsBuffer (const MeshConcept auto &)
 Function that sets the content of vertex tangent buffer and sends the data to the GPU.
 
void setVertexTexCoordsBuffer (const MeshConcept auto &)
 Function that sets the content of vertex texture coordinates buffer and sends the data to the GPU.
 
void setWedgeTexCoordsBuffer (const MeshConcept auto &)
 Function that sets the content of wedge texture coordinates buffer and sends the data to the GPU.
 
void setWireframeIndicesBuffer (const FaceMeshConcept auto &)
 Function that sets the content of wireframe indices buffer and sends the data to the GPU.
 
void swap (MeshRenderData &other)
 
- Protected Attributes inherited from vcl::MeshRenderData< MeshRenderBuffers< Mesh > >
std::vector< TriangleMaterialChunk > mMaterialChunks
 

Member Function Documentation

◆ bindMaterials()

template<MeshConcept Mesh>
uint64_t vcl::MeshRenderBuffers< Mesh >::bindMaterials ( const MeshRenderSettings mrs,
uint  chunkNumber,
const MeshType m 
) const
inline

Sets and binds the material uniforms for the given triangle chunk, and returns the render state associated to the material that must be set for the draw call.

Parameters
mrs
chunkNumber
m
Returns
the render state associated to the material

◆ setVertexQuadIndexBuffer()

template<MeshConcept Mesh>
void vcl::MeshRenderBuffers< Mesh >::setVertexQuadIndexBuffer ( const MeshType mesh)
inlineprivate

The function allocates and fills a GPU index buffer to render a quad for each vertex of the mesh.

Parameters
[in]meshthe input mesh from which to get the data

Member Data Documentation

◆ N_TEXTURE_TYPES

template<MeshConcept Mesh>
const uint vcl::MeshRenderBuffers< Mesh >::N_TEXTURE_TYPES
inlinestaticprivate
Initial value:
=
@ COUNT
Utility value to get the number of texture types.

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