read individual vertices and components of vertices in attributes
This commit is contained in:
parent
54cf01246b
commit
660865b2f2
|
@ -210,6 +210,21 @@ namespace sb
|
|||
add({std::initializer_list<XType>({coordinate_0, coordinate_1, coordinates ...})});
|
||||
}
|
||||
|
||||
/* Return a const reference to the vertex at the specified index in the attributes vector. */
|
||||
template<typename VertexType>
|
||||
const VertexType& read(std::size_t index) const
|
||||
{
|
||||
return std::get<std::vector<VertexType>>(vertices)[index];
|
||||
}
|
||||
|
||||
/* 2D lookup of a value in the attributes. Return a const reference to the coordinate value at inner index
|
||||
* within a vertex at outer index in the attributes vector. */
|
||||
template<typename VertexType, typename CoordinateType = float>
|
||||
const CoordinateType& read(std::size_t outer, std::size_t inner)
|
||||
{
|
||||
return std::get<std::vector<VertexType>>(vertices)[outer][inner];
|
||||
}
|
||||
|
||||
/* Return the attributes as a reference to a typed vector. If the type is not the alternative in use by the
|
||||
* attributes, std::bad_variant_access will be thrown. */
|
||||
template<typename VertexType>
|
||||
|
|
Loading…
Reference in New Issue