This is the documentation for Enlighten.

class Geo IdentVertLinkBuilder

class Geo::IdentVertLinkBuilder

A utility for identifying pairs of "identical" vertices in a vertex buffer.

Runs in O(nlogn) time.

This class constructs an IdxArray of pairs that link together "identical" vertices. Note that not every possible pair of links is generated. If 3 vertices are identical, we only need 2 links to join them together. So large numbers of identical vertices are represented efficiently. If you wish to test if two vertices are identical, given the generated link array, it is not sufficient to just find an IdxLink with both vertices in it. The links describe a graph so you need to find a link with one of the vertices you are interested in and walk the graph described by the links to see if there is a path of links that touches the other vertex.

To determine whether two vertices are 'identical' this class uses a mask and does a bit-wise comparison. The mask should cover the stride of a single vertex. Any non-zero value in a byte in the mask indicates that the entire byte should be part of the bit-wise comparison between two vertices. Using this mask you can select the parts of the vertex structure that you consider to be relevant (for example, only masking in the position and normals).

If a bit-wise comparison is not suitable for your application, the code is fairly simple to modify. See the implementation in corresponding cpp file.

Functions

Name Description
Create(Geo::s32, Geo::s32, const Geo::u8 *, const Geo::u8 *)

Construct this object and find links between identical vertices.

GetIdentGroup(Geo::s32, Geo::GeoArray< Geo::s32 > &)

Get a group of identical vertex indices.

GetLinkArray()

Get the link array. Will not be null.

GetNumIdentGroups()

The number of groups of indentical vertices.

GetNumLinks()

The number of links in the link array.

Release()

Release this object.


static IdentVertLinkBuilder* Geo::IdentVertLinkBuilder::Create


public: IdentVertLinkBuilder * Create
(
    Geo::s32 numVertices,
    Geo::s32 vertexStride,
    const Geo::u8 * vertexMask,
    const Geo::u8 * vertexBufferData
)


Construct this object and find links between identical vertices.

Parameters
[in] numVertices

The number of vertices. Must be > 0.

[in] vertexStride

The size in bytes of a single vertex. Must be > 0.

[in] vertexMask

A byte array of length at least vertexStride. Any non-zero value masks in the byte. Cannot be null.

[in] vertexBufferData

The vertex data array. The length and vertex stride must match numVertices and vertexStride respectively. Cannot be null.

Returns

NULL if the parameters are invalid or there is insufficient memory.


bool Geo::IdentVertLinkBuilder::GetIdentGroup


public: bool GetIdentGroup
(
    Geo::s32 groupIdx,
    Geo::GeoArray< Geo::s32 > & group
) const


Get a group of identical vertex indices.


const IdxLink* Geo::IdentVertLinkBuilder::GetLinkArray


public: const IdxLink * GetLinkArray() const


Get the link array. Will not be null.


Geo::s32 Geo::IdentVertLinkBuilder::GetNumIdentGroups


public: Geo::s32 GetNumIdentGroups() const


The number of groups of indentical vertices.



public: Geo::s32 GetNumLinks() const


The number of links in the link array.


void Geo::IdentVertLinkBuilder::Release


public: void Release()


Release this object.