; EntityFX Example ; ---------------- Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() ; Fog tints distant objects, so the disable-fog flag is easy to spot CameraFogMode camera,1 CameraFogRange camera,1,15 CameraFogColor camera,100,100,140 CameraClsColor camera,100,100,140 light=CreateLight() RotateEntity light,45,45,0 ; A green orb pickup to apply effects to orb=CreateSphere(16) PositionEntity orb,0,0,10 EntityColor orb,0,255,0 mode=0 While Not KeyDown(1) ; Space cycles through the fx modes If KeyHit(57) Then mode=(mode+1) Mod 7 ; Each mode is a single flag: 0,1,2,4,8,16,32 (flags may also be added together) If mode=0 Then fx=0 Else fx=1 Shl (mode-1) fx_name$="nothing (default)" If fx=1 Then fx_name="full-bright" If fx=2 Then fx_name="use vertex colors" If fx=4 Then fx_name="flatshaded" If fx=8 Then fx_name="disable fog" If fx=16 Then fx_name="disable backface culling" If fx=32 Then fx_name="force alpha-blending" ; Apply the current effect to the orb EntityFX orb,fx TurnEntity orb,0,1,0 ; 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,"Space: next fx mode Arrows: camera Esc: exit" Text 0,20,"EntityFX orb,"+fx+" ("+fx_name+")" Flip Wend End