shout3d
Class Shout3DApplet

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--shout3d.Shout3DApplet

public class Shout3DApplet
extends java.applet.Applet
implements Shout3DViewer

Shout3DApplet

See Also:
Serialized Form

Field Summary
 Shout3DPanel panel
          The panel in which this applet will display its Shout3D rendering
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
Shout3DApplet()
          Constructs a Shout3DApplet
 
Method Summary
 void addJSDeviceObserver(java.lang.String typeName, java.lang.String methodName)
          Adds a DeviceObserver that will call back to the page
 void addJSFieldObserver(java.lang.String theNode, java.lang.String theField, java.lang.String methodName)
          Adds a FieldObserver that will call back to the page
 void addJSRenderObserver(boolean onPreRender, java.lang.String methodName)
          Adds a RenderObserver that will call back to the page.
 boolean addRoute(Field fromField, Field toField)
          Adds a route that copies values from 'fromField' to 'toField' each time that fromField's value changes.
 void clearResourceCaches()
          Clears the cache of loaded resources, freeing the memory that holds them.
 boolean deleteRoute(Field fromField, Field toField)
          Removes any existing route from fromField to toField Returns true if a route existed and was removed, false otherwise Note: Routes of ArrayFields copy by reference, not by value.
 Clock getClock()
          Gets this viewer's Clock
 Bindable getCurrentBindableNode(java.lang.String typeName)
          Returns a reference to the currently bound node of the given type.
 DeviceListener getDeviceListener()
          Gets this viewer's DeviceListener
 Picker getNewPicker()
          Gets a new Picker
 Searcher getNewSearcher()
          Gets a new Searcher
 Node getNodeByName(java.lang.String nodeName)
          Gets a Node by its DEF Name Returns null if no node is found with the given name
 java.lang.String getProfile()
          Gets a string denoting the profile of the current scene.
 Renderer getRenderer()
          Gets this viewer's Renderer
 ResourceListener getResourceListener()
          Gets this viewer's ResourceListener
 Group getScene()
          Gets the scene in the Viewer
 java.lang.String getVersion()
          Gets a string denoting the version of this viewer.
 void init()
          Applets that override this method must call super.init() within their own init() method, or the Applet will not work correctly
 void initShout3DPanel()
          Initializes the panel.
 boolean isAntiAliased()
          Returns whether antialiasing is enabled
 boolean isBilinearFiltering()
          Returns whether bilinear filtering is enabled on textures
 boolean isLoadResourcesInSeparateThread()
          Returns whether resources should are being loaded in a separate thread.
 boolean isRouted(Field fromField, Field toField)
          Checks if a route currently exists from fromField to toField
 void loadURL(java.lang.String[] url, Node root)
          Loads an URL into the node root.
 void setAntiAliased(boolean newVal)
          Sets whether antialiasing is enabled.
 void setBilinearFiltering(boolean newVal)
          Sets whether bilinear filtering is enabled on textures.
 void setLoadResourcesInSeparateThread(boolean newVal)
          Sets whether resources (textures and sounds) should be loaded in a separate thread from the main thread.
 void setScene(Group root)
          Replaces the scene in the Viewer This includes applying all of the applet parameters (headlight, anti-aliasing, etc) to the newly loaded scene.
 void setSceneFromURL(java.lang.String[] url)
          Loads an URL into the viewer's scene.
 void start()
          Applets that override this method must call super.start() within their own start() method, or the Applet will not work correctly
 void stop()
          Applets that override this method must call super.stop() within their own stop() method, or the Applet will not work correctly
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

panel

public Shout3DPanel panel
The panel in which this applet will display its Shout3D rendering
Constructor Detail

Shout3DApplet

public Shout3DApplet()
Constructs a Shout3DApplet
Method Detail

init

public void init()
Applets that override this method must call super.init() within their own init() method, or the Applet will not work correctly
Overrides:
init in class java.applet.Applet

start

