; Glow - ArcBasic extension sample ; ; CameraGlow makes the brightest parts of the picture bleed light into ; their surroundings. EntityGlow makes an entity give off its own light, ; bright enough to glow - ideal for lasers, engines, neon and magic. ; ; Keys: G glow on/off Up/Down orb brightness (EntityGlow) ; T glow threshold Escape quit Graphics3D 800,600,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,4,-14 TurnEntity camera,12,0,0 CameraClsColor camera,5,5,15 AmbientLight 40,40,60 light=CreateLight(1) RotateEntity light,60,30,0 LightColor light,90,90,110 floor=CreatePlane() EntityColor floor,40,40,55 ; a ring of coloured orbs that give off light Dim orb(5) For i=0 To 5 orb(i)=CreateSphere(16) ScaleEntity orb(i),.7,.7,.7 Next EntityColor orb(0),255,60,60 EntityColor orb(1),255,160,40 EntityColor orb(2),255,255,80 EntityColor orb(3),60,255,90 EntityColor orb(4),60,150,255 EntityColor orb(5),200,80,255 ; neon bars: thin full-bright boxes that glow Dim bar(2) For i=0 To 2 bar(i)=CreateCube() ScaleEntity bar(i),4,.08,.08 PositionEntity bar(i),0,1+i*1.4,5 EntityFX bar(i),1 EntityGlow bar(i),2 Next EntityColor bar(0),255,40,140 EntityColor bar(1),40,220,255 EntityColor bar(2),255,40,140 ; flames: sprites drawn additively, made to glow Dim flame(1) For i=0 To 1 flame(i)=LoadSprite("flame.bmp") ScaleSprite flame(i),1.2,1.2 PositionEntity flame(i),-6+i*12,2,3 EntityGlow flame(i),1 Next ; a plain grey cube for comparison: it does not glow plain=CreateCube() PositionEntity plain,0,1,0 EntityColor plain,150,150,150 glow=True : brightness#=2 : threshold#=1 CameraGlow camera,glow,1,threshold While Not KeyHit(1) If KeyHit(34) glow=Not glow CameraGlow camera,glow,1,threshold EndIf If KeyHit(20) threshold=threshold+.5 If threshold>2 Then threshold=.5 CameraGlow camera,glow,1,threshold EndIf If KeyHit(200) And brightness<5 Then brightness=brightness+.5 If KeyHit(208) And brightness>0 Then brightness=brightness-.5 t#=MilliSecs()/1000.0 For i=0 To 5 a#=t*30+i*60 PositionEntity orb(i),Sin(a)*5,1.2+Sin(t*90+i*40)*.5,Cos(a)*3 EntityGlow orb(i),brightness Next TurnEntity plain,0,1,.5 RenderWorld Color 255,255,255 Text 10,10,"GLOW (ArcBasic extension)" If glow Then g$="on" Else g$="off" Text 10,30,"G glow: "+g$ Text 10,45,"Up/Down orb brightness (EntityGlow): "+brightness Text 10,60,"T threshold: "+threshold+" (lower = more of the picture glows)" Text 10,75,"Esc quit" Flip Wend End