; LightRange Example ; ------------------ Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,6,-14 RotateEntity camera,20,0,0 ; Keep ambient light low so the point light's reach is obvious AmbientLight 16,16,16 ; Point lights need well-tessellated geometry to show up, so use a ; subdivided plane and a high-segment sphere ground=CreatePlane(16) statue=CreateSphere(24) PositionEntity statue,0,1,0 ; A point light circling the statue light=CreateLight(2) ; A small full-bright marker sphere rides on the light so we can see it marker=CreateSphere(8,light) ScaleEntity marker,0.2,0.2,0.2 EntityFX marker,1 EntityColor marker,255,255,0 range#=6 angle#=0 While Not KeyDown(1) ; Press [ / ] to shrink or grow the light's range If KeyDown(26) And range>1 Then range=range-0.1 If KeyDown(27) And range<40 Then range=range+0.1 ; Apply the range - geometry beyond it receives no light at all LightRange light,range ; Circle the light around the statue angle=angle+1 PositionEntity light,Cos(angle)*5,3,Sin(angle)*5 ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld Text 0,0,"[ / ]: change light range Arrow keys: move camera Esc: exit" Text 0,20,"LightRange light,"+range Flip Wend End