ArcBasicDocs

samples/JamesH/Glow

glow.abs

101 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 glow.absAll files in this folder

glow.abs
; 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  quitGraphics3D 800,600,0,2SetBuffer BackBuffer()camera=CreateCamera()PositionEntity camera,0,4,-14TurnEntity camera,12,0,0CameraClsColor camera,5,5,15AmbientLight 40,40,60light=CreateLight(1)RotateEntity light,60,30,0LightColor light,90,90,110floor=CreatePlane()EntityColor floor,40,40,55; a ring of coloured orbs that give off lightDim orb(5)For i=0 To 5	orb(i)=CreateSphere(16)	ScaleEntity orb(i),.7,.7,.7NextEntityColor orb(0),255,60,60EntityColor orb(1),255,160,40EntityColor orb(2),255,255,80EntityColor orb(3),60,255,90EntityColor orb(4),60,150,255EntityColor orb(5),200,80,255; neon bars: thin full-bright boxes that glowDim 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),2NextEntityColor bar(0),255,40,140EntityColor bar(1),40,220,255EntityColor bar(2),255,40,140; flames: sprites drawn additively, made to glowDim 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),1Next; a plain grey cube for comparison: it does not glowplain=CreateCube()PositionEntity plain,0,1,0EntityColor plain,150,150,150glow=True : brightness#=2 : threshold#=1CameraGlow camera,glow,1,thresholdWhile 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"	FlipWendEnd