net.jinx.video.model
Class Modeler

java.lang.Object
  extended by net.jinx.video.model.Modeler
All Implemented Interfaces:
ModelerGUI
Direct Known Subclasses:
ActionGUI, Colorizer

public class Modeler
extends java.lang.Object
implements ModelerGUI

The main class of the vertex modeler application. In a nutshell, this class loads Visible implementations from Java source files, and then either exports them, or displays them on a black background. For more information, run it and use the "-help" commandline switch.

NOTE: This class requires an embedded Java compiler called Janino. See http://janino.codehaus.org/ or http://janino.net for more information. At the time of writing, Janino seems to be in the process of moving from the second address to the first.

API Stability: Stable.


Constructor Summary
Modeler()
          Constructor for the default ModelerGUI implementation.
 
Method Summary
 void displayGUI(Hierarchy h, Visible drawable)
          Constructs and displays the default GUI components to display a Visible object.
static java.lang.String getApplicationName()
          Provides the name of the application.
static java.lang.String getApplicationTitle()
          Provides the title line that is used by default in the title bar of the modeler.
 java.awt.Frame getDefaultFrame(Hierarchy config, java.awt.Color bg)
          Constructs and configures a default Frame to use to display things in.
 javax.media.opengl.GLAutoDrawable getDefaultGLDrawable(Hierarchy config)
          This method just calls getGLCanvas(config).
 javax.media.opengl.GLCanvas getGLCanvas(Hierarchy config)
          Provides the default GLCanvas with double buffering and hardware acceleration hints obtained from config.
 javax.media.opengl.GLJPanel getGLJPanel(Hierarchy config)
          Provides the default GLCanvas with double buffering and hardware acceleration hints obtained from config.
 Visible getGrid(Hierarchy config)
           
 Visible getOrigin(Hierarchy config)
           
 java.lang.String[] getVersion()
          Provides the Vertex Modeler's current version and the JOGL version used as two Strings.
static java.lang.String getVersionString()
          Provides a String representation of the current version of Vertex Modeler.
 Context loadContext(Hierarchy config)
          Constructs and configures a Context object.
 Light[] loadLights(Hierarchy config)
          Constructs and configures an array of Light objects.
 TextureManager loadTextureManager(Hierarchy config)
          Constructs and configures a TextureManager object.
 TextureManager loadTextureManager(Hierarchy config, Context options)
          Constructs and configures a TextureManager object, attaching it to the given Context object.
 View[] loadViews(Hierarchy config)
          Constructs and configures an array of View objects.
static Visible loadVisible(java.io.InputStream in)
          Builds a Visible from a Java source describing a class with the name "VisibleFactoryImpl" that is an implementation of VisibleFactory.
static void main(ModelerGUI gui, java.lang.String[] args)
          The configurable entry point for the Vertex Modeler application.
static void main(java.lang.String[] args)
          The main entry point for the Vertex Modeler application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Modeler

public Modeler()
Constructor for the default ModelerGUI implementation.

Method Detail

getVersion

public java.lang.String[] getVersion()
Provides the Vertex Modeler's current version and the JOGL version used as two Strings.

Specified by:
getVersion in interface ModelerGUI
Returns:
the version String array.

loadContext

public Context loadContext(Hierarchy config)
Constructs and configures a Context object.

Parameters:
config - the Hierarchy version of the configuration file.
Returns:
the Context object.

loadTextureManager

public TextureManager loadTextureManager(Hierarchy config)
Constructs and configures a TextureManager object.

Parameters:
config - the Hierarchy version of the configuration file.
Returns:
the TextureManager object.

loadTextureManager

public TextureManager loadTextureManager(Hierarchy config,
                                         Context options)
Constructs and configures a TextureManager object, attaching it to the given Context object.

Parameters:
config - the Hierarchy version of the configuration file.
options - the Context object to attach the TextureManager to.
Returns:
the TextureManager object.

loadViews

