NAP
Public Member Functions | Protected Attributes | List of all members
ShapeTriangleIterator Class Referenceabstract

#include <triangleiterator.h>

Public Member Functions

 ShapeTriangleIterator (const MeshShape &shape, int startIndex)
 
virtual ~ShapeTriangleIterator ()
 
bool isDone () const
 
virtual const ShapeTriangle next ()=0
 

Protected Attributes

const uint32mCurrentIndex
 The current position in the index buffer of the shape that we're iterating through. More...
 
int mCurrentTriangle = 0
 

Description

A ShapeTriangleIterator can be used to iterate through all triangles in a MeshShape. The ShapeTriangleIterator itself only serves as a base class; derived classes are provided that deal with differing index layouts depending on the type of the mesh.

Inheritance diagram for ShapeTriangleIterator:
[legend]

Constructor & Destructor Documentation

◆ ShapeTriangleIterator()

ShapeTriangleIterator ( const MeshShape shape,
int  startIndex 
)

◆ ~ShapeTriangleIterator()

virtual ~ShapeTriangleIterator ( )
virtual

Member Function Documentation

◆ isDone()

bool isDone ( ) const

Checks whether this iterator is done iterating. next() should only be called while this function returns false.

Returns
true if done iterating, false if not

◆ next()

virtual const ShapeTriangle next ( )
pure virtual

Retrieves the indices of the next triangle in the MeshShape. Should only be called while isDone() returns false.

Returns
the 3 indices of the next triangle in a glm::ivec3

Implemented in ShapeTriangleStripIterator, ShapeTriangleFanIterator, and ShapeTriangleListIterator.

Member Data Documentation

◆ mCurrentIndex

const uint32* mCurrentIndex
protected

The current position in the index buffer of the shape that we're iterating through.

◆ mCurrentTriangle

int mCurrentTriangle = 0
protected