Blitz3D+ Command Reference

DebugEntityIcon entity,view_camera[,size#][,red][,green][,blue][,depth_test]

Parameters

entity - camera or light entity to draw

view_camera - camera the icon is drawn for

size# (optional) - icon size in viewport pixels; 40 (default)

red (optional) - icon colour red; 255 (default)
green (optional) - icon colour green; 230 (default)
blue (optional) - icon colour blue; 160 (default)

depth_test (optional) - True hides the icon behind scene geometry; False draws it on top (default)

Description

Draws an editor-style outline icon for a camera or light.

Cameras draw as a camera outline; lights draw as a bulb outline with directional rays, point rays or a spot cone. It is ideal for level-editor tools and for debugging where your lights really are. The size is measured in viewport pixels using view_camera.

Icons follow world position and rotation, ignore entity scale, and create no scene objects. Other entity classes draw nothing. Use EntityIconHit to let the user click an icon.

Requires Extended mode.

See also: EntityIconHit, DebugEntityAxes, DebugLightVolume, DebugCameraFrustum, ClearDebugDraw.

Example

; DebugEntityIcon Example
; -----------------------
; Requires Extended mode.

Graphics3D 640,480,0,2
SetBuffer BackBuffer()

camera=CreateCamera()
PositionEntity camera,0,2,-8

; A floor so there is something to hide the icons behind
floor=CreateCube()
ScaleEntity floor,6,0.1,6
PositionEntity floor,0,-1,0
EntityColor floor,70,90,110

; A spot light, a point light and a second (non-rendering) camera to mark
spot=CreateLight(3)
PositionEntity spot,-2,2,0
lamp=CreateLight(2)
PositionEntity lamp,2,0.5,0
LightRange lamp,4
spy=CreateCamera()
CameraProjMode spy,0
PositionEntity spy,0,1,3

size#=40
depth=False

While Not KeyDown(1)

    ; [ / ] change the icon size; Space toggles depth testing
    If KeyDown(26) And size>10 Then size=size-1
    If KeyDown(27) And size<120 Then size=size+1
    If KeyHit(57) Then depth=Not depth

    TurnEntity spot,0.5,1,0
    TurnEntity spy,0,-1,0

    ; Icons are queued each frame and drawn by RenderWorld
    DebugEntityIcon spot,camera,size,255,230,160,depth
    DebugEntityIcon lamp,camera,size,255,230,160,depth
    DebugEntityIcon spy,camera,size,120,200,255,depth

    ; 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   [ / ] : icon size   Space: depth test   Esc: exit"
    Text 0,20,"DebugEntityIcon light,camera,"+size+",255,230,160,"+depth

    Flip

Wend

End

Index