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

Object representing the layout of one set of related attributes representing (presumably) one object or instance. More...

#include <instance.hpp>

Public Member Functions

 InstanceLayout (const std::vector< InstanceAttributeDescriptor > &attributeList)
 Constructs a new instance layout object.
 
std::vector< InstanceAttributeDescriptorgetAttributeList () const
 Returns this layout's attribute list.
 
std::size_t computeStride () const
 Computes the stride for this layout, i.e., the number of bytes separating the start of one instance's attributes and the start of the next one's.
 
std::size_t computeRelativeOffset (std::size_t attributeIndex) const
 Computes the offset of a specific attribute from the start of the instance, in bytes.
 
bool isSubsetOf (const InstanceLayout &other) const
 Tests whether another InstanceLayout has the same attributes in the same order as this one, where some attributes may be absent from the other.
 

Private Attributes

std::vector< InstanceAttributeDescriptormAttributeList
 The list of attribute descriptors that make up this InstanceLayout.
 

Detailed Description

Object representing the layout of one set of related attributes representing (presumably) one object or instance.

In implementation it is essentially a list of attribute descriptors. The descriptors are then used to upload data to GPU memory, and also help bind (a subset of) attributes correctly to shaders for some rendering stage.

Constructor & Destructor Documentation

◆ InstanceLayout()

ToyMaker::InstanceLayout::InstanceLayout ( const std::vector< InstanceAttributeDescriptor > & attributeList)
inline

Constructs a new instance layout object.

Parameters
attributeListList of attribute descriptors.

Member Function Documentation

◆ computeRelativeOffset()

std::size_t ToyMaker::InstanceLayout::computeRelativeOffset ( std::size_t attributeIndex) const
inline

Computes the offset of a specific attribute from the start of the instance, in bytes.

Parameters
attributeIndexThe index to the attribute descriptor whose offset we want.
Returns
std::size_t The number of bytes from the start of the layout to the start of the desired attribute.

◆ computeStride()

std::size_t ToyMaker::InstanceLayout::computeStride ( ) const
inline

Computes the stride for this layout, i.e., the number of bytes separating the start of one instance's attributes and the start of the next one's.

Returns
std::size_t The size, in memory, of a single instance's attributes.

◆ getAttributeList()

std::vector< InstanceAttributeDescriptor > ToyMaker::InstanceLayout::getAttributeList ( ) const
inline

Returns this layout's attribute list.

Returns
std::vector<InstanceAttributeDescriptor> This layout's attribute descriptors.

◆ isSubsetOf()

bool ToyMaker::InstanceLayout::isSubsetOf ( const InstanceLayout & other) const
inline

Tests whether another InstanceLayout has the same attributes in the same order as this one, where some attributes may be absent from the other.

Parameters
otherThe layout this one is being compared with.
Return values
trueThe other layout is a subset of this one.
falseThe other layout is not a subset of this one.

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