CrystalSpace

Public API Reference

iTerrainSystem Struct Reference

This class represents the terrain object as a set of cells. More...

#include <imesh/terrain2.h>

Inheritance diagram for iTerrainSystem:

List of all members.

Public Member Functions

virtual void AddCellHeightUpdateListener (iTerrainCellHeightDataCallback *cb)=0
 Add a listener to the cell height update callback.
virtual void AddCellLoadListener (iTerrainCellLoadCallback *cb)=0
 Add a listener to the cell load/unload callback.
virtual bool Collide (iCollider *collider, float radius, const csReversibleTransform &trans, bool oneHit, iTerrainCollisionPairArray *pairs)=0
 Collide collider with the terrain.
virtual bool CollideSegment (const csVector3 &start, const csVector3 &end, bool oneHit, iTerrainVector3Array *points)=0
 Collide segment with the terrain.
virtual
csTerrainColliderCollideSegmentResult 
CollideSegment (const csVector3 &start, const csVector3 &end, bool use_ray=false)=0
 Collide segment with the terrain.
virtual bool CollideTriangles (const csVector3 *vertices, size_t tri_count, const unsigned int *indices, float radius, const csReversibleTransform &trans, bool oneHit, iTerrainCollisionPairArray *pairs)=0
 Collide set of triangles with the terrain.
virtual bool GetAutoPreLoad () const =0
 Get automatic preload flag.
virtual csVector3 GetBinormal (const csVector2 &pos)=0
 Get binormal with bilinear interpolation.
virtual iTerrainCellGetCell (const char *name, bool loadData=false)=0
 Query a cell by name.
virtual iTerrainCellGetCell (size_t index, bool loadData=false)=0
 Query a cell by index (0 to GetCellCount ()).
virtual iTerrainCellGetCell (const csVector2 &pos, bool loadData=false)=0
 Query a cell by position.
virtual size_t GetCellCount () const =0
 Get total number of cells in terrain (loaded or not).
virtual float GetHeight (const csVector2 &pos)=0
 Query height doing bilinear interpolation.
virtual const
csTerrainMaterialPalette
GetMaterialPalette () const =0
 Get material palette.
virtual size_t GetMaxLoadedCells () const =0
 Get maximum number of loaded cells.
virtual csVector3 GetNormal (const csVector2 &pos)=0
 Get normal with bilinear interpolation.
virtual csVector3 GetTangent (const csVector2 &pos)=0
 Get tangent with bilinear interpolation.
virtual float GetVirtualViewDistance () const =0
 Get virtual view distance, that is, the distance from camera, at which the cells are preloaded.
virtual void PreLoadCells (iRenderView *rview, iMovable *movable)=0
 Preload all cells that are in the 'virtual view' (that is, the given view, extended to virtual view distance).
virtual void RemoveCellHeightUpdateListener (iTerrainCellHeightDataCallback *cb)=0
 Remove a listener to the cell height update callback.
virtual void RemoveCellLoadListener (iTerrainCellLoadCallback *cb)=0
 Remove a listener to the cell load/unload callback.
virtual void SetAutoPreLoad (bool mode)=0
 Set automatic preload flag.
virtual void SetMaterialPalette (const csTerrainMaterialPalette &array)=0
 Set a new material palette.
virtual void SetMaxLoadedCells (size_t value)=0
 Set maximum number of loaded cells.
virtual void SetVirtualViewDistance (float distance)=0
 Set virtual view distance, that is, the distance from camera, at which the cells are preloaded.
virtual void UnloadOldCells ()=0
 Unload cells to satisfy the requirement of max loaded cell count.

Detailed Description

This class represents the terrain object as a set of cells.

The object can be rendered and collided with. To gain access to some operations that are done at cell level you might want to use cell quering functions (GetCell)

Definition at line 552 of file terrain2.h.


Member Function Documentation

