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

Base class for instance data structures. More...

#include <vppLangIntVertex.hpp>

Detailed Description

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

Base class for instance data structures.

Inherit from this class to define your instance 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 from InstanceStruct.

Use Attribute template to define fields inside the structure.

Structures defined with InstanceStruct will be treated in vertex shaders as holding the data for single instance when performing instanced draw calls. You can pass the data common for entire mesh instance here, e.g. a model-world transformation matrix.

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.

Example of type definition:

template< ETag TAG >
struct TInstancePar : public InstanceStruct< TAG, TInstancePar >
{
Attribute< TAG, ext< glm::mat4 > > m_model2world;
Attribute< TAG, ext< glm::mat4 > > m_model2worldNorm;
Attribute< TAG, float, float, float, float > m_auxParams;
};
typedef TInstancePar< CPU > CInstancePar;
typedef TInstancePar< GPU > GInstancePar;
typedef gvector< CInstancePar, Buf::VERTEX > CInstanceBuffer;

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