Index

 E3d_PolygonVertexNodesAllocate
 E3d_PolygonAddVertexNode
 E3d_PolygonDefault
 E3d_PolygonsAllocate
 E3d_PolyGroupAddPolygon
 E3d_PolygonInit
 E3d_PolygonInitAsTriangle
 E3d_PolygonSet
 E3d_PolygonSetAsTriangle
 E3d_TriangleStripsAllocate
 E3d_TriangleStripVertexNodesAllocate


E3d_PolygonVertexNodesAllocate

Allocate VertexNodes for a Polygon

Syntax
 E3dVertexNode* E3d_PolygonVertexNodesAllocate(E3dPolygon* LPolygon, unsigned int LVertexNodeSize,
                                     unsigned int LNumOfVertexNodes)
Arguments
 E3dPolygon*  LPolygon             Pointer to the Polygon structure
 unsigned int LNumOfVertexNodes    The number of VertexNodes to allocate
Description
Allocates VertexNodes for the given Polygon and initializes these fields:
 LPolygon->NumOfVertices = 0;                    // Number of VertexNodes minus contour separators
 LPolygon->NumOfExteriorVertices = 0;            // Number of Vertices in the exterior contour
 LPolygon->NumOfVertexNodes = LNumOfVertexNodes; // Total number of VertexNodes


Return value
A pointer to the allocated array of VertexNodes or NULL in case of an error

See also
E3d_PolygonAddVertexNode

E3d_PolygonAddVertexNode

Add one VertexNode to a Polygon

Syntax
 E3dVertexNode* E3d_PolygonAddVertexNode(E3dPolygon* LPolygon, unsigned int LVertexNodeSize,
                                         int LVIdx,
                                         int LWhere)
Arguments
 E3dPolygon*  LPolygon          Pointer to the E3dPolygon structure
 int          LVIdx             Vertex index
 int          LWhere            Where to add the new VertexNode
 ...               List of vertex indices (int)
Description

This function adds a new VertexNode to the given Polygon. The LWhere argument is the index of the VertexNode BEFORE which the the new one should be inserted.
The value E3dVNODE_END for LWhere is recognized. It means to add the new VertexNode after the last one.
LVIdx is an index to the Vertex array on the E3dMesh that the Polygon belongs to. This value will be copied into the VertexID field of the new VertexNode.
A Polygon can have multiple contours: exterior and optional holes. The exterior contour is always the first one and is defined with a counter-clockwise Vertex order, while holes are defined with a clockwise Vertex order.
In the VertexNode list of a Polygon, negative VertexIDs separate the contours and these numbers give the number of Vertices in the next contour (e.g.: -3 means that the next contour has 3 Vertices). There is no such separator before the exterior contour, but instead the Polygon has a field called NumOfExteriorVertices.



Example
This call inserts a VertexNode that uses the #42 Vertex of the Mesh, before the #5 VertexNode of LPolygon:
 E3d_PolygonAddVertexNode(LPolygon, 42, 5);


Return value
A pointer to the new VertexNode, or NULL in case of an error.

See also
E3d_PolygonsAllocate, E3d_PolygonInit, E3d_PolygonInitAsTriangle

E3d_PolygonDefault

Default a Polygon

Syntax
 void E3d_PolygonDefault(E3dPolygon* LPolygon)
Argument
 E3dPolygon* LPolygon   Pointer to the Polygon
Description
Initializes a Polygon structure

Return value
None.

E3d_PolygonsAllocate

Allocate array of Polygons

Syntax
 E3dPolygon* E3d_PolygonsAllocate(unsigned int LNumOfPolys)
Arguments
 unsigned int LNumOfPolys    Number of Polygons to Allocate
Description
This function allocates memory for an array of Polygons and initializes each Polygon in this array.

Return value
A pointer to the newly allocated array of Polygons, or NULL in case of an error.

See also
E3d_PolygonInit, E3d_PolygonInitAsTriangle

E3d_PolyGroupAddPolygon

Add one Polygon to a PolyGroup

Syntax
 E3dPolygon* E3d_PolyGroupAddPolygon(E3dPolyGroup* LPolyGroup)
Arguments
 E3dPolyGroup* LPolyGroup     Pointer to the PolyGroup structure
Description
This function adds a new Polygon to the given PolyGroup.

Return value
A pointer to the new Polygon, or NULL in case of an error.

See also
E3d_PolygonsAllocate, E3d_PolygonInit, E3d_PolygonInitAsTriangle

E3d_PolygonInit

Initialize a Polygon's Flags and VertexNodes

Syntax
 EBool E3d_PolygonInit(E3dPolygon* LPolygon, unsigned int LVertexNodeSize, unsigned int LNumOfVertexNodes, ...)
