![]() |
Public API Reference |
![]() |
This class represents the terrain object as a set of cells. More...
#include <imesh/terrain2.h>
Public Member Functions | |
virtual iTerrainCell * | AddCell (iTerrainFactoryCell *)=0 |
Add a cell to the terrain instance based on the given iTerrainFactoryCell. | |
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, iMaterialArray *materials)=0 |
Collide segment with the terrain. | |
virtual bool | CollideSegment (const csVector3 &start, const csVector3 &end, csVector3 &hitPoint, iMaterialWrapper **hitMaterial)=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 iTerrainCell * | GetCell (const char *name, bool loadData=false)=0 |
Query a cell by name. | |
virtual iTerrainCell * | GetCell (const csVector2 &pos, bool loadData=false)=0 |
Query a cell by position. | |
virtual iTerrainCell * | GetCell (size_t index, bool loadData=false)=0 |
Query a cell by index (0 to GetCellCount ()). | |
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 | RemoveCell (iTerrainCell *)=0 |
Remove the given cell from this instance. | |
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. |
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 601 of file terrain2.h.
virtual iTerrainCell* iTerrainSystem::AddCell | ( | iTerrainFactoryCell * | ) | [pure virtual] |
Add a cell to the terrain instance based on the given iTerrainFactoryCell.
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.
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 |
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, | ||
iMaterialArray * | materials | ||
) | [pure virtual] |
Collide segment with the terrain.
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 |
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::CollideSegment | ( | const csVector3 & | start, |
const csVector3 & | end, | ||
csVector3 & | hitPoint, | ||
iMaterialWrapper ** | hitMaterial | ||
) | [pure virtual] |
Collide segment with the terrain.
Stops on finding the first intersection point (the closest to the segment start).
start | segment start (specified in object space) |
end | segment end (specified in object space) |
hitPoint | receives intersection point |
hitMaterial | receives material at intersection point if not null |
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.
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). |
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.
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 |
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.
virtual csVector3 iTerrainSystem::GetBinormal | ( | const csVector2 & | pos | ) | [pure virtual] |
Get binormal with bilinear interpolation.
pos | object-space position. |
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.
name | name of cell |
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.
load | set if cell should be loaded if it isn't. Default is not to load cell data. |
this will perform cell loading if the resulted cell was not completely loaded
virtual iTerrainCell* iTerrainSystem::GetCell | ( | size_t | index, |
bool | loadData = false |
||
) | [pure virtual] |
Query a cell by index (0 to GetCellCount ()).
load | set if cell should be loaded if it isn't. Default is not to load cell data. |
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.
pos | object-space position. |
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.
virtual size_t iTerrainSystem::GetMaxLoadedCells | ( | ) | const [pure virtual] |
Get maximum number of loaded cells.
virtual csVector3 iTerrainSystem::GetNormal | ( | const csVector2 & | pos | ) | [pure virtual] |
Get normal with bilinear interpolation.
pos | object-space position. |
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.
pos | object-space position. |
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.
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).
rview | real view |
movable | terrain object |
this will not perform preloading for cells that have Visible property set to false
virtual void iTerrainSystem::RemoveCell | ( | iTerrainCell * | ) | [pure virtual] |
Remove the given cell from this instance.
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.
mode | new automatic preload flag |
virtual void iTerrainSystem::SetMaterialPalette | ( | const csTerrainMaterialPalette & | array | ) | [pure virtual] |
Set a new material palette.
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.
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.
distance | new virtual view distance |
virtual void iTerrainSystem::UnloadOldCells | ( | ) | [pure virtual] |
Unload cells to satisfy the requirement of max loaded cell count.