The DPR Simulator uses the ODE Physics Engine to manage collisions, friction and gravity. We have added support for cylinders and capped cylinders (along with collision models for them). We have also extracted and extensively patched the graphics/visualization section of the Code.

Graphics system (from the outside):

The DPR Graphics system is contained in the the "graphics" subdirectory of the dprsim source. The interface to the graphics system is very limited by design since the simulator should be isolated from any introspection system. Currently, the only function that the main simulator code calls in the graphics system is dsGetCallbacks. This function returns a structure that contains several functions pointers. These are called as part of the main control flow loop in DPRSim.cxx. Other than that, the graphics code should not be called by anything in the simulator. Instead, the graphics code inspects the state of objects in the simulator. The current examples of this are the "speak" and "selected" functions of Catom. They are called by the graphics system when appropriate. The selected function is called when a catom is clicked on in the GUI (left click). The speak function is polled to see what the catom should display while rendering. Currently a HUD is being created that will have more run time information and will probably require augmenting the interface. Additionally, a function to get image data from another perspective in the world (ie. a catom's "internal" camera) exists, but the interface is still being decided.

Graphics system (from the inside):

The graphics system is contained (currently) in four files: graphics.cpp, event.cpp, font.cpp, and x11.cpp. graphics.cpp is the main file in the graphic system. It contains the external interface of the graphics system as well as the rendering code for most objects. x11.cpp contains the X11 specific code to create a display window, a GL context, and a pbuffer for off-screen rendering of a world view. These functions are called primarily by functions in graphics.cpp. font.cpp contains the code necessary to use the freetype font library and to render text to the screen. event.cpp handles user interface events (mouse clicks, keyboard events, etc.) and updates the state of the graphics system as well as the main simulator (pause for example).

The function pointers returned by dsGetCallbacks are dsStart, dsTick, and dsEnd. They initialize the graphics system, render a frame and poll for events, and shutdown the graphics system, respectively. They each call a similar function (dsPlatformStart, dsPlatformTick, and dsPlatformEnd) in x11.cpp to perform all the X11 function calls. dsStart is called once before the main simulation loop begins, dsTick is called every cycle through simLoop, and dsEnd is called after the simulation loop has completed.

Graphics system (in use):

The interface is a hardware accelerated OpenGL environment. Simulator control is acheived with keyboard CTRL commands:

Ctrl-P : pause / unpause the simulator
Ctrl-O : single step when paused
Ctrl-T : toggle textures on / off
Ctrl-S : toggle shadows on / off
Ctrl-H : toggle heads-up-display on / off
Ctrl-V : print current viewpoint coordinates to the terminal
Ctrl-W : toggle writing of .png files of frames to disk on / off
Ctrl-X : exit
Camera control and movement is achieved with the mouse/keyboard combo:
Up Arrow    : move forward along camera direction
Down Arrow  : move backward along camera direction
Left Arrow  : strafe left
Right Arrow : strafe right

Left Click  : select the Catom under the cursor
Right Click/Hold : aim the camera
So in the end, simulator navigation is very similar to popular video game control mechanisms. You can hold down the right mouse button to point the camera and hold the up arrow to move forward and now you can fly through the world.