![]() |
VPP
0.8
A high-level modern C++ API for Vulkan
|
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 |
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:
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: