fastest 3D software for linux

Linux 3D
interactive ray-tracing

Index

 E3d_VerticesNew
 E3d_VerticesAdd
 E3d_MeshVerticesFree
 E3d_MeshFilterVertices
 E3d_MeshVerticesRemap
 E3d_MeshVertexGetConnectedVertices
 E3d_MeshVertexGetEdges
 E3d_MeshGetVertexUsageList
 E3d_EdgesNew
 E3d_MeshEdgesNew
 E3d_MeshEdgesAdd
 E3d_MeshEdgesFree
 E3d_MeshEdgesSorted
 E3d_EdgesSort
 E3d_MeshEdgesSort
 E3d_MeshCreateWingedEdgesFromEdges
 E3d_MeshGetEdgeNormals
 E3d_MeshEdgeGetPolygons
 E3d_MeshNumOfSelectedEdges
 E3d_MeshEdgeFlagsUpdate
 E3d_MeshPolyGroupsEdgesFromMeshEdges
 E3d_MeshAppendPolyGroup
 E3d_MeshAddPolyGroup
 E3d_MeshRemovePolyGroup
 E3d_MeshChangePolygonFlags
 E3d_MeshPolyGroupAddTriangleStrip
 E3d_MeshPolyGroupAddTriangleStrips
 E3d_MeshEdgesAndPolyGroupsRemapVertexIndices
 E3d_MeshNumOfSelectedPolygons
 E3d_MeshGetBoundingBox
 E3d_MeshGetTransformedBoundingBox
 E3d_MeshFreeCaches


E3d_VerticesNew

Allocate memory for an array of Vertices

Syntax
E3dVertex* E3d_VerticesNew(const EIndex PNumOfVertices, const EBool PInitialize)

Arguments
const EIndex PNumOfVertices Number of Vertices to allocate const EBool PInitialize If TRUE, initialize the Vertices via E3dM_VertexInit
Description
Allocates memory for the specified number of Vertices.

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

See also
E3d_MeshVerticesFree

E3d_VerticesAdd

Add Vertices to an array

Syntax
E3dVertex* E3d_VerticesAdd(E3dVertex* PVertices, const EIndex POldNumOfVertices, EIndex PNumOfNewVertices, const EBool PInitialize)

Arguments
E3dVertex* PVertices Pointer to the array const EIndex POldNumOfVertices Number of Vertices already in the array EIndex PNumOfNewVertices Number of Vertices to add const EBool PInitialize Initialize the Vertex array
Description
Allocates memory for the specified number of Vertices.

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

See also
E3d_MeshVerticesFree

E3d_MeshVerticesFree

Free Vertices of a Mesh

Syntax
void E3d_MeshVerticesFree(E3dMesh* PMesh)

Argument
E3dMesh* PMesh Pointer to the Mesh
Description
Frees the Vertex array of a Mesh.

Return value
None.

E3d_MeshFilterVertices

Mark Vertices of a Mesh that pass the given filter criteria

Syntax
EIndex E3d_MeshFilterVertices(const E3dMesh* PMesh, const unsigned int PWhatToInclude)

Argument
const E3dMesh* PMesh Pointer to the Mesh structure const unsigned int PWhatToInclude The filter criteria (OR-ed together bits)
Description
Examines the given Mesh and marks the Vertices that pass z given filter criteria, by setting their E3dVtxMARK0 flag.

Example
E3d_MeshFilterVertices(PMesh, E3dBB_SELECTED_POLYGROUPS);
This will mark the Vertices PASSED, that are referenced from the selected PolyGroups of the Mesh. For improved efficiency, if all the Vertices pass, no Vertex flags are set, but the returned value will be equal to PMesh->Vertices_Count.

Return value
The number of Vertices that passed the test.

See also
E3d_MeshGetBoundingBox

E3d_MeshVerticesRemap

Add / remove or reorder Mesh Vertices

Syntax
void E3d_MeshVerticesRemap(E3dMesh* PMesh, const EIndex* PNewToOldVertexTable, const EIndex PNumOfVertices)

