PixelLightAPI  .
Classes | Public Member Functions
PLScene::GMMSurface Class Reference

Geometrically MipMapping surface. More...

#include <GMMSurface.h>

List of all members.

Classes

struct  Vertex
 GMM surface vertex. More...

Public Member Functions

PLS_API GMMSurface (PLRenderer::Renderer &cRenderer)
 Constructor.
PLS_API ~GMMSurface ()
 Destructor.
PLS_API bool Create (PLCore::uint32 nHeightMapSize, float fHeightMap[], PLCore::uint32 nPatchSize=16, int nGeoMipMaps=-1)
 Creates the GMM surface.
PLS_API void Destroy ()
 Kills the GMM surface.
PLS_API const PLMath::Vector3GetViewerPos () const
 Returns the viewer position.
PLS_API void SetViewerPos (const PLMath::Vector3 &vPos)
 Sets the viewer position.
PLS_API PLCore::uint32 GetHeightMapSize () const
 Returns the size of the height map.
PLS_API const float * GetHeightMap () const
 Returns a pointer to the height map.
PLS_API PLCore::uint32 GetVertices () const
 Returns the number of surface vertices.
PLS_API VertexGetVertex (PLCore::uint32 nID=0) const
 Returns a pointer to a surface vertex.
PLS_API float GetHeight (PLCore::uint32 nX, PLCore::uint32 nY) const
 Returns the height of a height map coordinate.
PLS_API bool SetHeight (PLCore::uint32 nX, PLCore::uint32 nY, float fHeight=0)
 Sets the height of a height map coordinate.
PLS_API PLCore::uint32 GetPatchSize () const
 Returns the size of a patch.
PLS_API PLCore::uint32 GetXYPatches () const
 Returns the number of patches per column/row.
PLS_API PLCore::uint32 GetPatches () const
 Returns the total number of patches in the GMM surface.
PLS_API GMMSurfacePatchGetPatch (PLCore::uint32 nID) const
 Returns a pointer to the patch with the given ID.
PLS_API PLCore::uint32 GetGeoMipMaps () const
 Returns the number of geometrically mip maps.
PLS_API void SetNeighbours (GMMSurface *pLeft=nullptr, GMMSurface *pTop=nullptr, GMMSurface *pRight=nullptr, GMMSurface *pBottom=nullptr)
 Sets the neighbour GMM surfaces.
PLS_API
PLRenderer::MaterialHandler
GetMaterialHandler ()
 Returns the surface material handler.
PLS_API PLMath::QuadtreeGetQuadtree ()
 Returns the GMM surface quadtree.
PLS_API void Update ()
 Updates the GMM surface.
PLS_API void Draw () const
 Draws the GMM surface.

Detailed Description

Geometrically MipMapping surface.

Remarks:
This surface takes a hight map and displays it with an optimal level of detail using height variance and distance to camera.
Note:
  • For optimal frustum culling a quadtree is used
  • The standard usage of this surface type is a terrain
  • Similar to the ROAM surface but this technique is quite better for modern hardware

Constructor & Destructor Documentation

Constructor.

Parameters:
[in]cRendererRenderer to use

Destructor.


Member Function Documentation

PLS_API bool PLScene::GMMSurface::Create ( PLCore::uint32  nHeightMapSize,
float  fHeightMap[],
PLCore::uint32  nPatchSize = 16,
int  nGeoMipMaps = -1 
)

Creates the GMM surface.

Parameters:
[in]nHeightMapSizeHeight map size
[in]fHeightMapReference to the height map
[in]nPatchSizePatch size
[in]nGeoMipMapsNumber of geometrically mip maps, -1 = automatic
Returns:
'true' if all went fine, else 'false'
Note:
  • The reference to the height map is used directly, short the reference must be valid as long as the GMM surface is used!!
  • The GMM takes place in the single patches of the surface further they are used for frustum culling and each patch could have another material
