iicm.vrml.vrwave
Class Scene

java.lang.Object
  |
  +--iicm.vrml.vrwave.Scene

public class Scene
extends java.lang.Object
implements ApplyColour

Scene - the VRML scene. Copyright 1998 IICM, Graz University of Technology.


Field Summary
static int COLAMBIENT
           
static int COLBACKGROUND
           
static int COLHEADLIGHT
           
 int current_font_
           
 boolean cursor_changed_
           
static int DB_BEHAVIOUR
           
static int DB_INTERACTION
           
static int DB_LOOK
           
protected  int db_movemode_
           
static int DB_NUMNAVMODES
           
static int DB_PAN
           
static int DB_ROTATE
           
static int DB_TRANSLATE
           
static int DB_WALK
           
static int DB_ZOOM
           
static Font3D font_
           
 boolean font_enabled_
           
 Font3D[] fonts_
           
protected  java.awt.Frame frame_
           
 float framespersecond_
           
static int HELVETICA
           
static int NUMCOLORS
           
protected  GroupNode root
           
static int TIMES
           
static int TRISTATE_AUTO
           
static int TRISTATE_OFF
           
static int TRISTATE_ON
           
static int UPDATE_ALL
           
static int UPDATE_ICON
           
static int UPDATE_MENU
           
 java.util.Vector viewpoints_
           
 
Constructor Summary
Scene(java.applet.Applet applet)
          constructor
 
