Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

class Enlighten::MergeGeometry

This is the very basic geometry description we operate on.

It's function is to provide a basic wrapper around simple arrays which is will release/delete with itself. You can construct it how you like, but there's some utils to allocate/delete arrays for you. The data is create/freeable in two halfs, geometry related stuff and tri-group/param related stuff.

Note
titleNote

It intentionally doesn't handle "empty" geometry (no verts or indices or both). This case should be handled upstream.

Functions

NameDescription
~MergeGeometry()

Free all resources.

BuildMergeGeometryCache()

Build cache data.

CacheGetBoxForGroup(Geo::s32)

Access the cache data.

CacheGetNumGroups()

Access the cache data.

CacheGetNumUniqueVertsInGroup(Geo::s32)

Access the cache data.

CacheGetOptimalModelForGroup(Geo::s32)

Access the cache data.

CacheGetPrincipleNormalForGroup(Geo::s32)

Access the cache data.

CacheGetUniqueVertIndicesInGroup(Geo::s32)

Access the cache data.

CacheGetWorldSurfaceAreaForGroup(Geo::s32)

Access the cache data.

CacheSetFlagsOnGroup(Geo::s32, Geo::u32)

Access the cache data.

CacheTestFlagsOnGroup(Geo::s32, Geo::u32)

Access the cache data.

CalculateProjectedArea(const Geo::s32 *, Geo::s32, FitModel const &)

calculate the total projected area of the passed in groups

ClearUp()

Free all memory and reset the class to it's initial state.

ClearUpGeometry()

Free just the vertex and index buffer data.

ClearUpTriGroupsAndParams()

Free just the tri groups and param data.

ComputeGroupMaxDistance(Geo::s32, const FitModel &, float)


Given a vector of points, this computes the least-squares plane.

ComputeModel(Geo::s32, Geo::s32, FitModel &)


Given a vector of points, this computes the least-squares plane.

ComputeModel(Geo::s32, FitModel &)


Given a vector of points, this computes the least-squares plane.

ComputeTriNormal(Geo::s32, Geo::s32, Geo::s32)

Get a single representative normal for a triangle in a MergeGeometry.

FitPlaneToGroups(const Geo::s32 *, Geo::s32, FitModel &)


Given a vector of points, this computes the least-squares plane.

GetMaxGeneralNormalDeviationCosForGroupIdx(Geo::s32)

access per group data

GetMaxInitialNormalDeviationCosForGroupIdx(Geo::s32)

access per group data

GetMaxPlaneDistanceForGroupIdx(Geo::s32)

access per group data

GetOverlapExpansionPercForGroupIdx(Geo::s32)

access per group data

GetSignificantAreaRatioForGroupIdx(Geo::s32)

access per group data

GetTriPoints(Geo::s32, Geo::GeoPoint3 &, Geo::GeoPoint3 &, Geo::GeoPoint3 &)

Utility function that is used when computing triangle shrinkage.

InitialiseGeometry(Geo::s32, Geo::s32)

Initialise the vertex and index buffers to the given sizes.

InitialiseTriGroupsAndParams(Geo::TriGroupSelection *, Geo::s32)

Takes ownership (not a copy) of the tri group selection and creates the trigroup and param arrays.

IsCacheValid()

Checks if the cache is valid.

MergeGeometry()

Just nulls everything.

Variables

NameDescription
Geo::s32 * m_IdxBuffer32

Vertex indices. Length assume to be a multiple of 3.

Geo::GeoFileString m_Name

Name of the geometry that was used to create this MergeGeometry.

Geo::s32 m_NumIndices

Length of m_IdxBuffer32.

Geo::s32 m_NumParams

Length of the m_TriGroupParams array.

Geo::s32 m_NumVertices

Length of m_Vert* arrays.

Geo::s32 * m_ParamIdxFromGroupIdx

Maps tri group indices to param indices. Length of num tri groups.

MergeTriGroupParams * m_TriGroupParams

Array of params for specific tri groups.

Geo::TriGroupSelection * m_TriGroupSelection

The tri groups for this geometry.

Geo::GeoPoint2 * m_VertChartUVs

Vertex chart UVs (provided, not generated). Length of m_NumVertices.

Geo::v128 * m_VertNormals

Vertex normals. Length of m_NumVertices.

Geo::v128 * m_VertPositions

Vertex positions. Length of m_NumVertices.


Anchor
a8822a5350ff16ed6b5018ab856888db0
a8822a5350ff16ed6b5018ab856888db0

Enlighten::MergeGeometry::~MergeGeometry

...

public: ~MergeGeometry()

...

Free all resources.


Anchor
af77519c0b2555d059315709423c0025a
af77519c0b2555d059315709423c0025a

bool Enlighten::MergeGeometry::BuildMergeGeometryCache

...

public: bool BuildMergeGeometryCache()

...

Build cache data.


Anchor
aee29a744d089a7bb7acfa689e445aaef
aee29a744d089a7bb7acfa689e445aaef

Geo::GeoBoundingBox Enlighten::MergeGeometry::CacheGetBoxForGroup

