This is the documentation for Enlighten.

class Geo AtlasMesh

class Geo::AtlasMesh

The AtlasMesh implementation used for the packer and anything else that needs not to know whether we have one mesh or several.

Functions

Name Description
AreChartsIndependent()

Report on the independence of the charts, that is whether no vertex belongs to more than one chart.

Create(const AtlasMeshVertices *, const AtlasMeshTriangles *)

Create a new instance of an AtlasMesh, instantiating it with a copy of the vertex and triangle list.

DeepCopy(const AtlasMesh *)

Create a clone of an AtlasMesh.

DetectCharts(const AtlasMeshChartingFlags &)

Chart Dependency.

GetCharacteristicVertex(s32)

A mesh can have a number of vertices which whilst topologically distinct have exactly the same 3D and UV coordinates.

GetChart(s32)

Obtain access to one of the mesh charts.

GetChartCount()

The number of charts that the mesh is composed of.

GetChartingFlags()

Return the flags used to chart this mesh.

GetEdgeToEdgeAdjacencyMap()

The adjacency data is a list of edges that map to their neighbours.

GetTriangle(s32)

Obtain a mesh triangle.

GetTriangleCount()

Obtain the number of triangles in the mesh.

GetTrianglePartitioning()

Return an array that specifies which triangle is in which chart.

GetTriangles()

Obtain the list of triangles.

GetVertex(s32)

Obtain a vertex.

GetVertexCount()

Obtain the number of vertices in the mesh.

GetVertices()

Obtain a copy of the vertices in the mesh.

IsChartTriangleDegenerate(Geo::s32, Geo::s32)

Degeneracy testing.

MakeChartsIndependent(GeoArray< AtlasMeshVertexSplitResult > *)

Make the charts independent by duplicating vertices which are shared by more than one chart, and relinking any triangles to the new vertices as necessary.

Release()

Release the mesh after it is finished with.

RepackCharts(const AtlasMeshPackingFlags &, IGeoProgressProxy *)

Pack the charts into the single square in UV space spanned by (0,0) - (1,1).

SerializeFromFile(FILE *)

Serialize this mesh from file - note that this does not include any of the charting information.

SetVertexUV(s32, float, float)

Update the UV coordinate of a vertex.


bool Geo::AtlasMesh::AreChartsIndependent


public: bool AreChartsIndependent() const


Report on the independence of the charts, that is whether no vertex belongs to more than one chart.

Outputs problem cases to LOG_INFO.

Returns

True if the charts are independent, or false otherwise.


static AtlasMesh* Geo::AtlasMesh::Create


public: AtlasMesh * Create
(
    const AtlasMeshVertices * vertices,
    const AtlasMeshTriangles * triangles
)


Create a new instance of an AtlasMesh, instantiating it with a copy of the vertex and triangle list.


static AtlasMesh* Geo::AtlasMesh::DeepCopy


public: AtlasMesh * DeepCopy
(
    const AtlasMesh * other
)


Create a clone of an AtlasMesh.


bool Geo::AtlasMesh::DetectCharts


public: bool DetectCharts
(
    const AtlasMeshChartingFlags & chartingFlags
)


Chart Dependency.

All charts need to be independent of each other in UV space, so that they can be individually parametrised and packed. In order to do this some vertices might need to be duplicated, and the triangles that use them might have to have their corners relinked to the new copy. Parse the mesh structure and populate the charts.


s32 Geo::AtlasMesh::GetCharacteristicVertex


public: s32 GetCharacteristicVertex
(
    s32 vertexIndex
) const


A mesh can have a number of vertices which whilst topologically distinct have exactly the same 3D and UV coordinates.

A map of these characteristically identical vertices is maintained internally, which identifies them all with one of them through its vertex index. XXX Should this be in the private interface. It's only used XXX internally, and by the parametriser as far as I know.

Returns

The index of the vertex which representative of this one.

Parameters
[in] vertexIndex

The index of the vertex to find the characteristic of.


AtlasMeshChart* Geo::AtlasMesh::GetChart


public: AtlasMeshChart * GetChart
(
    s32 chartIndex
) const


Obtain access to one of the mesh charts.

Returns

A chart belonging to the mesh.

Parameters
[in] chartIndex

