Crafter.Graphics
C++ graphics library using Wayland and Vulkan.
 
Loading...
Searching...
No Matches
Crafter::MeshShader< VertexType > Class Template Referenceexport

Shader for rendering indexed meshes. More...

Public Member Functions

 MeshShader (Mesh< VertexType > *mesh)
 Constructs the MeshShader with a mesh. The Model-View-Projection (MVP) matrix and the transform matrix are initialized to the identity matrix.
 
 MeshShader (Mesh< VertexType > *mesh, Camera *camera)
 Constructs the MeshShader with a mesh. The transform is initialized to identity, the transform is initialized to identity and the mvp to the camera's projectionView.
 
void WriteDescriptors (VkDescriptorSet set)
 Writes this class's 3 descriptors to the set, this method must be called before rendering with this shader. Slot 0 mvp: VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER. Slot 1 vertex: VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER. Slot 2 index: VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER.
 
void Update ()
 Must be called after every update to the camera or this transform.
 

Public Attributes

MatrixRowMajor< float, 4, 4, 1 > transform
 
Mesh< VertexType > * mesh
 
Cameracamera
 
Buffer< MatrixRowMajor< float, 4, 4, 1 > > mvp
 
std::uint32_t threadCount
 

Detailed Description

template<typename VertexType>
class Crafter::MeshShader< VertexType >

Shader for rendering indexed meshes.

Template Parameters
VertexTypeThe vertex type to use that is internally stored, this must match the type the glsl shader expects.

Constructor & Destructor Documentation

◆ MeshShader() [1/2]

template<typename VertexType>
Crafter::MeshShader< VertexType >::MeshShader ( Mesh< VertexType > * mesh)
inline

Constructs the MeshShader with a mesh. The Model-View-Projection (MVP) matrix and the transform matrix are initialized to the identity matrix.

Parameters
meshPointer to the mesh to use. The mesh must remain valid for the lifetime of this object.

◆ MeshShader() [2/2]

template<typename VertexType>
Crafter::MeshShader< VertexType >::MeshShader ( Mesh< VertexType > * mesh,
Camera * camera )
inline

Constructs the MeshShader with a mesh. The transform is initialized to identity, the transform is initialized to identity and the mvp to the camera's projectionView.

Parameters
meshPointer to the mesh to use. The mesh must remain valid for the lifetime of this object.
meshPointer to the camera to use. The camera must remain valid for the lifetime of this object.

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