public void start()
Applets that override this method must call super.start() within their own start() method, or the Applet will not work correctly
Overrides:
start in class java.applet.Applet

stop

public void stop()
Applets that override this method must call super.stop() within their own stop() method, or the Applet will not work correctly
Overrides:
stop in class java.applet.Applet

initShout3DPanel

public void initShout3DPanel()
Initializes the panel. Subclasses need only override this method to create a subclass of Shout3DPanel, and set the member variable 'panel' to refer to the newly created Shout3DPanel.

getRenderer

public final Renderer getRenderer()
Gets this viewer's Renderer
Returns:
the renderer

getClock

public final Clock getClock()
Gets this viewer's Clock
Returns:
the clock

getNewPicker

public final Picker getNewPicker()
Gets a new Picker
Returns:
the Picker

getNewSearcher

public final Searcher getNewSearcher()
Gets a new Searcher
Returns:
the Searcher

getDeviceListener

public final DeviceListener getDeviceListener()
Gets this viewer's DeviceListener
Returns:
the DeviceListener

getResourceListener

public final ResourceListener getResourceListener()
Gets this viewer's ResourceListener
Returns:
the ResourceListener

getNodeByName

public final Node getNodeByName(java.lang.String nodeName)
Gets a Node by its DEF Name Returns null if no node is found with the given name
Returns:
the Node

loadURL

public final void loadURL(java.lang.String[] url,
                          Node root)
                   throws Shout3DException
Loads an URL into the node root. If isLoadResourcesInSeparateThread() is true, then this is done in a separate thread from the main thread. Otherwise, it is done in the same thread.
Parameters:
url - the URL to load
root - the scene, once loaded

setSceneFromURL

public final void setSceneFromURL(java.lang.String[] url)
                           throws Shout3DException
Loads an URL into the viewer's scene. This includes applying all of the applet parameters (headlight, anti-aliasing, etc) to the newly loaded scene. This is always done in the same thread as the main thread.
Parameters:
url - the URL to load

setScene

public final void setScene(Group root)
Replaces the scene in the Viewer This includes applying all of the applet parameters (headlight, anti-aliasing, etc) to the newly loaded scene.
Parameters:
root - the root of the new scene

getScene

public final Group getScene()
Gets the scene in the Viewer
Returns:
the root of the scene

getProfile

public final java.lang.String getProfile()
Gets a string denoting the profile of the current scene. The format of the returned string is yet to be specified.
Returns:
the profile string

getVersion

public final java.lang.String getVersion()
Gets a string denoting the version of this viewer.
Returns:
the version string

getCurrentBindableNode

public final Bindable getCurrentBindableNode(java.lang.String typeName)
                                      throws Shout3DException
Returns a reference to the currently bound node of the given type. Takes a string specifying a subclass of Bindable node as input. Throws an exception if the input type is not a bindable class of node
Returns:
the currently bound node of the specified type

addRoute

public final boolean addRoute(Field fromField,
                              Field toField)
                       throws Shout3DException
Adds a route that copies values from 'fromField' to 'toField' each time that fromField's value changes. 'toField' will, in turn, notify any listeners or routed fields of this change. Also copies value from fromField to toField, so the values will match after this call. Note: Routes of ArrayFields copy by reference, not by value. This makes routing of ArrayFields efficient, since a value change does not cause a copy of the array contents. However, deleting the route does not undo the fact that both fields refer to the array in memory. (See deleteRoute for more info). Throws a Shout3DException if the two fields are not of the same type. Will not add a second route if a route already exists. Returns true if a route was added, false otherwise
Specified by:
addRoute in interface Shout3DViewer
Parameters:
fromField - the field from which values will be copied
toField - the field to which values will be copied
Returns:
true if the route was added, false otherwise

deleteRoute

public final boolean deleteRoute(Field fromField,
                                 Field toField)
