#include <AlPolygon.h>
class AlPolygon : public AlObject
AlPolygon();
virtual ~AlPolygon();
virtual AlObject* copyWrapper() const;
virtual AlObjectType type() const;
virtual AlPolygon* asPolygonPtr();
int numberOfVertices() const;
AlPolysetVertex* vertex( int ) const;
statusCode vertexD( int, AlPolysetVertex& ) const;
statusCode addVertex( int );
statusCode removeVertex( int );
statusCode verticesWorldPosition( double[] )const;
statusCode verticesAffectedPosition( const AlTM&, double[] )const;
statusCode verticesUnaffectedPosition( double[] )const;
statusCode normal( double&, double&, double& ) const;
statusCode setNormal( double, double, double );
statusCode calcNormal();
int index();
AlPolyset* polyset() const;
int findVertexIndex( AlPolysetVertex* );
int vertexPolysetIndex( int vertexIndex );
int shaderIndex();
statusCode setShaderIndex( int );
statusCode setSt( int vertex, float, float );
statusCode st( int vertex, float &, float & );
statusCode normal( int vertex, float &, float &, float & );
statusCode setNormal( int vertex, float, float, float );
boolean queryPerPolyTextures() const;
statusCode setPerPolyTextures( boolean state );
statusCode queryPerPolyTextureOther1( unsigned short &index ) const;
statusCode setPerPolyTextureOther1( unsigned short index );
statusCode queryPerPolyTextureOther2( unsigned short &index ) const;
statusCode setPerPolyTextureOther2( unsigned short index );
statusCode queryPerPolyTextureIndex( unsigned short &index ) const;
statusCode setPerPolyTextureIndex( unsigned short index );
statusCode queryPerPolyTextureRotation( int &flag ) const;
statusCode setPerPolyTextureRotation( int flag );
statusCode queryPerPolyTextureFlip( int &flag ) const;
statusCode setPerPolyTextureFlip( int flag );
statusCode blindData( int, long&, const char *& );
statusCode setBlindData( int, long, const char * );
statusCode removeBlindData( int );
statusCode applyIteratorToVertices( AlIterator*, int& ) const;
statusCode doUpdates( boolean newState = TRUE );
A polygon is a collection of vertices from a particular polyset.
The only way to delete a polygon is with the AlPolyset::deletePolygon() method.
Polygons are made of lists of vertices which you traverse using an index through the vertex() method. You can also pack the vertex information into an array using methods in this class.
int AlPolygon::findVertexIndex( AlPolysetVertex* polyvertex)
statusCode AlPolygon::addVertex( int index )
Description
Add a new vertex to the polygon's array of vertices. The argument is the vertex's index in the polyset's array of vertices. Arguments
< int index - the index of the vertex to add Return codes
sSuccess - vertex is added statusCode AlPolygon::removeVertex( int index )
Description
Remove a vertex from the polygon's array of vertices given the vertex's index. The index is the vertex's index in the polygon, and not the polyset. Arguments
< int index - the index of the vertex to remove Return code
sSuccess - The removal succeeded. int AlPolygon::vertexPolysetIndex( int vertexIndex )
Description
Converts the vertex index from a polygon to its index in the polyset. Arguments
< int vertexIndex - the index of the vertex in the polygon Return value
The index of the vertex in the polyset or -1 on error. statusCode AlPolygon::verticesWorldPosition( double vertexList[] ) const
Description
Returns the world position of this polygon's vertices in the given array. The vertex array must have the size [numberOfVertices * 3]. Arguments
> vertexList - contains all the vertices' world positions upon return Return code
sSuccess - The method succeeded. statusCode AlPolygon::verticesUnaffectedPosition( double vertexList[] ) const
Description
Returns the unaffected position of this polygon's vertices in the given array. The vertex array must have the size [numberOfVertices * 3]. Arguments
> vertexList - contains all the vertices' unaffected positions upon return Return code
sSuccess - The method succeeded. statusCode AlPolygon::verticesAffectedPosition( const AlTM& tm, double vertexList[] ) const
Description
Returns the position of this polygon's vertices in the given array modified by the AlTM. The vertex array must have the size [numberOfVertices * 3]. Arguments
> vertexList - contains all the vertices' affected positions upon return Return code
sSuccess - The method succeeded. statusCode AlPolygon::setSt( int vertex, float s, float t )
Description
Sets the ST coordinates for the vertex Arguments
s,t - the coordinates Return code
sSuccess - the coordinates were set statusCode AlPolygon::setNormal( int vertex, float x, float y, float z )
Description
Sets the normal of the vertex Arguments
x,y,z - the normal of of the vertex Return code
sSuccess - the normal was set statusCode AlPolygon::st( int vertex, float &s, float &t )
Description
Retrieves the ST coordinates of the vertex Arguments
s,t - returned coordinates Return code
sSuccess - the coordinates were returned statusCode AlPolygon::normal( int vertex, float &x, float &y, float &z )
Description
Gets the normal of a vertex Arguments
x,y,z - the coordinates of the normal Return code
sInvalidObject - the object was invalid statusCode AlPolygon::normal( double& x, double& y, double& z ) const
Description
Gets the normal for the polygon. Arguments
> double &x, &y, &z - retrieved 3D normal Return code
sSuccess - The normal was retrieved from the polygon. statusCode AlPolygon::setNormal( double x, double y, double z )
Description
Sets the normal for the polygon. The calcNormal() method will overwrite any values set with this method. Arguments
< double x, y, z - 3D vector to set the normal of the polygon Return code
sSuccess - The normal was retrieved from the polygon. statusCode AlPolygon::calcNormal()
Description
Calculate the normal for this polygon. The setNormal() method can be used to set a specific normal on a polygon. Return code
sSuccess - The normal was retrieved from the polygon. statusCode AlPolygon::setPerPolyTextures( boolean state )
Return code
sInvalidObject - the polygon is invalid boolean AlPolygon::queryPerPolyTextures() const
Description
statusCode AlPolygon::queryPerPolyTextureOther1( unsigned short &index ) const
Description
Arguments
Return code
sInvalidObject - the polygon is invalid statusCode AlPolygon::queryPerPolyTextureOther2( unsigned short &index ) const
Description
Arguments
Return code
sInvalidObject - the polygon is invalid statusCode AlPolygon::queryPerPolyTextureIndex( unsigned short &index ) const
Description
Arguments
Return code
sInvalidObject - the polygon is invalid statusCode AlPolygon::queryPerPolyTextureRotation( int &flag ) const
Description
Arguments
Return code
sInvalidObject - the polygon is invalid statusCode AlPolygon::queryPerPolyTextureFlip( int &flag ) const
Description
Arguments
Return code
sInvalidObject - the polygon is invalid statusCode AlPolygon::setPerPolyTextureOther1( unsigned short index )
Description
Arguments
Return code
sInvalidObject - the polygon is invalid statusCode AlPolygon::setPerPolyTextureOther2( unsigned short index )
Description
Arguments
Return code
sInvalidObject - the polygon is invalid statusCode AlPolygon::setPerPolyTextureIndex( unsigned short index )
Description
Arguments
Return code
sInvalidObject - the polygon is invalid statusCode AlPolygon::setPerPolyTextureRotation( int flag )
Description
Arguments
Return code
sInvalidObject - the polygon is invalid statusCode AlPolygon::setPerPolyTextureFlip( int flag )
Description
Arguments
Return code
sInvalidObject - the polygon is invalid int AlPolygon::shaderIndex()
Description
Return the polyset shader list index to be used when rendering this polygon. This method returns -1 if the polygon is invalid. statusCode AlPolygon::setShaderIndex( int index )
Description
Set the polyset shader list to be used when rendering this polygon. Polyset shader lists are defined in the AlPolyset class. Note that the index used MUST be defined in the polyset, and MUST be less than AL_MAX_SHADERS_PER_POLYSET (currently 64). Arguments
< int index - index to set Return codes
sSuccess - shader index set int AlPolygon::index()
Description
Return the index of this polygon in the polyset. On errors -1 is returned. AlPolyset* AlPolygon::polyset() const
Description
Return a pointer to the parent polyset of this polygon. On errors NULL is returned. statusCode AlPolygon::blindData( int user_type, long& size, const char *& data )
Description
Obtains the size and address of a block of data associated with the object. If there is no data, then the size will be zero and the address of the data is NULL. User_types between 0 and 11999 are reserved. If you would like to reserve a block of "user_types" please contact us. Arguments
< type - user type of the data desired. Return codes
sSuccess - blind data retrieved statusCode AlPolygon::setBlindData( int user_type, long size, const char * data )
Description
Associates a block of data with the object. If a block of data is already associated with this object and this user_type, the old block is replaced by a reference to the new block. The old block of data is not deleted. Arguments
< user_type - user type of the blind data desired. Return codes
sSuccess - everything is okay. statusCode AlPolygon::removeBlindData( int user_type )
Description
Removes the block of data of the given type from the object. Note that the user is still responsible for the memory associated with this block of data. Arguments
< user_type - user type of the blind desired. Return codes
sSuccess - everthing is okay statusCode AlPolygon::applyIteratorToVertices( AlIterator* iter, int &rc ) const
Description
Apply the given AlIterator to all vertices in the polygon. The second argument will be set to the return value of the last application of the iterator's function. See the AlIterator class for more information.
Arguments
< iter - the iterator to apply to each vertex Return codes
sSuccess - the application of the iterator terminated normally