VermelTrapBeta 2 |
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.
Download The Virtual Light Company, Sydney, Australia
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