Function _IrrAddGrass

au3Irr2

au3Irr2 Function Reference

_IrrAddGrass

Adds a grass object to the scene.

#Include <au3Irrlicht2.au3>
_IrrAddGrass($h_Terrain, $i_X, $i_Y, $i_PatchSize, $f_FadeDistance, $i_Crossed, $f_GrassScale, $i_MaxDensity, $i_DataPosX, $i_DataPosY, $h_HeightMap, $h_TextureMap, $h_GrassMap, $h_GrassTexture)

 

Parameters

$h_Terrain [explanation]
$i_X X Positon of grass patch.
$i_Y Y Positon of grass patch.
$i_PatchSize Size of grass patch
$f_FadeDistance Distance at which the number of displayed grass elements in that patch are reduced.
If this is set to 1.0 then when the cameral is inside the patch all of grass will be displayed but once outside less and less will be shown.
By increasing this to 2.0 then all of the grass is shown until the camera is two patches distant.
This gives a better appearence but reduces performance as more grass has to be drawn.
$i_Crossed IRR_ON or IRR_OFF.
When off each piece of grass is a separate entity with its own position and rotation.
When On grass is paired up and placed to form a cross. Crossed grass can have a better appearance as you rotate around it.
However individual grass can give the impression that there is more of it and you can therefore reduce the number of grass blades and increase performance.
$f_GrassScale Scale of a grass patch.
$i_MaxDensity number of individual clumps of folliage that are created.
$i_DataPosX X position of large bitmap associated with a tiled terrain and allow the color information to be taken from an offset position on the bitmap.
$i_DataPosY Y position of large bitmap associated with a tiled terrain and allow the color information to be taken from an offset position on the bitmap.
$h_TextureMap Handle to an image that contains the height of the terrain onto which the grass is placed.
$h_GrassMap Handle to an image used to adjust the height and density of the grass. For example you might have a patch where you dont want to see any grass or a barren patch where you want short stubble.
$h_GrassTexture Handle to a Texture used for the grass. This RGBA image is automatically broken up into a number of sections that are used to texure different clumps of grass.

 

Return Value

Success: Handle to a Grass node.
Failure: False and @error 1

 

Remarks

Grass objects are associated with terrain and tile terrain objects and are used to place small billboard objects into the scene representing folliage,
this implementation of grass creates a large number of grass objects already positioned across the terrain and then dynamically shows or hides them depending on where the camera is within the scene.
The grass is also affected with a wind modifier that gently moves the grass as if it were caught in the wind.
By setting the speed of the wind to zero the grass will become static and you will see an increase in performance.
Grass usually looks best when it is closely matched to the color of the terrain and to assist with this a new Material Type has been
added IRR_EMT_TRANSPARENT_ADD_ALPHA_CHANNEL_REF that adds the color of grass texture to the color of the grass which is automatically set to the color of the terrain that it lies upon.

 

Related

_IrrGetGrassDrawCount, _IrrSetGrassDensity, _IrrSetGrassWind