...

public: Geo::GeoBoundingBox CacheGetBoxForGroup
(
    Geo::s32 groupIdx
) const

...

Access the cache data.


Anchor
acbb2d4953a9c37261bda28a9dfe585f9
acbb2d4953a9c37261bda28a9dfe585f9

Geo::s32 Enlighten::MergeGeometry::CacheGetNumGroups

...

public: Geo::s32 CacheGetNumGroups() const

...

Access the cache data.


Anchor
a5a83691eb53b75f9cc51653666ebc1f6
a5a83691eb53b75f9cc51653666ebc1f6

Geo::s32 Enlighten::MergeGeometry::CacheGetNumUniqueVertsInGroup

...

public: Geo::s32 CacheGetNumUniqueVertsInGroup
(
    Geo::s32 groupIdx
) const

...

Access the cache data.


Anchor
ad6092abf0a2a74daa1ca59f633681929
ad6092abf0a2a74daa1ca59f633681929

FitModel Enlighten::MergeGeometry::CacheGetOptimalModelForGroup

...

public: FitModel CacheGetOptimalModelForGroup
(
    Geo::s32 groupIdx
) const

...

Access the cache data.


Anchor
a1a9442c0c5634e42902a22b7dce34f3d
a1a9442c0c5634e42902a22b7dce34f3d

Geo::v128 Enlighten::MergeGeometry::CacheGetPrincipleNormalForGroup

...

public: Geo::v128 CacheGetPrincipleNormalForGroup
(
    Geo::s32 groupIdx
) const

...

Access the cache data.


Anchor
a3f6cf2b6feb5e3b8bd6e491cf2d8cc68
a3f6cf2b6feb5e3b8bd6e491cf2d8cc68

const Geo::s32* Enlighten::MergeGeometry::CacheGetUniqueVertIndicesInGroup

...

public: const Geo::s32 * CacheGetUniqueVertIndicesInGroup
(
    Geo::s32 groupIdx
) const

...

Access the cache data.


Anchor
a29698854df916282058ece64773317e8
a29698854df916282058ece64773317e8

double Enlighten::MergeGeometry::CacheGetWorldSurfaceAreaForGroup

...

public: double CacheGetWorldSurfaceAreaForGroup
(
    Geo::s32 groupIdx
) const

...

Access the cache data.


Anchor
a4e2f644ed8288bb13e5811511cda5a25
a4e2f644ed8288bb13e5811511cda5a25

void Enlighten::MergeGeometry::CacheSetFlagsOnGroup

...

public: void CacheSetFlagsOnGroup
(
    Geo::s32 groupIdx,
    Geo::u32 flags
)

...

Access the cache data.


Anchor
a1c54d1a628ae11356b15b3effadc16bd
a1c54d1a628ae11356b15b3effadc16bd

bool Enlighten::MergeGeometry::CacheTestFlagsOnGroup

...

public: bool CacheTestFlagsOnGroup
(
    Geo::s32 groupIdx,
    Geo::u32 flags
) const

...

Access the cache data.


Anchor
a95f390e0835db825e604e6a62fab3c38
a95f390e0835db825e604e6a62fab3c38

float Enlighten::MergeGeometry::CalculateProjectedArea

...

public: float CalculateProjectedArea
(
    const Geo::s32 * groupIndices,
    Geo::s32 numGroups,
    FitModel const & model
) const

...

calculate the total projected area of the passed in groups


Anchor
a85f442a06839d53d56030773b35f6df6
a85f442a06839d53d56030773b35f6df6

void Enlighten::MergeGeometry::ClearUp

...

public: void ClearUp()

...

Free all memory and reset the class to it's initial state.


Anchor
a914204e97069aac38db66d2b4d9de885
a914204e97069aac38db66d2b4d9de885

void Enlighten::MergeGeometry::ClearUpGeometry

...

public: void ClearUpGeometry()

...

Free just the vertex and index buffer data.


Anchor
a515119ff1865e8ee377a1e7bceac09dd
a515119ff1865e8ee377a1e7bceac09dd

void Enlighten::MergeGeometry::ClearUpTriGroupsAndParams

...

public: void ClearUpTriGroupsAndParams()

...

Free just the tri groups and param data.


Anchor
ae3b40f4467724307427300caaefd6bcc
ae3b40f4467724307427300caaefd6bcc

float Enlighten::MergeGeometry::ComputeGroupMaxDistance

...

public: float ComputeGroupMaxDistance
(
    Geo::s32 groupIdx,
    const FitModel & model,
    float distanceThreshold
) const

...

...

The idea is that we want an optimal plane for the given combined groups.


Anchor
a06179c2a0a8ab2e385d7920156055093
a06179c2a0a8ab2e385d7920156055093

void Enlighten::MergeGeometry::ComputeModel

...

public: void ComputeModel
(
    Geo::s32 groupIdx0,
    Geo::s32 groupIdx1,
    FitModel & model
) const

...

...

The idea is that we want an optimal plane for the given combined groups.