Removes any existing route from fromField to toField Returns true if a route existed and was removed, false otherwise Note: Routes of ArrayFields copy by reference, not by value. (see addRoute) Deleting a route does not undo the fact that both fields refer to the array in memory. If you want to insure that the toField refers to unique memory, you should allocate a new value array of the same size as the source field, copy the values into the new array, and set this new array as the toField's value.
Specified by:
deleteRoute in interface Shout3DViewer
Parameters:
fromField - the field from which values will be copied
toField - the field to which values will be copied
Returns:
true if the route was removed, false otherwise

isRouted

public final boolean isRouted(Field fromField,
                              Field toField)
Checks if a route currently exists from fromField to toField
Specified by:
isRouted in interface Shout3DViewer
Returns:
true if the route exists, false otherwise

clearResourceCaches

public final void clearResourceCaches()
Clears the cache of loaded resources, freeing the memory that holds them. Normally, a texture, sound or Shout3d scene that is loaded by the applet is stored in a cache, so that if the resource is needed again, it does not need to be fetched by the server repeatedly. This method frees those caches, which frees memory while making it so that all resources will be fetched if they are requested anew. Note: Nodes (such as ImageTexture and JavaSound) store separate references to their resources. The caches are a second reference. So calling clearResourceCaches() will not cause any errors in the way those nodes function.
Specified by:
clearResourceCaches in interface Shout3DViewer

setAntiAliased

public final void setAntiAliased(boolean newVal)
Sets whether antialiasing is enabled. (Default is false) This performs antialiasing of edges of all geometry against the background.
Specified by:
setAntiAliased in interface Shout3DViewer
Parameters:
newVal - whether antialiasing should be enabled

isAntiAliased

public final boolean isAntiAliased()
Returns whether antialiasing is enabled
Specified by:
isAntiAliased in interface Shout3DViewer
Returns:
whether antialiasing is currently enabled

setBilinearFiltering

public final void setBilinearFiltering(boolean newVal)
Sets whether bilinear filtering is enabled on textures. (Default is false) This results in higher quality, but slower rendering of the textures
Specified by:
setBilinearFiltering in interface Shout3DViewer
Parameters:
newVal - whether bilinear filtering should be enabled

isBilinearFiltering

public final boolean isBilinearFiltering()
Returns whether bilinear filtering is enabled on textures
Specified by:
isBilinearFiltering in interface Shout3DViewer
Returns:
whether bilinear filtering is currently enabled

setLoadResourcesInSeparateThread

public final void setLoadResourcesInSeparateThread(boolean newVal)
Sets whether resources (textures and sounds) should be loaded in a separate thread from the main thread. (Default is true)
Specified by:
setLoadResourcesInSeparateThread in interface Shout3DViewer
Parameters:
newVal - whether resources should be loaded in a separate thread.

isLoadResourcesInSeparateThread

public final boolean isLoadResourcesInSeparateThread()
Returns whether resources should are being loaded in a separate thread.
Specified by:
isLoadResourcesInSeparateThread in interface Shout3DViewer
Returns:
whether resources should are being loaded in a separate thread.

addJSFieldObserver

public void addJSFieldObserver(java.lang.String theNode,
                               java.lang.String theField,
                               java.lang.String methodName)
Adds a FieldObserver that will call back to the page
Parameters:
theNode - the Node
theField - the Field on the Node
methodName - the method on the page. This method must take a string as an argument

addJSDeviceObserver

public void addJSDeviceObserver(java.lang.String typeName,
                                java.lang.String methodName)
Adds a DeviceObserver that will call back to the page
Parameters:
typeName - the type of input (i.e. "KeyboardInput")
methodName - the method on the page. This method must take an argument which will be the input class specified

addJSRenderObserver

public void addJSRenderObserver(boolean onPreRender,
                                java.lang.String methodName)
Adds a RenderObserver that will call back to the page.
Parameters:
onPreRender - true if the method should be called prior to rendering, false if it should be called after rendering is completed.
methodName - the method on the page. This method must take an argument which will be the input class specified