Gorilla.Terrain.CVLOD
Unit Gorilla.Terrain.CVLOD.pasClasses
- TGorillaCVLODTerrain = class ( TGorillaControl )
Records
- record TGorillaLODChunk
Enumerations
- enum TGorillaFocusedChunkDetection = ( CameraDirection, CameraPosition ) ;
Constants
- const GORILLA_TERRAIN_CHUNK_SUBDIV_MIN : Integer = $2;
- const GORILLA_TERRAIN_CHUNK_SUBDIV_MAX : Integer = $100;
- const GORILLA_TERRAIN_CHUNK_DETAIL_MIN : Integer = $1;
- const GORILLA_TERRAIN_CHUNK_DETAIL_MAX : Integer = $8;
- const GORILLA_TERRAIN_LOD_MIN : Integer = $1;
- const GORILLA_TERRAIN_LOD_MAX : Integer = $5;
TGorillaCVLODTerrain
The CVLOD (Chunked Visual Level Of Detail) terrain is a chunk managed terrain with different level of details (LOD) shown depending on the current view frustum.
Remarks
The component splits a specific resolution into chunks and level of details. It automatically computes a defined number of levels of details.Ancestors
Members
Fields
- protected FViewport :
TGorillaViewport
- protected FHeightMap :
TBitmap
- protected FHeightScale :
Single
- protected FFocusDetection :
TGorillaFocusedChunkDetection
- protected FShowGrid :
Boolean
- protected FSubdivisions :
Integer
- protected FDetails :
Integer
- protected FLevelOfDetails :
Integer
- protected FLODs :
TGorillaLODList
- protected FStaticBuffering :
Boolean
- protected FAutoDecimate :
Boolean
- protected FSmoothing :
Integer
- protected FMaterialSource :
TMaterialSource
- protected FFocus :
TGorillaLODChunk
- protected FUpdateLock :
TCriticalSection
- protected FInUpdateProcess :
Boolean
- protected FOnBeginLoading :
TOnLoadingCVLODTerrain
- protected FOnLoading :
TOnProgressCLVODTerrain
- protected FOnEndLoading :
TOnLoadingCVLODTerrain
Methods
- public constructor Create ( AOwner : TComponent ) ;
- public destructor Destroy ( ) ;
- protected function GetSubdivisions ( ) : Integer ; virtual;
- protected procedure SetSubdivisions ( const AValue : Integer ) ; virtual;
- protected function GetDetails ( ) : Integer ; virtual;
- protected procedure SetDetails ( const AValue : Integer ) ; virtual;
- protected procedure SetHeightMap ( const AValue : TBitmap ) ; virtual;
- protected procedure SetHeightScale ( const AValue : Single ) ; virtual;
- protected function GetLevelOfDetails ( ) : Integer ; virtual;
- protected procedure SetLevelOfDetails ( const AValue : Integer ) ; virtual;
- protected procedure SetFocusDetection ( const AValue : TGorillaFocusedChunkDetection ) ; virtual;
- protected procedure SetStaticBuffering ( const AValue : Boolean ) ; virtual;
- protected procedure SetAutoDecimate ( const AValue : Boolean ) ; virtual;
- protected procedure SetSmoothing ( const AValue : Integer ) ; virtual;
- protected function GetMaterialSource ( ) : TMaterialSource ; virtual;
- protected procedure SetMaterialSource ( AValue : TMaterialSource ) ; virtual;
- protected function GetChunksPerColumn ( ) : Integer ; virtual;
- protected function GetChunksPerLOD ( ) : Integer ; virtual;
- protected procedure Lock
(
)
;
The generation process should only be accessed once, so we need to secure the whole async process from multiple access.
- protected procedure Unlock ( ) ;
- protected procedure DoOnHeightMapChanged ( ASender : TObject ) ; virtual;
- protected procedure DoEnableSurroundingChunks
(
const
ALOD :
Integer; const
AUpperLODCoord :
TPoint; var
AGrid :
TArray<System.TArray<System.Byte>>
)
;
Enables all visible chunks depending on the distance to the currently focused chunk. You need to supply the current LOD and the row-and-column coordinate in the current LOD.
- protected procedure DoComputeChunkedLevelOfDetail
(
)
;
virtual;
Detect the focused chunk in the highest level of detail depending on the current camera position and view direction.
- protected procedure Render ( ) ; override;
- protected procedure DoUpdateTerrain
(
)
;
virtual;
The basis routine to build a chunked terrain with all level of details.
- protected procedure Notification ( AComponent : TComponent; Operation : TOperation ) ; override;
- public procedure UpdateTerrain
(
)
;
Rebuilds chunks and terrains asychronously.
- public procedure Clear
(
)
;
virtual;
Destroys all existing terrain chunks.
- public procedure EndUpdate ( ) ; override;
- public function GetChunk
(
const
ALOD :
Integer; const
ARow :
Integer; const
ACol :
Integer; out
AChunk :
TGorillaLODChunk
)
: Boolean
;
virtual;
Request a specific chunk from a level of detail at a certain position in the terrain grid.
- public procedure RandomTerrain
(
const
AAlgorithm :
TRandomTerrainAlgorithmType; const
AStaticBuffering :
Boolean
=
True
; const
ADecimate :
Boolean
=
False
)
;
overload;
Execute this method to build a heightmap by a specific procedural terrain algorithm. The method will automatically execute the RebuildTerrain() method.
- public procedure RandomTerrain
(
const
AAlgorithm :
TRandomTerrainAlgorithm; const
AStaticBuffering :
Boolean
=
True
; const
ADecimate :
Boolean
=
False
)
;
overload;
Execute this method to build a heightmap by a specific procedural terrain algorithm. The method will automatically execute the RebuildTerrain() method.
Properties
- public ShowGrid : Boolean
- public LODs : TObjectList<System.Generics.Collections.TList<Gorilla.Terrain.CVLOD.TGorillaLODChunk>>
- public Focus : TGorillaLODChunk
Request the latest focused high lod chunk. This value will be detected during rendering.
read FFocus - public ChunksPerColumn : Integer
- public ChunksPerLOD : Integer
- published Viewport : TGorillaViewport
- published Subdivisions : Integer
Get or set terrain subdivisions to generate a dynamic terrain from. Allowed values are: 32, 64, 128, 256, 512, 1024, 2048 If an invalid value is passed, the default value 512 will be used.
read GetSubdivisions
write SetSubdivisions - published Details : Integer
Get or set the factor of detail inside of single chunk. Allowed values are 1..8, which will increase memory usage. The default value is 1.
read GetDetails
write SetDetails - published LevelOfDetails : Integer
Get or set the number of computed level of details. The value should be a valid ordinal between 1 and 4.
read GetLevelOfDetails
write SetLevelOfDetails - published HeightMap : TBitmap
The heightmap bitmap is used to compute the y-value of every vertex in the terrain grid.
read FHeightMap
write SetHeightMap - published HeightScale : Single
Describes the y-multiplicator on applying the heightmap on the terrain grid.
read FHeightScale
write SetHeightScale - published FocusDetection : TGorillaFocusedChunkDetection
The component provides two methods to detect the focused chunk for level of detail arrangement.
read FFocusDetection
write SetFocusDetection - published StaticBuffering : Boolean
Get or set if the vertex data should be stored in a framebufferobject for fast rendering.
read FStaticBuffering
write SetStaticBuffering - published AutoDecimate : Boolean
Get or set if vertex data will automatically be reduced by the integrated algorithm.
read FAutoDecimate
write SetAutoDecimate - published Smoothing : Integer
Defines if heightmap getting smoothed before translating to vertex positions. The higher this value is, the more smoothing iterations will be executed. To deactivate smoothing, set the value to 0.
read FSmoothing
write SetSmoothing - published MaterialSource : TMaterialSource
Get or set the used material source for rendering this mesh instance.
read GetMaterialSource
write SetMaterialSource