Gorilla.Material.Grass
Unit Gorilla.Material.Grass.pasClasses
- TGorillaGrassMaterial = class ( TGorillaDefaultMaterial )
- TGorillaGrassMaterialSource = class ( TGorillaDefaultMaterialSource )
Constants
- const GORILLA_GLSL_DEFINE_GRASS : string = "GRASS";
- const GORILLA_MATERIAL_TEXTURE_DUDV : string = "DUDVMap";
TGorillaGrassMaterial
The grass material implements a shader which applies a texture to billboard elements built with TGorillaBillboard component. The shader also moves vertices less than 0.0 on x and z axis by sin and cos functions to simulate some kind of waving grass. Those waving mechanism can be manipulated by the Speed and Amplitude value.
Ancestors
Members
Fields
- protected FSpeedAmplitudeOffset :
TPoint3D
- protected FDUDVTexture :
TTexture
- protected FSpot :
TPoint3D
- protected FSpotRadius :
Single
- protected FSpotEnabled :
Boolean
Methods
- public constructor Create ( const ASource : TGorillaDefaultMaterialSource ) ;
- public destructor Destroy ( ) ;
- protected function GetSpeed ( ) : Single ;
- protected procedure SetSpeed ( const AValue : Single ) ;
- protected function GetAmplitude ( ) : Single ;
- protected procedure SetAmplitude ( const AValue : Single ) ;
- protected function GetOffset ( ) : Single ;
- protected procedure SetOffset ( const AValue : Single ) ;
- protected procedure DoApply ( const Context : TContext3D ) ; override;
- protected procedure DoCreateTexturePool ( ) ; override;
- protected procedure DoCreateVertexShader ( ) ; override;
- protected procedure DoSetupVertexShader ( ) ; override;
- protected procedure DoCreateFragmentShader ( ) ; override;
- protected procedure DoSetupFragmentShader ( ) ; override;
- protected function GetCutoutLevel ( ) : Single ;
- protected procedure SetCutoutLevel ( const AValue : Single ) ;
Properties
- public Speed : Single
- public Amplitude : Single
Get or set the maximum amplitude of waving grass. The larger this value, the more waving the grass is.
read GetAmplitude
write SetAmplitude - public Offset : Single
- public Spot : TPoint3D
- public SpotRadius : Single
Get or set radius of obstacle which is used to simulate bending of grass.
read FSpotRadius
write FSpotRadius - public SpotEnabled : Boolean
- public CutoutLevel : Single
This shader discards fragments at a certain transparency level. This is a helper property to set UseAlphaCutOff / AlphaCutOff values at once. Setting values > 0.0, will activate alpha cutoff, otherwise it will be disabled.
read GetCutoutLevel
write SetCutoutLevel
TGorillaGrassMaterialSource
The grass material source implements a shader which applies a texture to billboard elements built with TGorillaBillboard component. The shader also moves vertices less than 0.0 on x and z axis by sin and cos functions to simulate some kind of waving grass. Those waving mechanism can be manipulated by the Speed and Amplitude value.
Remarks
By the bitmap-pool it is possible to declare multiple textures for more variety in billboard element display. In most cases grass with a single texture do not look very realistic.Ancestors
Members
Methods
- public constructor Create ( AOwner : TComponent ) ;
- public destructor Destroy ( ) ;
- protected function GetSpeed ( ) : Single ;
- protected procedure SetSpeed ( const AValue : Single ) ;
- protected function GetAmplitude ( ) : Single ;
- protected procedure SetAmplitude ( const AValue : Single ) ;
- protected function GetOffset ( ) : Single ;
- protected procedure SetOffset ( const AValue : Single ) ;
- protected function GetSpot ( ) : TPoint3D ;
- protected procedure SetSpot ( const AValue : TPoint3D ) ;
- protected function GetSpotRadius ( ) : Single ;
- protected procedure SetSpotRadius ( const AValue : Single ) ;
- protected function GetSpotEnabled ( ) : Boolean ;
- protected procedure SetSpotEnabled ( const AValue : Boolean ) ;
- protected function GetCutoutLevel ( ) : Single ;
- protected procedure SetCutoutLevel ( const AValue : Single ) ;
- protected function GetDUDVTexture ( ) : TBitmap ;
- protected procedure SetDUDVTexture ( const AValue : TBitmap ) ;
- protected procedure DoCreateBitmapPool ( ) ; override;
- protected procedure DoCreateDefaultBitmaps ( ) ; override;
- protected function CreateMaterial ( ) : TMaterial ; override;
Properties
- published DUDVTexture : TBitmap
- published UseLighting : Boolean
- published UseSpecular : Boolean
- published UseTexturing : Boolean
- published UseTexture0 : Boolean
- published UseVertexColor : Boolean
- published UseColorClipping : Boolean
- published ShadingModel : TGorillaShadingModel
- published Diffuse : TAlphaColor
- published Emissive : TAlphaColor
- published Ambient : TAlphaColor
- published Specular : TAlphaColor
- published Shininess : Single
- published ClippingColor : TAlphaColor
- published NearLimit : Single
- published FarLimit : Single
- published Shadows : Boolean
- published ShadowMethod : TGorillaShadowMethod
- published DepthPass : TGorillaRenderPassController
- published Reflections : Boolean
- published ReflectionPass : TGorillaRenderPassController
- published ReflectionPower : Single
- published Refractions : Boolean
- published RefractionPass : TGorillaRenderPassController
- published RefractionPower : Single
- published Bitmaps : TGorillaBitmapPool
- published Speed : Single
- published Amplitude : Single
Get or set the maximum amplitude of waving grass. The larger this value, the more waving the grass is.
read GetAmplitude
write SetAmplitude - published Offset : Single
- published Spot : TPoint3D
- published SpotRadius : Single
Get or set radius of obstacle which is used to simulate bending of grass.
read GetSpotRadius
write SetSpotRadius - published SpotEnabled : Boolean
- published CutoutLevel : Single
Get or set the cutout alpha level where fragments are discarded by shader to produce better transparency effects.
read GetCutoutLevel
write SetCutoutLevel