MAGE  v0.171.0
Matthias Advanced Game Engine
mage::rendering::PrimitiveBatchMesh< VertexT, IndexT > Class Template Reference

#include <primitive_batch_mesh.hpp>

Inheritance diagram for mage::rendering::PrimitiveBatchMesh< VertexT, IndexT >:
mage::rendering::Mesh

Public Member Functions

 PrimitiveBatchMesh (ID3D11Device &device, std::size_t nb_vertices, const std::vector< IndexT > &indices, D3D11_PRIMITIVE_TOPOLOGY primitive_topology=D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST)
 
 PrimitiveBatchMesh (const PrimitiveBatchMesh &mesh)=delete
 
 PrimitiveBatchMesh (PrimitiveBatchMesh &&mesh) noexcept
 
virtual ~PrimitiveBatchMesh ()
 
PrimitiveBatchMeshoperator= (const PrimitiveBatchMesh &mesh)=delete
 
PrimitiveBatchMeshoperator= (PrimitiveBatchMesh &&mesh) noexcept
 
const BufferLock Lock (ID3D11DeviceContext &device_context, D3D11_MAP map_type, D3D11_MAPPED_SUBRESOURCE &mapped_buffer)
 
- Public Member Functions inherited from mage::rendering::Mesh
virtual ~Mesh ()
 
Meshoperator= (const Mesh &mesh)=delete
 
Meshoperator= (Mesh &&mesh) noexcept
 
std::size_t GetNumberOfVertices () const noexcept
 
std::size_t GetNumberOfIndices () const noexcept
 
std::size_t GetVertexSize () const noexcept
 
DXGI_FORMAT GetIndexFormat () const noexcept
 
D3D11_PRIMITIVE_TOPOLOGY GetPrimitiveTopology () const noexcept
 
void BindMesh (ID3D11DeviceContext &device_context) const noexcept
 
void BindMesh (ID3D11DeviceContext &device_context, D3D11_PRIMITIVE_TOPOLOGY topology) const noexcept
 
void Draw (ID3D11DeviceContext &device_context) const noexcept
 
void Draw (ID3D11DeviceContext &device_context, std::size_t start_index, std::size_t nb_indices) const noexcept
 

Private Member Functions

void SetupVertexBuffer (ID3D11Device &device, std::size_t nb_vertices)
 
void SetupIndexBuffer (ID3D11Device &device, const std::vector< IndexT > &indices)
 

Additional Inherited Members

- Protected Member Functions inherited from mage::rendering::Mesh
 Mesh (std::size_t vertex_size, DXGI_FORMAT index_format, D3D11_PRIMITIVE_TOPOLOGY primitive_topology)
 
 Mesh (const Mesh &mesh)=delete
 
 Mesh (Mesh &&mesh) noexcept
 
void SetNumberOfVertices (std::size_t nb_vertices) noexcept
 
void SetNumberOfIndices (std::size_t nb_indices) noexcept
 
- Protected Attributes inherited from mage::rendering::Mesh
ComPtr< ID3D11Buffer > m_vertex_buffer
 
ComPtr< ID3D11Buffer > m_index_buffer
 

Detailed Description

template<typename VertexT, typename IndexT>
class mage::rendering::PrimitiveBatchMesh< VertexT, IndexT >

A class of primitive batch meshes.

Template Parameters
VertexTThe vertex type.
IndexTThe index type.

Constructor & Destructor Documentation

◆ PrimitiveBatchMesh() [1/3]

template<typename VertexT, typename IndexT>
mage::rendering::PrimitiveBatchMesh< VertexT, IndexT >::PrimitiveBatchMesh ( ID3D11Device &  device,
std::size_t  nb_vertices,
const std::vector< IndexT > &  indices,
D3D11_PRIMITIVE_TOPOLOGY  primitive_topology = D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST 
)
explicit

Constructs a primitive batch mesh.

Parameters
[in,out]deviceA reference to the device.
[in]nb_verticesThe number of vertices.
[in]indicesA reference to the vector containing the indices.
[in]primitive_topologyThe primitive topology.
Exceptions
ExceptionFailed to setup the vertex buffer of the primitive batch mesh.
ExceptionFailed to setup the index buffer of the primitive batch mesh.

