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::InstanceAttributeDescriptor Struct Reference

A struct describing the name and type of each attribute designated as an instance attribute. More...

#include <instance.hpp>

Public Member Functions

 InstanceAttributeDescriptor (const std::string &name, const GLint layoutLocation, GLuint nComponents, GLenum type=GL_FLOAT)
 Constructs a new instance attribute descriptor.
 
bool operator== (const InstanceAttributeDescriptor &other) const
 Compares two vertex attributes for equality.
 

Public Attributes

const std::string mName
 Name of the attribute.
 
const GLint mLayoutLocation
 The OpenGL shader attribute location of this attribute.
 
const GLuint mNComponents
 The number or components or dimensions that represent this attribute.
 
const GLenum mType
 The underlying OpenGL type of the attribute.
 
const std::size_t mSize
 The size of the attribute, computed as size of mType * mNComponents.
 

Static Private Member Functions

static std::size_t GetGLTypeSize (GLenum type)
 Returns the size of a few known OpenGL component types, throws an error otherwise.
 

Detailed Description

A struct describing the name and type of each attribute designated as an instance attribute.

Constructor & Destructor Documentation

◆ InstanceAttributeDescriptor()

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

Constructs a new instance attribute descriptor.

Parameters
nameThe name of the attribute.
layoutLocationThe OpenGL attribute location of the attribute.
nComponentsThe number of dimensions this attribute has, a multiplier on the storage size of type.
typeThe actual OpenGL type of the attribute, like GL_FLOAT

Member Function Documentation

◆ GetGLTypeSize()

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

Returns the size of a few known OpenGL component types, throws an error otherwise.

Parameters
typeThe OpenGL type of the attribute component.
Returns
std::size_t The attribute component's size, in bytes.

◆ operator==()

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

Compares two vertex attributes for equality.

Todo
code duplicated from VertexAttributeDescriptor. Refactor needed.
Parameters
otherThe attribute descriptor this one is being compared to.
Return values
trueAttributes are the same;
falseAttributes are different;

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