Arguments
E3dMesh* PMesh Pointer to the Mesh const EIndex* PNewToOldVertexTable Indices to the original Vertex for each new Vertex const EIndex PNumOfVertices The new number of Vertices
Description
Copies the Vertex list of a Mesh to a new one, based on a remapping table (potentially doing one-to-many mapping).
This function should be used to add or remove Vertices from a Mesh, so those changes are propagated to the Mesh's runtime-typed components.
PNewToOldVertexTable should have PNumOfVertices entries. One for each Vertex in the new Vertex list.
The values should be indices to the original Vertex to be copied to a given new Vertex.
PNumOfVertices may be less than PMesh->Vertices_Count (removing Vertices), greater (adding / duplicating Vertices) or equal (reordering).
More than one new Vertex may be derived from each original Vertex.
An index value of -1 means that no original Vertex will be copied to the corresponding new Vertex.
It is the caller's responsibility to properly initialize such new Vertices.

Return value
None.

See also
E3d_MeshEdgesAndPolyGroupsRemapVertexIndices

E3d_MeshVertexGetConnectedVertices

Collect Vertices that a Vertex is connected to via Edges

Syntax
EIndex E3d_MeshVertexGetConnectedVertices(const E3dMesh* PMesh, const EIndex PVertexIndex, EIndex** PVertexIndicesP)

Arguments
const E3dMesh* PMesh Pointer to the Mesh const EIndex PVertexIndex Index of the Vertex in question EIndex** PVertexIndicesP The list of Vertex indices will be returned here
Description
Collects a list of Edges in a Mesh that share a given Vertex.

Return value
The number of Edges that share the given Vertex

E3d_MeshVertexGetEdges

Collect Edges that share a Vertex

Syntax
EIndex E3d_MeshVertexGetEdges(const E3dMesh* PMesh, const EIndex PVertexIndex, E3dEdge*** PEdgesPtr)

Arguments
const E3dMesh* PMesh Pointer to the Mesh const EIndex PVertexIndex Index of the Vertex in question E3dEdge*** PEdgesPtr The list of Edges will be returned here
Description
Collects a list of Edges in a Mesh that share a given Vertex.

Return value
The number of Edges that share the given Vertex

E3d_MeshGetVertexUsageList

Collect information on which Polygon VertexNodes use each Vertex of the given Mesh.

Syntax
E3dVertexUsage* E3d_MeshGetVertexUsageList(E3dMesh* PMesh, const EBool PGetPolyGroups, const EBool PGetEdges)

Arguments
E3dMesh* PMesh Pointer to the Mesh const EBool PGetPolyGroups Fill in PolyGroups fields const EBool PGetEdges Fill in EdgeEnds fields
Description
Builds array of E3dVertexUsage structs for PMesh (one entry per Mesh Vertex). Each entry will show: - Which Polygon VertexNodes use that Vertex. If PGetPolyGroups is TRUE, it will also show which PolyGroups those Polygons belong to. - The other end (Vertex) of each Edge that connects to this Vertex. See the definition of E3dVertexUsage for more details.

Return value
Pointer to the array, or NULL, in case of an error.

E3d_EdgesNew

Allocate array of independent Edges (line segments)

Syntax
E3dEdge* E3d_EdgesNew(const EIndex PEdgeNum)

Argument
const EIndex PEdgeNum Number of Edges to allocate
Description
Allocates memory for an array of Edges and initializes all the Edges.

Return value
Pointer to the array of Edges or NULL in case of an error.

E3d_MeshEdgesNew

Allocate array of independent Edges (line segments)

Syntax
E3dEdge* E3d_MeshEdgesNew(E3dMesh* PMesh, const EIndex PCount, const EBool PInitialize)

Argument
E3dMesh* PMesh Pointer to the Mesh Count Number of Edges to allocate
Description
Reallocates the Edge array of PMesh and initializes all the Edges.

Return value
Pointer to the array of Edges or NULL in case of an error.

E3d_MeshEdgesAdd

Add Edges to a Mesh

Syntax
E3dEdge* E3d_MeshEdgesAdd(E3dMesh* PMesh, const EIndex PCount, const EBool PInitialize)

Arguments
E3dMesh* PMesh Pointer to the Mesh const EIndex PCount The number of Edges to add const EBool PInitialize If TRUE, initialize the new Edges
Description
Adds the given number of Edges to PMesh.

Return value
Pointer to the first newly added Edge.

E3d_MeshEdgesFree

Free Edges of a Mesh

Syntax
void E3d_MeshEdgesFree(E3dMesh* PMesh)

Argument
E3dMesh* PMesh Pointer to the Mesh
Description
Frees the VertexUsageList, VertexLinks, WingedEdges, PolyGroup Edge index lists, and finally the Edge array of a Mesh.

Return value
None.

E3d_MeshEdgesSorted