Anchor
a6ebd782f3d0607586a28af4e4f4a9aaf
a6ebd782f3d0607586a28af4e4f4a9aaf

void Enlighten::MergeGeometry::ComputeModel

...

public: void ComputeModel
(
    Geo::s32 groupIdx,
    FitModel & model
) const

...

...

The idea is that we want an optimal plane for the given combined groups.


Anchor
a36c5770b183d8e77a68706eed309b488
a36c5770b183d8e77a68706eed309b488

Geo::v128 Enlighten::MergeGeometry::ComputeTriNormal

...

public: Geo::v128 ComputeTriNormal
(
    Geo::s32 vertIdx0,
    Geo::s32 vertIdx1,
    Geo::s32 vertIdx2
) const

...

Get a single representative normal for a triangle in a MergeGeometry.


Anchor
ad7bee2b816abf9cc74ffac9416c88243
ad7bee2b816abf9cc74ffac9416c88243

void Enlighten::MergeGeometry::FitPlaneToGroups

...

public: void FitPlaneToGroups
(
    const Geo::s32 * groupIndices,
    Geo::s32 numGroups,
    FitModel & model
) const

...

...

The idea is that we want an optimal plane for the given combined groups.


Anchor
a512adef0d56f5505523c50fb44a91c5d
a512adef0d56f5505523c50fb44a91c5d

float Enlighten::MergeGeometry::GetMaxGeneralNormalDeviationCosForGroupIdx

...

public: float GetMaxGeneralNormalDeviationCosForGroupIdx
(
    Geo::s32 groupIdx
) const

...

access per group data


Anchor
a9d41b3c50dda1a3c0e8d353997777a7d
a9d41b3c50dda1a3c0e8d353997777a7d

float Enlighten::MergeGeometry::GetMaxInitialNormalDeviationCosForGroupIdx

...

public: float GetMaxInitialNormalDeviationCosForGroupIdx
(
    Geo::s32 groupIdx
) const

...

access per group data


Anchor
a110909942d63f34903eb5bac804e4441
a110909942d63f34903eb5bac804e4441

float Enlighten::MergeGeometry::GetMaxPlaneDistanceForGroupIdx

...

public: float GetMaxPlaneDistanceForGroupIdx
(
    Geo::s32 groupIdx
) const

...

access per group data


Anchor
a640f5d2a5ff113b3afcffbe2ea430317
a640f5d2a5ff113b3afcffbe2ea430317

float Enlighten::MergeGeometry::GetOverlapExpansionPercForGroupIdx

...

public: float GetOverlapExpansionPercForGroupIdx
(
    Geo::s32 groupIdx
) const

...

access per group data


Anchor
ad20a8b4b124da10ba82b1cb1383ff549
ad20a8b4b124da10ba82b1cb1383ff549

float Enlighten::MergeGeometry::GetSignificantAreaRatioForGroupIdx

...

public: float GetSignificantAreaRatioForGroupIdx
(
    Geo::s32 groupIdx
) const

...

access per group data


Anchor
ae7a869fa1ce336ef8c4c1eaf9fe22a8b
ae7a869fa1ce336ef8c4c1eaf9fe22a8b

void Enlighten::MergeGeometry::GetTriPoints

...

public: void GetTriPoints
(
    Geo::s32 tri,
    Geo::GeoPoint3 & p0,
    Geo::GeoPoint3 & p1,
    Geo::GeoPoint3 & p2
) const

...

Utility function that is used when computing triangle shrinkage.


Anchor
a114eb188827950477ebb93061438a5ef
a114eb188827950477ebb93061438a5ef

bool Enlighten::MergeGeometry::InitialiseGeometry

...

public: bool InitialiseGeometry
(
    Geo::s32 numVertices,
    Geo::s32 numIndices
)

...

Initialise the vertex and index buffers to the given sizes.

This will clear any existing vertex and index buffer data first, but leaves all tri group and parameter data untouched.

The new buffers are initialised with -1 for indices and 0 for all other vertex data.


Anchor
a4a23c4076fbc5f574ea55aa0f7ceb18a
a4a23c4076fbc5f574ea55aa0f7ceb18a

bool Enlighten::MergeGeometry::InitialiseTriGroupsAndParams

...

public: bool InitialiseTriGroupsAndParams
(
    Geo::TriGroupSelection * triGroups,
    Geo::s32 numParams
)

...

Takes ownership (not a copy) of the tri group selection and creates the trigroup and param arrays.

Parameters are left at their defaults, and the mapping is initialised to 0.


Anchor
a36dc6cbf1caf8d2744153a3513448598
a36dc6cbf1caf8d2744153a3513448598

bool Enlighten::MergeGeometry::IsCacheValid

...

public: bool IsCacheValid() const

...

Checks if the cache is valid.


Anchor
a1c919cc329561e6e73d6ab6083d15f7b
a1c919cc329561e6e73d6ab6083d15f7b

Enlighten::MergeGeometry::MergeGeometry

...

public: MergeGeometry()

...

Just nulls everything.