PixelLightAPI  .
Public Member Functions
PLMesh::MeshLODLevel Class Reference

Mesh LOD level. More...

#include <MeshLODLevel.h>

List of all members.

Public Member Functions

PLMESH_API MeshLODLevel (Mesh *pMesh=nullptr)
 Constructor.
PLMESH_API ~MeshLODLevel ()
 Destructor.
PLMESH_API MeshGetMesh () const
 Returns the mesh the LOD level belongs to.
PLMESH_API void SetMesh (Mesh *pMesh=nullptr)
 Sets the mesh the LOD level belongs to.
PLMESH_API float GetLODDistance () const
 Returns the distance for using this LOD level.
PLMESH_API void SetLODDistance (float fDistance=0.0f)
 Sets the distance for using this LOD level.
PLMESH_API MeshLODLeveloperator= (const MeshLODLevel &cSource)
 Copy operator.
PLMESH_API void ClearIndexBuffer ()
 Clears the index buffer for this LOD level.
PLMESH_API void CreateIndexBuffer ()
 Creates the index buffer for this LOD level.
PLMESH_API
PLRenderer::IndexBuffer
GetIndexBuffer () const
 Returns the index buffer for this LOD level.
PLMESH_API PLCore::uint32 GetNumOfTriangles () const
 Returns the total number of LOD level triangles.
PLMESH_API void ClearGeometries ()
 Clears the geometries for this LOD level.
PLMESH_API void CreateGeometries ()
 Creates the geometries for this LOD level.
PLMESH_API PLCore::Array
< Geometry > * 
GetGeometries () const
 Gets the geometries of this LOD level.
PLMESH_API bool CreateOctree (PLCore::uint32 nSubdivide=1, PLCore::uint32 nMinGeometries=10, PLCore::Array< PLCore::Array< PLCore::uint32 > * > *plstOctreeIDList=nullptr)
 Creates the LOD level octree.
PLMESH_API void DestroyOctree ()
 Destroys the LOD level octree.
PLMESH_API MeshOctreeGetOctree () const
 Returns the LOD level octree.
PLMESH_API void BuildConnectivity ()
 Builds the connectivity information.
PLMESH_API void BuildTriangleList ()
 Builds the current triangle list.
PLMESH_API PLCore::Array
< MeshTriangle > & 
GetTriangleList ()
 Gets the triangle list.
PLMESH_API void BuildEdgeList ()
 Builds the current edge list.
PLMESH_API PLCore::Array
< MeshEdge > & 
GetEdgeList ()
 Gets the edge list.
PLMESH_API bool GetTriangle (PLCore::uint32 nGeometry, PLCore::uint32 nIndex, PLCore::uint32 &nVertex1, PLCore::uint32 &nVertex2, PLCore::uint32 &nVertex3) const
 Gets a triangle of a geometry.
PLMESH_API bool SplitGeometries (bool bSingleGeometries=false, PLCore::uint32 *pSplit=nullptr, PLCore::uint32 nSplitNumber=0)
 Splits up geometries to geometries of single triangles.
PLMESH_API bool JoinGeometries (PLCore::uint32 *pJoin=nullptr, PLCore::uint32 nJoinNumber=0)
 Joins geometries with the same properties to one single geometry.
PLMESH_API bool GenerateOctreeGeometries (PLCore::uint32 nSubdivide=1, PLCore::uint32 nMinGeometries=10)
 Optimizes the geometries for an octree.
PLMESH_API bool GenerateStrips (PLCore::uint32 nVertexCacheSize=18, PLCore::uint32 nMinStripLength=3)
 Optimizes the geometries using triangle strips.
PLMESH_API bool CalculateBoundingBox (const PLCore::Array< const Geometry * > &lstGeometries, PLRenderer::VertexBuffer &cVertexBuffer, PLMath::Vector3 &vMinPos, PLMath::Vector3 &vMaxPos) const
 Calculates the LOD level bounding box.
PLMESH_API bool CalculateBoundingSphere (const PLCore::Array< const Geometry * > &lstGeometries, PLRenderer::VertexBuffer &cVertexBuffer, PLMath::Vector3 &vPos, float &fRadius) const
 Calculates the LOD level bounding sphere.

Detailed Description

Mesh LOD level.