Arguments
 E3dPolygon*  LPolygon             Pointer to the E3dPolygon structure
 unsigned int LNumOfVertexNodes    Number of vertex nodes
 ...                  List of vertex indices (int)
Description
This function initializes the given Polygon by allocating VertexNodes for it, initializing them and setting the Polygon's Flags.
The argument "..." is a variable length vertex index list. The vertex indices are of type: "int". These indices refer to the Vertex array on the E3dMesh the given E3dPolygon belongs to.

Example
This call defines a rectangle of vertices: 0, 1, 2 and 3 with a triangle hole: 6, 5, 4:
 E3d_PolygonInit(0, LPolygon, 0, 1, 2, 3, -1, 6, 5, 4);


Return value
TRUE if successful, FALSE in case of an error.

See also
E3d_PolygonAllocate, E3d_PolygonsAllocate, E3d_PolygonInitAsTriangle, E3d_PolygonSet, E3d_PolygonSetAsTriangle

E3d_PolygonInitAsTriangle

Initialize Polygon as a triangle

Syntax
 EBool E3d_PolygonInitAsTriangle(E3dPolygon* LPolygon, unsigned int LVertexNodeSize, int LVtx0, int LVtx1, int LVtx2)
Arguments
 E3dPolygon*  LPolygon              The E3dPolygon to be initialized
 int          LVtx0, LVtx1, LVtx2   Vertex indices (from the Mesh)
Description
Takes a pointer to a Polygon and initializes it as a triangle:
- it sets the Polygon's flags,
- allocates memory for 3 VertexNodes
- initializes the Vertex indices of the VertexNodes, using LVtx0, LVtx1 and LVtx2

Return value
TRUE or FALSE depending on whether the Polygon was successfully initialized or not.

See also
E3d_PolygonInit, E3d_PolygonSet, E3d_PolygonSetAsTriangle

E3d_PolygonSet

Change a Polygon's VertexNodes

Syntax
 EBool E3d_PolygonSet(E3dPolygon* LPolygon, unsigned int LVertexNodeSize, unsigned int LNumOfVertexNodes, ...)
Arguments
 E3dPolygon*  LPolygon             Pointer to the E3dPolygon structure
 unsigned int LNumOfVertexNodes    Number of vertex nodes
 ...                  List of vertex indices (int)
Description
This function is just like E3d_PolygonInit, except it fitst checks whether VertexNodes are already allocated for this Polygon. If yes and the number of VertexNodes allocated were equal to LNumOfVertexNodes, it uses the old VertexNode array, otherwise it (re)allocates the VertexNodes before initializing them.

Return value
TRUE if successful, FALSE in case of an error.

See also
E3d_PolygonAllocate, E3d_PolygonsAllocate, E3d_PolygonInit, E3d_PolygonInitAsTriangle

E3d_PolygonSetAsTriangle

Make a Polygon a triangle

Syntax
 EBool E3d_PolygonSetAsTriangle(E3dPolygon* LPolygon, unsigned int LVertexNodeSize, int LVtx0, int LVtx1, int LVtx2)
Arguments
 E3dPolygon*  LPolygon              The E3dPolygon to be initialized
 int          LVtx0, LVtx1, LVtx2   Vertex indices (from the Mesh)
Description
This function is just like E3d_PolygonInitAsTriangle, except it fitst checks whether VertexNodes are already allocated for this Polygon. If yes and the and the number of VertexNodes allocated were 3, it uses that VertexNode array, otherwise it (re)allocates the VertexNodes before initializing them.

Return value
TRUE or FALSE depending on whether the Polygon was successfully initialized or not.

See also
E3d_PolygonInit, E3d_PolygonInitAsTriangle, E3d_PolygonSet

E3d_TriangleStripsAllocate

Allocate memory for triangle strips

Syntax
 E3dTriangleStrip* E3d_TriangleStripsAllocate(unsigned int LNumOfStrips)
Argument
 unsigned int LNumOfStrips   Number of strips to allocate
Description
Allocates memory for the specified number of triangle strips and initializes them.

Return value
A pointer to the allocated array of triangle strips or NULL in case of an error

See also
E3d_PolyGroupFreeTriangleStrips

E3d_TriangleStripVertexNodesAllocate

Allocate vertex nodes for a triangle strip

Syntax
 E3dVertexNode* E3d_TriangleStripVertexNodesAllocate(E3dTriangleStrip* LTriangleStrip, unsigned int LVertexNodeSize,
                                     int LNumOfVertices)
Arguments
 E3dTriangleStrip* LTriangleStrip     Pointer to the Polygon structure
 LNumOfVertexNodes  Number of vertex nodes to allocate
Description
This function allocates a number of E3dVertexNode structures in an array and initializes them.

Return value
Pointer to the array of allocated vertex nodes or NULL in case of an error.

See also
E3d_TriangleStripsAllocate