Castle Game Engine: CastleTerrain: Class TTerrainGrid

# Class TTerrainGrid
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleTerrain ## Declaration `type TTerrainGrid = class(TTerrain)` ## Description Terrain data from a grid of values with specified width * height. Used when your underlying data is a simple 2D array of GridSizeX * GridSizeY heights. The idea is that on such terrain, there are special grid points where the height data is accurate. Everything else is an interpolation derived from this data. ## Hierarchy TObject TTerrain TTerrainGrid ## Overview ### Methods
| `constructor Create;`
| `function Height(const X, Y: Single): Single; override;`
| `function GridHeight(const X, Y: Cardinal): Single; virtual; abstract;`
| `function GridSizeX: Cardinal; virtual; abstract;`
| `function GridSizeY: Cardinal; virtual; abstract;`
### Properties
| `property GridX1: Single read FGridX1 write FGridX1 default 0;`
| `property GridY1: Single read FGridY1 write FGridY1 default 0;`
| `property GridX2: Single read FGridX2 write FGridX2 default 1;`
| `property GridY2: Single read FGridY2 write FGridY2 default 1;`
| `property GridHeightScale: Single read FGridHeightScale write FGridHeightScale default 1;`
## Description ### Methods
| `constructor Create;`
| `function Height(const X, Y: Single): Single; override;`
Get height of the terrain at specified 2D point. This is implemented in TTerrainGrid class, using the data returned by GridHeight. For float X in 0..1 range, we return grid values for grid points 0..GridSizeX - 1. Outside 0..1 range, we clamp (that is, take nearest value from 0..1 range) — this way the terrain seemingly continues into the infinity. In comparison to GridHeight, it's (very slightly) slower, and it doesn't really present any more interesting information (in contrast to typical procedural terrain, where there can be always more and more detail at each level).
| `function GridHeight(const X, Y: Cardinal): Single; virtual; abstract;`
GridSizeX, GridSizeY specify grid dimensions. Use `GridHeight`(0..GridSizeX - 1, 0..GridSizeY - 1) to get height at particular grid point.
| `function GridSizeX: Cardinal; virtual; abstract;`
| `function GridSizeY: Cardinal; virtual; abstract;`
### Properties
| `property GridX1: Single read FGridX1 write FGridX1 default 0;`
Specify where terrain is located, for Height method. These do not affect GridHeight method.
| `property GridY1: Single read FGridY1 write FGridY1 default 0;`
| `property GridX2: Single read FGridX2 write FGridX2 default 1;`
| `property GridY2: Single read FGridY2 write FGridY2 default 1;`
| `property GridHeightScale: Single read FGridHeightScale write FGridHeightScale default 1;`
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:12