Remarks:
A LOD level for a mesh can redefine one or more of the mesh's base data Index data (indices into the vertex data) Geometries (that structure the index data in different parts)

Constructor & Destructor Documentation

PLMESH_API PLMesh::MeshLODLevel::MeshLODLevel ( Mesh pMesh = nullptr)

Constructor.

Parameters:
[in]pMeshPointer to the owner mesh, can be a null pointer

Destructor.


Member Function Documentation

PLMESH_API Mesh* PLMesh::MeshLODLevel::GetMesh ( ) const

Returns the mesh the LOD level belongs to.

Returns:
Pointer to the owner mesh, can be a null pointer
PLMESH_API void PLMesh::MeshLODLevel::SetMesh ( Mesh pMesh = nullptr)

Sets the mesh the LOD level belongs to.

Parameters:
[in]pMeshPointer to the owner mesh, can be a null pointer
PLMESH_API float PLMesh::MeshLODLevel::GetLODDistance ( ) const

Returns the distance for using this LOD level.

Returns:
Distance for the LOD level
PLMESH_API void PLMesh::MeshLODLevel::SetLODDistance ( float  fDistance = 0.0f)

Sets the distance for using this LOD level.

Parameters:
[in]fDistanceDistance for the LOD level
PLMESH_API MeshLODLevel& PLMesh::MeshLODLevel::operator= ( const MeshLODLevel cSource)

Copy operator.

Parameters:
[in]cSourceSource to copy from
Returns:
Reference to this instance

Clears the index buffer for this LOD level.

Creates the index buffer for this LOD level.

Note:
  • If you don't want to overwrite the mesh's index buffer (if the LOD level only alters the vertex buffers or geometries), you don't have to call this function. In this case the meshes standard index buffer will be used.

Returns the index buffer for this LOD level.

Returns:
The LOD level's index buffer, can be a null pointer
PLMESH_API PLCore::uint32 PLMesh::MeshLODLevel::GetNumOfTriangles ( ) const

Returns the total number of LOD level triangles.

Returns:
Total number of LOD level triangles

Clears the geometries for this LOD level.

Creates the geometries for this LOD level.

Note:
  • If you don't want to overwrite the mesh's geometries (if the LOD level only alters the index or vertex buffers), you don't have to call this function. In this case the meshes standard geometries will be used.

Gets the geometries of this LOD level.

Returns:
List of geometries, can be a null pointer
PLMESH_API bool PLMesh::MeshLODLevel::CreateOctree ( PLCore::uint32  nSubdivide = 1,
PLCore::uint32  nMinGeometries = 10,
PLCore::Array< PLCore::Array< PLCore::uint32 > * > *  plstOctreeIDList = nullptr 
)

Creates the LOD level octree.

Parameters:
[in]nSubdivideOctree subdivide
[in]nMinGeometriesMinimum number of geometries per octree
[out]plstOctreeIDListWill optionally store a list of octrees each geometry is on, can be a null pointer
Returns:
'true' if all went fine, else 'false'
Note:
  • This function doesn't manipulate the geometries etc. Therefore an octree can only be efficient if there are different smaller geometries because the octree later checks which geometries are currently visible!
  • The tool function GenerateOctreeGeometries() will split up the geometries in octree friendly parts

Destroys the LOD level octree.

Returns the LOD level octree.

Returns:
LOD level octree, a null pointer if there's no octree
Note:
  • The octree is used for fast visibility and collision determination

Builds the connectivity information.

Note:

Builds the current triangle list.

Note:
  • The triangle list must be updated after manipulating geometries!

Gets the triangle list.

Returns:
Triangle list
See also:

Builds the current edge list.

Note:
  • The edge list must be updated after manipulating geometries!
  • The triangle list must be build before the edge list can be constructed! (see BuildTriangleList())

Gets the edge list.

Returns:
Edge list
See also:
PLMESH_API bool PLMesh::MeshLODLevel::GetTriangle ( PLCore::uint32  nGeometry,
PLCore::uint32  nIndex,
PLCore::uint32 &  nVertex1,
PLCore::uint32 &  nVertex2,
PLCore::uint32 &  nVertex3 
) const

Gets a triangle of a geometry.

