ArcBasicDocs

help/commands/3d_examples

EntityShadows.abs

52 lines of ArcBasic. Words in colour that are commands link to their help page. To run it, download ArcBasic, open the file and press F5.

Download EntityShadows.absAll files in this folder

EntityShadows.abs
; Shadows example (an ArcBasic extension); S toggles shadows, Q changes the shadow quality, Escape quitsGraphics3D 640,480SetBuffer BackBuffer()camera=CreateCamera()PositionEntity camera,0,6,-12TurnEntity camera,25,0,0AmbientLight 70,70,80; the sun: a directional light, pointing down at an anglesun=CreateLight(1)RotateEntity sun,50,30,0LightShadows sunground=CreatePlane()EntityColor ground,120,160,120cube=CreateCube()PositionEntity cube,-2,1,0EntityColor cube,200,80,80ball=CreateSphere(16)PositionEntity ball,2,1.5,1EntityColor ball,80,120,220; this cube neither casts nor receives shadowsghost=CreateCube()PositionEntity ghost,0,1,3EntityColor ghost,240,240,120EntityShadows ghost,False,Falseshadows=Truequality=2While Not KeyDown(1)	If KeyHit(31) ; S		shadows=Not shadows		LightShadows sun,shadows	EndIf	If KeyHit(16) ; Q		quality=(quality+1) Mod 4		ShadowQuality quality	EndIf	TurnEntity cube,0,1,0	RenderWorld	Text 0,0,"Shadows: "+shadows+"  Quality: "+quality+"  (S / Q)"	FlipWendEnd