; RenderDecalDrawCalls Example ; ---------------------------- ; Requires Extended mode. Graphics3D 640,480,0,2 SetBuffer BackBuffer() SeedRnd MilliSecs() camera=CreateCamera() PositionEntity camera,0,0,-6 light=CreateLight() RotateEntity light,45,45,0 ; A wall that slowly collects paint splats wall=CreateCube() ScaleEntity wall,4,2.5,0.2 PositionEntity wall,0,0,3 EntityColor wall,110,120,135 ; 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 While Not KeyDown(1) ; Space stamps a new splat at a random spot on the wall If KeyHit(57) Then decal=CreateDecal(splat) PositionEntity decal,Rnd(-3.5,3.5),Rnd(-2,2),2.8 created=created+1 EndIf ; 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 Space: add a splat Esc: exit" ; RenderDecalDrawCalls reports the decal pass cost of the last completed frame Text 0,20,"Decals created: "+created+" RenderDecalDrawCalls() = "+RenderDecalDrawCalls() Flip Wend End