'Clean' Sswift Shadow demo?

Blitz3D Forums/Blitz3D Programming/'Clean' Sswift Shadow demo?

Here this version will work. You also needed to update the normals on the cube you created because Blitz doesn't set them correctly, and the system needs the normals to determine how to offset the shadow from the surface.

;--------------------------------------
; Simple SSwift Shadow Demo
;--------------------------------------

Include "Swift Shadow System - 115.bb"

; Initialise graphics + camera


Graphics3D 640,480,16,2
ClearTextureFilters 
cam=CreateCamera()

arenalight=CreateLight()
LightColor arenalight,100,150,150

period=1000/UPS
time=MilliSecs()-period
Const UPS=60

; Load Meshes + Textures
Global samplecone = CreateCone()
EntityColor samplecone,255,150,150

Global arena = CreateCube()
EntityColor arena,140,190,240
ScaleMesh arena,20,0.05,20
PositionEntity arena,0,-0.1,0
UpdateNormals Arena

; Position and animate Entities
PositionEntity cam,0,1,0
RotateEntity   cam,0,0,0
PositionEntity arena,0,0,0
PositionEntity samplecone,0,2,8
RotateEntity   samplecone,0,180,0
PositionEntity arenalight,0,20,0


; Initialise Shadow Casters/REceivers
Cast_Light(arenalight,500)
Cast_Shadow(samplecone)
Receive_Shadow(arena)


.MainLoop

Repeat

	; Camera Movement code
	If KeyDown(200) MoveEntity cam,0,0,0.15
	If KeyDown(208)	MoveEntity cam,0,0,-0.15
	If KeyDown(203) TurnEntity cam,0,2,0
	If KeyDown(205) TurnEntity cam,0,-2,0


	; Frame Limiting Code Start	
	Repeat
		elapsed=MilliSecs()-time
	Until elapsed
	ticks=elapsed/period
	tween#=Float(elapsed Mod period)/Float(period)
	
	For k=1 To ticks
		time=time+period	
		If KeyHit(1) End
		UpdateWorld
	Next
	; End Frame Limiting

	TurnEntity samplecone,1,2,3
	
	Update_Shadows(cam)    		; Update Shadows
	RenderWorld tween			; Draw World (tween indicates 60fps)
	Flip

Forever