PLS_API void PLScene::GMMSurface::Destroy ( )

Kills the GMM surface.

Returns the viewer position.

Returns:
Viewer position
PLS_API void PLScene::GMMSurface::SetViewerPos ( const PLMath::Vector3 vPos)

Sets the viewer position.

Parameters:
[in]vPosViewer position
PLS_API PLCore::uint32 PLScene::GMMSurface::GetHeightMapSize ( ) const

Returns the size of the height map.

Returns:
The size of the height map
PLS_API const float* PLScene::GMMSurface::GetHeightMap ( ) const

Returns a pointer to the height map.

Returns:
Pointer to the height map, can be a null pointer
PLS_API PLCore::uint32 PLScene::GMMSurface::GetVertices ( ) const

Returns the number of surface vertices.

Returns:
Number of surface vertices
PLS_API Vertex* PLScene::GMMSurface::GetVertex ( PLCore::uint32  nID = 0) const

Returns a pointer to a surface vertex.

Parameters:
[in]nIDID of the vertex
Returns:
Pointer to a surface vertex, a null pointer if there was an error
PLS_API float PLScene::GMMSurface::GetHeight ( PLCore::uint32  nX,
PLCore::uint32  nY 
) const

Returns the height of a height map coordinate.

Parameters:
[in]nXHeight map x coordinate
[in]nYHeight map y coordinate
Returns:
The height of a height map coordinate
PLS_API bool PLScene::GMMSurface::SetHeight ( PLCore::uint32  nX,
PLCore::uint32  nY,
float  fHeight = 0 
)

Sets the height of a height map coordinate.

Parameters:
[in]nXHeight map x coordinate
[in]nYHeight map y coordinate
[in]fHeightNew height at the coordinate
Returns:
'true' if all went fine, else 'false'
Note:
  • If a height value in the height map is manipulated the patch using this coordinate must be recalculated during the next GMM surface update
PLS_API PLCore::uint32 PLScene::GMMSurface::GetPatchSize ( ) const

Returns the size of a patch.

Returns:
Size of a patch
PLS_API PLCore::uint32 PLScene::GMMSurface::GetXYPatches ( ) const

Returns the number of patches per column/row.

Returns:
Number of patches per column/row
PLS_API PLCore::uint32 PLScene::GMMSurface::GetPatches ( ) const

Returns the total number of patches in the GMM surface.

Returns:
The total number of patches in the GMM surface
PLS_API GMMSurfacePatch* PLScene::GMMSurface::GetPatch ( PLCore::uint32  nID) const

Returns a pointer to the patch with the given ID.

Parameters:
[in]nIDID of the patch which should be returned
Returns:
A pointer to the patch with the given ID, a null pointer if there was an error
PLS_API PLCore::uint32 PLScene::GMMSurface::GetGeoMipMaps ( ) const

Returns the number of geometrically mip maps.

Returns:
Number of geometrically mip maps
PLS_API void PLScene::GMMSurface::SetNeighbours ( GMMSurface pLeft = nullptr,
GMMSurface pTop = nullptr,
GMMSurface pRight = nullptr,
GMMSurface pBottom = nullptr 
)

Sets the neighbour GMM surfaces.

Parameters:
[in]pLeftThe left neighbour GMM surface
[in]pTopThe top neighbour GMM surface
[in]pRightThe right neighbour GMM surface
[in]pBottomThe bottom neighbour GMM surface

Returns the surface material handler.

Returns:
Surface material handler

Returns the GMM surface quadtree.

Returns:
GMM surface quadtree
PLS_API void PLScene::GMMSurface::Update ( )

Updates the GMM surface.

Note:
  • Must be done before the GMM surface is drawn!! (updates detail etc.)
PLS_API void PLScene::GMMSurface::Draw ( ) const

Draws the GMM surface.

Note:
  • The GMM surface must be updated before it's drawn! (updates detail etc.)

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


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:42
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported