Blitz3D+ Command Reference

RenderDecalDrawCalls ( )

Parameters

None.

Description

Returns how many draw calls the decal pass executed in the most recently completed frame.

Where RenderDecals counts projectors, RenderDecalDrawCalls counts the GPU work they turned into. Each visible projector costs a draw in the decal pass for each camera view it is rendered through, so with several active cameras (split-screen, mirrors, a minimap) the draw-call figure runs higher than the projector count.

Use it when budgeting a decal-heavy scene: if the number is surging, cut down live projectors (free old marks sooner), shrink their volumes so fewer are visible at once, or hide decals in views that do not need them. Read it after RenderWorld and Flip; it reports the last completed frame.

Requires Extended mode.

See also: RenderDecals, CreateDecal, RenderDrawCalls, DrawRenderStats.

Example

; 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

Index