Method Summary
 void activateAnchor(java.lang.String urlstr, java.lang.String[] params, int numparams)
          activate an anchor, given by a URL string. target in params passed to AppletContext (ignored otherwise)
 void addSensor(Node sens)
          add a Sensornode to a list of sensors which are to check before a redraw
 void addViewpoint(Viewpoint vp)
           
 void applyColour(DLGColourChoose dlg)
          apply color callback
 int backfaceCulling()
           
 boolean behavior()
          check if behavior is running (continuous repaints driven by TimeSensor)
 void buildInline(Inline node1, GroupNode node2)
          build a new subgraph and add created nodes as children nodes to a grouping node (Inline)
 void buildNode(GroupNode node)
          build a new subgraph (needed for EAI's createVrmlFromString)
 void clearScene()
           
 void clearStatusMessage()
          empty/default status message
 int curDrawingMode()
          get drawing mode (according to interaction flag)
static double currentTime()
          get current time in seconds (double precision) since Jan 1 1970 00:00:00 GMT
 void draw()
          draw the scene (called by SceneCanvas.paint)
 void drawingMode(int mode, boolean interactive)
          set (interactive) drawing mode
 boolean getBehavior()
          check if behavior is enabled
 Camera getCamera()
          get camera
 float[] getCenter()
          get center of scene
 int getColor(int i)
          get a color (RGB values)
 boolean getHeadlight()
          get headlight flag
 boolean getInteraction()
          check if interaction is enabled (otherwise navigation)
 int getLighting()
           
 int getLineAntialiasing()
           
 java.util.Hashtable getNodeNames()
           
 int getQuadslices()
           
 Ray getRay(float fx, float fy)
           
 boolean getTexLighting()
           
 int getTextureMipmapping()
           
 boolean getTextureTransparency()
           
 double getTimestamp()
          get frame timestamp
 int getTranspMethod()
           
 float getWinAspect()
          get window aspect
 java.lang.String getWorldURL()
          get the URL of the currently shown scene
 boolean hasLightSource()
          is there a light source?
 boolean interactionRelevant()
          interaction flag relevant?
 int interDrawingMode()
          interactive drawing mode
 boolean isSensorActiv()
           
protected  void levelView()
          level view
 boolean materials()
           
protected  void newScene()
          get a new, empty scene
 void nextViewpoint()
           
 int normalDrawingMode()
          normal drawing mode
 void openFile()
          choose a file to open
 void openLocation()
          choose a location to open
 Node pick(float fx, float fy, VHitpoint hit)
          pick the scenegraph. fills out Hitpoint.
 Node pick(float fx, float fy, VHitpoint hit, boolean sensors, boolean keeptrf)
          pick the scenegraph. fills out Hitpoint. if flag dragsens is set, pick only dragsensors, otherwise pick geometry
 void prevViewpoint()
           
 void readScene(java.io.InputStream input, java.lang.String baseurl, java.lang.String location)
          readScene - read VRML input stream
 void readScene(java.lang.String filename, java.lang.String baseurl)
          readScene - read VRML stream from file
 void readScene(java.net.URL url)
          readScene - read VRML stream from URL
 void redraw()
          redraw request
 boolean reloadFile()
          reload file/URL opened last time
 void replaceScene(GroupNode node)
           
protected  void resetView()
          reset camera
 void set3DFont()
           
 void setBackfaceCulling(int val)
           
protected  void setCamera()
          set camera via GE3D
 void setCenter(float[] c)
          set center of scene
 void setColor(int i, int rgb)
          change a color (RGB values)
 void setCursor(int mode)
          Implements the cursor-look in the scene-canvas.
 void setFarClip(float far)
          set far clipping plane
protected  void setFrame(java.awt.Frame frame)
          set frame (for dialogs)
 void setHasLight()
          scene has light source; no need for headlight
 void setInteraction(boolean flag)
          set interaction flag
 void setLighting(int val)
           
 void setMaterials(boolean val)
           
protected  void setMenus(java.awt.MenuItem[] items)
          set menuitems (created by frame)
 void setNavigationBar(NavigationBar navbar)
          Sets the navigation bar, so mode switching and enable/disable of buttons is more easyly.
 void setNavigationMode(int mode, int whatupdates)
          set navigation mode
 void setNearClip(float near)
          set near clipping plane
 void setProgress(float level)
          set progress (0.0 to 1.0)
 void setQuadslices(int val)
           
 void setSensor(boolean val)
           
 void setTexLighting(boolean val)
           
 void setTextureMipmapping(int quality)
           
 void setTextureTransparency(boolean val)
           
 void setTranspMethod(int val)
           
 void setViewpoint(int i)
           
 void setWinAspect(float val)
          set window aspect
 void showHelpfile(java.lang.String topic)
          show help file via web browser
 void statusMessage(java.lang.String label, int fnum)
          set status message
static java.lang.String substChar(java.lang.String str, char c, java.lang.String s)
          little helper to substitute each occurance of character c by s in String str
 void toggleAbout()
          toggle about dialog
 void toggleBehavior()
           
 void toggleColorChooser()
          toggle color chooser
static void toggleFrame(java.awt.Frame f)
          tiny helper to toggle a Frame
 void toggleHeadlight()
          toggle headlight
 void toggleInteraction()
           
 void toggleLineAntialiasing()
           
 void toggleSettings()
          toggle settings dialog
 void toggleShowframerate()
          framerate
protected  void untiltView()
          untilt view
 void workingMessage(java.lang.String label)
          set working message
 void workingState(boolean flag)
          switch to working state
protected  void zoomIn()
          zoom into the scene
protected  void zoomOut()
          zoom out of the scene
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

db_movemode_

protected int db_movemode_

DB_LOOK

public static final int DB_LOOK

DB_WALK

public static final int DB_WALK

DB_PAN

public static final int DB_PAN

DB_ZOOM

public static final int DB_ZOOM

DB_ROTATE

public static final int DB_ROTATE

DB_TRANSLATE

public static final int DB_TRANSLATE

DB_NUMNAVMODES

public static final int DB_NUMNAVMODES

DB_BEHAVIOUR

public static final int DB_BEHAVIOUR

DB_INTERACTION

public static final int DB_INTERACTION

UPDATE_MENU

public static final int UPDATE_MENU

UPDATE_ICON

public static final int UPDATE_ICON

UPDATE_ALL

public static final int UPDATE_ALL

COLBACKGROUND

public static final int COLBACKGROUND

COLHEADLIGHT

public static final int COLHEADLIGHT

COLAMBIENT

public static final int COLAMBIENT

NUMCOLORS

public static final int NUMCOLORS

TRISTATE_OFF

public static final int TRISTATE_OFF

TRISTATE_ON

public static final int TRISTATE_ON

TRISTATE_AUTO

public static final int TRISTATE_AUTO

HELVETICA

public static final int HELVETICA

TIMES

public static final int TIMES

root

protected GroupNode root

frame_

protected java.awt.Frame frame_

framespersecond_

public float framespersecond_

font_

public static Font3D font_

fonts_

public Font3D[] fonts_

current_font_

public int current_font_

font_enabled_

public boolean font_enabled_

viewpoints_

public java.util.Vector viewpoints_

cursor_changed_

public boolean cursor_changed_
Constructor Detail

Scene

public Scene(java.applet.Applet applet)
constructor
Method Detail

getTimestamp

public double getTimestamp()
get frame timestamp

toggleShowframerate

public void toggleShowframerate()
framerate

setInteraction

public void setInteraction(boolean flag)
set interaction flag

interactionRelevant

public boolean interactionRelevant()
interaction flag relevant? The case when interactive drawmode set differently from normal one

drawingMode

public void drawingMode(int mode,
                        boolean interactive)
set (interactive) drawing mode

curDrawingMode

public int curDrawingMode()
get drawing mode (according to interaction flag)

normalDrawingMode

public int normalDrawingMode()
normal drawing mode

interDrawingMode

public int interDrawingMode()
interactive drawing mode

resetView

protected void resetView()
reset camera

levelView

protected void levelView()
level view

untiltView

protected void untiltView()
untilt view

setCamera

protected void setCamera()
set camera via GE3D

getCamera

public Camera getCamera()
get camera

setNearClip

public void setNearClip(float near)
set near clipping plane

setFarClip

public void setFarClip(float far)
set far clipping plane

zoomOut

protected void zoomOut()
zoom out of the scene

zoomIn

protected void zoomIn()
zoom into the scene

setFrame

protected void setFrame(java.awt.Frame frame)
set frame (for dialogs)

setMenus

protected void setMenus(java.awt.MenuItem[] items)
set menuitems (created by frame)

redraw

public void redraw()
redraw request

statusMessage

public void statusMessage(java.lang.String label,
                          int fnum)
set status message

clearStatusMessage

public void clearStatusMessage()
empty/default status message

workingMessage

public void workingMessage(java.lang.String label)
set working message

workingState

public void workingState(boolean flag)
switch to working state

setProgress

public void setProgress(float level)
set progress (0.0 to 1.0)

setWinAspect

public void setWinAspect(float val)
set window aspect

getWinAspect

public float getWinAspect()
get window aspect

setCenter

public void setCenter(float[] c)
set center of scene

getCenter

public float[] getCenter()
get center of scene

setHasLight

public void setHasLight()
scene has light source; no need for headlight

hasLightSource

public boolean hasLightSource()
is there a light source?

toggleHeadlight

public void toggleHeadlight()
toggle headlight

getHeadlight

public boolean getHeadlight()
get headlight flag

getColor

public int getColor(int i)
get a color (RGB values)

setColor

public void setColor(int i,
                     int rgb)
change a color (RGB values)

backfaceCulling

public int backfaceCulling()

setBackfaceCulling

public void setBackfaceCulling(int val)

getLineAntialiasing

public int getLineAntialiasing()

toggleLineAntialiasing

public void toggleLineAntialiasing()

getTextureMipmapping

public int getTextureMipmapping()

setTextureMipmapping

public void setTextureMipmapping(int quality)

getLighting

public int getLighting()

setLighting

public void setLighting(int val)

getTexLighting

public boolean getTexLighting()

setTexLighting

public void setTexLighting(boolean val)

materials

public boolean materials()

setMaterials

public void setMaterials(boolean val)

getTextureTransparency

public boolean getTextureTransparency()

setTextureTransparency

public void setTextureTransparency(boolean val)

getTranspMethod

public int getTranspMethod()

setTranspMethod

public void setTranspMethod(int val)

setQuadslices

public void setQuadslices(int val)

getQuadslices

public int getQuadslices()

toggleBehavior

public void toggleBehavior()

getBehavior

public boolean getBehavior()
check if behavior is enabled

behavior

public boolean behavior()
check if behavior is running (continuous repaints driven by TimeSensor)

toggleInteraction

public void toggleInteraction()

getInteraction

public boolean getInteraction()
check if interaction is enabled (otherwise navigation)

addSensor

public void addSensor(Node sens)
add a Sensornode to a list of sensors which are to check before a redraw

currentTime

public static double currentTime()
get current time in seconds (double precision) since Jan 1 1970 00:00:00 GMT

set3DFont

public void set3DFont()

clearScene

public void clearScene()

newScene

protected void newScene()
get a new, empty scene

readScene

public void readScene(java.lang.String filename,
                      java.lang.String baseurl)
readScene - read VRML stream from file
Parameters:
filename - name of file to be read (non-null; use InputStream variant to read from stdin)
baseurl - base URL (set to file:filename if null)

readScene

public void readScene(java.net.URL url)
readScene - read VRML stream from URL

readScene

public void readScene(java.io.InputStream input,
                      java.lang.String baseurl,
                      java.lang.String location)
readScene - read VRML input stream
Parameters:
location - input name for error messages (e.g. baseurl or "")

draw

public void draw()
draw the scene (called by SceneCanvas.paint)

buildInline

public void buildInline(Inline node1,
                        GroupNode node2)
build a new subgraph and add created nodes as children nodes to a grouping node (Inline)

buildNode

public void buildNode(GroupNode node)
build a new subgraph (needed for EAI's createVrmlFromString)

pick

public Node pick(float fx,
                 float fy,
                 VHitpoint hit)
pick the scenegraph. fills out Hitpoint.
Returns:
node hit object

getRay

public Ray getRay(float fx,
                  float fy)

pick

public Node pick(float fx,
                 float fy,
                 VHitpoint hit,
                 boolean sensors,
                 boolean keeptrf)
pick the scenegraph. fills out Hitpoint. if flag dragsens is set, pick only dragsensors, otherwise pick geometry
Returns:
node hit object

activateAnchor

public void activateAnchor(java.lang.String urlstr,
                           java.lang.String[] params,
                           int numparams)
activate an anchor, given by a URL string. target in params passed to AppletContext (ignored otherwise)

showHelpfile

public void showHelpfile(java.lang.String topic)
show help file via web browser
See Also:
activateAnchor(java.lang.String, java.lang.String[], int)

substChar

public static java.lang.String substChar(java.lang.String str,
                                         char c,
                                         java.lang.String s)
little helper to substitute each occurance of character c by s in String str

openFile

public void openFile()
choose a file to open

openLocation

public void openLocation()
choose a location to open

reloadFile

public boolean reloadFile()
reload file/URL opened last time

toggleFrame

public static void toggleFrame(java.awt.Frame f)
tiny helper to toggle a Frame

toggleColorChooser

public void toggleColorChooser()
toggle color chooser

applyColour

public void applyColour(DLGColourChoose dlg)
apply color callback
Specified by:
applyColour in interface ApplyColour

toggleAbout

public void toggleAbout()
toggle about dialog

toggleSettings

public void toggleSettings()
toggle settings dialog

getWorldURL

public java.lang.String getWorldURL()
get the URL of the currently shown scene

getNodeNames

public java.util.Hashtable getNodeNames()

replaceScene

public void replaceScene(GroupNode node)

setNavigationBar

public void setNavigationBar(NavigationBar navbar)
Sets the navigation bar, so mode switching and enable/disable of buttons is more easyly.
Parameters:
navbar - The navigation bar at the bottom.

setNavigationMode

public void setNavigationMode(int mode,
                              int whatupdates)
set navigation mode

nextViewpoint

public void nextViewpoint()

prevViewpoint

public void prevViewpoint()

addViewpoint

public void addViewpoint(Viewpoint vp)

setViewpoint

public void setViewpoint(int i)

isSensorActiv

public boolean isSensorActiv()

setSensor

public void setSensor(boolean val)

setCursor

public void setCursor(int mode)
Implements the cursor-look in the scene-canvas. Attention: Custom made cursors will be supported since JDK 1.2