Revision as of 20:32, 2 January 2007

Contents

Using bug plug

The bug plug is a great feature is CS, you can easily debug your 3d world. You can use it in your own the same way, like any other plugin, you need it load and register.

So start walktest, the castle map will be perfecto our lessons. When walktest loads everything
,type it into the walktest console:

bugplug

This will load the bug plugin.

When bug plug is loaded, we’re ready to use it.

How it works

The bug plug is in action, when you see the current fps down on the screen:

But bug plug can do more.
First, you have to press the ctrl+D keys, and you will see this message:

Now push ‘e’ key, and you will see something like this:

So the bug plug shows you the wireframe of the rendered meshes. Nice.

You can always take a screenshot when press ctrl+D, and F11. The bug plug saves the screenshot in png format into your CS directory (by default, this can be changed) . The first image will be named crystalspace000.png, then crystalspace001.png etc. The plugin handles the correct numbering automatically, so be not afraid, you never rewrite your previously saved screenshots. When you need a really high resolution screenshot (an “überscreenshot”), press ctrl+D then shift+F11. It will make a 2048*1536 screenshot, I hope, this satisfy your needs.

Working with meshes

When you press ctrl+s, you can select meshes with mouse click. Just try it, press ctrls+s, and click on a simphatic mesh. The result will be something like this:

You can select any mesh in the loaded map file.
The following example uses the castle map. Run walktest, then do the following:

Go to the table in the castle level:

Now press ctrl+s, and click on the table. The result will be something, like this:

Now we can move this mesh with some bug plug key. Press ctrl+D, then shift+Page up keys. The mesh will move 1 unit in Z direction (Z coordinate will be greater by one).

Press ctrl+S, then click on the torch. The result will be something, like this:

See around, you will see, you selected a great box, that includes four torches. Now when you press ctrl+D, then ctrl+alt+C, you will see the colliding triangles:

So you can see, the four torches have been exported by one mesh.

Other possibilities

Bug plug can you show any sector with another colour.
Press ctrl+D, then ctrl+shift+C, and you will see something, like this (the shot was taken form a point, where three sector is visible):

You can edit the camera field of view value. Press f key, then type a new value.

The b key enables/disables the bounding box display, r do the same with the radial meshes.

Configuring bug plug

Bug plug has two configuration file in the CS/data/config directory. The bugplug.cfg contents the following lines:

; file, where the key bindings are stored

Bugplug.Keybindings = /config/bugplug.key

; format of the screenshot filename

; the rightmost string of digits is automatically replaced with a number

Bugplug.Capture.FilenameFormat = /this/crystal000.png

; MIME type of the screenshot image to save

Bugplug.Capture.Image.MIME = image/png

; image saver options for the screenshot file

Bugplug.Capture.Image.Options = progressive

The Bugplug.Capture.FilenameFormat key gives the format of the screenshot picture names. When you add the scrshot000.png format, the bug plug will saves your screenshots with this naming form (scrshot000,png, scrshot001.png) . The Bugplug.Capture.Image.MIME = image/png key stores the format of the screenshots. You can change it az any image format, that Crystal Space can handle (jpg, tga, bmp, etc).

The second config file has the name bugplug.key. There is a simple text file, here is the content:

ctrl-d=debugenter

ctrl-s=mouseenter

d=dumpeng

shift-d=dumpsec

e=edges

c=clear
ctrl-shift-c=colorsectors

alt-c=cacheclear

alt-d=cachedump
t=texture

l=lighting

shift-g=gouraud

shift-m=mmx

shift-t=transp

ctrl-b=bilinear

ctrl-t=trilinear

ctrl-l=ilace

m=mipmap

shift-i=inter

g=gamma

alt-b=dblbuff

shift-c=dumpcam

f=fov

shift-f=fovangle

alt-t=terrvis

b=meshbbox

r=meshrad

ctrl-alt-c=meshcd

ctrl-alt-v=meshvis

ctrl-alt-s=meshshad

ctrl-alt-b=meshbase

ctrl-g=debuggraph

ctrl-c=enginecmd toggle_cullstat

shift-e=enginestate

v=visculview

shift-v=visculcmd cycle_view

ctrl-v=visculcmd clear_stats

alt-v=visculcmd dump_state

alt-a=visculcmd analyze_vis

1=visculcmd toggle_frustum

2=visculcmd toggle_coverage

3=visculcmd toggle_history

4=visculcmd toggle_queue

5=visculcmd toggle_vpt

6=visculcmd toggle_ignoresmall

7=visculcmd toggle_clampoccluder

8=visculcmd toggle_splatting

9=visculcmd toggle_invertedclipper

0=visculcmd toggle_ignorebadoccluder

shift-1=visculcmd origin_z --

shift-2=visculcmd origin_z ++

shift-3=visculcmd setup_debugsector

shift-4=visculcmd navigate_child1

shift-5=visculcmd navigate_child2

shift-6=visculcmd navigate_parent

shift-s=debugsector

shift-up=mesh_yplus

shift-down=mesh_ymin

shift-left=mesh_xmin

shift-right=mesh_xplus

shift-pgup=mesh_zplus

shift-pgdn=mesh_zmin

up=ds_forward

down=ds_backward

left=ds_turnleft

right=ds_turnright

alt-up=ds_up

alt-down=ds_down

alt-left=ds_left

alt-right=ds_right

alt-s=debugview

s=visculcmd setup_debugview

alt-f=visculcmd toggle_freeze

ctrl-f=visculcmd exact_freeze

f10=savemap

ctrl-f10=savemap

f11=scrshot

ctrl-f11=scrshot

shift-f11=uberscreenshot

f12=scrshot

ctrl-f12=scrshot

ctrl-alt-p=fps

h=hideselected

shift-h=undohide

ctrl-p=counterreset

alt-p=counterremove

shift-p=counterfreeze

w=shadowdebug

alt-u=unprepare

ctrl-m=memorydump

p=profdump

ctrl-shift-p=profreset

ctrl-shift-s=debugcmd iGraphics3D dump_slms

ctrl-shift-v=debugcmd iGraphics3D dump_vbostat

ctrl-shift-f=debugcmd iGraphics2D dump_fontcache

ctrl-shift-z=debugcmd iGraphics3D dump_zbuf

ctrl-shift-1=switchculler crystalspace.culling.frustvis

ctrl-shift-2=switchculler crystalspace.culling.dynavis

ctrl-alt-m=selectmesh

ctrl-alt-o=onesector

ctrl-alt-l=listplugins

So you can change the key bindings of the debug commands here.

I hope, this short introduction help you to understand the basics of the usage of bug plug. Just press ctrl+D, and enjoy it.