Interface to Alias polyset polygons.
#include <AlPolygon.h>
class AlPolygon : public AlObject
AlPolygon();
virtual ~AlPolygon();
virtual AlObject* copyWrapper() const;
virtual AlObjectType type() const;
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 addVertices( int, int[] );
statusCode removeVertices( int, int[] );
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, double, double );
statusCode st( int vertex, double &, double & );
statusCode st( int vertex, float &, float & ); // Obsolete
statusCode normal( int vertex, double &, double &, double & );
statusCode normal( int vertex, float&, float&, float& ); // Obsolete
statusCode setNormal( int vertex, double, double, double );
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 );
AlPolygon is the interface to the polygon data of Alias' polyset objects. To create a polygon, first instantiate and create an AlPolyset and then use the AlPolyset::newPolygon() method to create a new polygon. It is not possible to create a polygon without a polyset.
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.
Constructs an AlPolygon wrapper object.
Deletes an AlPolygon wrapper object.
Makes an exact copy of the AlPolygon wrapper.
Returns the class identifier kPolygonType.
Returns a count of the number of vertices in this polygon. If the polygon is not valid, -1 is returned.
Finds a vertex in the polygon's array of vertices given the vertex's index. Returns the pointer to the vertex if the vertex is found and NULL otherwise.
< int index - the index of the vertex to find
int AlPolygon::findVertexIndex( AlPolysetVertex* polyvertex)
Calculates the index of a vertex in the polygon (in terms of polygon vertex indices). -1 is returned if the vertex is not present in the polygon.
Finds a vertex in the polygon's array of vertices given the vertex's index. If found, destructively set the given AlPolysetVertex to refer to that vertex. Otherwise, fail.
< int index - the index of the vertex to find
<> AlPolysetVertex& vtex - the found vertex
sSuccess - vertex has been found
sInvalidObject - the polygon was invalid
sFailure - vertex could not be found
See AlDagNode for information
Adds a new vertex to the polygon's array of vertices. The argument is the vertex's index in the polyset's array of vertices.
< int index - the index of the vertex to add
sInvalidArgument - index is not in the polyset's vertex range
sFailure - vertex could not be added
sInvalidObject - the polygon was invalid
Removes 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.
The vertex will remain in other polygons using it. To delete a vertex from all polygons in a polyset, use AlPolyset::deleteVertex().
< int index - the index of the vertex to remove
sSuccess - the removal succeeded
sInvalidArgument - the vertex doesn't belong to this AlPolygon
sFailure - the polygon is inactive
sInvalidObject - the polygon was invalid
Converts the vertex index from a polygon to its index in the polyset.
< int vertexIndex - the index of the vertex in the polygon
The index of the vertex in the polyset or -1 on error.
Returns the world position of this polygon's vertices in the given array. The vertex array must have the size [numberOfVertices * 3].
> vertexList - contains all the vertices' world positions upon return
sSuccess - the method succeeded
sInvalidArgument - vertexList was NULL
sFailure - the polygon is inactive
sInvalidObject - the polygon was invalid
Returns the unaffected position of this polygon's vertices in the given array. The vertex array must have the size [numberOfVertices * 3].
Note that there is no way to set the unaffected position of a polygon's vertices. You must use the AlPolyset method.
> vertexList - contains all the vertices' unaffected positions upon return
sSuccess - the method succeeded
sInvalidArgument - vertexList was NULL
sFailure - the polygon is inactive
sInvalidObject - the polygon was invalid
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].
Note that there is no way to set the unaffected position of a polygon's vertices. You must use the AlPolyset method.
> vertexList - contains all the vertices' affected positions upon return
< tm - the transformation matrix that is accumulated using the DAG
sSuccess - the method succeeded
sInvalidArgument - vertexList was NULL
sFailure - the polygon is inactive
sInvalidObject - the polygon was invalid
Sets the ST coordinates for the vertex.
sSuccess - the coordinates were set
sInvalidArgument - the vertex was out of range
sInvalidObject - the polygon was invalid
Sets the normal of the vertex.
x,y,z - the normal of of the vertex
vertex - the index of the vertex to set
sInvalidArgument - the vertex was out of range
sInvalidObject - the polygon was invalid
sFailure - the normal was frozen
Retrieves the ST coordinates of the vertex.
vertex - the vertex to examine
sSuccess - the coordinates were returned
sFailure - the coordinates were invalid and not returned
sInvalidArgument - the index was out of range
sInvalidObject - the polygon was invalid
x,y,z - the coordinates of the normal
sInvalidObject - the object was invalid
sSuccess - the normal was returned
sInvalidArgument - the vertex index was out of range
sFailure - the polygon is inactive
Allows the addition of a number of vertices to this polygon.
< numberOfVertices - number of vertices in array 'indices'
< indices - array of vertex indices to add
sSuccess - the method succeeded.
sInvalidArgument - the number of vertices to add is less than 1
sFailure - internal failure or could not find a vertex index that was specified in the array
sInvalidObject - the polygon was invalid
Removes a number of vertices from a polygon. Note that this method does not actually delete the vertices. The vertices will still remain in other polygons that contain them.
Note: this method will be more efficient if the indices array is sorted in increasing order.
< numberOfVertices - number of vertices in array 'indices'
< indices - array of indices to remove
sSuccess - the method succeeded
sInvalidArgument - the number of vertices is less than 0 or the number of vertices is greater than the number actually contained in this polygon
sInvalidObject - the polygon was invalid
Gets the normal for the polygon.
> double &x, &y, &z - retrieved 3D normal
sSuccess - the normal was retrieved from the polygon
sFailure - the polygon is inactive
sInvalidObject - the polygon is invalid
Sets the normal for the polygon. The calcNormal() method will overwrite any values set with this method.
< double x, y, z - 3D vector to set the normal of the polygon
sSuccess - the normal was retrieved from the polygon
sFailure - the polygon is inactive
sInvalidObject - the polygon is invalid
Calculates the normal for this polygon. The setNormal() method can be used to set a specific normal on a polygon.
sSuccess - the normal was retrieved from the polygon
sFailure - the polygon is inactive
sInvalidObject - the polygon is invalid
Setting the PerPolyTexture flag on a polygon alters the manner in which texture coordinates are mapped in the interactive Alias renderers (Quick Render and Toggle shade). It does not affect the Alias software renderers. Per Poly texturing causes textures to be mapped across a single polygon. All polygons are assumed to be Quads (four sided). The textures are exactly mapped onto these quads. The texture used is a portion of the texture specified in the multilister. The texture image is assumed to be composed of an 8 x 8 grid of smaller textures (a texture palette). The setPerPolyTextureIndex method may be used to control which element of this grid is used. In addition, the setPerPolyTextureFlip and setPerPolyTextureRotation methods may be used to flip or rotate the texture element on the polygon. Note: it is recommended that for new development the per-vertex-per-poly methods of setting texture coordinates directly be used, as opposed the perPolyTexture methods. The perPolyTexture methods are maintained for compatability with previous releases only.
sInvalidObject - the polygon is invalid
Querys whether perPolyTexturing is enabled on this polygon. Note: it is recommended that for new development the per-vertex-per-poly methods of setting texture coordinates directly be used, as opposed to the perPolyTexture methods. The perPolyTexture methods are maintained for compatability with previous releases only.
Allows you to query a single 8 bit user defined value onto a polygon that is being used in per-poly texturing mode.
Note: it is recommended that for new development the per-vertex-per-poly methods of setting texture coordinates directly be used, as opposed to the perPolyTexture methods. The perPolyTexture methods are maintained for compatability with previous releases only.
sInvalidObject - the polygon is invalid
Allows you to query a second 8 bit user defined value onto a polygon that is being used in per-poly texturing mode.
Note: it is recommended that for new development the per-vertex-per-poly methods of setting texture coordinates directly be used, as opposed to the perPolyTexture methods. The perPolyTexture methods are maintained for compatability with previous releases only.
sInvalidObject - the polygon is invalid
Allows you to query which of the texture images in the per-polygon palette is used to map this polygon. The grid is assumed to be an 8x8 grid of texture images, mapped horizontally and then vertically.
Note: it is recommended that for new development the per-vertex-per-poly methods of setting texture coordinates directly be used, as opposed to the perPolyTexture methods. The perPolyTexture methods are maintained for compatability with previous releases only.
sInvalidObject - the polygon is invalid
Returns the rotational value assigned to this polygon when used with perPolyTexturing. The value will be one of: kPOLY_ROT_NONE, kPOLY_ROT_90, kPOLY_ROT_180, or kPOLY_ROT_270
Note: it is recommended that for new development the per-vertex-per-poly methods of setting texture coordinates directly be used, as opposed to the perPolyTexture methods. The perPolyTexture methods are maintained for compatability with previous releases only.
validObject - the polygon is invalid
Returns the flip value assigned to this polygon when used with perPolyTexturing. The value will be one of: kPOLY_FLIP_NONE, kPOLY_FLIP_HORIZ, kPOLY_FLIP_VERT, or kPOLY_FLIP_BOTH
Note: it is recommended that for new development the per-vertex-per-poly methods of setting texture coordinates directly be used, as opposed to the perPolyTexture methods. The perPolyTexture methods are maintained for compatability with previous releases only.
sInvalidObject - the polygon is invalid
Allows you to set a single 8 bit user defined value onto a polygon that is being used in per-poly texturing mode.
Note: it is recommended that for new development the per-vertex-per-poly methods of setting texture coordinates directly be used, as opposed to the perPolyTexture methods. The perPolyTexture methods are maintained for compatability with previous releases only.
sInvalidObject - the polygon is invalid
Allows you to set a second 8 bit user defined value onto a polygon that is being used in per-poly texturing mode.
Note: it is recommended that for new development the per-vertex-per-poly methods of setting texture coordinates directly be used, as opposed to the perPolyTexture methods. The perPolyTexture methods are maintained for compatability with previous releases only.
sInvalidObject - the polygon is invalid
Allows you to specify which of the texture images in the per-polygon palette is used to map this polygon. The grid is assumed to be an 8x8 grid of texture images, mapped horizontally and then vertically.
Note: it is recommended that for new development the per-vertex-per-poly methods of setting texture coordinates directly be used, as opposed to the perPolyTexture methods. The perPolyTexture methods are maintained for compatability with previous releases only.
sInvalidObject - the polygon is invalid
Sets the rotational value assigned to this polygon when used with perPolyTexturing. The value will be one of: kPOLY_ROT_NONE, kPOLY_ROT_90, kPOLY_ROT_180, or kPOLY_ROT_270
Note: it is recommended that for new development the per-vertex-per-poly methods of setting texture coordinates directly be used, as opposed to the perPolyTexture methods. The perPolyTexture methods are maintained for compatability with previous releases only.
sInvalidObject - the polygon is invalid
Sets the flip value assigned to this polygon when used with perPolyTexturing. The value will be one of: kPOLY_FLIP_NONE, kPOLY_FLIP_HORIZ, kPOLY_FLIP_VERT, or kPOLY_FLIP_BOTH
Note: it is recommended that for new development the per-vertex-per-poly methods of setting texture coordinates directly be used, as opposed to the perPolyTexture methods. The perPolyTexture methods are maintained for compatability with previous releases only.
sInvalidObject - the polygon is invalid
Returns the polyset shader list index to be used when rendering this polygon. This method returns -1 if the polygon is invalid.
Sets 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).
sInvalidArgument - index not in polyset or >AL_MAX_SHADERS_PER_POLYSET
sFailure - polygon has no parent
sInvalidObject - the polygon is invalid
Returns the index of this polygon in the polyset. On errors -1 is returned.
Returns a pointer to the parent polyset of this polygon. On errors NULL is returned.
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 will be NULL. User_types between 0 and 11999 are reserved. If you would like to reserve a block of "user_types" please contact us.
< user_type - user type of the data desired
> size - number of characters in the block of data
> data - address of the block of data
sSuccess - blind data retrieved
sFailure - blind data not retrieved
sInvalidObject - the polygon was invalid
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.
< user_type - user type of the blind data desired
< size - number of characters in the block
< data - address of the block of data
sSuccess - operation was successful
sInsufficientMemory - not enough memory to allocate a new block
sFailure - create has not been called on this object yet
sInvalidObject - the polygon is invalid
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.
< user_type - user type of the blind desired
sSuccess - operation was successful
sFailure - no such blind data existed sInvalidObject - the given object was not valid
Applies 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.
< iter - the iterator to apply to each vertex
> rc - the return value of the last application of the iterator
sSuccess - the application of the iterator terminated normally
sFailure - the application of the iterator terminated abnormally
sInvalidObject - the polygon is invalid
sInvalidArgument - the iterator was NULL.