Parameters:
[in]nGeometryGeometry ID
[in]nIndexTriangle index
[out]nVertex1Will receive the first triangle vertex index
[out]nVertex2Will receive the second triangle vertex index
[out]nVertex3Will receive the third triangle vertex index
Returns:
'true' if all went fine, else 'false'
Note:
  • When requesting many triangle vertices you should lock the index buffer using GetIndexBuffer() for more performance by self!
  • GetTrianglePlaneList() is faster because it is using a precalculated triangle list
PLMESH_API bool PLMesh::MeshLODLevel::SplitGeometries ( bool  bSingleGeometries = false,
PLCore::uint32 *  pSplit = nullptr,
PLCore::uint32  nSplitNumber = 0 
)

Splits up geometries to geometries of single triangles.

Parameters:
[in]bSingleGeometriesOne geometry per triangle? Recommended if octrees should be build but not good when preparing the mesh for optimize!
[in]pSplitOptional index list of the geometries to split, if a null pointer all geometries will be split
[in]nSplitNumberIf pSplit isn't a null pointer this indicates the number of geometries to split
Returns:
'true' if all went fine, else 'false'
Note:
  • If there was an octree it will be destroyed!
PLMESH_API bool PLMesh::MeshLODLevel::JoinGeometries ( PLCore::uint32 *  pJoin = nullptr,
PLCore::uint32  nJoinNumber = 0 
)

Joins geometries with the same properties to one single geometry.

Parameters:
[in]pJoinOptional index list of the geometries to join, if a null pointer all geometries will be joined
[in]nJoinNumberIf pJoin isn't a null pointer, this indicates the number of geometries to join
Returns:
'true' if all went fine, else 'false'
Note:
PLMESH_API bool PLMesh::MeshLODLevel::GenerateOctreeGeometries ( PLCore::uint32  nSubdivide = 1,
PLCore::uint32  nMinGeometries = 10 
)

Optimizes the geometries for an octree.

Parameters:
[in]nSubdivideOctree subdivide
[in]nMinGeometriesMinimum number of geometries per octree
Returns:
'true' if all went fine, else 'false'
Note:
  • If there was an octree it will be destroyed!
  • The octree itself can be created using CreateOctree()
  • Its recommended to use GenerateStrips() to optimize the new geometries!
  • This may take some time so don't do it during runtime!
PLMESH_API bool PLMesh::MeshLODLevel::GenerateStrips ( PLCore::uint32  nVertexCacheSize = 18,
PLCore::uint32  nMinStripLength = 3 
)

Optimizes the geometries using triangle strips.

Parameters:
[in]nVertexCacheSizeSets the cache size which the stripfier uses to optimize the data. Controls the length of the generated individual strips. CacheSize should be 0 to disable the cache optimizer, 10 for a GeForce 256 or a GeForce 2, 16 or 18 for a GeForce 3 or a GeForce 4. Play a bit with this setting to find the best value for your 3D card.
[in]nMinStripLengthSets the minimum acceptable size for a strip, in triangles. All strips generated which are shorter than this will be thrown into one big, separate list.
Returns:
'true' if all went fine, else 'false'
Note:
PLMESH_API bool PLMesh::MeshLODLevel::CalculateBoundingBox ( const PLCore::Array< const Geometry * > &  lstGeometries,
PLRenderer::VertexBuffer cVertexBuffer,
PLMath::Vector3 vMinPos,
PLMath::Vector3 vMaxPos 
) const

Calculates the LOD level bounding box.

Parameters:
[in]lstGeometriesThe LOD level geometries to use
[in]cVertexBufferVertex buffer to use
[out]vMinPosWill receive the minimum bounding box position
[out]vMaxPosWill receive the maximum bounding box position
Returns:
'true' if all went fine, else 'false'
PLMESH_API bool PLMesh::MeshLODLevel::CalculateBoundingSphere ( const PLCore::Array< const Geometry * > &  lstGeometries,
PLRenderer::VertexBuffer cVertexBuffer,
PLMath::Vector3 vPos,
float &  fRadius 
) const

Calculates the LOD level bounding sphere.

Parameters:
[in]lstGeometriesThe LOD level geometries to use
[in]cVertexBufferVertex buffer to use
[out]vPosWill receive the bounding sphere position
[out]fRadiusWill receive the bounding sphere radius
Returns:
'true' if all went fine, else 'false'

The documentation for this class was generated from the following file:


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:51:21
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported