NAP
Public Types | Public Member Functions | List of all members
ShapeTriangle Class Reference

#include <triangleiterator.h>

Public Types

using IndexArray = std::array< int, 3 >
 

Public Member Functions

 ShapeTriangle (int triangleIndex, int index0, int index1, int index2)
 
int getTriangleIndex () const
 
IndexArray indices () const
 
int firstIndex () const
 
int secondIndex () const
 
int thirdIndex () const
 
int operator[] (std::size_t index) const
 
IndexArray::const_iterator begin ()
 
IndexArray::const_iterator end ()
 
template<class T >
TriangleData< T > getVertexData (const VertexAttribute< T > &attribute) const
 
template<class T >
void setVertexData (VertexAttribute< T > &attribute, const T &firstValue, const T &secondValue, const T &thirdValue)
 
template<class T >
void setVertexData (VertexAttribute< T > &attribute, const T &value)
 
template<class T >
void setVertexData (VertexAttribute< T > &attribute, const TriangleData< T > &value)
 

Description

Contains the indices of a triangle associated with a specific nap::MeshShape inside a nap::MeshInstance

Inheritance diagram for ShapeTriangle:
[legend]

Member Typedef Documentation

◆ IndexArray

using IndexArray = std::array<int, 3>

Constructor & Destructor Documentation

◆ ShapeTriangle()

ShapeTriangle ( int  triangleIndex,
int  index0,
int  index1,
int  index2 
)

Member Function Documentation

◆ begin()

IndexArray::const_iterator begin ( )

◆ end()

IndexArray::const_iterator end ( )

◆ firstIndex()

int firstIndex ( ) const
Returns
The index of the first vertex of this triangle

◆ getTriangleIndex()

int getTriangleIndex ( ) const
Returns
The index of the triangle in the shape

◆ getVertexData()

TriangleData<T> getVertexData ( const VertexAttribute< T > &  attribute) const

Returns the triangle vertex data of a specific attribute, for example the triangle position, color or normal.

Parameters
attributeThe vertex attribute to retrieve vertex data for.
Returns
the vertex data data of the given attribute, corresponding to the indices in this triangle.

◆ indices()

IndexArray indices ( ) const
Returns
The indices of this triangle

◆ operator[]()

int operator[] ( std::size_t  index) const
Returns
The index of the vertex at the specified index

◆ secondIndex()

int secondIndex ( ) const
Returns
The index of the second vertex of this triangle

◆ setVertexData() [1/3]

void setVertexData ( VertexAttribute< T > &  attribute,
const T &  firstValue,
const T &  secondValue,
const T &  thirdValue 
)

Sets the triangle vertex data of a specific attribute, for example the triangle position, color or normal.

Parameters
attributeThe VertexAttribute to set data to
firstValueThe value to set to the first vertex of the triangle
secondValueThe value to set to the second vertex of the triangle
thirdValueThe value to set to the third vertex of the triangle

◆ setVertexData() [2/3]

void setVertexData ( VertexAttribute< T > &  attribute,
const T &  value 
)
Parameters
attributeThe VertexAttribute to set data to
valueThe value to set to all vertices of the triangle

◆ setVertexData() [3/3]

void setVertexData ( VertexAttribute< T > &  attribute,
const TriangleData< T > &  value 
)
Parameters
attributeThe VertexAttribute to set data to
valuethe triangle data to set

◆ thirdIndex()

int thirdIndex ( ) const
Returns
The index of the third vertex of this triangle