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

#include <static_mesh.hpp>

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

Public Member Functions

 StaticMesh (ID3D11Device &device, std::vector< VertexT > vertices, std::vector< IndexT > indices, D3D11_PRIMITIVE_TOPOLOGY primitive_topology=D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST)
 
 StaticMesh (const StaticMesh &mesh)=delete
 
 StaticMesh (StaticMesh &&mesh) noexcept
 
virtual ~StaticMesh ()
 
StaticMeshoperator= (const StaticMesh &mesh)=delete
 
StaticMeshoperator= (StaticMesh &&mesh) noexcept
 
- 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)
 
void SetupIndexBuffer (ID3D11Device &device)
 

Private Attributes

std::vector< VertexT > m_vertices
 
std::vector< IndexT > m_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::StaticMesh< VertexT, IndexT >

A class of static meshes.

Template Parameters
VertexTThe vertex type.
IndexTThe index type.

Constructor & Destructor Documentation

◆ StaticMesh() [1/3]

template<typename VertexT , typename IndexT >
mage::rendering::StaticMesh< VertexT, IndexT >::StaticMesh ( ID3D11Device &  device,
std::vector< VertexT >  vertices,
std::vector< IndexT >  indices,
D3D11_PRIMITIVE_TOPOLOGY  primitive_topology = D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST 
)
explicit

Constructs a static mesh.

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

◆ StaticMesh() [2/3]

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

Constructs a static mesh from the given static mesh.

Parameters
[in]meshA reference to the static mesh to copy.

◆ StaticMesh() [3/3]

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

Constructs a static mesh by moving the given static mesh.

Parameters
[in]meshA reference to the static mesh to move.

◆ ~StaticMesh()

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

Destructs this static mesh.

Member Function Documentation

◆ operator=() [1/2]

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

Copies the given static mesh to this static mesh.

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

◆ operator=() [2/2]

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

Moves the given static mesh to this static mesh.

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

◆ SetupIndexBuffer()

template<typename VertexT , typename IndexT >
void mage::rendering::StaticMesh< VertexT, IndexT >::SetupIndexBuffer ( ID3D11Device &  device)
private

Sets up the index buffer of this static mesh.

Parameters
[in,out]deviceA reference to the device.
Exceptions
ExceptionFailed to setup the index buffer of this static mesh.

◆ SetupVertexBuffer()

template<typename VertexT , typename IndexT >
void mage::rendering::StaticMesh< VertexT, IndexT >::SetupVertexBuffer ( ID3D11Device &  device)
private

Sets up the vertex buffer of this static mesh.

Parameters
[in,out]deviceA reference to the device.
Exceptions
ExceptionFailed to setup the vertex buffer of this static mesh.

Member Data Documentation

◆ m_indices

template<typename VertexT , typename IndexT >
std::vector< IndexT > mage::rendering::StaticMesh< VertexT, IndexT >::m_indices
private

The vector containing the indices of this static mesh.

◆ m_vertices

template<typename VertexT , typename IndexT >
std::vector< VertexT > mage::rendering::StaticMesh< VertexT, IndexT >::m_vertices
private

The vector containing the vertices of this static mesh.