VPP  0.7
A high-level modern C++ API for Vulkan
Public Types | Public Member Functions | Public Attributes | List of all members
vpp::Attribute< TAG, C1, C2, C3, C4, C5 > Struct Template Reference

Template for defining vertex or instance data fields. More...

#include <vppLangIntVertex.hpp>

Public Types

typedef format< C1, C2, C3, C4, C5 > format_type
 

Public Member Functions

 Attribute ()
 Constructor - does not take any arguments.
 
 operator rvalue_type ()
 GPU-side data retrieval operator.
 

Public Attributes

typedef< implementation_defined > rvalue_type
 

Detailed Description

template<ETag TAG, typename C1, typename C2 = no_component, typename C3 = no_component, typename C4 = no_component, typename C5 = no_component>
struct vpp::Attribute< TAG, C1, C2, C3, C4, C5 >

Template for defining vertex or instance data fields.

Place Attribute inside VertexStruct or InstanceStruct to define a data field.

There are two forms of the attribute definition.

The first one, used mostly for vertex buffers, can have vector type of up to four elements. Fields are defined internally by a Vulkan format. Attribute automatically determines appropriate format to use for specified component types.

The first argument should be the tag passed from VertexStruct or InstanceStruct. Rest are component types. Specify one to four components of simple C++ types or special types acceptable by the vpp::format template.

Example:

template< vpp::ETag TAG = CPU >
struct TVertexPos : public vpp::VertexStruct< TAG, TVertexPos >
{
};

The second form accepts vpp::ext template instantiation. Its purpose is to allow more complex types (e.g. matrices). As the single argument of vpp::ext, specify the CPU custom type. This type must have a specialization of vpp::StructMemberTraits which contains required information about the type.

VPP defines StructMemberTraits specializations for common GLM matrix and vector types. You can define your own ones also.

Example:

template< ETag TAG >
struct TInstancePar : public InstanceStruct< TAG, TInstancePar >
{
};

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