|
@@ -2,7 +2,7 @@
|
|
// This unit is part of the GLScene Engine, http://glscene.org
|
|
// This unit is part of the GLScene Engine, http://glscene.org
|
|
//
|
|
//
|
|
unit GLRandomHDS;
|
|
unit GLRandomHDS;
|
|
-{
|
|
|
|
|
|
+(*
|
|
This unit provides tools and objects to generate random Height Data Sources
|
|
This unit provides tools and objects to generate random Height Data Sources
|
|
that can be used with TGLTerrainRenderer. General properties are defined in
|
|
that can be used with TGLTerrainRenderer. General properties are defined in
|
|
TGLBaseRandomHDS, but the main object is TGLCustomRandomHDS,
|
|
TGLBaseRandomHDS, but the main object is TGLCustomRandomHDS,
|
|
@@ -39,11 +39,12 @@ unit GLRandomHDS;
|
|
These components can be freely used. So far, you have to declare and
|
|
These components can be freely used. So far, you have to declare and
|
|
create this component manually in your code and link it to a TGLTerrainRenderer.
|
|
create this component manually in your code and link it to a TGLTerrainRenderer.
|
|
If you know how to make a registered component, please do it.
|
|
If you know how to make a registered component, please do it.
|
|
-}
|
|
|
|
|
|
+*)
|
|
|
|
|
|
interface
|
|
interface
|
|
|
|
|
|
uses
|
|
uses
|
|
|
|
+ Winapi.OpenGL,
|
|
Winapi.Windows,
|
|
Winapi.Windows,
|
|
System.Classes,
|
|
System.Classes,
|
|
System.Math,
|
|
System.Math,
|
|
@@ -54,7 +55,6 @@ uses
|
|
Vcl.Imaging.jpeg,
|
|
Vcl.Imaging.jpeg,
|
|
Vcl.Forms,
|
|
Vcl.Forms,
|
|
|
|
|
|
- OpenGLTokens,
|
|
|
|
GLScene,
|
|
GLScene,
|
|
GLVectorTypes,
|
|
GLVectorTypes,
|
|
GLVectorGeometry,
|
|
GLVectorGeometry,
|
|
@@ -110,10 +110,10 @@ type
|
|
TSingleClamp = procedure(var x, y: single) of object;
|
|
TSingleClamp = procedure(var x, y: single) of object;
|
|
TIntegerClamp = procedure(var x, y: integer) of object;
|
|
TIntegerClamp = procedure(var x, y: integer) of object;
|
|
|
|
|
|
- { This class introduces all the basic properties of random landscape. No method
|
|
|
|
|
|
+ (* This class introduces all the basic properties of random landscape. No method
|
|
implemented though. It is used as a descendant for
|
|
implemented though. It is used as a descendant for
|
|
- TGLCustomRandomLandscape: one tile landscape (cyclic or not)
|
|
- TGLCustomRandomLandscape: one tile landscape (cyclic or not)
|
|
- - TGLTiledRndLandscape: "infinite" landscapes (grids of TGLCustomRandomLandscape) }
|
|
|
|
|
|
+ - TGLTiledRndLandscape: "infinite" landscapes (grids of TGLCustomRandomLandscape) *)
|
|
TGLBaseRandomHDS = class(TGLHeightDataSource)
|
|
TGLBaseRandomHDS = class(TGLHeightDataSource)
|
|
private
|
|
private
|
|
FSteps: TSteps;
|
|
FSteps: TSteps;
|
|
@@ -177,15 +177,15 @@ type
|
|
property LightColor: TColorVector read FLightColor write SetLightColor;
|
|
property LightColor: TColorVector read FLightColor write SetLightColor;
|
|
// Light is parallel (sun light)
|
|
// Light is parallel (sun light)
|
|
property LightDirection: TVector read FLightDirection write SetLightDirection;
|
|
property LightDirection: TVector read FLightDirection write SetLightDirection;
|
|
- { This function must be supplied by the user. Here he/she can define which
|
|
|
|
|
|
+ (* This function must be supplied by the user. Here he/she can define which
|
|
colour to use depending on coordinates, elevation and normal. This provides
|
|
colour to use depending on coordinates, elevation and normal. This provides
|
|
a great flexibility. If no function is supplied (OnDrawTexture=nil), a default
|
|
a great flexibility. If no function is supplied (OnDrawTexture=nil), a default
|
|
- texture function is used (very basic, just blue and green). }
|
|
|
|
|
|
+ texture function is used (very basic, just blue and green). *)
|
|
property OnDrawTexture: TOnDrawTexture read FOnDrawTexture write SetOnDrawTexture;
|
|
property OnDrawTexture: TOnDrawTexture read FOnDrawTexture write SetOnDrawTexture;
|
|
published
|
|
published
|
|
property AmbientLight: single read FAmbientLight write SetAmbientLight;
|
|
property AmbientLight: single read FAmbientLight write SetAmbientLight;
|
|
- { If true, the landscape can be tiled to itself seamlessly.
|
|
|
|
- If false, the landscape is an isolated square. }
|
|
|
|
|
|
+ (* If true, the landscape can be tiled to itself seamlessly.
|
|
|
|
+ If false, the landscape is an isolated square. *)
|
|
property Cyclic: boolean read FCyclic write SetCyclic;
|
|
property Cyclic: boolean read FCyclic write SetCyclic;
|
|
// Erosion parameters. See associated record types
|
|
// Erosion parameters. See associated record types
|
|
property ErosionByFraction: TFractionErosion read FErosionByFraction write SetErosionByFraction;
|
|
property ErosionByFraction: TFractionErosion read FErosionByFraction write SetErosionByFraction;
|
|
@@ -199,8 +199,8 @@ type
|
|
property LightSmoothing: boolean read FLightSmoothing write SetLightSmoothing;
|
|
property LightSmoothing: boolean read FLightSmoothing write SetLightSmoothing;
|
|
(* Not used *)
|
|
(* Not used *)
|
|
property MaterialName: string read FMaterialName write SetMaterialName;
|
|
property MaterialName: string read FMaterialName write SetMaterialName;
|
|
- { If true, the height-field will not be emptied and generation will take the
|
|
|
|
- existing heights to shape the new landscape }
|
|
|
|
|
|
+ (* If true, the height-field will not be emptied and generation will take the
|
|
|
|
+ existing heights to shape the new landscape *)
|
|
property PrimerLandscape: boolean read FPrimerLandscape write SetPrimerLandscape;
|
|
property PrimerLandscape: boolean read FPrimerLandscape write SetPrimerLandscape;
|
|
// Enable the sea surface truncation
|
|
// Enable the sea surface truncation
|
|
property Sea: boolean read FSea write SetSea;
|
|
property Sea: boolean read FSea write SetSea;
|
|
@@ -208,22 +208,22 @@ type
|
|
property SeaLevel: single read GetSeaLevel write SetSeaLevel;
|
|
property SeaLevel: single read GetSeaLevel write SetSeaLevel;
|
|
// Depth at which the sea bottom becomes invisible. See DoSea for more information
|
|
// Depth at which the sea bottom becomes invisible. See DoSea for more information
|
|
property SeaTransparency: single read GetSeaTransparency write SetSeaTransparency;
|
|
property SeaTransparency: single read GetSeaTransparency write SetSeaTransparency;
|
|
- { Seed used by the random generator. Each seed generate a different
|
|
|
|
- reproductible landscape. }
|
|
|
|
|
|
+ (* Seed used by the random generator. Each seed generate a different
|
|
|
|
+ reproductible landscape. *)
|
|
property Seed: integer read FSeed write SetSeed;
|
|
property Seed: integer read FSeed write SetSeed;
|
|
// Enable shadow casting. May take some time for large Depth.
|
|
// Enable shadow casting. May take some time for large Depth.
|
|
property Shadows: boolean read FShadows write SetShadows;
|
|
property Shadows: boolean read FShadows write SetShadows;
|
|
property Steps: TSteps read FSteps write SetSteps;
|
|
property Steps: TSteps read FSteps write SetSteps;
|
|
// TerrainRenderer used to render the HDS.
|
|
// TerrainRenderer used to render the HDS.
|
|
property TerrainRenderer: TGLTerrainRenderer read FTerrainRenderer write SetTerrainRenderer;
|
|
property TerrainRenderer: TGLTerrainRenderer read FTerrainRenderer write SetTerrainRenderer;
|
|
- { Defines how many texture pixels are drawn per height-field cell. The larger
|
|
|
|
|
|
+ (* Defines how many texture pixels are drawn per height-field cell. The larger
|
|
this number the better the quality of the resulting image, but it takes a
|
|
this number the better the quality of the resulting image, but it takes a
|
|
- more time to compute. Good results are got between 1 and 5. }
|
|
|
|
|
|
+ more time to compute. Good results are got between 1 and 5. *)
|
|
property TextureScale: integer read FTextureScale write SetTextureScale;
|
|
property TextureScale: integer read FTextureScale write SetTextureScale;
|
|
end;
|
|
end;
|
|
|
|
|
|
- { Base structure for all random landscape objects. It can't be used directly
|
|
|
|
- since its BuildHeightField procedure is abstract. Use one of its descendants instead. }
|
|
|
|
|
|
+ (* Base structure for all random landscape objects. It can't be used directly
|
|
|
|
+ since its BuildHeightField procedure is abstract. Use one of its descendants instead. *)
|
|
TGLCustomRandomHDS = class(TGLBaseRandomHDS)
|
|
TGLCustomRandomHDS = class(TGLBaseRandomHDS)
|
|
private
|
|
private
|
|
FSlave: boolean;
|
|
FSlave: boolean;
|
|
@@ -257,31 +257,31 @@ type
|
|
function BoundaryZ: integer;
|
|
function BoundaryZ: integer;
|
|
// Generate the heightfield array, based on the topographical properties
|
|
// Generate the heightfield array, based on the topographical properties
|
|
procedure BuildHeightField; overload; virtual; abstract;
|
|
procedure BuildHeightField; overload; virtual; abstract;
|
|
- { Provide an automated way to build a landscape. However, a greater control can
|
|
|
|
|
|
+ (* Provide an automated way to build a landscape. However, a greater control can
|
|
be achieved by calling the various procedures manually (they are public methods)
|
|
be achieved by calling the various procedures manually (they are public methods)
|
|
as one gets a sligthly different result depending on the sequence of erosion
|
|
as one gets a sligthly different result depending on the sequence of erosion
|
|
- and sea steps. }
|
|
|
|
|
|
+ and sea steps. *)
|
|
procedure BuildLandscape;
|
|
procedure BuildLandscape;
|
|
- { - Compute the light effects
|
|
|
|
|
|
+ (* - Compute the light effects
|
|
- Compute the casted shadows
|
|
- Compute the casted shadows
|
|
- - Perform a basic smoothing if TextureScale>1 }
|
|
|
|
|
|
+ - Perform a basic smoothing if TextureScale>1 *)
|
|
procedure BuildLightMap; overload;
|
|
procedure BuildLightMap; overload;
|
|
procedure BuildLightMap(const aLightDirection: TVector); overload;
|
|
procedure BuildLightMap(const aLightDirection: TVector); overload;
|
|
// Normals are needed for lighting and slope-based textures
|
|
// Normals are needed for lighting and slope-based textures
|
|
procedure BuildNormals;
|
|
procedure BuildNormals;
|
|
- { For every pixel of the texture, computes slope and interpolated height and
|
|
|
|
|
|
+ (* For every pixel of the texture, computes slope and interpolated height and
|
|
sends these information to a user-supplied function (OnDrawTexture), whose
|
|
sends these information to a user-supplied function (OnDrawTexture), whose
|
|
result is a tColorVector. If no OnDrawTexture is supplied, a basic default
|
|
result is a tColorVector. If no OnDrawTexture is supplied, a basic default
|
|
- texture will be used. }
|
|
|
|
|
|
+ texture will be used. *)
|
|
procedure BuildTexture;
|
|
procedure BuildTexture;
|
|
// Fill the heightfield with "Empty" values (-999)
|
|
// Fill the heightfield with "Empty" values (-999)
|
|
procedure ClearHeightField;
|
|
procedure ClearHeightField;
|
|
// Fill the light map with 1
|
|
// Fill the light map with 1
|
|
procedure ClearLightMap;
|
|
procedure ClearLightMap;
|
|
- { Constrain x,y to be in the boundaries of the height field array. This is
|
|
|
|
|
|
+ (* Constrain x,y to be in the boundaries of the height field array. This is
|
|
done in two way depending on the kind of landscape:
|
|
done in two way depending on the kind of landscape:
|
|
Cyclic landscapes: mod
|
|
Cyclic landscapes: mod
|
|
- Non-cyclic landscape: clamp }
|
|
|
|
|
|
+ Non-cyclic landscape: clamp *)
|
|
procedure ConstrainCoordinates(var x, y: single); overload;
|
|
procedure ConstrainCoordinates(var x, y: single); overload;
|
|
procedure ConstrainCoordinates(var x, y: integer); overload;
|
|
procedure ConstrainCoordinates(var x, y: integer); overload;
|
|
constructor Create(AOwner: TComponent); override;
|
|
constructor Create(AOwner: TComponent); override;
|
|
@@ -290,36 +290,36 @@ type
|
|
procedure DoCyclicBoundaries;
|
|
procedure DoCyclicBoundaries;
|
|
(* Not yet implemented *)
|
|
(* Not yet implemented *)
|
|
procedure DoErosionByFraction;
|
|
procedure DoErosionByFraction;
|
|
- { Just a smoothing. Should be done last as it improves the look of other
|
|
|
|
|
|
+ (* Just a smoothing. Should be done last as it improves the look of other
|
|
erosion effects. Too much biological erosion can ruin erase their results
|
|
erosion effects. Too much biological erosion can ruin erase their results
|
|
- though. Some tweaking may be needed }
|
|
|
|
|
|
+ though. Some tweaking may be needed *)
|
|
procedure DoErosionByLife;
|
|
procedure DoErosionByLife;
|
|
- { Create sharp valleys and canyons. If DepositRate>0, it will also fill the
|
|
|
|
- low pools, producing flat "lakes" and "ponds" }
|
|
|
|
|
|
+ (* Create sharp valleys and canyons. If DepositRate>0, it will also fill the
|
|
|
|
+ low pools, producing flat "lakes" and "ponds" *)
|
|
procedure DoErosionByRain;
|
|
procedure DoErosionByRain;
|
|
// Create a beach and a cliff around the islands
|
|
// Create a beach and a cliff around the islands
|
|
procedure DoErosionBySea;
|
|
procedure DoErosionBySea;
|
|
- { Cut all elevations lower than sea level. If Transparency>0, the sea surface
|
|
|
|
|
|
+ (* Cut all elevations lower than sea level. If Transparency>0, the sea surface
|
|
will not be flat, but a slight elevation change (unperceptible in 3D view)
|
|
will not be flat, but a slight elevation change (unperceptible in 3D view)
|
|
- allow to fake transparency in the OnDrawTexture. }
|
|
|
|
|
|
+ allow to fake transparency in the OnDrawTexture. *)
|
|
procedure DoSea;
|
|
procedure DoSea;
|
|
// Discretise the heigthfield in a chosen number of steps
|
|
// Discretise the heigthfield in a chosen number of steps
|
|
procedure DoSteps;
|
|
procedure DoSteps;
|
|
- { x and y are range-checked and constrained into the array. This slows down
|
|
|
|
|
|
+ (* x and y are range-checked and constrained into the array. This slows down
|
|
computation. If you don't need to range-check (this is mainly useful in
|
|
computation. If you don't need to range-check (this is mainly useful in
|
|
cyclic landscapes when you need a seamless joint), call fHeigth instead
|
|
cyclic landscapes when you need a seamless joint), call fHeigth instead
|
|
(this is a protected field, therefore only accessible from TGLFractalHDS
|
|
(this is a protected field, therefore only accessible from TGLFractalHDS
|
|
- descendents. }
|
|
|
|
|
|
+ descendents. *)
|
|
property Heights[x, y: integer]: single read GetHeight write SetHeight;
|
|
property Heights[x, y: integer]: single read GetHeight write SetHeight;
|
|
// Range checked
|
|
// Range checked
|
|
- { A specific implementation of THeightDataSource.InterpolatedHeight }
|
|
|
|
|
|
+ (* A specific implementation of THeightDataSource.InterpolatedHeight *)
|
|
function Interpolate(x, y: single): single;
|
|
function Interpolate(x, y: single): single;
|
|
- { Keep the array of normals for future use }
|
|
|
|
|
|
+ // Keep the array of normals for future use
|
|
property KeepNormals: boolean read FKeepNormals write SetKeepNormals;
|
|
property KeepNormals: boolean read FKeepNormals write SetKeepNormals;
|
|
- { Property used by TGLTiledRndLandscape to know where the landtile is located
|
|
|
|
- and other parameters. See tLandTileInfo }
|
|
|
|
|
|
+ (* Property used by TGLTiledRndLandscape to know where the landtile is located
|
|
|
|
+ and other parameters. See tLandTileInfo *)
|
|
property LandTileInfo: TLandTileInfo read GetLandTileInfo write SetLandTileInfo;
|
|
property LandTileInfo: TLandTileInfo read GetLandTileInfo write SetLandTileInfo;
|
|
- { Range checking }
|
|
|
|
|
|
+ // Range checking
|
|
function PointInMap(const x, y: single): boolean; overload;
|
|
function PointInMap(const x, y: single): boolean; overload;
|
|
function PointInMap(const x, y: integer): boolean; overload;
|
|
function PointInMap(const x, y: integer): boolean; overload;
|
|
// Store the minimum and maximum elevations
|
|
// Store the minimum and maximum elevations
|
|
@@ -329,16 +329,16 @@ type
|
|
function Normal(const Position: TVector): TVector;
|
|
function Normal(const Position: TVector): TVector;
|
|
// Max height - min height
|
|
// Max height - min height
|
|
property RangeHeight: single read FRangeHeight;
|
|
property RangeHeight: single read FRangeHeight;
|
|
- { Scale of the Terrain Renderer. They are set so as giving a identical
|
|
|
|
|
|
+ (* Scale of the Terrain Renderer. They are set so as giving a identical
|
|
vertical/horitontal ratio with any size. Therefore, Scale.X=Scale.Y=1 and
|
|
vertical/horitontal ratio with any size. Therefore, Scale.X=Scale.Y=1 and
|
|
only Scale.Z varies. If you want to increase the landscape scale, the best way
|
|
only Scale.Z varies. If you want to increase the landscape scale, the best way
|
|
- would be to place the Terrain Renderer in a DummyCube and rescale it. }
|
|
|
|
|
|
+ would be to place the Terrain Renderer in a DummyCube and rescale it. *)
|
|
function Scale: TGLCoordinates;
|
|
function Scale: TGLCoordinates;
|
|
- { Size of the square height array. With the middle-point algorithm, it is always
|
|
|
|
|
|
+ (* Size of the square height array. With the middle-point algorithm, it is always
|
|
Size = 2^N+1. In a cyclic landscape, the last row and columns are identical
|
|
Size = 2^N+1. In a cyclic landscape, the last row and columns are identical
|
|
- to the first. }
|
|
|
|
|
|
+ to the first. *)
|
|
property Size: integer read FSize;
|
|
property Size: integer read FSize;
|
|
- { A height rescaled between 0 and 1000 for }
|
|
|
|
|
|
+ // A height rescaled between 0 and 1000 for
|
|
function StandardisedHeight(const x, y: integer): single;
|
|
function StandardisedHeight(const x, y: integer): single;
|
|
{ When long computations are running, this property contains the operation
|
|
{ When long computations are running, this property contains the operation
|
|
beeing processed. }
|
|
beeing processed. }
|
|
@@ -354,7 +354,7 @@ type
|
|
property Cyclic: boolean read FCyclic write SetCyclic;
|
|
property Cyclic: boolean read FCyclic write SetCyclic;
|
|
end;
|
|
end;
|
|
|
|
|
|
- { Random landscape based on the middle-point displacement algorithm }
|
|
|
|
|
|
+ // Random landscape based on the middle-point displacement algorithm
|
|
TGLFractalHDS = class(TGLCustomRandomHDS)
|
|
TGLFractalHDS = class(TGLCustomRandomHDS)
|
|
private
|
|
private
|
|
FAmplitude: integer;
|
|
FAmplitude: integer;
|
|
@@ -368,13 +368,13 @@ type
|
|
procedure BuildHeightField(const aDepth, aSeed, aAmplitude: integer); overload;
|
|
procedure BuildHeightField(const aDepth, aSeed, aAmplitude: integer); overload;
|
|
constructor Create(AOwner: TComponent); override;
|
|
constructor Create(AOwner: TComponent); override;
|
|
published
|
|
published
|
|
- { Proportional to the difference between highest and lowest altitude. }
|
|
|
|
|
|
+ // Proportional to the difference between highest and lowest altitude.
|
|
property Amplitude: integer read fAmplitude write SetAmplitude;
|
|
property Amplitude: integer read fAmplitude write SetAmplitude;
|
|
- { Number of levels in the fractal process. Depth defines the size of the
|
|
|
|
|
|
+ (* Number of levels in the fractal process. Depth defines the size of the
|
|
landscape: Size = 2^Depth+1 . Good results are got with Depth>=6. Above 10
|
|
landscape: Size = 2^Depth+1 . Good results are got with Depth>=6. Above 10
|
|
- the landscape takes a lot of time to be generated. }
|
|
|
|
|
|
+ the landscape takes a lot of time to be generated. *)
|
|
property Depth: integer read fDepth write SetDepth;
|
|
property Depth: integer read fDepth write SetDepth;
|
|
- { The lower this parameter, the smoother the landscape. Takes value between 0 and 1 }
|
|
|
|
|
|
+ // The lower this parameter, the smoother the landscape. Takes value between 0 and 1
|
|
property Roughness: single read fRoughness write SetRoughness;
|
|
property Roughness: single read fRoughness write SetRoughness;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -433,12 +433,12 @@ type
|
|
procedure ComputeLandTile(const aX, aZ: integer; var NewLandTile: TGLLandTile); virtual;
|
|
procedure ComputeLandTile(const aX, aZ: integer; var NewLandTile: TGLLandTile); virtual;
|
|
procedure CyclicClamp(var x, z: single); overload;
|
|
procedure CyclicClamp(var x, z: single); overload;
|
|
procedure CyclicClamp(var x, z: integer); overload;
|
|
procedure CyclicClamp(var x, z: integer); overload;
|
|
- { tTerrainRenderer event handler }
|
|
|
|
|
|
+ // tTerrainRenderer event handler
|
|
procedure GetTerrainBounds(var l, t, r, b: single);
|
|
procedure GetTerrainBounds(var l, t, r, b: single);
|
|
function LandTileSeed(x, z: integer): integer;
|
|
function LandTileSeed(x, z: integer): integer;
|
|
property OnCreateDefaultTile: TStartPreparingDataEvent read fOnCreateDefaultTile write SetOnCreateDefaultTile;
|
|
property OnCreateDefaultTile: TStartPreparingDataEvent read fOnCreateDefaultTile write SetOnCreateDefaultTile;
|
|
procedure SetCyclic(const Value: boolean); override;
|
|
procedure SetCyclic(const Value: boolean); override;
|
|
- { This procedure MUST be called by the descendent of TGLRandomArchipelago }
|
|
|
|
|
|
+ // This procedure MUST be called by the descendent of TGLRandomArchipelago
|
|
procedure SetSize(const aSize: integer);
|
|
procedure SetSize(const aSize: integer);
|
|
function fSortLandscapes(Item1, Item2: Pointer): integer;
|
|
function fSortLandscapes(Item1, Item2: Pointer): integer;
|
|
// procedure PrepareLandTileData(HeightData:tHeightData; LandTile:tLandTile);
|
|
// procedure PrepareLandTileData(HeightData:tHeightData; LandTile:tLandTile);
|
|
@@ -450,10 +450,10 @@ type
|
|
procedure ApplyTopography(var aLandTile: TGLLandTile);
|
|
procedure ApplyTopography(var aLandTile: TGLLandTile);
|
|
procedure CameraPosition(var TileX, TileZ: integer);
|
|
procedure CameraPosition(var TileX, TileZ: integer);
|
|
procedure CleanUp;
|
|
procedure CleanUp;
|
|
- { Constrain x,y to be in the boundaries of the height field array. This is
|
|
|
|
|
|
+ (* Constrain x,y to be in the boundaries of the height field array. This is
|
|
done in two way depending on the kind of landscape:
|
|
done in two way depending on the kind of landscape:
|
|
Cyclic landscapes: mod
|
|
Cyclic landscapes: mod
|
|
- Non-cyclic landscape: clamp }
|
|
|
|
|
|
+ Non-cyclic landscape: clamp *)
|
|
procedure ConstrainCoordinates(var x, z: single); overload;
|
|
procedure ConstrainCoordinates(var x, z: single); overload;
|
|
procedure ConstrainCoordinates(var x, z: integer); overload;
|
|
procedure ConstrainCoordinates(var x, z: integer); overload;
|
|
constructor Create(AOwner: TComponent); override;
|
|
constructor Create(AOwner: TComponent); override;
|
|
@@ -485,7 +485,7 @@ type
|
|
function of camera position. This is let to the descendent classes. }
|
|
function of camera position. This is let to the descendent classes. }
|
|
procedure Update;
|
|
procedure Update;
|
|
property MapUpdating: boolean read fMapUpdating;
|
|
property MapUpdating: boolean read fMapUpdating;
|
|
- { Use these boundaries with non-cyclic landscapes to constrain camera movements. }
|
|
|
|
|
|
+ // Use these boundaries with non-cyclic landscapes to constrain camera movements.
|
|
function XMoveBoundary: single;
|
|
function XMoveBoundary: single;
|
|
function ZMoveBoundary: single;
|
|
function ZMoveBoundary: single;
|
|
procedure StartPreparingData(heightData: TGLHeightData); override;
|
|
procedure StartPreparingData(heightData: TGLHeightData); override;
|
|
@@ -500,7 +500,7 @@ type
|
|
{ Distance at which a new landtile begin to be built. Increasing this value
|
|
{ Distance at which a new landtile begin to be built. Increasing this value
|
|
allows for a higher camera speed but it will also increase the memory requirements. }
|
|
allows for a higher camera speed but it will also increase the memory requirements. }
|
|
property GenerationRadius: integer read FGenerationRadius write SetGenerationRadius;
|
|
property GenerationRadius: integer read FGenerationRadius write SetGenerationRadius;
|
|
- { Number of landtile to keep in memory. Should not be modified. }
|
|
|
|
|
|
+ // Number of landtile to keep in memory. Should not be modified.
|
|
property LandTileCapacity: integer read FLandTileCapacity write SetLandTileCapacity;
|
|
property LandTileCapacity: integer read FLandTileCapacity write SetLandTileCapacity;
|
|
{ Probability that a given landtile is non-default }
|
|
{ Probability that a given landtile is non-default }
|
|
property LandTileDensity: single read FLandTileDensity write SetLandTileDensity;
|
|
property LandTileDensity: single read FLandTileDensity write SetLandTileDensity;
|
|
@@ -546,13 +546,13 @@ type
|
|
procedure ComputeLandTile(const aX, aZ: integer; var NewLandTile: TGLLandTile); override;
|
|
procedure ComputeLandTile(const aX, aZ: integer; var NewLandTile: TGLLandTile); override;
|
|
constructor Create(AOwner: TComponent); override;
|
|
constructor Create(AOwner: TComponent); override;
|
|
published
|
|
published
|
|
- { Ranges for the amplitude parameter in the fractal algorithm }
|
|
|
|
|
|
+ // Ranges for the amplitude parameter in the fractal algorithm
|
|
property AmplitudeMax: integer read FAmplitudeMax write SetAmplitudeMax;
|
|
property AmplitudeMax: integer read FAmplitudeMax write SetAmplitudeMax;
|
|
property AmplitudeMin: integer read FAmplitudeMin write SetAmplitudeMin;
|
|
property AmplitudeMin: integer read FAmplitudeMin write SetAmplitudeMin;
|
|
- { Depth of the fractal algorithm }
|
|
|
|
|
|
+ // Depth of the fractal algorithm
|
|
property Depth: integer read fDepth write SetDepth;
|
|
property Depth: integer read fDepth write SetDepth;
|
|
- { A wrapper for LandtileDensity. This is the probabilty for a landtile to
|
|
|
|
- contain an island. }
|
|
|
|
|
|
+ (* A wrapper for LandtileDensity. This is the probabilty for a landtile to
|
|
|
|
+ contain an island. *)
|
|
property IslandDensity: single read GetIslandDensity write SetIslandDensity;
|
|
property IslandDensity: single read GetIslandDensity write SetIslandDensity;
|
|
{ Ranges for the roughness parameter in the fractal algorithm }
|
|
{ Ranges for the roughness parameter in the fractal algorithm }
|
|
property RoughnessMax: single read FRoughnessMax write SetRoughnessMax;
|
|
property RoughnessMax: single read FRoughnessMax write SetRoughnessMax;
|
|
@@ -881,17 +881,17 @@ begin
|
|
FTask := 'Landscape generation';
|
|
FTask := 'Landscape generation';
|
|
FTaskProgress := 0;
|
|
FTaskProgress := 0;
|
|
|
|
|
|
- { Empty all height-field cells }
|
|
|
|
|
|
+ // Empty all height-field cells
|
|
if not FPrimerLandscape then
|
|
if not FPrimerLandscape then
|
|
ClearHeightField;
|
|
ClearHeightField;
|
|
|
|
|
|
- { Build the basic fractal height field. It is mandatory and must always be
|
|
|
|
- called first. }
|
|
|
|
|
|
+ (* Build the basic fractal height field. It is mandatory and must always be
|
|
|
|
+ called first. *)
|
|
BuildHeightField;
|
|
BuildHeightField;
|
|
|
|
|
|
- { Various operations that reshape the height field. These procedures may be
|
|
|
|
|
|
+ (* Various operations that reshape the height field. These procedures may be
|
|
called in any order, although the one proposed here is the most natural.
|
|
called in any order, although the one proposed here is the most natural.
|
|
- These procedures are optional }
|
|
|
|
|
|
+ These procedures are optional *)
|
|
if FErosionByRain.Enabled then
|
|
if FErosionByRain.Enabled then
|
|
DoErosionByRain;
|
|
DoErosionByRain;
|
|
if FErosionByLife.Enabled then
|
|
if FErosionByLife.Enabled then
|
|
@@ -901,30 +901,30 @@ begin
|
|
if FSteps.Enabled then
|
|
if FSteps.Enabled then
|
|
DoSteps;
|
|
DoSteps;
|
|
|
|
|
|
- { Doing sea first would speeds up the following processes
|
|
|
|
|
|
+ (* Doing sea first would speeds up the following processes
|
|
but the result would be slightly less realistic. In
|
|
but the result would be slightly less realistic. In
|
|
particular with transparency, you can have a nice effect
|
|
particular with transparency, you can have a nice effect
|
|
of submarine valleys prolungating land canyons.
|
|
of submarine valleys prolungating land canyons.
|
|
- This procedure is optional }
|
|
|
|
|
|
+ This procedure is optional *)
|
|
if FSea then
|
|
if FSea then
|
|
DoSea;
|
|
DoSea;
|
|
|
|
|
|
if FCyclic then
|
|
if FCyclic then
|
|
DoCyclicBoundaries; // Ensures a seamless fit
|
|
DoCyclicBoundaries; // Ensures a seamless fit
|
|
|
|
|
|
- { Compute a normal for each vertex. Used by BuildLightMap and BuildTexture }
|
|
|
|
|
|
+ // Compute a normal for each vertex. Used by BuildLightMap and BuildTexture
|
|
if FLandCover then
|
|
if FLandCover then
|
|
BuildNormals;
|
|
BuildNormals;
|
|
|
|
|
|
- { Add light effects. Either BuildLightMap or ClearLigthMap must be called.
|
|
|
|
- Used by BuildTexture. }
|
|
|
|
|
|
+ (* Add light effects. Either BuildLightMap or ClearLigthMap must be called.
|
|
|
|
+ Used by BuildTexture. *)
|
|
if FLighting and LandCover then
|
|
if FLighting and LandCover then
|
|
BuildLightMap
|
|
BuildLightMap
|
|
else
|
|
else
|
|
ClearLightMap;
|
|
ClearLightMap;
|
|
|
|
|
|
- { Builds the actual texture. If it is not used, the terrain will be textured
|
|
|
|
- with its Material, if defined. }
|
|
|
|
|
|
+ (* Builds the actual texture. If it is not used, the terrain will be textured
|
|
|
|
+ with its Material, if defined. *)
|
|
if FLandCover then
|
|
if FLandCover then
|
|
BuildTexture;
|
|
BuildTexture;
|
|
|
|
|
|
@@ -1778,8 +1778,8 @@ begin
|
|
r := FSize;
|
|
r := FSize;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+// Copied from GLHeightData.InterpolatedHeight
|
|
function TGLCustomRandomHDS.Interpolate(x, y: single): single;
|
|
function TGLCustomRandomHDS.Interpolate(x, y: single): single;
|
|
-{ Copied from GLHeightData.InterpolatedHeight }
|
|
|
|
var
|
|
var
|
|
ix, iy: integer;
|
|
ix, iy: integer;
|
|
h1, h2, h3: single;
|
|
h1, h2, h3: single;
|
|
@@ -2012,7 +2012,9 @@ begin
|
|
fRoughness := Value;
|
|
fRoughness := Value;
|
|
end;
|
|
end;
|
|
|
|
|
|
-{ TGLRandomLandscape }
|
|
|
|
|
|
+//-----------------------------------
|
|
|
|
+// TGLRandomLandscape
|
|
|
|
+//-----------------------------------
|
|
|
|
|
|
procedure TGLTiledRndLandscape.ApplyLighting(var aLandTile: TGLLandTile);
|
|
procedure TGLTiledRndLandscape.ApplyLighting(var aLandTile: TGLLandTile);
|
|
begin
|
|
begin
|
|
@@ -2280,8 +2282,8 @@ begin
|
|
end; // for
|
|
end; // for
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+// Generates a unique seed from the tile coordinates
|
|
function TGLTiledRndLandscape.LandTileSeed(x, z: integer): integer;
|
|
function TGLTiledRndLandscape.LandTileSeed(x, z: integer): integer;
|
|
-{ Generates a unique seed from the tile coordinates }
|
|
|
|
begin
|
|
begin
|
|
Result := fBaseSeed + z * ExtentX + x;
|
|
Result := fBaseSeed + z * ExtentX + x;
|
|
end;
|
|
end;
|
|
@@ -2291,7 +2293,7 @@ begin
|
|
Result := fLandTiles.Count;
|
|
Result := fLandTiles.Count;
|
|
end;
|
|
end;
|
|
|
|
|
|
-{ procedure TGLTiledRndLandscape.PrepareLandTileData(HeightData: tHeightData;
|
|
|
|
|
|
+(* procedure TGLTiledRndLandscape.PrepareLandTileData(HeightData: tHeightData;
|
|
LandTile: tLandTile);
|
|
LandTile: tLandTile);
|
|
var
|
|
var
|
|
x,y,x0,y0 :integer;
|
|
x,y,x0,y0 :integer;
|
|
@@ -2321,7 +2323,7 @@ end;
|
|
DataState:=hdsReady;
|
|
DataState:=hdsReady;
|
|
if oldType<>hdtSingle then DataType:=oldType;
|
|
if oldType<>hdtSingle then DataType:=oldType;
|
|
end;//with
|
|
end;//with
|
|
- end; }
|
|
|
|
|
|
+ end; *)
|
|
|
|
|
|
procedure TGLTiledRndLandscape.SetCamera(const Value: TGLCamera);
|
|
procedure TGLTiledRndLandscape.SetCamera(const Value: TGLCamera);
|
|
begin
|
|
begin
|
|
@@ -2614,7 +2616,7 @@ begin
|
|
InitializeRandomGenerator(aSeed);
|
|
InitializeRandomGenerator(aSeed);
|
|
with TGLFractalHDS(aLandscape) do
|
|
with TGLFractalHDS(aLandscape) do
|
|
begin
|
|
begin
|
|
- { Initialize the tile }
|
|
|
|
|
|
+ // Initialize the tile
|
|
Seed := random(MaxInt);
|
|
Seed := random(MaxInt);
|
|
Depth := Self.fDepth;
|
|
Depth := Self.fDepth;
|
|
Amplitude := random(FAmplitudeMax - FAmplitudeMin) + FAmplitudeMin;
|
|
Amplitude := random(FAmplitudeMax - FAmplitudeMin) + FAmplitudeMin;
|
|
@@ -2625,7 +2627,7 @@ begin
|
|
Cyclic := True;
|
|
Cyclic := True;
|
|
PrimerLandscape := True;
|
|
PrimerLandscape := True;
|
|
|
|
|
|
- { Generate the landscape }
|
|
|
|
|
|
+ // Generate the landscape
|
|
PrimerIsland(SeaLevel - SeaTransparency, random * Amplitude / 2, FHeight);
|
|
PrimerIsland(SeaLevel - SeaTransparency, random * Amplitude / 2, FHeight);
|
|
// Pre-generate an island
|
|
// Pre-generate an island
|
|
BuildHeightField;
|
|
BuildHeightField;
|
|
@@ -2682,9 +2684,9 @@ const
|
|
end;
|
|
end;
|
|
SinCos(WaterPhase(px, py) * FWaveSpeed, sa, ca);
|
|
SinCos(WaterPhase(px, py) * FWaveSpeed, sa, ca);
|
|
colorRatio := 1 - alpha * 0.1;
|
|
colorRatio := 1 - alpha * 0.1;
|
|
- gl.Color4f(r * colorRatio, g * colorRatio, b, alpha);
|
|
|
|
- gl.TexCoord2f(px * 0.01 + 0.002 * sa, py * 0.01 + 0.0022 * ca - t * 0.01);
|
|
|
|
- gl.Vertex3f(px, py, FSeaLevel + FWaveAmplitude * sa * VSF);
|
|
|
|
|
|
+ glColor4f(r * colorRatio, g * colorRatio, b, alpha);
|
|
|
|
+ glTexCoord2f(px * 0.01 + 0.002 * sa, py * 0.01 + 0.0022 * ca - t * 0.01);
|
|
|
|
+ glVertex3f(px, py, FSeaLevel + FWaveAmplitude * sa * VSF);
|
|
end;
|
|
end;
|
|
|
|
|
|
begin
|
|
begin
|
|
@@ -2693,16 +2695,16 @@ begin
|
|
FTerrainRenderer.MaterialLibrary.ApplyMaterial(FSeaMaterialName, rci);
|
|
FTerrainRenderer.MaterialLibrary.ApplyMaterial(FSeaMaterialName, rci);
|
|
repeat
|
|
repeat
|
|
// if not WasAboveWater then InverTGLFrontFace;
|
|
// if not WasAboveWater then InverTGLFrontFace;
|
|
- gl.PushAttrib(GL_ENABLE_BIT);
|
|
|
|
|
|
+ glPushAttrib(GL_ENABLE_BIT);
|
|
|
|
|
|
- gl.Disable(GL_LIGHTING);
|
|
|
|
- gl.Disable(GL_NORMALIZE);
|
|
|
|
|
|
+ glDisable(GL_LIGHTING);
|
|
|
|
+ glDisable(GL_NORMALIZE);
|
|
|
|
|
|
- gl.StencilFunc(GL_ALWAYS, 1, 255);
|
|
|
|
- gl.StencilMask(255);
|
|
|
|
- gl.StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
|
|
|
- gl.Enable(GL_STENCIL_TEST);
|
|
|
|
- gl.Normal3f(0, 0, 1);
|
|
|
|
|
|
+ glStencilFunc(GL_ALWAYS, 1, 255);
|
|
|
|
+ glStencilMask(255);
|
|
|
|
+ glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
|
|
|
+ glEnable(GL_STENCIL_TEST);
|
|
|
|
+ glNormal3f(0, 0, 1);
|
|
|
|
|
|
for i := 0 to HeightDatas.Count - 1 do
|
|
for i := 0 to HeightDatas.Count - 1 do
|
|
begin
|
|
begin
|
|
@@ -2726,8 +2728,8 @@ begin
|
|
IssuePoint(0, 0);
|
|
IssuePoint(0, 0);
|
|
gl.End_;
|
|
gl.End_;
|
|
end;
|
|
end;
|
|
- gl.StencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
|
|
|
- gl.PopAttrib;
|
|
|
|
|
|
+ glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
|
|
|
+ glPopAttrib;
|
|
// if not WasAboveWater then InverTGLFrontFace;
|
|
// if not WasAboveWater then InverTGLFrontFace;
|
|
// WaterPolyCount:=heightDatas.Count*8;
|
|
// WaterPolyCount:=heightDatas.Count*8;
|
|
until not FTerrainRenderer.MaterialLibrary.UnApplyMaterial(rci);
|
|
until not FTerrainRenderer.MaterialLibrary.UnApplyMaterial(rci);
|
|
@@ -2760,9 +2762,9 @@ const
|
|
alpha := ClampValue(alpha, 0.5, 1);
|
|
alpha := ClampValue(alpha, 0.5, 1);
|
|
end;
|
|
end;
|
|
colorRatio := 1 - alpha * 0.1;
|
|
colorRatio := 1 - alpha * 0.1;
|
|
- gl.Color4f(r * colorRatio, g * colorRatio, b, alpha);
|
|
|
|
- gl.TexCoord2f(px * 0.01, py * 0.01 + t);
|
|
|
|
- gl.Vertex3f(px, py, FSeaLevel);
|
|
|
|
|
|
+ glColor4f(r * colorRatio, g * colorRatio, b, alpha);
|
|
|
|
+ glTexCoord2f(px * 0.01, py * 0.01 + t);
|
|
|
|
+ glVertex3f(px, py, FSeaLevel);
|
|
end;
|
|
end;
|
|
|
|
|
|
begin
|
|
begin
|
|
@@ -2771,16 +2773,16 @@ begin
|
|
FTerrainRenderer.MaterialLibrary.ApplyMaterial(FSeaMaterialName, rci);
|
|
FTerrainRenderer.MaterialLibrary.ApplyMaterial(FSeaMaterialName, rci);
|
|
repeat
|
|
repeat
|
|
// if not WasAboveWater then InverTGLFrontFace;
|
|
// if not WasAboveWater then InverTGLFrontFace;
|
|
- gl.PushAttrib(GL_ENABLE_BIT);
|
|
|
|
|
|
+ glPushAttrib(GL_ENABLE_BIT);
|
|
|
|
|
|
- gl.Disable(GL_LIGHTING);
|
|
|
|
- gl.Disable(GL_NORMALIZE);
|
|
|
|
|
|
+ glDisable(GL_LIGHTING);
|
|
|
|
+ glDisable(GL_NORMALIZE);
|
|
|
|
|
|
- gl.StencilFunc(GL_ALWAYS, 1, 255);
|
|
|
|
- gl.StencilMask(255);
|
|
|
|
- gl.StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
|
|
|
- gl.Enable(GL_STENCIL_TEST);
|
|
|
|
- gl.Normal3f(0, 0, 1);
|
|
|
|
|
|
+ glStencilFunc(GL_ALWAYS, 1, 255);
|
|
|
|
+ glStencilMask(255);
|
|
|
|
+ glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
|
|
|
+ glEnable(GL_STENCIL_TEST);
|
|
|
|
+ glNormal3f(0, 0, 1);
|
|
|
|
|
|
for i := 0 to HeightDatas.Count - 1 do
|
|
for i := 0 to HeightDatas.Count - 1 do
|
|
begin
|
|
begin
|
|
@@ -2804,8 +2806,8 @@ begin
|
|
IssuePoint(0, 0);
|
|
IssuePoint(0, 0);
|
|
gl.End_;
|
|
gl.End_;
|
|
end;
|
|
end;
|
|
- gl.StencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
|
|
|
- gl.PopAttrib;
|
|
|
|
|
|
+ glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
|
|
|
+ glPopAttrib;
|
|
// if not WasAboveWater then InverTGLFrontFace;
|
|
// if not WasAboveWater then InverTGLFrontFace;
|
|
// WaterPolyCount:=heightDatas.Count*8;
|
|
// WaterPolyCount:=heightDatas.Count*8;
|
|
until not FTerrainRenderer.MaterialLibrary.UnApplyMaterial(rci);
|
|
until not FTerrainRenderer.MaterialLibrary.UnApplyMaterial(rci);
|
|
@@ -2877,29 +2879,29 @@ begin
|
|
FWaveSpeed := Value;
|
|
FWaveSpeed := Value;
|
|
end;
|
|
end;
|
|
|
|
|
|
-{ *************************************************************** }
|
|
|
|
-{ ******* RANDOM HDS ALGORITHMS ******** }
|
|
|
|
-{ *************************************************************** }
|
|
|
|
|
|
+(***************************************************************
|
|
|
|
+ ******* RANDOM HDS ALGORITHMS ********
|
|
|
|
+ ***************************************************************)
|
|
|
|
|
|
|
|
+(* Fractal algorithm based on the middle-point displacement method. It is built in
|
|
|
|
+ a way that it can be juxtaposed seamlessly to itself (cyclic boundaries) *)
|
|
procedure FractalMiddlePointHDS(const aDepth, aSeed, aAmplitude: integer; const aRoughness: single; aCyclic: boolean;
|
|
procedure FractalMiddlePointHDS(const aDepth, aSeed, aAmplitude: integer; const aRoughness: single; aCyclic: boolean;
|
|
var z: TMapOfSingle; var MinZ, MaxZ: single);
|
|
var z: TMapOfSingle; var MinZ, MaxZ: single);
|
|
-{ Fractal algorithm based on the middle-point displacement method. It is built in
|
|
|
|
- a way that it can be juxtaposed seamlessly to itself (cyclic boundaries) }
|
|
|
|
var
|
|
var
|
|
iter, Stp, stp2: integer;
|
|
iter, Stp, stp2: integer;
|
|
i, j: integer;
|
|
i, j: integer;
|
|
dz: single;
|
|
dz: single;
|
|
Size: integer;
|
|
Size: integer;
|
|
|
|
|
|
|
|
+ // Fill variables only if they have not been predefined
|
|
procedure Let(var z: single; const Value: single);
|
|
procedure Let(var z: single; const Value: single);
|
|
- { Fill variables only if they have not been predefined }
|
|
|
|
begin
|
|
begin
|
|
if z = Empty then
|
|
if z = Empty then
|
|
z := Value;
|
|
z := Value;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ // Fill variables only if they have not been predefined
|
|
function Get(const x, y: integer; var Value: single): boolean;
|
|
function Get(const x, y: integer; var Value: single): boolean;
|
|
- { Fill variables only if they have not been predefined }
|
|
|
|
begin
|
|
begin
|
|
Value := z[x, y];
|
|
Value := z[x, y];
|
|
Result := (Value = Empty);
|
|
Result := (Value = Empty);
|
|
@@ -2965,8 +2967,8 @@ begin
|
|
Let(z[Size, 0], z[0, 0]);
|
|
Let(z[Size, 0], z[0, 0]);
|
|
Let(z[Size, Size], z[0, 0]);
|
|
Let(z[Size, Size], z[0, 0]);
|
|
|
|
|
|
- { Build Height field }
|
|
|
|
- FOR iter := 1 TO aDepth do
|
|
|
|
|
|
+ // Build Height field
|
|
|
|
+ for iter := 1 TO aDepth do
|
|
begin // iterations
|
|
begin // iterations
|
|
Stp := Round(Size / IntPower(2, (iter - 1))); // step
|
|
Stp := Round(Size / IntPower(2, (iter - 1))); // step
|
|
stp2 := Stp div 2; // half step
|
|
stp2 := Stp div 2; // half step
|
|
@@ -3014,7 +3016,7 @@ begin
|
|
Let(z[Size, 0], random * dz * 2 - dz);
|
|
Let(z[Size, 0], random * dz * 2 - dz);
|
|
Let(z[Size, Size], random * dz * 2 - dz);
|
|
Let(z[Size, Size], random * dz * 2 - dz);
|
|
|
|
|
|
- { Build Height field }
|
|
|
|
|
|
+ // Build Height field
|
|
for iter := 1 to aDepth do
|
|
for iter := 1 to aDepth do
|
|
begin // iterations
|
|
begin // iterations
|
|
Stp := Round(Size / IntPower(2, (iter - 1))); // step
|
|
Stp := Round(Size / IntPower(2, (iter - 1))); // step
|
|
@@ -3055,12 +3057,12 @@ begin
|
|
end; // else Cyclic
|
|
end; // else Cyclic
|
|
end;
|
|
end;
|
|
|
|
|
|
-{ *************************************************************** }
|
|
|
|
-{ ******* PREDEFINED HEIGHT-FIELD ******** }
|
|
|
|
-{ *************************************************************** }
|
|
|
|
|
|
+(***************************************************************
|
|
|
|
+ ******* PREDEFINED HEIGHT-FIELD ********
|
|
|
|
+ ***************************************************************)
|
|
|
|
|
|
procedure PrimerNull(var z: TMapOfSingle);
|
|
procedure PrimerNull(var z: TMapOfSingle);
|
|
-{ Empty field }
|
|
|
|
|
|
+// Empty field
|
|
var
|
|
var
|
|
x, y: integer;
|
|
x, y: integer;
|
|
Size: integer;
|
|
Size: integer;
|
|
@@ -3075,9 +3077,9 @@ begin
|
|
end; // for
|
|
end; // for
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+(* Ensure that the border of the tile is low (below sea level) and the middle
|
|
|
|
+ is high. *)
|
|
procedure PrimerIsland(LowZ, HighZ: single; var z: TMapOfSingle);
|
|
procedure PrimerIsland(LowZ, HighZ: single; var z: TMapOfSingle);
|
|
-{ Ensure that the border of the tile is low (below sea level) and the middle
|
|
|
|
- is high. }
|
|
|
|
var
|
|
var
|
|
i: integer;
|
|
i: integer;
|
|
Size: integer;
|
|
Size: integer;
|