![]() |
CUGL 4.0
Cornell University Game Library
|
#include <CUGraphicsBase.h>
Public Member Functions | |
| AttributeDef () | |
| AttributeDef (const AttributeDef &def) | |
| AttributeDef & | operator= (const AttributeDef &def) |
Public Attributes | |
| GLSLType | type |
| Uint32 | group |
| Sint32 | location |
| size_t | offset |
This class represents a shader attribute variable.
Attributes must be declared before the shader is compiled. The shader will validate the GLSL code against declared attributes. Note that not all GLSL types are supported on all platforms.
Note that while GLSL supports the binding keyword for uniform buffers and textures, there is no binding keyword for attributes. However, when we specify an attribute, we still have to give it an binding value. The purpose of this is for the organizing VertexBuffer objects. All attributes in the same vertex buffer must share the same binding. Conversely, attributes in distinct vertex buffers must have distinct bindings.
In this class, we refer to this concept as a vertex group instead of a binding, in order to make the difference clear. Technically, the group number can be anything we choose. However, for performance reasons, we prefer to start at 0 and assigning groups consecutively.
| cugl::graphics::AttributeDef::AttributeDef | ( | ) |
Creates a default attribute definition.
| cugl::graphics::AttributeDef::AttributeDef | ( | const AttributeDef & | def | ) |
Creates a copy of the given attribute definition
| def | The attribute definition to copy |
| AttributeDef & cugl::graphics::AttributeDef::operator= | ( | const AttributeDef & | def | ) |
Assigns this object to be a copy of the given attribute definition.
| def | The attribute definition to copy |
| Uint32 cugl::graphics::AttributeDef::group |
The vertex group for this attribute
This is a user-defined value for grouping attributes that should be stored in the same VertexBuffer.
| Sint32 cugl::graphics::AttributeDef::location |
The attribute location
In OpenGL, setting this value to -1 causes the shader to determine this location automatically. Vulkan requires that this value be set explicitly.
| size_t cugl::graphics::AttributeDef::offset |
The stride offset of this attribute
| GLSLType cugl::graphics::AttributeDef::type |
The GLSL type of this attribute