Check if the Edges of a Mesh are sorted

Syntax
int E3d_MeshEdgesSorted(E3dMesh* PMesh)

Argument
E3dMesh* PMesh The Mesh
Description
Check if the Edges of a Mesh are sorted by Start and End Vertex index.

Return value
E_YES if the Edges are sorted. E_NO, if the Edges are not sorted. E_CORRUPT_DATA if one or more Edges have Start > End. E_NO_DATA if the Mesh has no Edges.

E3d_EdgesSort

Sort a list of Edges

Syntax
int E3d_EdgesSort(E3dEdge* PEdges, const EIndex PCount)

Argument
E3dEdge* PEdges The array of Edges const EIndex PCount Number of Edges in the array
Description
Ensures that the "Start" field of each Edge is lower than the "End" field, then sorts the Edges in ascending order, by their "Start" field. This allows for much more efficient Edge manipulation, faster lookups etc.

Return value
E_SUCCESS if successful, E_NO_DATA if the array is empty and E_CORRUPT_DATA, if one or more of the Edges have Start == End

E3d_MeshEdgesSort

Sort Edges of a Mesh

Syntax
int E3d_MeshEdgesSort(E3dMesh* PMesh, const EBool PCheckIfSorted)

Argument
E3dMesh* PMesh The Mesh const EBool PCheckIfSorted If TRUE, check if the Edges are already properly sorted
Description
- For each Edge, ensures that the Start Vertex index is < End. - Sorts Edges by Start first, then by End. If PMesh has more than one PolyGroup, this function must be called before calling E3d_MeshPolyGroupsEdgesFromMeshEdges(). Otherwise the PolyGroup Edge indices will be wrong!

Return value
E_SUCCESS if the operation was successful. E_NO_DATA if the Mesh has no Edges E_NOTHING_TO_DO if PCheckIfSorted was TRUE and the Edges are already sorted.

E3d_MeshCreateWingedEdgesFromEdges

Create WingedEdge list and VertexLinks for the given Mesh from its Edge list
Unlike E3d_MeshCreateEdgesFromPolygons, this function leaves the Mesh's Edges intact,
so Edge selection etc. information will be preserved.

Syntax
void E3d_MeshCreateWingedEdgesFromEdges(E3dMesh* PMesh, const EBool PKeepVertexLinks, const EBool PRepair)

Arguments
E3dMesh* PMesh Pointer to the Mesh const EBool PKeepVertexLinks Keep Mesh->VertexLinks data const EBool PRepair Add missing Edges, if any
Description
Builds WidgedEdges data for a Mesh, from the Edges array.

Return value
None.

E3d_MeshGetEdgeNormals

Generate normals for the Edges of a Mesh

Syntax
E3dCoord3Sum* E3d_MeshGetEdgeNormals(const E3dMesh* PMesh)

Argument
const E3dMesh* PMesh Pointer to the Mesh
Description
Generates normal vectors for the Edges of a Mesh. The Mesh must have up-to-date WingedEdges.

Return value
Pointer to the normal vectors (one for each Edge), as an array of E3dCoord3Sum structs, or NULL, in case of an error.

See also
E3d_MeshCreateWingedEdgesFromEdges

E3d_MeshEdgeGetPolygons

Collect Polygons that share an Edge

Syntax
EIndex E3d_MeshEdgeGetPolygons(const E3dMesh* PMesh, const E3dEdge* PEdge, E3dEdgePolygonInfo** PDescriptorsP, unsigned int* PDescriptionP)

Arguments
const E3dMesh* PMesh Pointer to the Mesh const E3dEdge* PEdge The Edge to be tested E3dEdgePolygonInfo** PDescriptorsP Results pointer unsigned int* PDescriptionP Flags, providing some details
Description
Description Collects the Polygons that share an Edge within a Mesh. If successful, it will return an array of E3dEdgePolygonInfo structs. If PEdge is part of a Polygon's hole contour, the flag E3dPolyEDGE_IS_IN_HOLE_CONTOUR will be set in PDescriptionP.

Return value
The number of Polygons that share PEdge

E3d_MeshNumOfSelectedEdges

Count selected Edges in a Mesh

Syntax
EIndex E3d_MeshNumOfSelectedEdges(const E3dMesh* PMesh)

Argument
const E3dMesh* PMesh Pointer to the E3dMesh structure
Description
Returns the number of selected Edges in the given Mesh.

Return value
The number of selected Edges.

E3d_MeshEdgeFlagsUpdate

