; DecalSize Example ; ----------------- ; Requires Extended mode. Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,0,-6 light=CreateLight() RotateEntity light,45,45,0 ; A wall with a thin pillar sticking out in front of it wall=CreateCube() ScaleEntity wall,4,2.5,0.2 PositionEntity wall,0,0,3 EntityColor wall,110,120,135 pillar=CreateCube() ScaleEntity pillar,0.3,2.5,0.3 PositionEntity pillar,0,0,2.4 EntityColor pillar,150,110,70 ; Paint an orange splat texture in memory splat=CreateTexture(64,64,3) SetBuffer TextureBuffer(splat) ClsColor 0,0,0 Cls Color 255,80,20 Oval 6,6,52,52,True SetBuffer BackBuffer() Color 255,255,255 ; One decal that slides back and forth across the wall decal=CreateDecal(splat) size#=1 depth#=0.25 While Not KeyDown(1) ; [ and ] change the size, D cycles the projection depth If KeyHit(26) And size>0.25 Then size=size-0.25 If KeyHit(27) And size<3 Then size=size+0.25 If KeyHit(32) Then depth=depth*2 If depth>2 Then depth=0.25 EndIf ; DecalSize sets width, height and how far the decal projects DecalSize decal,size,size,depth ; Slide the projector across the wall - a big depth also reaches the pillar angle#=angle+1.5 PositionEntity decal,3*Sin(angle),0,2.2 ; 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,"Arrow keys: move camera [ / ] : size D: depth Esc: exit" Text 0,20,"DecalSize decal,"+size+","+size+","+depth Text 0,40,"Depth "+depth+" decides whether the splat reaches the wall behind the pillar" Flip Wend End