Function _IrrAddNodeShadow

au3Irr2

au3Irr2 Function Reference

_IrrAddNodeShadow

Adds shadows to a node that are cast across other nodes in the scene.

#Include <au3Irrlicht2.au3>
_IrrAddNodeShadow($h_Node, $h_mesh = 0)

 

Parameters

$h_Node Handle of a node in the scene
$h_mesh [optional] Handle of mesh casting the shadow (0 uses mesh of h_Node, see remarks)

 

Return Value

Success: True
Failure: False

 

Remarks

_IrrAddShadows will only work when shadowing has been activated with _IrrStart or _IrrStartAdvanced.
You should analyse the performance of your scene carefully when using this function as it can have a significant effect on your frame rate.
You can supply a different mesh to the one used to display the node, this shadow mesh could be a much lower resoloution than that used for your model thereby improving performance.

_IrrAddNodeShadow does NOT work with buildin nodes types _IrrAddTestSceneNode, _IrrAddCubeSceneNode, and _IrrAddSphereSceneNode. If you need a cube or a sphere casting shadows, create a node from a loaded cube or sphere mesh as workaround.

 

Related

_IrrStart, _IrrStartAdvanced, _IrrSetShadowColor, _IrrAddLight, _IrrSetAmbientLight

 

Example


#include "au3Irrlicht2.au3"

_IrrStart( $IRR_EDT_OPENGL, 800, 600, $IRR_BITS_PER_PIXEL_32, _
        $IRR_WINDOWED, $IRR_SHADOWS, $IRR_IGNORE_EVENTS, $IRR_VERTICAL_SYNC_ON )

local $texture = _IrrGetTexture(".\media\au3irr2_logo.jpg")

local $meshReceive = _IrrAddHillPlaneMesh( "Plane", 8, 8, 1, 1)
local $nodeReceive = _IrrAddMeshToScene( $meshReceive )
_IrrSetNodeMaterialTexture( $nodeReceive, $texture, 0)

local $meshCast = _IrrGetMesh(".\media\sphere.obj")
local $nodeCast = _IrrAddMeshToScene($meshCast)
_IrrSetNodeMaterialTexture( $nodeCast, $texture, 0)
_IrrAddFlyCircleAnimator($nodeCast, 1, 3, 1, 3, 0.0005)

local $nodeLight = _IrrAddLight($IRR_NO_PARENT, 0,50,0, 0.9,0.3,0.3, 1000.0)
_IrrAddNodeShadow($nodeCast)

local $nodeCamera = _IrrAddCamera(-5,5,-6, 0,0,0 )

WHILE _IrrRunning()
    _IrrBeginScene(100, 100, 100)
    _IrrDrawScene()
    _IrrEndScene()
WEND

_IrrStop()