Update a Mesh after Edge parameters change

Syntax
void E3d_MeshEdgeFlagsUpdate(E3dMesh* PMesh)

Argument
E3dMesh* PMesh Pointer to the Mesh
Description
This function must be called after changing the E3dSELECTED_EDGES, E3dACTIVE_EDGES and E3dHARD_EDGES flags, or the Hardness value of a Mesh's Edges. Otherwise, the changes will not be visible. This is because of performance optimiziations. If a Mesh has none of those flags set and all its Edge Hardness values are 0.0: - its wireframe can be drawn much faster, in a single OpenGL call - the Edge flags don't need to be saved, potentially resulting in significan file size reduction, with large Meshes

Return value
None.

E3d_MeshPolyGroupsEdgesFromMeshEdges

Create PolyGroup Edges for PMesh's PolyGroups (if there's more than 1 PolyGroup)

Syntax
int E3d_MeshPolyGroupsEdgesFromMeshEdges(E3dMesh* PMesh, const EBool PKeepEdgeCaches, const EBool PRepair)

Arguments
E3dMesh* PMesh Pointer to the Mesh const EBool PKeepEdgeCaches If TRUE, WingedEdges and VertexLinks won't be freed const EBool PRepair Add missing Edges, if any
Description
If PMesh has more than 1 PolyGroup, it creates PolyGroup Edge lists from the Edge list of the Mesh.

Return value
None.

E3d_MeshAppendPolyGroup

Append an existing PolyGroup to a Mesh

Syntax
int E3d_MeshAppendPolyGroup(E3dMesh* PMesh, E3dPolyGroup* PPolyGroup)

Arguments
E3dMesh* PMesh Pointer to the Mesh E3dPolyGroup* PPolyGroup Pointer to the PolyGroup
Description
Adds an existing PolyGroup to PMesh.

Return value
E_SUCCESS on success, or E_ALREADY_EXISTS, if PPolyGroup is already on PMesh.

E3d_MeshAddPolyGroup

Allocate a new PolygGroup and add it to a Mesh

Syntax
E3dPolyGroup* E3d_MeshAddPolyGroup(E3dMesh* PMesh)

Arguments
E3dMesh* PMesh Pointer to the Mesh
Description
Creates a new PolyGroup and adds it to PMesh.

Return value
Pointer to the new PolyGroup, or NULL, in case of an error.

E3d_MeshRemovePolyGroup

Remove a PolyGroup from a Mesh and free it

Syntax
int E3d_MeshRemovePolyGroup(E3dMesh* PMesh, E3dPolyGroup* PPolyGroup)

Arguments
E3dMesh* PMesh Pointer to the Mesh E3dPolyGroup* PPolyGroup Pointer to the PolyGroup
Description
Removes the given PolyGroup from the given Mesh's dynamically allocated PolyGroups array and frees all memory assiciated with the PolyGroup.

Return value
E_SUCCESS on success, or E_NOT_FOUND, if PPolyGroup is not on PMesh.

E3d_MeshChangePolygonFlags

Change flags on Polygons of a Mesh

Syntax
void E3d_MeshChangePolygonFlags(E3dMesh* PMesh, const E3dPolygonFlags PFlags, const int PAction)

Arguments
E3dMesh* PMesh Pointer to the Mesh const E3dPolygonFlags PFlags The flags to change const int PAction The action to take: E_SET, E_CLEAR or E_COPY
Description
Set, clear, or copy the flags given in PFlags in the Flags field of each Polygon of each PolyGroup in PMesh.

Return value
None.

E3d_MeshPolyGroupAddTriangleStrip

Add a TriangleStrip to a Mesh

Syntax
E3dTriangleStrip* E3d_MeshPolyGroupAddTriangleStrip(E3dMesh* PMesh, E3dPolyGroup* PPolyGroup)

Arguments
E3dMesh* PMesh Pointer to the E3dMesh E3dPolyGroup* PPolyGroup The PolyGroup to which the strip will be added
Description
Allocates space for and initializes a new TriangleStrip in the given Mesh and PolyGroup.

Return value
A pointer to the new strip or NULL, if unsuccessful.

See also
E3d_TriangleStripsAllocate, E3d_MeshPolyGroupAddTriangleStrips

E3d_MeshPolyGroupAddTriangleStrips

Add TriangleStrips to a Mesh