virtual void iTerrainSystem::AddCellHeightUpdateListener ( iTerrainCellHeightDataCallback cb  )  [pure virtual]

Add a listener to the cell height update callback.

virtual void iTerrainSystem::AddCellLoadListener ( iTerrainCellLoadCallback cb  )  [pure virtual]

Add a listener to the cell load/unload callback.

virtual bool iTerrainSystem::Collide ( iCollider collider,
float  radius,
const csReversibleTransform trans,
bool  oneHit,
iTerrainCollisionPairArray pairs 
) [pure virtual]

Collide collider with the terrain.

Parameters:
collider collider
radius radius of the bounding sphere surrounding the given set of triangles (used for fast rejection)
trans triangle set transformation (vertices' coordinates are specified in the space defined by this transformation)
oneHit if this is true, than stop on finding the first collision pair; otherwise, detect all collisions
points destination collision pair array
Returns:
true if there were any collisions, false if there were none

this will perform cell loading for the cells that potentially collide with the collider

this will not perform collision for cells that have Collideable property set to false

virtual bool iTerrainSystem::CollideSegment ( const csVector3 start,
const csVector3 end,
bool  oneHit,
iTerrainVector3Array points 
) [pure virtual]

Collide segment with the terrain.

Parameters:
start segment start (specified in object space)
end segment end (specified in object space)
oneHit if this is true, than stop on finding the first intersection point (the closest to the segment start); otherwise, detect all intersections
points destination point array
Returns:
true if there were any intersections, false if there were none

this will perform cell loading for the cells that potentially collide with the segment

this will not perform collision for cells that have Collideable property set to false

virtual csTerrainColliderCollideSegmentResult iTerrainSystem::CollideSegment ( const csVector3 start,
const csVector3 end,
bool  use_ray = false 
) [pure virtual]

Collide segment with the terrain.

Parameters:
start segment start (specified in object space)
end segment end (specified in object space)
use_ray if true then use a ray instead of a segment (default false).
Returns:
the intersection result.

this will perform cell loading for the cells that potentially collide with the segment

this will not perform collision for cells that have Collideable property set to false

virtual bool iTerrainSystem::CollideTriangles ( const csVector3 vertices,
size_t  tri_count,
const unsigned int *  indices,
float  radius,
const csReversibleTransform trans,
bool  oneHit,
iTerrainCollisionPairArray pairs 
) [pure virtual]

Collide set of triangles with the terrain.

Parameters:
vertices vertex array
tri_count triangle count
indices vertex indices, 3 indices for each triangle
radius radius of the bounding sphere surrounding the given set of triangles (used for fast rejection)
trans triangle set transformation (vertices' coordinates are specified in the space defined by this transformation)
oneHit if this is true, than stop on finding the first collision pair; otherwise, detect all collisions
points destination collision pair array
Returns:
true if there were any collisions, false if there were none

this will perform cell loading for the cells that potentially collide with the triangle set

this will not perform collision for cells that have Collideable property set to false

virtual bool iTerrainSystem::GetAutoPreLoad (  )  const [pure virtual]

Get automatic preload flag.

If it is set, then PreLoadCells is called when rendering an object. Otherwise, you have to call it yourself if you want cell streaming. The default value is true.

Returns:
automatic preload flag
virtual csVector3 iTerrainSystem::GetBinormal ( const csVector2 pos  )  [pure virtual]

Get binormal with bilinear interpolation.

Parameters:
pos object-space position.
Returns:
binormal value

this will perform cell loading for the cell that is used to sample binormal value

virtual iTerrainCell* iTerrainSystem::GetCell ( const char *  name,
bool  loadData = false 
) [pure virtual]

Query a cell by name.

Parameters:
name name of cell
load set if cell should be loaded if it isn't. Default is not to load cell data.
Returns:
pointer to the cell with the given name, or NULL, if none found
virtual iTerrainCell* iTerrainSystem::GetCell ( size_t  index,
bool  loadData = false 
) [pure virtual]

Query a cell by index (0 to GetCellCount ()).

Parameters:
load set if cell should be loaded if it isn't. Default is not to load cell data.
virtual iTerrainCell* iTerrainSystem::GetCell ( const csVector2 pos,
bool  loadData = false 
) [pure virtual]

Query a cell by position.

Parameters:
load set if cell should be loaded if it isn't. Default is not to load cell data.
Returns:
pointer to the first cell which intersects with the vertical ray of given position, or NULL if none found

this will perform cell loading if the resulted cell was not completely loaded

virtual size_t iTerrainSystem::GetCellCount (  )  const [pure virtual]

Get total number of cells in terrain (loaded or not).

virtual float iTerrainSystem::GetHeight ( const csVector2 pos  )  [pure virtual]

Query height doing bilinear interpolation.

This is equivalent to doing an intersection with vertical ray, except that it is faster.

Parameters:
pos object-space position.
Returns:
height value

this will perform cell loading for the cell that is used to sample height value

virtual const csTerrainMaterialPalette& iTerrainSystem::GetMaterialPalette (  )  const [pure virtual]

Get material palette.

The material map indices index this array.

Returns:
material palette
virtual size_t iTerrainSystem::GetMaxLoadedCells (  )  const [pure virtual]

Get maximum number of loaded cells.

Returns:
maximum number of loaded cells
virtual csVector3 iTerrainSystem::GetNormal ( const csVector2 pos  )  [pure virtual]

Get normal with bilinear interpolation.

Parameters:
pos object-space position.
Returns:
normal value

this will perform cell loading for the cell that is used to sample normal value

virtual csVector3 iTerrainSystem::GetTangent ( const csVector2 pos  )  [pure virtual]

Get tangent with bilinear interpolation.

Parameters:
pos object-space position.
Returns:
tangent value

this will perform cell loading for the cell that is used to sample tangent value

virtual float iTerrainSystem::GetVirtualViewDistance (  )  const [pure virtual]

Get virtual view distance, that is, the distance from camera, at which the cells are preloaded.

Returns:
virtual view distance
virtual void iTerrainSystem::PreLoadCells ( iRenderView rview,
iMovable movable 
) [pure virtual]

Preload all cells that are in the 'virtual view' (that is, the given view, extended to virtual view distance).

Preloading is feeder- dependent (that is, cell feeders are free to either implement or not implement it).

Parameters:
rview real view
movable terrain object

this will not perform preloading for cells that have Visible property set to false

virtual void iTerrainSystem::RemoveCellHeightUpdateListener ( iTerrainCellHeightDataCallback cb  )  [pure virtual]

Remove a listener to the cell height update callback.

virtual void iTerrainSystem::RemoveCellLoadListener ( iTerrainCellLoadCallback cb  )  [pure virtual]

Remove a listener to the cell load/unload callback.

virtual void iTerrainSystem::SetAutoPreLoad ( bool  mode  )  [pure virtual]

Set automatic preload flag.

Parameters:
mode new automatic preload flag
virtual void iTerrainSystem::SetMaterialPalette ( const csTerrainMaterialPalette array  )  [pure virtual]

Set a new material palette.

Parameters:
array new material palette
virtual void iTerrainSystem::SetMaxLoadedCells ( size_t  value  )  [pure virtual]

Set maximum number of loaded cells.

If the number of loaded cells becomes greater than this value (in the process of cell loading), the cell with least recent usage is unloaded.

Parameters:
value maximum number of loaded cells
virtual void iTerrainSystem::SetVirtualViewDistance ( float  distance  )  [pure virtual]

Set virtual view distance, that is, the distance from camera, at which the cells are preloaded.

Parameters:
distance new virtual view distance
virtual void iTerrainSystem::UnloadOldCells (  )  [pure virtual]

Unload cells to satisfy the requirement of max loaded cell count.


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

Generated for Crystal Space 1.4.1 by doxygen 1.7.1