Interface to Alias polyset geometry.
#include <AlPolyset.h>
class AlPolyset : public AlObject
AlPolyset();
virtual ~AlPolyset();
virtual statusCode deleteObject();
virtual AlObject* copyWrapper() const;
statusCode create();
virtual AlObjectType type() const;
AlPolysetNode* polysetNode() const;
statusCode create( int, int );
int newVertex( double, double, double );
int newPolygon();
statusCode newVertices( int, double *, int * );
statusCode newPolygons( int );
statusCode deleteVertex( int );
statusCode deleteVertices( int, const int[] );
statusCode deletePolygon( int );
statusCode deletePolygons( int, const int[] );
statusCode deleteGeometry();
AlPolysetVertex* vertex( int ) const;
statusCode vertexD( int, AlPolysetVertex& ) const;
AlPolygon* polygon( int ) const;
statusCode polygonD( int, AlPolygon& ) const;
int numberOfVertices() const;
int numberOfPolygons() const;
statusCode calcNormals( boolean );
statusCode verticesWorldPosition( double* ) const;
statusCode verticesAffectedPosition( AlTM&, double* ) const;
statusCode verticesUnaffectedPosition( double* ) const;
statusCode setVerticesUnaffectedPosition( double* );
// Modify vertex sharing information
//
statusCode mergeVertices( int flags,
double distanceTolerance,
double normalTolerance,
double textureTolerance );
statusCode splitVertices();
int numberOfShaderLists() const;
// For backwards compatibility, these first routines always deal with
// the first shader list
AlShader* firstShader() const;
AlShader* nextShader( AlShader* ) const;
statusCode nextShaderD( AlShader *) const;
statusCode assignShader( AlShader* );
statusCode layerShader( AlShader* );
// The following routines allow full access to potentially multiple
// shader lists per polyset. The first parameter is the list number.
AlShader* firstShader( int ) const;
AlShader* nextShader( int, AlShader* ) const;
statusCode nextShaderD( int, AlShader *) const;
statusCode assignShader( int, AlShader* );
statusCode renderInfo( AlRenderInfo & ) const;
statusCode setRenderInfo( AlRenderInfo& ) const;
boolean isDisplayModeSet( AlDisplayModeType ) const;
statusCode setDisplayMode( AlDisplayModeType, boolean );
boolean isFrozenNormals() const;
statusCode freezeNormals();
statusCode unFreezeNormals();
statusCode calcSTs();
statusCode blindData( int, long&, const char *& );
statusCode setBlindData( int, long, const char * );
statusCode removeBlindData( int );
statusCode applyIteratorToPolygons( AlIterator*, int& ) const;
statusCode applyIteratorToVertices( AlIterator*, int& ) const;
statusCode doUpdates( boolean newState = TRUE );
AlPolyset is the interface to the geometric data of Alias' polyset objects. To create a polyset, first instantiate and then create an AlPolyset. The AlPolysetNode for the polyset is created automatically.
For more information on how to create the polyset geometry, see the description for the create() method.
A polyset is a collection of polygons that use a collection of vertices.
There are two ways to delete an AlPolyset.
If the AlPolyset::deleteObject() is called, the attached AlPolysetNode is deleted. If the AlPolysetNode::deleteObject() is called, the attached AlPolyset is deleted.
All AlPolyset objects have render information attached to them. The AlRenderInfo structure can be used to query the polyset's render parameters.
In addition, polysets may contain more than one list of shaders. These shaders are used to specify per-polygon shading.
Polysets are made of polygons and vertices, each of which you traverse as a list by using the polygon() and vertex() methods. The AlPolygon and AlPolysetVertex methods allow you to work with the individual polygons and vertices. You can also pack the polyset information into an array using methods in this class.
Constructs an AlPolyset wrapper object.
Deletes an AlPolyset wrapper object.
Deletes the AlPolyset, its AlPolyons, its AlPolysetVertices, and its parent AlPolysetNode.
sSuccess - the polyset, polygons and vertices were deleted
sFailure - they could not be deleted
sInvalidObject - the polyset was invalid
Makes an exact copy of the AlPolyset wrapper.
Creates the data used to represent a polygonal surface. A polyset is composed of two entities, polygons and vertices, each maintained as arrays. Polygons and vertices may only be created and deleted through the methods in this class.
Polygons maintain their own arrays of vertices selected from the polyset's vertices.
When a polygon or a vertex is created, its index in the polyset's array is returned. This index is used to get pointers to the polygon or vertex through either of the polygon() or vertex() methods as appropriate.
The AlPolysetNode for this polyset is created by this method as well. It is available through the polysetNode() method. It is impossible to create a polyset without a polyset node.
sSuccess - the operation was successful
sFailure - polyset no longer active
sInsufficientMemory - ran out of memory
sAlreadyCreated - the AlPolyset has already been created
Returns the class identifier kPolysetType.
This virtual function returns a non-null pointer to itself, indicating that it is safe to cast to an object of this class.
Returns a pointer to the AlPolysetNode for this polyset. Returns NULL if there is not an attached polyset node.
A special version of the create method that preallocates the memory for the vertices and polygons.
After calling this routine, get and set the appropriate parameters for the vertices and polygons.
< vertices - number of vertices to allocate
< polygons - number of polygons to allocate
sSuccess - the operation was successful
sInsufficientMemory - ran out of memory
sAlreadyCreated - the AlPolyset has already been created
Adds a new vertex to the polyset's array of vertices. Returns the index of the new vertex or -1 if there is an error.
< double x, y, z - 3D coordinates of the new vertex to create
Adds a new polygon to the polyset's array of polygons. Returns the index of the new polygon or -1 if there is an error.
Deletes a vertex from the polyset's array of vertices given the vertex's index. This will also remove this vertex from all polygons using it. See AlPolyset::deletePolygon() for additional information.
< int index - the index to delete
sSuccess - the deletion succeeded
sFailure - the polyset is inactive
sInvalidObject - the polyset was invalid
Delete a polygon from the polyset's array of polygons given the polygon's index.
Note that when deleting several polygons, the polygon with the highest index should be deleted first, and the one with the lowest index should be deleted last.
For example, if you had three polygons, indexed 0, 1, and 2, and you were to delete them all starting at the lowest index, only two would actually be deleted. That is, on the first iteration, polygon 0 would be deleted and polygon 2 would be moved to index 0. On the second iteration, polygon 1 would be deleted, leaving one polygon with an index of 0. On the last iteration, an attempt would be made to delete polygon 2, but there would be no such polygon, so nothing would be deleted. In the end, one polygon would remain. However, if the deletion started with the greatest index, on the first iteration polygon 2 would be deleted. On the second iteration, polygon 1 would be deleted. And on the last iteration, polygon 0 would be deleted.
< int index - the index of the polygon to delete
sSuccess - the deletion succeeded
sInvalidArgument - the polygon doesn't belong to this AlPolyset
sFailure - the polyset is inactive
sInvalidObject - the polygon was invalid
Deletes a set of polygons from the polyset's array of polygons, given the polygons' indices. This method is more efficient than deleting polygons individually.
< int numIndices - number of indices
< indices - the array of indices to delete
sSuccess - the deletion succeeded
sInvalidArgument - 'indices' was NULL
sFailure - the polyset is inactive
sInvalidObject - the polyset was invalid
Finds a vertex in the polyset'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
Finds a vertex in the polyset's array of vertices, given the vertex's index.
< int index - the index of the vertex to find
sSuccess - the vertex was retrieved
sInvalidArgument - the vertex index was out of range
sInvalidObject - the polyset was invalid
Finds a polygon in the polyset's array of polygons, given the polygon's index. Returns the pointer to the polygon if the polygon is found and NULL otherwise.
< int index - the index of the polygon to find
Finds a polygon in the polyset's array of polygons, given the polygon's index.
< int index - the index of the polygon to find
sInvalidObject - the polyset was invalid
sInvalidArgument - index was out of range
Returns a count of the number of vertices in this polyset. In the case of failure, -1 is returned.
Returns a count of the number of polygons in this polyset. In the case of failure, -1 is returned.
Recalculates the normals of the polygons and if the argument is TRUE, the normals at the vertices will be calculated as well.
< boolean vertices - calculate the normals of the vertices
sSuccess - the normals were successfully calculated
sInvalidObject - the polyset was invalid
Returns the world position of this polyset'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 deletion succeeded
sInvalidArgument - vertexList was NULL
sFailure - the polyset is inactive
sInvalidObject - the polyset was invalid
Returns the affected position of this polyset's vertices in the given array. The vertex array must have the size [numberOfVertices * 3].
< tm - the transformation matrix generated while walking the DAG.
> vertexList - contains all the vertices' unaffected positions upon return
sSuccess - the deletion succeeded
sInvalidArgument - vertexList was NULL
sFailure - the polyset is inactive
sInvalidObject - the polyset was invalid
Returns the unaffected position of this polyset's vertices in the given array. The vertex array must have the size [numberOfVertices * 3].
> vertexList - contains all the vertices' unaffected positions upon return
sSuccess - the deletion succeeded
sInvalidArgument - vertexList was NULL
sFailure - the polyset is inactive
sInvalidObject - the polyset was invalid
See AlDagNode for information.
Sets the unaffected positions of this polyset's vertices to the given array. The vertexList array must have the size [numberOfVertices * 3].
< vertexList - contains all the vertices' unaffected positions
sSuccess - the deletion succeeded
sInvalidArgument - vertexList was NULL
sFailure - the polyset is inactive
sInvalidObject - the polyset was invalid
Returns the first shader that the specified shader list in this polyset references. Note that the index used MUST be defined in the polyset, and MUST be less than AL_MAX_SHADERS_PER_POLYSET (currently 64).
< shaderlist - Shader list to act on
Returns the first shader that the first shader list in this polyset references.
Returns the shader after the given shader in the object's specified shader list. Returns NULL if there isn't a next shader. Specifying NULL as parameter will return the first shader in the specified shader list. Note that the index used MUST be defined in the polyset, and MUST be less than AL_MAX_SHADERS_PER_POLYSET (currently 64).
< shaderlist - Shader list we are dealing with
< last_shader - Shader from which to walk forward
Destructively points last_shader to the shader after the given shader in the object's specified shader list. Returns sFailure if there isn't a next shader. Note that the index used MUST be defined in the polyset, and MUST be less than AL_MAX_SHADERS_PER_POLYSET (currently 64).
< shader_list - Shader list we are dealing with
< lastshader - Shader from which to walk forward
sSuccess - the wrapper last_shader points to the next shader
sInvalidArgument - last_shader was invalid or NULL
sFailure - the wrapper last_shader does not point to the next shader
sInvalidObject - the polyset was invalid
Returns the shader after the given shader in the object's first shader list. Returns NULL if there isn't a next shader. Specifying NULL as parameter will return the first shader in the first shader list.
< last_shader - Shader from which to walk forward
Returns the shader after the given shader in the object's first shader list.
< last_shader - Shader from which to walk forward
sSuccess - the wrapper last_shader points to the next shader
sInvalidArgument - last_shader was invalid or NULL
sFailure - the wrapper last_shader does not point to the next shader
sInvalidObject - the polyset was invalid
Assigns the given shader to the polyset. If the polyset already has shaders, they will be removed from the polyset. The polyset must have a polyset node for this method to succeed.
< shader - the shader which will be assigned to the polyset
sSuccess - the shader was successfully assigned to the polyset
sInvalidArgument - shader was invalid or NULL
sInvalidObject - the polyset is invalid
sFailure - the shader was not assigned
Assigns the given shader to the polyset list. If the polyset list already has shaders they will be removed from the list. Note that the index used MUST be defined in the polyset, and MUST be less than or equal to AL_MAX_SHADERS_PER_POLYSET (currently 64). To assign an additional shader to a polyset, specify the list number as one plus the current number of shader lists, as returned by the numberOfShaderLists() method. Note that it is only possible to layer shaders on the first shader list of a polyset. All other shader lists must contain only one shader.
< shader - the shader which will be assigned to the polyset
sSuccess - the shader was successfully assigned to the polyset
sInvalidObject - the polyset is invalid
sInvalidArgument - the shader was invalid
Layers the given shader on the polyset. The polyset must have a polyset node for this method to succeed. Note that it is only possible to layer shaders on the first shader list of a polyset. All other shader lists must contain only one shader.
< shader - the shader which will be layered on the polyset
sSuccess - the shader was successfully layered on the polyset
sInvalidArgument - shader was invalid
sFailure - the shader was not created.
sInvalidObject - the polyset was invalid
Fills in the renderInfo structure with the render info for this polyset. If there wasn't any render information, the renderInfo is unchanged.
> renderInfo - the structure to fill in
sSuccess - if getting the render information was successful
sInvalidArgument - if renderInfo was NULL
sFailure - if there wasn't any render information
sInvalidObject - the polyset was invalid
Processes the entire polyset, and based on the tolerances specified in the flags parameter, merges vertices so that they are shared between polygons.
The DISTANCE flag means merge based on object space 3D distance. The ST flag means merge based on texture coordinate 2D distance. The NORMAL flag means merge based on normals.
SHADER determines what certain vertex values will be set to after it is determined that they need to be merged.If the SHADER flag is set, and any vertices are merged, then the per polygon per vertex texture coordinates may be created for each resultant merged vertex. Otherwise, if this flag is not set, each merged vertex will have texture coordinates that are averaged from the original vertices. A similiar logic is used to determine what normal(s) to assign to each resultant merged vertex.
< flags - one of { AL_MERGE_RESPECT_ST | AL_MERGE_RESPECT_NORMAL | AL_MERGE_RESPECT_DISTANCE | AL_MERGE_RESPECT_SHADER }
< distanceTolerance - If merging vertices based on distances, this is the distance tolerance. If the vertices are within this 3D OBJECT SPACE distance they may be merged.
< normalTolerance - If merging is based on vertex normals, then any vertices with normals that have an angular difference within this tolerance may be merged.
< textureTolerance - Similiar to distanceTolerance except the distance measured is in texture coordinate space (2D). If the vertices are within this tolerance distance then they may be merged.
sSuccess - merging was successful
sInvalidObject - the polyset was invalid
Separates out all vertices from being shared into individual non-shared vertices per polygon.
sSuccess - splitting was successful
sInvalidObject - the polyset was invalid
Returns the number of shader lists associated with this polyset. Each shader list contains a list of shaders that may be used for rendering. The shader list used for rendering may be set on a per-polygon level. The default is the first (or list number 0). Additional lists may be created by assigning shaders to the n+1st shader list, where n is the number of shader lists currently in existance, as returned by the numberOfShaderLists() method. This method returns -1 if the polyset is invalid.
Sets the render info for this surface to the contents of the renderInfo structure.
> renderInfo - the structure to take the render information from
sSuccess - setting the render information was successful
sInvalidArgument - renderInfo was NULL or one of the parameters was out of range
sFailure - setting the render information failed
sInvalidObject - the polyset was invalid
Returns TRUE if the specified display mode is toggled on for the polyset. Returns FALSE otherwise, or if the object is not valid.
The only valid AlDisplayModeType for an AlPolyset is kDisplayGeomCVs.
< mode - display mode of interest
For the given display mode, if the flag is TRUE, the display mode for the polyset is set; otherwise, it is unset.
The only valid AlDisplayModeType for an AlPolyset is kDisplayGeomCVs.
< mode - display mode of interest
< on_or_off - TRUE to have display mode set and FALSE to have it unset
sSuccess - if this operation was successful
sInvalidArgument - the 'mode' was invalid
sInvalidObject - the polyset was invalid
Returns whether the normals of this polyset have been "frozen"; that is, protected from calls to calcNormals. Since normals may be recalculated in the Alias environment at any time, use this call to preserve use-generated normals.
FALSE - the normals are not frozen
Sets a flag on the polyset to indicate that the normals of the polyset should not be recomputed. Note that modifying the polyset after freezing the normals will result in the normals not matching the underlying geometry.
sSuccess - the normals are frozen
sInvalidObject - an error occured
Sets a flag on the polyset to indicate that the normals of the polyset should be recomputed as needed.
sSuccess - the normals are unfrozen
sInvalidObject - the an error occured
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.
< 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 polyset 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 - the operation was successful
sInsufficientMemory - not enough memory to allocate a new block
sInvalidObject - the polyset 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 - the operation was successful
sFailure - no such blind data existed sInvalidObject - the given object was not valid
Applies the given AlIterator to all polygons in the polyset. 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 polygon
> rc - 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 polyset is invalid
sInvalidArgument - the iterator was NULL
Applies the given AlIterator to all vertices in the polyset. 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 polygon
> rc - 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 polyset is invalid
sInvalidArgument - the iterator was NULL
Uses a linear projection algorithm to calculate the default texture coordinates.
sSuccess - the operation was successful
sFailure - the operation failed
sInvalidObject - the polyset was invalid
Allows the creation of a set of vertices which have they x,y,z point specified in an array parameter. If the polygonIndex pointer is not NULL then vertex N will be added to the polygon specified by polygonIndex[N].
Note: vertexList is pointing to an array of double the size of [ numberOfVertices * 3 ]. Also, polygonIndex points to list of size numberOfVertices.
< numberOfVertices - the number of vertices in the array
< vertexList - the array of x,y,z vertices
< polygonIndex - array of indices for polygons
sSuccess - vertice creation succeeded
sFailure - vertice creation failed
sInvalidObject - the polyset is invalid
sInvalidArgument - the number of vertices to create is less than 1
Used for allocating a number of polygons.
< numberOfPolygons - number of polygons to create
sSuccess - polygon creation succeeded
sFailure - polygon creation failed
sInvalidObject - the polyset is invalid
sInvalidArgument - the number of polygons to create is less than 1
Used for the batch deletion of vertices. The indices[] array contains the indices of vertices that are to be deleted.
Note: this routine always sorts the list of indices before performing the delete.
< numberOfIndices - number of indices
< indices - the array of indices to delete
sSuccess - the deletion succeeded
sInvalidArgument - 'indices' was NULL
sFailure - the polyset is inactive
sInvalidObject - the polyset was invalid
Deletes the polygons and vertices associated with the polyset.
sSuccess - the polygons and vertices were deleted
sInvalidObject - the polyset was invalid