|
VulkanEngine 0.1
Graphics engine using Vulkan
|
#include <Mesh.h>
Public Types | |
| template<typename T > | |
| using | AttributeContainer = std::vector< std::shared_ptr< VertexAttribute< T > > > |
Public Member Functions | |
| Mesh () | |
| Default constructor. | |
| Mesh (const std::shared_ptr< VertexAttribute< PositionType > > &_positions, const std::shared_ptr< IndexAttribute< IndexType > > &_indices, const std::tuple< AttributeContainer< AdditionalAttributeTypes >... > &_attributes, const std::shared_ptr< Shader > &_shader) | |
| virtual | ~Mesh () |
| Destructor. | |
| void | setPositions (const std::shared_ptr< VertexAttribute< PositionType > > &_positions) |
| void | setIndices (const std::shared_ptr< IndexAttribute< IndexType > > &_indices) |
| void | setAttributes (const std::tuple< AttributeContainer< AdditionalAttributeTypes >... > &_attributes) |
| void | setBoundingBox (const PositionType &max, const PositionType &min) |
| virtual const vk::PipelineVertexInputStateCreateInfo & | createVkPipelineVertexInputStateCreateInfo () |
| virtual const vk::PipelineInputAssemblyStateCreateInfo & | createVkPipelineInputAssemblyStateCreateInfo () |
| virtual void | transferBuffers (const vk::CommandBuffer &command_buffer=nullptr) |
| virtual void | bindVertexBuffers (const vk::CommandBuffer &command_buffer) |
| virtual void | bindIndexBuffer (const vk::CommandBuffer &command_buffer) |
| virtual void | draw (const vk::CommandBuffer &command_buffer) |
Public Member Functions inherited from VulkanEngine::MeshBase | |
| MeshBase () | |
| Constructor. | |
| ~MeshBase () | |
| Destructor. | |
| virtual const vk::PipelineVertexInputStateCreateInfo & | createVkPipelineVertexInputStateCreateInfo ()=0 |
| virtual const vk::PipelineInputAssemblyStateCreateInfo & | createVkPipelineInputAssemblyStateCreateInfo ()=0 |
| virtual void | transferBuffers (const vk::CommandBuffer &command_buffer=nullptr)=0 |
| virtual void | bindVertexBuffers (const vk::CommandBuffer &command_buffer)=0 |
| virtual void | bindIndexBuffer (const vk::CommandBuffer &command_buffer)=0 |
| virtual void | draw (const vk::CommandBuffer &command_buffer)=0 |
| template<typename PositionType > | |
| const BoundingBox< PositionType > & | getBoundingBox () const |
Additional Inherited Members | |
Protected Attributes inherited from VulkanEngine::MeshBase | |
| std::shared_ptr< BoundingBoxBase > | bounding_box |
| The Mesh's bounding box. | |
Represents a mesh consisting of VertexAttribute instances. The mesh will at the very least support positions and indices. Any additional types that should be supported can be specified as template arguments. Example: Mesh< Eigen::Vector3f, uint32_t, Eigen::Vector3f, Eigen::Vector3f > represents a mesh which supports Eigen::Vector3f positions, uint32_t indices as well as additional Eigen::Vector3f and Eigen::Vector2f vertex attributes which could for example represent normals and texture coordinates.
| PositionType | The scalar type to use for the positions, e.g float, double. |
| IndexType | The type to use for storing indices, e.g uint16_t or uint32_t. |
| AdditionalAttributeTypes | A variadic list of additional VertexAttribute types supported by the mesh. |
| using VulkanEngine::Mesh< PositionType, IndexType, AdditionalAttributeTypes >::AttributeContainer = std::vector<std::shared_ptr<VertexAttribute<T> >> |
Defines the container for storing additional attributes.
| T | The type of the VertexAttribute. |
| VulkanEngine::Mesh< PositionType, IndexType, AdditionalAttributeTypes >::Mesh | ( | const std::shared_ptr< VertexAttribute< PositionType > > & | _positions, |
| const std::shared_ptr< IndexAttribute< IndexType > > & | _indices, | ||
| const std::tuple< AttributeContainer< AdditionalAttributeTypes >... > & | _attributes, | ||
| const std::shared_ptr< Shader > & | _shader | ||
| ) |
Constructor.
| _positions | A VertexAttribute giving the positions of the vertices of the mesh. |
| _indices | An IndexAttribute giving the indices of the mesh. |
| _attribute | A list of additional VertexAttribute instances which will be used when rendering the mesh. |
| _shader | The shader to use when rendering the mesh. |
|
virtual |
Bind the index buffer of this Mesh.
| command_buffer | The vk::CommandBuffer to insert the commands into. |
Implements VulkanEngine::MeshBase.
|
virtual |
Bind VertexBuffers in this Mesh which will be used for rendering.
| command_buffer | The vk::CommandBuffer to insert the commands into. |
Implements VulkanEngine::MeshBase.
|
virtual |
Implements VulkanEngine::MeshBase.
|
virtual |
Implements VulkanEngine::MeshBase.
|
virtual |
Insert drawing commands.
| command_buffer | The vk::CommandBuffer to insert the commands into. |
Implements VulkanEngine::MeshBase.
| void VulkanEngine::Mesh< PositionType, IndexType, AdditionalAttributeTypes >::setAttributes | ( | const std::tuple< AttributeContainer< AdditionalAttributeTypes >... > & | _attributes | ) |
Sets the additional attributes of the Mesh.
| _additional_attributes | A list of additional VertexAttribute instances which will be used when rendering the Mesh. |
| void VulkanEngine::Mesh< PositionType, IndexType, AdditionalAttributeTypes >::setBoundingBox | ( | const PositionType & | max, |
| const PositionType & | min | ||
| ) |
Set the Mesh's BoundingBox.
| max | The maximum position of the bounding box. |
| min | The minimum position of the bounding box. |
| void VulkanEngine::Mesh< PositionType, IndexType, AdditionalAttributeTypes >::setIndices | ( | const std::shared_ptr< IndexAttribute< IndexType > > & | _indices | ) |
Sets the indices of the Mesh.
| _indices | An IndexAttribute giving the indices of the Mesh. |
| void VulkanEngine::Mesh< PositionType, IndexType, AdditionalAttributeTypes >::setPositions | ( | const std::shared_ptr< VertexAttribute< PositionType > > & | _positions | ) |
Sets the positions of the Mesh.
| _positions | A VertexAttribute giving the positions of the vertices of the Mesh. |
|
virtual |
Start transfer of data belonging to all associated VertexAttribute instances from staging buffer to vertex buffer memory.
| command_buffer | The vk::CommandBuffer to insert the commands into. If not specified an internal command buffer will be created and submitted to the graphics queue. |
Implements VulkanEngine::MeshBase.