The index of the chart that is required.


s32 Geo::AtlasMesh::GetChartCount


public: s32 GetChartCount() const


The number of charts that the mesh is composed of.

Returns

The number of charts.


AtlasMeshChartingFlags Geo::AtlasMesh::GetChartingFlags


public: AtlasMeshChartingFlags GetChartingFlags() const


Return the flags used to chart this mesh.


const s32* Geo::AtlasMesh::GetEdgeToEdgeAdjacencyMap


public: const s32 * GetEdgeToEdgeAdjacencyMap() const


The adjacency data is a list of edges that map to their neighbours.

If they don't map to a neighbouring edge, it stores -1, otherwise it stores the neighbour's's index.


const AtlasMeshTriangle* Geo::AtlasMesh::GetTriangle


public: const AtlasMeshTriangle * GetTriangle
(
    s32 triangleIndex
) const


Obtain a mesh triangle.

Returns

Returns the specified triangle.

Parameters
[in] triangleIndex

The index of the triangle to obtain.


s32 Geo::AtlasMesh::GetTriangleCount


public: s32 GetTriangleCount() const


Obtain the number of triangles in the mesh.

Returns

The number of triangles in the mesh.


const s32* Geo::AtlasMesh::GetTrianglePartitioning


public: const s32 * GetTrianglePartitioning() const


Return an array that specifies which triangle is in which chart.

The array is number of triangles long, but may be null. It is non-null after DetectCharts() has been successfully called. Each element is the index of the charts this tri is in, or a negative number for "not in any chart".

Note

Triangles can not be in a chart (ie. topological degenerates when using edge-connected chart detection)

Returns

An array of memory with one entry for each triangle in the mesh, describing which chart it is part of.


const AtlasMeshTriangles* Geo::AtlasMesh::GetTriangles


public: const AtlasMeshTriangles * GetTriangles() const


Obtain the list of triangles.


const AtlasMeshVertex* Geo::AtlasMesh::GetVertex


public: const AtlasMeshVertex * GetVertex
(
    s32 vertexIndex
) const


Obtain a vertex.

Returns

Returns the specified vertex.

Parameters
[in] vertexIndex

The index of the vertex in the mesh.


s32 Geo::AtlasMesh::GetVertexCount


public: s32 GetVertexCount() const


Obtain the number of vertices in the mesh.

Returns

The number of vertices in the mesh.


const AtlasMeshVertices* Geo::AtlasMesh::GetVertices


public: const AtlasMeshVertices * GetVertices() const


Obtain a copy of the vertices in the mesh.

Returns

A copy of the vertex list.


bool Geo::AtlasMesh::IsChartTriangleDegenerate


public: bool IsChartTriangleDegenerate
(
    Geo::s32 chart,
    Geo::s32 tri
) const


Degeneracy testing.

(In AtlasMesh interface only)


AtlasMesh* Geo::AtlasMesh::MakeChartsIndependent


public: AtlasMesh * MakeChartsIndependent
(
    GeoArray< AtlasMeshVertexSplitResult > * vertexSplitSpec
) const


Make the charts independent by duplicating vertices which are shared by more than one chart, and relinking any triangles to the new vertices as necessary.

Returns

A new mesh that has been fixed in this regard.

Parameters
[inout] vertexSplitSpec

- An array of changes to the original mesh.


void Geo::AtlasMesh::Release


public: void Release()


Release the mesh after it is finished with.


bool Geo::AtlasMesh::RepackCharts


public: bool RepackCharts
(
    const AtlasMeshPackingFlags & params,
    IGeoProgressProxy * progress
)


Pack the charts into the single square in UV space spanned by (0,0) - (1,1).


static AtlasMesh* Geo::AtlasMesh::SerializeFromFile


public: AtlasMesh * SerializeFromFile
(
    FILE * f
)


Serialize this mesh from file - note that this does not include any of the charting information.

It will be in the same state as if you had called Create(...) with the vertices and triangles of this mesh.


void Geo::AtlasMesh::SetVertexUV


public: void SetVertexUV
(
    s32 vertexIndex,
    float u,
    float v
)


Update the UV coordinate of a vertex.

Parameters
[in] vertexIndex

The index of the vertex which is to be modified.

[in] u

The new UV coordinates.