fastest 3D software for linux

Linux 3D
interactive ray-tracing

Index

 E3d_PolygonAddVertexNode
 E3d_PolygonFreeContents
 E3d_PolygonsNew
 E3d_PolygonVaInit
 E3d_PolygonInitAsTriangle
 E3d_PolygonSetAsTriangle
 E3d_PolygonInitAsQuad
 E3d_PolygonVaSet
 E3d_TriangleStripsNew
 E3d_TriangleStripVertexNodesNew


E3d_PolygonAddVertexNode

Add one VertexNode to a Polygon

Syntax
E3dVertexNode* E3d_PolygonAddVertexNode(E3dPolygon* PPolygon, const E3dVertexNodeSize PVertexNodeSize, const EIndex PMeshVertexIndex, EIndex PWhere)

Arguments
E3dPolygon* PPolygon Pointer to the E3dPolygon structure const E3dVertexNodeSize PVertexNodeSize The size of a VertexNode in bytes (this is a property of the PolyGroup and is variable) const EIndex PMeshVertexIndex Mesh Vertex index to use EIndex PWhere Where to add the new VertexNode
Description

This function adds a new VertexNode to the given Polygon. The PWhere argument is the index of the VertexNode BEFORE which the the new one should be inserted.
The value E3dVNODE_END for PWhere is recognized, meaning to add the new VertexNode after the last one.
PMeshVertexIndex is an index to the Vertex array on the E3dMesh to which the Polygon belongs. This value will be copied into the VertexID field of the new VertexNode. Other members of the VertexNode are not initialized, so it's the caller's responsibility to set them. This is because VertexNode members are dynamically typed (the description is in the PolyGroup), so this funcion doesn't know the memory layout of those data members, or what the sensible default values would be.
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 member called NumOfExteriorVertices.



Example
This call inserts a VertexNode that uses the #42 Vertex of the Mesh, before the #5 VertexNode of PPolygon:
 E3d_PolygonAddVertexNode(PPolygon, 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_PolygonFreeContents

Free contents of a Polygon

Syntax
void E3d_PolygonFreeContents(E3dPolygon* PPolygon)

Argument
E3dPolygon* PPolygon Pointer to the Polygon
Description
Frees memory for Polygon's VertexNodes and ITriangles

Return value
None.

E3d_PolygonsNew

Allocate array of Polygons

Syntax
E3dPolygon* E3d_PolygonsNew(const EIndex PCount)

Arguments
const EIndex PCount 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_PolygonVaInit

Initialize a Polygon's Flags and VertexNodes

Syntax
EBool E3d_PolygonVaInit(E3dPolygon* PPolygon, const E3dVertexNodeSize PVertexNodeSize, const EIndex PCount, ...)

Arguments
E3dPolygon* PPolygon Pointer to the E3dPolygon structure const EIndex PCount Number of vertex nodes ... List of vertex indices (EIndex)
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: "EIndex". 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_PolygonVaInit(0, PPolygon, PPolyGroup->VertexNodeSize,  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* PPolygon, const E3dVertexNodeSize PVertexNodeSize, const EIndex PVtx0, const EIndex PVtx1, const EIndex PVtx2)

Arguments
E3dPolygon* PPolygon The E3dPolygon to be initialized const EIndex PVtx0, PVtx1, PVtx2 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 PVtx0, PVtx1 and PVtx2

Return value
TRUE or FALSE depending on whether the Polygon was successfully initialized or not. Use this function for newly allocated Polygons.

See also
E3d_PolygonInit, E3d_PolygonSet, E3d_PolygonSetAsTriangle

E3d_PolygonSetAsTriangle

Make a Polygon a triangle

Syntax
EBool E3d_PolygonSetAsTriangle(E3dPolygon* PPolygon, const E3dVertexNodeSize PVertexNodeSize, const EIndex PVtx0, const EIndex PVtx1, const EIndex PVtx2)

Arguments
E3dPolygon* PPolygon The E3dPolygon to be initialized const EIndex PVtx0, PVtx1, PVtx2 Vertex indices (from the Mesh)
Description
This function is similar to E3d_PolygonInitAsTriangle, except it fitst checks whether the number of VertexNodes currently allocated for this Polygon is exactly 3. If so, it uses the old VertexNode array, otherwise it (re)allocates the array before initializing it.

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

See also
E3d_PolygonInit, E3d_PolygonInitAsTriangle, E3d_PolygonSet

E3d_PolygonInitAsQuad

Initialize Polygon as a quadrangle

Syntax
int E3d_PolygonInitAsQuad(E3dPolygon* PPolygon, const E3dVertexNodeSize PVertexNodeSize, const EIndex PVtx0, const EIndex PVtx1, const EIndex PVtx2, const EIndex PVtx3)

Arguments
E3dPolygon* PPolygon The E3dPolygon to be initialized const EIndex PVtx0, PVtx1, PVtx2, PVtx3 Vertex indices (from the Mesh)
Description
Takes a pointer to a Polygon and initializes it as a quadrangle:
- it sets the Polygon's flags,
- allocates memory for 4 VertexNodes
- initializes the Vertex indices of the VertexNodes, using PVtx0, PVtx1, PVtx2 and PVtx3 - creates ITriangles

Return value
E_SUCCESS if the Polygon was successfully initialized or not, otherwise an error code, such as E_NO_MEMORY. Use this function for newly allocated Polygons.

See also
E3d_PolygonInit, E3d_PolygonSet, E3d_PolygonInitAsTriangle, E3d_PolygonSetAsTriangle

E3d_PolygonVaSet

Change a Polygon's VertexNodes

Syntax
EBool E3d_PolygonVaSet(E3dPolygon* PPolygon, const E3dVertexNodeSize PVertexNodeSize, EIndex PCount, ...)

Arguments
E3dPolygon* PPolygon Pointer to the E3dPolygon structure EIndex PCount Number of vertex nodes ... List of vertex indices (EIndex)
Description
This function is just like E3d_PolygonInit, except it fitst checks whether the number of VertexNodes currently allocated for this Polygon is exactly PCount. If so, it uses the old VertexNode array, otherwise it (re)allocates the array before initializing it.

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

See also
E3d_PolygonAllocate, E3d_PolygonsAllocate, E3d_PolygonInit, E3d_PolygonInitAsTriangle

E3d_TriangleStripsNew

Allocate memory for triangle strips

Syntax
E3dTriangleStrip* E3d_TriangleStripsNew(const EIndex PCount)

Argument
const EIndex PCount 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_TriangleStripVertexNodesNew

Allocate vertex nodes for a triangle strip

Syntax
E3dVertexNode* E3d_TriangleStripVertexNodesNew(E3dTriangleStrip* PTriangleStrip, const E3dVertexNodeSize PVertexNodeSize, const EIndex PCount)

Arguments
E3dTriangleStrip* PTriangleStrip Pointer to the Polygon structure const E3dVertexNodeSize PVertexNodeSize The size of a VertexNode in bytes PNumOfVertexNodes 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
© 1992-2017 By Gabor Nagy