fastest 3D software for linux

Linux 3D
interactive ray-tracing
[1 introduction] [2 overview] [3 reference] [4 GUI]

Index

 E3dPolygon_AddVertexNode
 E3dPolygon_FreeContents
 E3dPolygons_New
 E3dPolygon_InitVa
 E3dPolygon_InitAsTriangle
 E3dPolygon_SetAsTriangle
 E3dPolygon_InitAsQuad
 E3dPolygon_SetVa
 E3dPolygon_Triangulate
 E3dTriangleStrips_New
 E3dTriangleStrip_VertexNodesNew

E3dPolygon_AddVertexNode

Add one VertexNode to a Polygon

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

Arguments
PPolygon Pointer to the E3dPolygon structure PVertexNodeSize The size of a VertexNode in bytes (this is a property of the PolyGroup and is variable) PMeshVertexIndex Mesh Vertex index to use 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:
 E3dPolygon_AddVertexNode(PPolygon, 42, 5);
Return value
A pointer to the new VertexNode, or NULL in case of an error.

See also
E3dPolygons_New, E3dPolygon_Init, E3dPolygon_InitAsTriangle

E3dPolygon_FreeContents

Free contents of a Polygon

Syntax
void E3dPolygon_FreeContents(E3dPolygon* PPolygon)

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

Return value
None.

E3dPolygons_New

Allocate array of Polygons

Syntax
E3dPolygon* E3dPolygons_New(const EIndex PCount)

Arguments
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
E3dPolygon_Init, E3dPolygon_InitAsTriangle

E3dPolygon_InitVa

Initialize a Polygon's Flags and VertexNodes

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

Arguments
PPolygon Pointer to the E3dPolygon structure 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:
 E3dPolygon_InitVa(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
E3dPolygons_New, E3dPolygon_InitAsTriangle, E3d_PolygonSet, E3dPolygon_SetAsTriangle

E3dPolygon_InitAsTriangle

Initialize Polygon as a triangle

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

Arguments
PPolygon The E3dPolygon to be initialized 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
E3dPolygon_Init, E3d_PolygonSet, E3dPolygon_SetAsTriangle

E3dPolygon_SetAsTriangle

Make a Polygon a triangle

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

Arguments
PPolygon The E3dPolygon to be initialized PVtx0, PVtx1, PVtx2 Vertex indices (from the Mesh)
Description
This function is similar to E3dPolygon_InitAsTriangle, except it first 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
E3dPolygon_Init, E3dPolygon_InitAsTriangle, E3d_PolygonSet

E3dPolygon_InitAsQuad

Initialize Polygon as a quadrangle

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

Arguments
PPolygon The E3dPolygon to be initialized 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
E3dPolygon_Init, E3d_PolygonSet, E3dPolygon_InitAsTriangle, E3dPolygon_SetAsTriangle

E3dPolygon_SetVa

Change a Polygon's VertexNodes

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

Arguments
PPolygon Pointer to the E3dPolygon structure PCount Number of vertex nodes ... List of vertex indices (EIndex)
Description
This function is just like E3dPolygon_Init, 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
E3dPolygons_New, E3dPolygon_Init, E3dPolygon_InitAsTriangle

E3dPolygon_Triangulate

Triangulate a Polygon

Syntax
EIndex E3dPolygon_Triangulate(E3dPolygon* PPolygon, const E3dVertexNodeSize PVertexNodeSize, const E3dVertex* PVertices, const EIndex PNVertices, const E3dVertexSize PVertexSize, const EBool PDoConvex)

Arguments
PVertices The array of Vertices this Polygon is indexing in its VertexNodes PNVertices The number of Vertices in PVertices (for index range-checking) PPolygon Pointer to the E3dPolygon structure PDoConvex Should we try to triangulate convex Polys or just concave ones
Description
Triangulates a Polygon and stores the resulting triangles in the Polygon structure. The Polygon's normal must be correct before calling this function.

Return value
The number of resulting triangles, or anE_ error code if the triangulation was unsuccessful.

See also
E3d_TestTriangulatePolygon, E3dPolygon_TriangulateForRendering, E3dPolygon_UpdateNormal

E3dTriangleStrips_New

Allocate memory for triangle strips

Syntax
E3dTriangleStrip* E3dTriangleStrips_New(const EIndex PCount)

Argument
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
E3dPolyGroup_FreeTriangleStrips

E3dTriangleStrip_VertexNodesNew

Allocate vertex nodes for a triangle strip

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

Arguments
PTriangleStrip Pointer to the Polygon structure 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
© 1996-2024 By Gabor Nagy