public View[] loadViews(Hierarchy config)
Constructs and configures an array of View objects.

Parameters:
config - the Hierarchy version of the configuration file.
Returns:
the View array.

loadLights

public Light[] loadLights(Hierarchy config)
Constructs and configures an array of Light objects.

Parameters:
config - the Hierarchy version of the configuration file.
Returns:
the Light array.

getGLCanvas

public javax.media.opengl.GLCanvas getGLCanvas(Hierarchy config)
Provides the default GLCanvas with double buffering and hardware acceleration hints obtained from config.

Parameters:
config - the Hierarchy version of the configuration file.
Returns:
the GLCanvas.

getGLJPanel

public javax.media.opengl.GLJPanel getGLJPanel(Hierarchy config)
Provides the default GLCanvas with double buffering and hardware acceleration hints obtained from config.

Parameters:
config - the Hierarchy version of the configuration file.
Returns:
the GLCanvas.

getDefaultGLDrawable

public javax.media.opengl.GLAutoDrawable getDefaultGLDrawable(Hierarchy config)
This method just calls getGLCanvas(config). This can be overidden if you wish to use a different kind GLDrawable. The getGLCanvas and getGLJPanel methods are there to fill that need.

Parameters:
config - the Hierarchy version of the configuration file.
Returns:
the default GLDrawable. The return value is assumed to be a java.awt.Component, so it can be placed into a window of some kind.

getDefaultFrame

public java.awt.Frame getDefaultFrame(Hierarchy config,
                                      java.awt.Color bg)
Constructs and configures a default Frame to use to display things in.

Parameters:
config - the Hierarchy version of the configuration file.
bg - the background color for the window.
Returns:
the Frame.

getOrigin

public Visible getOrigin(Hierarchy config)

getGrid

public Visible getGrid(Hierarchy config)

displayGUI

public void displayGUI(Hierarchy h,
                       Visible drawable)
Constructs and displays the default GUI components to display a Visible object.

Specified by:
displayGUI in interface ModelerGUI
Parameters:
h - the Hierarchy object that contains configuration information for displaying drawable.
drawable - the Visible object to display.

getVersionString

public static java.lang.String getVersionString()
Provides a String representation of the current version of Vertex Modeler. This is used by getApplicationTitle().

Returns:
the String describing the version.

getApplicationName

public static java.lang.String getApplicationName()
Provides the name of the application. This is used by getApplicationTitle().

Returns:
the String name of the application.

getApplicationTitle

public static java.lang.String getApplicationTitle()
Provides the title line that is used by default in the title bar of the modeler.

Returns:
the String for the title.

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
The main entry point for the Vertex Modeler application. This is the same as main(new Modeler(), args).

Throws:
java.lang.Exception

main

public static void main(ModelerGUI gui,
                        java.lang.String[] args)
                 throws java.lang.Exception
The configurable entry point for the Vertex Modeler application. This allows you to provide a custom ModelerGUI object for constructing the GUI components while still using this class to parse the command line arguments. The very end of this method calls the displayGUI method of gui with the resulting Hierarchy configuration data and Visible object.

Parameters:
gui - the ModelerGUI object to use.
args - the commandline arguments to parse.
Throws:
java.lang.Exception

loadVisible

public static Visible loadVisible(java.io.InputStream in)
                           throws java.io.IOException,
                                  org.codehaus.janino.Scanner.LocatedException,
                                  java.lang.ClassNotFoundException,
                                  java.lang.InstantiationException,
                                  java.lang.IllegalAccessException
Builds a Visible from a Java source describing a class with the name "VisibleFactoryImpl" that is an implementation of VisibleFactory. The newVisible() method is called and the result is returned. This method uses (and requires) Janino to compile to source.

Parameters:
in - the InputStream to read the source from.
Returns:
the Visible built from the source code.
Throws:
java.io.IOException
org.codehaus.janino.Scanner.LocatedException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException