VPP  0.8
A high-level modern C++ API for Vulkan
vpp::VertexStruct< TAG, TDef > Struct Template Reference

Base class for vertex data structures. More...

#include <vppLangIntVertex.hpp>

Detailed Description

template<ETag TAG, template< vpp::ETag TAG > class TDef>
struct vpp::VertexStruct< TAG, TDef >

Base class for vertex data structures.

Inherit from this class to define your vertex data structure template. The first template argument should be passed from your template. The second one should be the name of your template which is being derived.

Use Attribute template to define fields inside the structure.

Structures defined with VertexStruct will be treated in vertex shaders as holding the data for single vertex of a mesh.

Instantiating the template with GPU tag argument gives GPU-side version of the structure, while CPU tag gives the host version. The CPU version can be directly used to fill data buffers meant to be transfered to GPU.

CPU flavor uses Vulkan format enumeration internally. Also Attribute arguments correspond to vpp::format arguments. This is because Vulkan needs to interpret the data in order to construct and rasterize primitives. Interpretation of numeric data in Vulkan is based on the format.

Example of type definition:

template< ETag TAG >
struct TVertexAttr : public VertexStruct< TAG, TVertexAttr >
{
Attribute< TAG, float, float, float, float > m_position;
Attribute< TAG, float16_t, float16_t, float16_t, float16_t > m_normal;
Attribute< TAG, float16_t, float16_t, float16_t, float16_t > m_tangent;
Attribute< TAG, float16_t, float16_t, float16_t, float16_t > m_texture01;
Attribute< TAG, float16_t, float16_t, float16_t, float16_t > m_texture23;
};
typedef TVertexAttr< CPU > CVertexAttr;
typedef TVertexAttr< GPU > GVertexAttr;
typedef gvector< CVertexAttr, Buf::VERTEX > CVertexAttrBuffer;

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