Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
Loading...
Searching...
No Matches
ToyMaker::VertexAttributeDescriptor Struct Reference

The description of a single vertex attribute associated with a vertex layout, giving its size and location id. More...

#include <vertex.hpp>

Public Member Functions

 VertexAttributeDescriptor (const std::string &name, GLint layoutLocation, GLuint nComponents=1, GLenum type=GL_FLOAT)
 Creates a single vertex attribute descriptor.
 
bool operator== (const VertexAttributeDescriptor &other) const
 Compares two vertex attribute descriptors for equality.
 

Public Attributes

std::string mName
 The name of the attribute, per the shader.
 
GLint mLayoutLocation
 The layout location ID of the attribute, as specified by the shader.
 
GLuint mNComponents
 The number of components making up the attribute.
 
GLenum mType
 The type of component used by the attribute, such as GL_FLOAT or GL_UNSIGNED_BYTE.
 
std::size_t mSize
 The computed size of the attribute, in bytes.
 

Static Private Member Functions

static std::size_t GetGLTypeSize (GLenum type)
 Gets the size of the type of a single component of an attribute.
 

Detailed Description

The description of a single vertex attribute associated with a vertex layout, giving its size and location id.

Constructor & Destructor Documentation

◆ VertexAttributeDescriptor()

ToyMaker::VertexAttributeDescriptor::VertexAttributeDescriptor ( const std::string & name,
GLint layoutLocation,
GLuint nComponents = 1,
GLenum type = GL_FLOAT )
inline

Creates a single vertex attribute descriptor.

Parameters
nameThe name of the attribute, as seen by the shader.
layoutLocationThe location ID of the attribute, as specified by the shader.
nComponentsThe number of components making up this attribute.
typeThe type of a single component of the attribute (like GL_FLOAT, GL_UNSIGNED_BYTE, and so on).

Member Function Documentation

◆ GetGLTypeSize()

static std::size_t ToyMaker::VertexAttributeDescriptor::GetGLTypeSize ( GLenum type)
inlinestaticprivate

Gets the size of the type of a single component of an attribute.

Parameters
typeThe GLenum of the component type.
Returns
std::size_t The size of that component type, in bytes.

◆ operator==()

bool ToyMaker::VertexAttributeDescriptor::operator== ( const VertexAttributeDescriptor & other) const
inline

Compares two vertex attribute descriptors for equality.

Mainly used to determine whether the vertex layout requested by a render stage matches the vertex layout associated with some vertex data.

Parameters
otherThe vertex descriptor this one is being compared to.
Return values
trueThe other description matches this one.
falseThe other description does not match this one.

Member Data Documentation

◆ mSize

std::size_t ToyMaker::VertexAttributeDescriptor::mSize

The computed size of the attribute, in bytes.

Given by : size of mType * mNComponents


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