Syntax
E3dTriangleStrip* E3d_MeshPolyGroupAddTriangleStrips(E3dMesh* PMesh, E3dPolyGroup* PPolyGroup, EIndex PNumOfNewStrips)

Arguments
E3dMesh* PMesh Pointer to the Mesh E3dPolyGroup* PPolyGroup The PolyGroup to which the strip will be added EIndex PNumOfNewStrips Number of triangle strips to add
Description
Allocates space for and initializes the specified number of TriangleStrips in the given Mesh and PolyGroup.

Return value
A pointer to the new strips or NULL, if unsuccessful.

See also
E3d_TriangleStripsAllocate, E3d_MeshPolyGroupAddTriangleStrip

E3d_MeshEdgesAndPolyGroupsRemapVertexIndices

Re-map Vertex indices of Edges and Polygons in a Mesh, according to a table

Syntax
void E3d_MeshEdgesAndPolyGroupsRemapVertexIndices(E3dMesh* PMesh, const EIndex* POldToNewVertexTable)

Arguments
E3dMesh* PMesh Pointer to the Mesh const EIndex* POldToNewVertexTable Indices to the original Vertex for each new Vertex
Description
Adjusts the Vertex indices of each VertexNode on the PolyGroups of a Mesh, based on a remapping table.
This function is usually used in conjunction with E3d_MeshVerticesRemap.
Note that, as the name indicates, the remapping table for this function is the opposite of the one passed to E3d_MeshVerticesRemap.
POldToNewVertexTable tells, for each original Vertex, which new Vertex it should be replaced with.
This function does not modify the Vertex array of PMesh, so it does not require a number of Vertices argument.

Return value
None.

See also
E3d_MeshVerticesRemap

E3d_MeshNumOfSelectedPolygons

Count selected Polygons in a Mesh

Syntax
EIndex E3d_MeshNumOfSelectedPolygons(const E3dMesh* PMesh)

Argument
Mesh Pointer to the E3dMes structure
Description
Returns the number of selected Polygons in the given Mesh.

Return value
The number of selected Polygons.

E3d_MeshGetBoundingBox

Get the local bounding box of a Mesh

Syntax
EBool E3d_MeshGetBoundingBox(const E3dMesh* PMesh, const unsigned int PWhatToInclude, E3dCoord3* PBBMin, E3dCoord3* PBBMax)

Argument
const E3dMesh* PMesh Pointer to the Mesh structure E3dCoord3* PBBMin Returned bounding box point 0 E3dCoord3* PBBMax Returned bounding box point 1
Description
This function returns the minimum and maximum XYZ values of the bounding box of the given Mesh.

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

See also
E3d_MeshGetTransformedBoundingBox

E3d_MeshGetTransformedBoundingBox

Get the bounding box of a Mesh aligned to an arbitrary coordinate system

Syntax
EBool E3d_MeshGetTransformedBoundingBox(const E3dMesh* PMesh, const E3dMatrix PMatrix, const unsigned int PWhatToInclude, E3dCoord3* PBBMin, E3dCoord3* PBBMax)

Argument
const E3dMesh* PMesh Pointer to the Mesh structure const E3dMatrix PMatrix The Matrix that defines the coordinate system E3dCoord3* PBBMin Returned bounding box point 0 E3dCoord3* PBBMax Returned bounding box point 1
Description
This function transforms each Vertex of the given Mesh with the given Matrix and returns the minimum and maximum XYZ values of the resulting bounding box.

Example
E3d_MeshGetTransformedBoundingBox(PMesh, LModel->LocalToWorldMatrix, PBBMin, PBBMax);
This will return the "world-aligned" bounding box of the PMesh (assuming that PMesh is a Geometry of LModel).

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

See also
E3d_MeshGetBoundingBox

E3d_MeshFreeCaches

Free VertexUsageList etc. of a Mesh

Syntax
void E3d_MeshFreeCaches(E3dMesh* PMesh)

Argument
E3dMesh* PMesh Pointer to the Mesh
Description
Frees the render data, VertexUsageList, VertexLinks, WingedEdges and PolyGroup Edge lists of a Mesh. These caches can greatly accelerate operations on a Mesh, but they use memory and cost time to build, so they are only rebuilt as needed. This function must be called after changes to a Mesh (except when only changing Vertex positions etc.), to ensure that these data caches are valid. Trying to operate on a Mesh with invalid cached data, may cause crashes (e.g. a WidgedEdge may try to access a no longer existing PolyGroup).

Return value
None.
© 1992-2017 By Gabor Nagy