This is the documentation for Enlighten.
class Enlighten MergeGeometry
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
It intentionally doesn't handle "empty" geometry (no verts or indices or both). This case should be handled upstream.
Functions
Name | Description |
---|---|
~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
Name | Description |
---|---|
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. |
Enlighten::MergeGeometry::~MergeGeometry
public: ~MergeGeometry()
Free all resources.
bool Enlighten::MergeGeometry::BuildMergeGeometryCache
public: bool BuildMergeGeometryCache()
Build cache data.
Geo::GeoBoundingBox Enlighten::MergeGeometry::CacheGetBoxForGroup
public: Geo::GeoBoundingBox CacheGetBoxForGroup
(
Geo::s32 groupIdx
) const
Access the cache data.
Geo::s32 Enlighten::MergeGeometry::CacheGetNumGroups
public: Geo::s32 CacheGetNumGroups() const
Access the cache data.
Geo::s32 Enlighten::MergeGeometry::CacheGetNumUniqueVertsInGroup
public: Geo::s32 CacheGetNumUniqueVertsInGroup
(
Geo::s32 groupIdx
) const
Access the cache data.
FitModel Enlighten::MergeGeometry::CacheGetOptimalModelForGroup
public: FitModel CacheGetOptimalModelForGroup
(
Geo::s32 groupIdx
) const
Access the cache data.
Geo::v128 Enlighten::MergeGeometry::CacheGetPrincipleNormalForGroup
public: Geo::v128 CacheGetPrincipleNormalForGroup
(
Geo::s32 groupIdx
) const
Access the cache data.
const Geo::s32* Enlighten::MergeGeometry::CacheGetUniqueVertIndicesInGroup
public: const Geo::s32 * CacheGetUniqueVertIndicesInGroup
(
Geo::s32 groupIdx
) const
Access the cache data.
double Enlighten::MergeGeometry::CacheGetWorldSurfaceAreaForGroup
public: double CacheGetWorldSurfaceAreaForGroup
(
Geo::s32 groupIdx
) const
Access the cache data.
void Enlighten::MergeGeometry::CacheSetFlagsOnGroup
public: void CacheSetFlagsOnGroup
(
Geo::s32 groupIdx,
Geo::u32 flags
)
Access the cache data.
bool Enlighten::MergeGeometry::CacheTestFlagsOnGroup
public: bool CacheTestFlagsOnGroup
(
Geo::s32 groupIdx,
Geo::u32 flags
) const
Access the cache data.
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
void Enlighten::MergeGeometry::ClearUp
public: void ClearUp()
Free all memory and reset the class to it's initial state.
void Enlighten::MergeGeometry::ClearUpGeometry
public: void ClearUpGeometry()
Free just the vertex and index buffer data.
void Enlighten::MergeGeometry::ClearUpTriGroupsAndParams
public: void ClearUpTriGroupsAndParams()
Free just the tri groups and param data.
float Enlighten::MergeGeometry::ComputeGroupMaxDistance
public: float ComputeGroupMaxDistance
(
Geo::s32 groupIdx,
const FitModel & model,
float distanceThreshold
) const
Given a vector of points, this computes the least-squares plane.
The idea is that we want an optimal plane for the given combined groups.
void Enlighten::MergeGeometry::ComputeModel
public: void ComputeModel
(
Geo::s32 groupIdx0,
Geo::s32 groupIdx1,
FitModel & model
) const
Given a vector of points, this computes the least-squares plane.
The idea is that we want an optimal plane for the given combined groups.
void Enlighten::MergeGeometry::ComputeModel
public: void ComputeModel
(
Geo::s32 groupIdx,
FitModel & model
) const
Given a vector of points, this computes the least-squares plane.
The idea is that we want an optimal plane for the given combined groups.
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.
void Enlighten::MergeGeometry::FitPlaneToGroups
public: void FitPlaneToGroups
(
const Geo::s32 * groupIndices,
Geo::s32 numGroups,
FitModel & model
) const
Given a vector of points, this computes the least-squares plane.
The idea is that we want an optimal plane for the given combined groups.
float Enlighten::MergeGeometry::GetMaxGeneralNormalDeviationCosForGroupIdx
public: float GetMaxGeneralNormalDeviationCosForGroupIdx
(
Geo::s32 groupIdx
) const
access per group data
float Enlighten::MergeGeometry::GetMaxInitialNormalDeviationCosForGroupIdx
public: float GetMaxInitialNormalDeviationCosForGroupIdx
(
Geo::s32 groupIdx
) const
access per group data
float Enlighten::MergeGeometry::GetMaxPlaneDistanceForGroupIdx
public: float GetMaxPlaneDistanceForGroupIdx
(
Geo::s32 groupIdx
) const
access per group data
float Enlighten::MergeGeometry::GetOverlapExpansionPercForGroupIdx
public: float GetOverlapExpansionPercForGroupIdx
(
Geo::s32 groupIdx
) const
access per group data
float Enlighten::MergeGeometry::GetSignificantAreaRatioForGroupIdx
public: float GetSignificantAreaRatioForGroupIdx
(
Geo::s32 groupIdx
) const
access per group data
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.
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.
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.
bool Enlighten::MergeGeometry::IsCacheValid
public: bool IsCacheValid() const
Checks if the cache is valid.
Enlighten::MergeGeometry::MergeGeometry
public: MergeGeometry()
Just nulls everything.