Class TTerrain

Unit

Declaration

type TTerrain = class(TObject)

Description

Terrain (height for each X, Y) data.

Hierarchy

  • TObject
  • TTerrain

Overview

Methods

Public function Height(const X, Y: Single): Single; virtual; abstract;
Public function CreateNode(const Divisions: Cardinal; const InputRange, OutputRange: TFloatRectangle; const Appearance: TAppearanceNode): TAbstractChildNode; overload;
Public procedure UpdateNode(const Node: TAbstractChildNode; const Divisions: Cardinal; const InputRange, OutputRange: TFloatRectangle);
Public function CreateNode(const Divisions: Cardinal; const Size: Single; const XRange, ZRange: TVector2; const ColorFromHeight: TColorFromHeightFunction): TAbstractChildNode; overload; deprecated 'use overloaded version without ColorFromHeight; better to set color by shaders or texture color';
Public function CreateTriangulatedNode(const Divisions: Cardinal; const InputRange, OutputRange: TFloatRectangle; const Appearance: TAppearanceNode): TAbstractChildNode; experimental;
Public procedure UpdateTriangulatedNode(const Node: TAbstractChildNode; const Divisions: Cardinal; const InputRange, OutputRange: TFloatRectangle);

Description

Methods

Public function Height(const X, Y: Single): Single; virtual; abstract;
 
Public function CreateNode(const Divisions: Cardinal; const InputRange, OutputRange: TFloatRectangle; const Appearance: TAppearanceNode): TAbstractChildNode; overload;

Create X3D node with the given terrain shape.

InputRange determines the range of values (minimum and maximum X and Y) queried from the underlying terrain, that is: queried using the Height method.

OutputRange determines the span of the resulting shape in X and Z coordinates. Note that, when converting a heightmap to 3D, the 2nd dimension is Z. In 3D, we use Y for height, as this is the default in X3D and Castle Game Engine.

Often you will set InputRange and OutputRange to the same values, but you don't have to. Often they will at least have the same aspect ratio (actually, often they will be square), but you don't have to.

Divisions determines how dense is the mesh.

We return the node that you should insert to your scene.

It will use the given TAppearanceNode. The appearance is not configured in any way by this method, and it can even be Nil.

Public procedure UpdateNode(const Node: TAbstractChildNode; const Divisions: Cardinal; const InputRange, OutputRange: TFloatRectangle);

Update a node created by CreateNode to the new terrain and it's settings. The appearance of the previously created node (in CreateNode) is preserved.

Public function CreateNode(const Divisions: Cardinal; const Size: Single; const XRange, ZRange: TVector2; const ColorFromHeight: TColorFromHeightFunction): TAbstractChildNode; overload; deprecated 'use overloaded version without ColorFromHeight; better to set color by shaders or texture color';

Warning: this symbol is deprecated: use overloaded version without ColorFromHeight; better to set color by shaders or texture color

 
Public function CreateTriangulatedNode(const Divisions: Cardinal; const InputRange, OutputRange: TFloatRectangle; const Appearance: TAppearanceNode): TAbstractChildNode; experimental;

Warning: this symbol is experimental.

Alternative version of CreateNode that creates a different shape. It's has little less quality (triangulation is not adaptive like for ElevationGrid), but updating it (by UpdateTriangulatedNode) is a little faster (than updating the CreateNode by UpdatNode). In practice, the speed gain is minimal, and this method will likely be removed at some point.

The parameters have the same meaning as for CreateNode, and resulting look should be the same.

Public procedure UpdateTriangulatedNode(const Node: TAbstractChildNode; const Divisions: Cardinal; const InputRange, OutputRange: TFloatRectangle);

Update a node created by CreateTriangulatedNode to the new terrain and it's settings.


Generated by PasDoc 0.16.0.