VermelTrap

A GNU VRML Scenegraph Debugger In Java

Beta 2

A GNU production of The Virtual Light Company

Written by Justin Couch

VermelTrap is a scenegraph level debugger written in Java. Given a node to as a root, the debugger will provide a formatted representation of the scenegraph underneath that node.

The first beta will only run using the Java Script Interface however we expect to be releasing an EAI capable version very shortly.

VermelTrap was started as a project from a book I have recently completed co-authoring with Bernie Roehl called Late Night VRML 2.0 and Java Naturally, I would like to recommend this book to you. If you are creating software complex enough to warrant needing this debugger, then the book is aimed directly at you.

Licensing

VermelTrap is released under the GNU Copyleft which basically means you can take and use this code however you like (even sell it for money) so long as you acknowledge us as the original author and distribute the original source code. Fairly simple. Of course if you start making large sums of money from derivatives, a donation wouldn't go astray :)

Download

Beta 1 is available only from this site. We are looking for mirror sites. If you are interested, let us know

Download The Virtual Light Company, Sydney, Australia

Installation and Use

Installation is simple. Just download the zip file, unzip the class into your project directory and add the class to your code wherever you need it.

To use the debugger you will need to firstly import to the class. Next, create and instance of the class in your code. Then, when you need to see the scenegraph for a given node, just call the toString() method. This will return a formatted string which represents the scenegraph as it exists at that time.

An example piece of code is included in the zip file. But here is an example anyway.

import vrml.*;
import vrml.node.*;
import vrml.field.*;

import VermelTrap;

public class DebugScript extends Script
{
	SFNode	root;

	public void initialize()
	{
		root = (SFNode)getField("someRootNode");

		VermelTrap tester = new VermelTrap((Node)root.getValue());
	}

	public void handleEvent(Event e)
	{
		// in response to some event we print out the scene graph
		printScenegraph();
	}

	private void printSceneGraph()
	{
		System.out.println(tester.toString());
	}
}

The output is completely dynamically generated. As an example, if you have a Grouping Node with 2 children the output would look something like the following
Group
  Shape
    Box
    Appearance
      Material
  Transform
    Shape
      Cone
      Appearance
        ImageTexture
and then add a third child (An Anchor), the new scenegraph would now print out the following:
Group
  Shape
    Box
    Appearance
      Material
  Transform
    Shape
      Cone
      Appearance
        ImageTexture
  Anchor

[ The Virtual Light Company ] [ Justin Couch ] [ Bug Report ] [ JVerge ] [ VermelGen ]