Terrain is a heightfield that stretches over entire world on XY plane (so altitude is along Z axis).
Terrain can be queried for altitude at a specified point. Terrain altitudes may be updated. Terrain can render additional rectangular areas above it (ex. for selection).
To access the terrain use CEngine.
Public Types | |
| enum | |
| Terrain cells along X axis (must be a power of 2). | |
| enum | |
| Terrain cells along Y axis (must be a power of 2). | |
Public Methods | |
| CTerrain (const CResourceId &effect, const CResourceId &texture, float tuTiles, float tvTiles) | |
| Constructor. | |
| virtual | ~CTerrain () |
| Destructor. | |
| void | clearQuad () |
| Sets "none" additional quad. | |
| void | prepareQuad (float x1, float y1, float x2, float y2, float addZ) |
| Initializes additional quad. | |
| void | renderQuad (D3DCOLOR color) |
| Renders quad (must be initialized first). | |
| float | getAltitude (float x, float y) const |
| Gets terrain altitude at XY coordinate. | |
| float | getAltitudeIdx (int idxX, int idxY) const |
| Gets terrain altitude at XY cell index. | |
| void | getNearestCell (float x, float y, int &cx, int &cy) const |
| Gets nearest cell index for XY coordinate. | |
| float | getMinAltitude () const |
| Gets lowest altitude. | |
| float | getMaxAltitude () const |
| Gets highest altitude. | |
| const CResourceId & | getEffect () const |
| Gets terrain effect resource ID. | |
| void | setEffect (const CResourceId &effect) |
| Sets terrain effect resource ID. | |
| const CResourceId & | getTexture () const |
| Gets terrain texture resource ID. | |
| void | setTexture (const CResourceId &texture) |
| Sets terrain texture resource ID. | |
| void | beginUpdate () |
| Begin heightfield update. | |
| void | setAltitude (int idxX, int idxY, float z) |
| Update cell altitude. | |
| void | endUpdate () |
| Ends heightfield update. | |
|
||||||||||||||||||||
|
Constructor.
|
|
|
Begin heightfield update.
|
|
|
Ends heightfield update.
|
|
||||||||||||||||
|
Update cell altitude. All updates must happen between beginUpdate() and endUpdate().
|
1.2.17