Share

AlSubdiv

Interface to Alias subdivision objects.

Synopsis

#include <AlSubdivNode.h>
class AlSubdiv : public AlObject
AlSubdiv();
virtual ~AlSubdiv();

statusCode deleteObject() override;
AlObject* copyWrapper() const override;

AlObjectType type() const override;

int numberOfVertices() const;
statusCode vertices( double* vertices );

struct AlFaceInfo
{
  int vertsNum;
  int* vertsIds;
};

int numberOfFaces() const;
statusCode faces( AlFaceInfo* faces );

struct AlCreasedInfo
{
  int faceId;
  int elementId;
  double creaseWeight;
};

int numberOfCreasedEdges() const;
statusCode creasedEdges( AlCreasedInfo* creasedEdges );

AlSubdivNode* subdivNode();

static AlSubdiv* create( int numVerts, const double* verts, 
                         int numFaces, AlFaceInfo* faces, 
                         int numCreasedEdges, AlCreasedInfo* creasedEdges );

statusCode transform( double[4][4] ) const;
statusCode boundingBox( double* min, double* max ) const;

Description

AlSubdiv is the interface to subdivision objects and their data in Alias. This class lets you create and manipulate subdivision objects. The following properties are used throughout the mesh class.

Face

Vertices

Vertices are passed by this class using an array of floating point values. A vertex consists of three values: x, y, and z. Refer to the definition of triangles for a description of the relationship between vertices and triangles (see AlMesh).

AlSubdiv::AlSubdiv()

Description

Constructs an AlSubdiv wrapper object.

AlSubdiv::~AlSubdiv()

Description

Deletes an AlSubdiv wrapper object. Note that this destructor does not delete the associated subdivision object. To properly remove a node or geometry from the DAG use AlDagNode::deleteObject() (see AlDagNode).

statusCode deleteObject() override

Description

Deletes the underlying subdivision node.

AlObject *AlSubdivNode::copyWrapper() const

Description

Makes a copy of the AlSubdiv wrapper.

AlObjectType AlSubdiv::type() const

Description

Returns -1 cast to AlObjectType.

int numberOfVertices() const

Description

Returns the number of vertices in the subdivision object.

statusCode vertices( double* vertices )

Description

Sets each element of the vertices array to a pointer to an array of coordinates. Memory for the vertices array should be allocated by the caller.

int numberOfFaces() const

Description

Returns the number of faces in this subdivision object.

statusCode faces( AlFaceInfo* faces )

Description

For each face in the subdivision object, it returns the number of vertices and the ID of each vertex. Memory for the AlFaceInfo array should be allocated by the caller.

int numberOfCreasedEdges() const

Description

Returns the number of creased edges in this subdivision object.

statusCode creasedEdges( AlCreasedInfo* creasedEdges )

Description

Fills in face ID, element ID and crease weight for each creased edge in the subdivision object. Memory for creased edge information structures should be allocated by the caller.

class AlSubdivNode *AlSubdiv::subdivNode() const

Description

Returns a wrapper for the group node containing this subdivision node.

static AlSubdiv* create( int numVerts, int numFaces, AlCreasedInfo* creasedEdges )

AlFaceInfo* faces, int numCreasedEdges,

AlCreasedInfo* creasedEdges

Description

This adds a subdivision node beside the Alias root node.

Note: Alias does not yet support creased vertices. The arguments are provided here for future implementation.

statusCode transform( double tm[4][4] ) const

Description

Transforms the mesh by the matrix 'tm'.

statusCode boundingBox( double* min, double* max ) const

Description

Retrieves the bounding box of the subdivision object. The 'min' and 'max' arguments are arrays that contain the min or max x, y, and z values.

AlSubdiv::assignShader( AlShader* shader )

Description

Layers the given shader to the subdiv. If the subdiv already has shaders they will be kept and the passed shader will be add (layered). The subdiv must have a subdiv node for this method to succeed.

Note: The shader actually gets layered to all of the subdiv's limit surfaces rather than to the subdiv body itself.

Arguments

< shader - The shader which will be layered on the subdiv's limit surfaces.

Return codes

sSuccess - the shader was successfully layered on the subdiv.

sInvalidArgument - 'shader' was invalid.

sFailure - the shader was not assigned due to invalid data.

sInvalidObject - this subdiv object is in an invalid state.

AlSubdiv::layerShader( AlShader* shader )

Description

Layers the given shader to the subdiv. If the subdiv already has shaders they will be kept and the passed shader will be added (layered). The subdiv must have a subdiv node for this method to succeed.

Note: The shader actually gets layered to all of the subdiv's limit surfaces rather than to the subdiv body itself.

Arguments

< shader - The shader which will be layered on the subdiv's limit surfaces.

Return codes

sSuccess - the shader was successfully layered on the subdiv.

sInvalidArgument - 'shader' was invalid.

sFailure - the shader was not assigned due to invalid data.

sInvalidObject - this subdiv object is in an invalid state.

AlSubdiv::assignSwitchShader( AlSwitchShader* switchShader )

Description

Assigns the given Switch Shader to the subdiv. If the subdiv already has shaders they will be removed from the subdiv. The subdiv must have a subdiv node for this method to succeed.

Note: The Switch Shader actually gets assigned to all of the subdiv's limit surfaces rather than to the subdiv body itself.

Arguments

< switchShader - The Switch Shader which will be assigned to the subdiv.

Return codes

sSuccess - the shader was successfully layered on the subdiv.

sInvalidArgument - 'shader' was invalid.

sFailure - the shader was not assigned due to invalid data.

sInvalidObject - this subdiv object is in an invalid state.

AlSubdiv::assignLayeredShader( AlLayeredShader* layeredShader )

Description

Layers the given shader to the subdiv. If the subdiv already has shaders they will be kept and the passed shader will be added (layered). The subdiv must have a subdiv node for this method to succeed.

Note: The shader actually gets layered to all of the subdiv's limit surfaces rather than to the subdiv body itself.

Arguments

< shader - The shader which will be layered on the subdiv's limit surfaces.

Return codes

sSuccess - the shader was successfully layered on the subdiv.

sInvalidArgument - 'shader' was invalid.

sFailure - the shader was not assigned due to invalid data.

sInvalidObject - this subdiv object is in an invalid state.

Was this information helpful?