◆ PrimitiveBatchMesh() [2/3]

template<typename VertexT, typename IndexT>
mage::rendering::PrimitiveBatchMesh< VertexT, IndexT >::PrimitiveBatchMesh ( const PrimitiveBatchMesh< VertexT, IndexT > &  mesh)
delete

Constructs a primitive batch mesh from the given primitive batch mesh.

Parameters
[in]meshA reference to the primitive batch mesh to copy.

◆ PrimitiveBatchMesh() [3/3]

template<typename VertexT, typename IndexT>
mage::rendering::PrimitiveBatchMesh< VertexT, IndexT >::PrimitiveBatchMesh ( PrimitiveBatchMesh< VertexT, IndexT > &&  mesh)
noexcept

Constructs a primitive batch mesh by moving the given primitive batch mesh.

Parameters
[in]meshA reference to the primitive batch mesh to move.

◆ ~PrimitiveBatchMesh()

template<typename VertexT, typename IndexT>
virtual mage::rendering::PrimitiveBatchMesh< VertexT, IndexT >::~PrimitiveBatchMesh ( )
virtual

Destructs this primitive batch mesh.

Member Function Documentation

◆ Lock()

template<typename VertexT, typename IndexT>
const BufferLock mage::rendering::PrimitiveBatchMesh< VertexT, IndexT >::Lock ( ID3D11DeviceContext &  device_context,
D3D11_MAP  map_type,
D3D11_MAPPED_SUBRESOURCE &  mapped_buffer 
)

Locks the vertex buffer of this primitive batch mesh.

Parameters
[in,out]device_contextA reference to the device context.
[in]map_typeThe map type specifying the CPU's read and write permissions for the vertex buffer of this primitive batch mesh.
[in,out]mapped_bufferA reference to map the vertex buffer of this primitive batch mesh to.
Exceptions
ExceptionFailed to map the vertex buffer of this primitive batch mesh.

◆ operator=() [1/2]

template<typename VertexT, typename IndexT>
PrimitiveBatchMesh& mage::rendering::PrimitiveBatchMesh< VertexT, IndexT >::operator= ( const PrimitiveBatchMesh< VertexT, IndexT > &  mesh)
delete

Copies the given primitive batch mesh to this primitive batch mesh.

Parameters
[in]meshA reference to the primitive batch mesh to copy.
Returns
A reference to the copy of the given primitive batch mesh (i.e. this primitive batch mesh).

◆ operator=() [2/2]

template<typename VertexT, typename IndexT>
PrimitiveBatchMesh& mage::rendering::PrimitiveBatchMesh< VertexT, IndexT >::operator= ( PrimitiveBatchMesh< VertexT, IndexT > &&  mesh)
noexcept

Moves the given primitive batch mesh to this primitive batch mesh.

Parameters
[in]meshA reference to the primitive batch mesh to move.
Returns
A reference to the moved primitive batch mesh (i.e. this primitive batch mesh).

◆ SetupIndexBuffer()

template<typename VertexT, typename IndexT>
void mage::rendering::PrimitiveBatchMesh< VertexT, IndexT >::SetupIndexBuffer ( ID3D11Device &  device,
const std::vector< IndexT > &  indices 
)
private

Sets up the index buffer of this primitive batch mesh.

Parameters
[in,out]deviceA reference to the device.
[in]indicesA reference to the vector containing the indices.
Exceptions
ExceptionFailed to setup the index buffer of this primitive batch mesh.

◆ SetupVertexBuffer()

template<typename VertexT, typename IndexT>
void mage::rendering::PrimitiveBatchMesh< VertexT, IndexT >::SetupVertexBuffer ( ID3D11Device &  device,
std::size_t  nb_vertices 
)
private

Sets up the vertex buffer of this primitive batch mesh.

Parameters
[in,out]deviceA reference to the device.
[in]nb_verticesThe number of vertices.
Exceptions
ExceptionFailed to setup the vertex buffer of this primitive batch mesh.