Help with shadow system

Blitz3D Forums/Blitz3D Beginners Area/Help with shadow system

rtk(Posted 2008) [#1]
I have a program I am trying to plug the Devil Shadow System into, but I can't figure out where to put the functions and what order to call them in and when. Could I get some help with this please!

I have made a little demo that explains the basic workings of the program I am trying to plug it into.



Graphics3D 800,600,32,1
AntiAlias True
WBuffer True
BackBuffer()


Global Gravity# = -1
Global WalkSpeed#=.5
Global Jumped=0
Global FlyMode=0
Global Height=15

Global CamPivot = CreatePivot( )
Global Camera = CreateCamera( )
PositionEntity CamPivot,40,50,40
EntityType CamPivot, 1
EntityRadius CamPivot, 3
EntityType Camera, 1
EntityRadius Camera, 2

Collisions 1,2,2,3
Collisions 2,3,2,3
Collisions 3,2,2,3
Collisions 4,2,2,2
Collisions 4,1,2,2

Function controls(sky)

If KeyDown( 42 ) =1
WalkSpeed# = 2
Else
WalkSpeed# = .5
EndIf

If KeyHit( 57 ) And Jumped =0
Jumped=1
MoveEntity Campivot,0,7,0
EndIf




; Keys for movement
If FlyMode=0
If KeyDown(17) =1 Then MoveEntity CamPivot, 0, 0, WalkSpeed# PlaySound(footstep)

If KeyDown(31) =1 Then MoveEntity CamPivot, 0, 0, 0-WalkSpeed#
PositionEntity Camera, EntityX#( CamPivot ), EntityY#( CamPivot )+Height, EntityZ#( CamPivot )
EndIf

If KeyDown(30) =1 Then MoveEntity CamPivot, -WalkSpeed#, 0, 0
If KeyDown(32) =1 Then MoveEntity CamPivot, WalkSpeed#, 0, 0

If EntityCollided(CamPivot,2)
Jumped=0
Gravity#=0
Else
Gravity#=-1
EndIf

TranslateEntity CamPivot, 0, Gravity#, 0

TurnEntity CamPivot, 0, 0 -MouseXSpeed(), 0

TurnEntity Camera, MouseYSpeed(), 0, 0

RotateEntity CamPivot, EntityPitch#( CamPivot ), EntityYaw#( CamPivot ), 0

MoveMouse GraphicsWidth()/2, GraphicsHeight()/2

RotateEntity Camera, EntityPitch#( Camera ), EntityYaw#( CamPivot ), 0

TranslateEntity sky,EntityX(Campivot),EntityY(Campivot),EntityZ(Campivot)

Return
ClearCollisions
End Function

.Loadlevel1





ground=CreateTerrain(128)
PositionEntity ground,0,0,0
ScaleEntity ground,20,20,20
EntityType ground,2
EntityPickMode ground,2
EntityColor ground,0,255,0


box=CreateCube()
PositionEntity box,250,0,350
ScaleEntity box,40,40,40
EntityType box,2
EntityPickMode box,2
EntityColor box,100,255,100


sky=CreateSphere()
ScaleEntity sky,9000,9000,9000
FlipMesh sky
PositionEntity sky,0,0,0
EntityOrder sky,10000
EntityColor sky,180,120,255
AmbientLight 255,255,200

Sunlight=CreateLight()
PositionEntity sunlight,3,300,500
RotateEntity sunlight,-50,0,0


While Not KeyHit(1)

controls(sky)


MoveEntity fog,0,0,.01


UpdateWorld()

RenderWorld


Flip

Wend

Return

Gosub Loadlevel1

End

Thanks for the help!