The Scene Viewer Application

marinilli.com > Projects > The Scene Viewer Application

The Scene Viewer Application

About the Project

This is an old, discontinued Project.
It is one of the very first graphical scene editors for Java3D.

Related URLs

Here are some URLs related with the Project: Java3D, the 3D API for Java enables 3D applications with new features like Java 3D on the Web, and a high level approach to 3D programming. This package is one of the first developed for this API and represents the core of a library of classes aimed at developing a fully Java-implemented Java3D editor facility. This is anyway a basic release and most of its functionalities are just sketched or even not yet fully available from Javasoft. Future releases will come as soon as new features will be provided.
Here is a screenshot from the Viewer class, as you can see nodes by now are tagged laconically with their toString() method.

a screenshot from the program
figure 1. a screenshot from the Viewer

A Java package for visualizing VirtualUniverse instances with a tree-like interface using the Swing JTree class. A set of classes that build a tree model out of a Java3D scene graph. This not just for looking at it, but also for editing, building and generating full working scenes (The model is bidirectional).
This current release anyway has not editing features because of not yet resolved problems with the 1.1 Java3D API.

Installation

Unzip the file in a new directory and be sure to have Java 2 1.3 with Java3D properly installed and launch the Viewer class for a GUI front end.

Using It With Existing Scenes

When you use it pay attention to obtain all the needed capabilities from every node, otherwise it won't work; for instance, just after a objNode object statement, write also:
objNode.setCapability(objNode.ALLOW_CHILDREN_READ);

That is unpractical in this basic release, because you need to code it for every Node instance in your code! As soon as serialization and robust cloning will be available (and documented) this boundary will be overcome.

As a simple procedure, following these steps to see the SceneGraph from your Java3D scene:

  1. make sure every node has its property set for being readable from the tree model
  2. call one of the classes described below, the one that better matches your needs, or even MainFrame as well, giving as the constructor parameter your VirtualUniverse instance, fully readable or editable as you need.
In the package is also shipped a HelloTree class modified, so just launch it.

A Brief Class Description

To summarize, TreeModelSupport handles the Listeners, those classes responsible for handling specialized events in the Swing architecture model (a modified MVC ).It's just a matter of visiting each of them, stored in a list and fire their notification methods. Its work is general and could be used and reused for different tree model needs.
Then comes SceneTreeModel that implements all the remaining methods needed for carving out a tree of any object, in Swing's programmer's view:
getRoot, getChild, getChildCount, isLeaf, indexOfChild, valueForPathChanged

After you have had a tree model of your data structure (here the VirtualUniverse class, any VirtualUniverse) it's just a layering exercise, to make from it a JTree , and with the JTree a JPanel, and with the JPanel a JFrame, each class providing more and more accessory methods suited for their respective levels. Of course you can get rid of all this proliferation and make it out with one or two classes, but you know...

Release Notes

First Release

Sept.1998 written the essential classes and the UI fully working.
the I/O operations (loading especially) are not working due to unresolved problems

Known Problems

Java and Java3D are trademarks of SUN Microsystems Inc.

© 1998-2008 Mauro Marinilli