Full HTML for

Basic foilset VRML97 Scripting: Java Nodes and External Authoring Interface

Given by Wojtek Furmanski and Balaji Natarajan at UC Web Applications Certificate on July 24 1997. Foils prepared 5 August 97
Outside Index Summary of Material


This describes use of Java for VRML97(VRML2) Nodes
Accessing a VRML97 world from a Java Application(Applet)
  • This is EAI or External Authoring Interface
Link to LiveConnect from Netscape
Comments on NPAC-IBM Televirtual reality project
Java Shared Data Architecture(JSDA)

Table of Contents for full HTML of VRML97 Scripting: Java Nodes and External Authoring Interface

Denote Foils where Image Critical
Denote Foils where Image has important information
Denote Foils where HTML is sufficient

1 CPS 616 Summer 97 Computational Science for the Information Applications
2 Scripts and Execution Model in VRML'97
3 Script Nodes in VRML'97 - Introduction I
4 Script Nodes in VRML'97-Introduction II
5 Why Java with VRML ?
6 Why VRML with Java ?
7 Methods of Java-VRML interaction
8 Script Nodes in Java for VRML'97 - I
9 Script Nodes in Java for VRML'97 - II
10 Script Nodes in Java for VRML'97 - III
11 Java class referencing a VRML file
12 VRML Browsers with Java Node support
13 Sample VRML file referenced by a Java class - I
14 Sample VRML file referenced by a Java class - II
15 Java code to set an eventOut field - I
16 Java code to set an eventOut field - II
17 External Authoring Interface(EAI) - I
18 External Authoring Interface(EAI) -II
19 EventOutObserver interface in EAI - I
20 EventOutObserver Interface in EAI - II
21 EAI and Script Node - The difference - I
22 EAI and Script Node - the difference - II
23 An example of Java-VRML interaction through EAI -fig 1
24 An example of Java-VRML interaction through Script Node-fig 2
25 Netscape's LiveConnect with EAI
26 VRML Browsers with Java External Authoring Interface(EAI) support
27 Useful applications of Java - VRML interaction
28 Dynamic Generation of VRML nodes - The world
29 Java class to dynamically generate VRML nodes at runtime - I
30 Java class to dynamically generate VRML nodes at runtime - II
31 Java class to dynamically generate VRML nodes at runtime - III
32 Java class to dynamically generate VRML nodes at runtime - IV
33 Dynamic Generation of VRML nodes at runtime using Java
34 Collaborative virtual environments - I
35 Collaborative Virtual Environments - II
36 An illustration of Collaborative Virtual Environments - TeleVirtual Reality(TVR)
37 TVR - Framework details
38 TeleVirtual Reality(TVR) Environments - A typical Scenario
39 TeleVirtual Reality(TVR) Environments - Design -I
40 TeleVirtual Reality(TVR) Environments - Design II
41 Java Shared Data Architecture(JSDA) - A Brief Overview - I
42 Java Shared Data Architecture (JSDA) - A Brief overview - II

Outside Index Summary of Material



HTML version of Basic Foils prepared 5 August 97

Foil 1 CPS 616 Summer 97 Computational Science for the Information Applications

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Scripting in VRML `97
Part I - Java Node and
External Authoring Interface
Balaji Natarajan
balaji@npac.syr.edu

HTML version of Basic Foils prepared 5 August 97

Foil 2 Scripts and Execution Model in VRML'97

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Script Nodes essentially give logic and state management to a VRML world.
Key feature of the execution model is that time advances in a VRML'97 scene in virtual units
Each time unit in the scene has an associated time value , called a timestamp.
Start of an Event Cascade signifies creation of a timestamp and attaching it to an event.

HTML version of Basic Foils prepared 5 August 97

Foil 3 Script Nodes in VRML'97 - Introduction I

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
The syntax of a Script Node in a VRML'97 file :
Script{
exposedField MFString url []
eventIn eventTypeName eventName
eventOut eventTypeName eventName
field SFBool directOutput FALSE
}

HTML version of Basic Foils prepared 5 August 97

Foil 4 Script Nodes in VRML'97-Introduction II

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Location of Script Node in the scene graph has no effect on its operation
Script Nodes can either receive eventIns through ROUTE statements or directly access the exposed Fields of the respective nodes when the directOutput Field is set to TRUE
Script Nodes by themselves cannot have exposed Fields.

HTML version of Basic Foils prepared 5 August 97

Foil 5 Why Java with VRML ?

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
The blending of Java and VRML enables true multimedia ,experiential and dynamic content on the Web.
Both Java and VRML are cross - platform standards.
The powerful networking classes of Java can be optimally used with VRML to provide for Collaborative virtual environments.

HTML version of Basic Foils prepared 5 August 97

Foil 6 Why VRML with Java ?

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
VRML with Java is a powerful combination that results in executable content, optimized for today's low bandwidth environments.
Simplistic 3-D programming of complex front-ends possible using well-defined nodes in VRML'97 specifications.
Huge bandwidth savings possible by using a VRML world animated by a Java applet - rather than a 2D GIF/JPEG image animated by Java.

HTML version of Basic Foils prepared 5 August 97

Foil 7 Methods of Java-VRML interaction

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
In VRML'97, Script nodes allows to design nodes that are described by Java classes using the VRML - Java API.
Using External Authoring Interface and Netscape's LiveConnect architecture,a VRML world can be directly controlled by a Java applet inside a HTML page.
The whole VRML browser can be written in Java - having a set of Java classes that implement the VRML specifications .

HTML version of Basic Foils prepared 5 August 97

Foil 8 Script Nodes in Java for VRML'97 - I

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
In VRML'97,Script Nodes facilitate development of nodes that are described by Java classes using the VRML - Java API
Typical fields in a Java Script Node:
url : This field specifies the location of the Java class
eventIn : for getting the actual event in VRML world
eventOut : for sending the received event to the Java class

HTML version of Basic Foils prepared 5 August 97

Foil 9 Script Nodes in Java for VRML'97 - II

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
VRML'97 specs allow for trapping of events in scene using Sensors.
Trapped Event is routed as the eventIn or input event to the Script Node using ROUTE statement
Events arriving at an eventIn field automatically cause the browser to pass the event to the program referred to in the url field of the Script node.This mechanism is called Event Dispatching.

HTML version of Basic Foils prepared 5 August 97

Foil 10 Script Nodes in Java for VRML'97 - III

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Java program on receiving the eventIn calls the eventProcessed method
Events are classified here and corresponding computation is performed .
The result of the computation will be sent as an EventOut or an output event to the VRML file.
The output event is then routed to the required nodes in the scene through a ROUTE statement

HTML version of Basic Foils prepared 5 August 97

Foil 11 Java class referencing a VRML file

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
This class will extend the Script class defined in the vrml package - a part of the VRML - Java API.
Contains an initialize method for getting eventOuts and exposedFields from the VRML file.
Contains a processEvent method for getting details about the event and processing it.
Contains a shutdown method - this method is automatically called when Script node is deleted

HTML version of Basic Foils prepared 5 August 97

Foil 12 VRML Browsers with Java Node support

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
PC Platform :
SGI's CosmoPlayer 1.0 beta3a
Sony's Community Place
IRIX Platform:
SGI's CosmoPlayer 1.0 beta3a
Solaris Platform:
DimensionX's Liquid Reality
IICM's VRWave

HTML version of Basic Foils prepared 5 August 97

Foil 13 Sample VRML file referenced by a Java class - I

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
#VRML V2.0 utf8
Transform {
children [ DEF TS TouchSensor {}
Shape { appearance Appearance {
material DEF SphereColor material { diffuseColor 1 0 0 }
} geometry Sphere {}
} ] }

HTML version of Basic Foils prepared 5 August 97

Foil 14 Sample VRML file referenced by a Java class - II

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
DEF ColorScript Script {
url "ChangeColor.class"
eventIn SFBool clicked
eventOut SFColor newColor
field SFBool on FALSE}
ROUTE TS.isActive TO ColorScript.clicked
ROUTE ColorScript.newColor TO SphereColor.set_diffuseColor

HTML version of Basic Foils prepared 5 August 97

Foil 15 Java code to set an eventOut field - I

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Public class Changecolor extends Script {
private SFColor newColor ;
float red[] = {1,0,0};
float blue[] = {0,0,1};
public void initialize() {
newColor = (SFColor)
getEventOut ("newColor"); }

HTML version of Basic Foils prepared 5 August 97

Foil 16 Java code to set an eventOut field - II

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Public void processEvent(Event e) {
ConstSFBool v = (ConstSFBool)e.getValue();
if(v.getValue()) {
if(on.getValue()){
newColor.setValue(red);
} else { newColor.setValue(blue);
}
on.setValue(!on.getValue()); } } }

HTML version of Basic Foils prepared 5 August 97

Foil 17 External Authoring Interface(EAI) - I

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Defines a set of functions on the VRML browser that the external environment can perform to affect the VRML world
Using EAI, Java applets can interact with the VRML scene by accessing nodes in it using the existing VRML event model

HTML version of Basic Foils prepared 5 August 97

Foil 18 External Authoring Interface(EAI) -II

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Java applet communicates with the VRML world by obtaining an instance of the Browser class or by using the JSObject class in netscape's liveconnect package
Then applet gets instance of node using the getNode() method of Browser class
getEventIn() and getEventOut() methods of the Node class return relevant eventIn's and eventOut's respectively

HTML version of Basic Foils prepared 5 August 97

Foil 19 EventOutObserver interface in EAI - I

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
To receive an eventOut notification,applet implements the EventOutObserver interface - implementing the callback method.
An instance of the eventoutobserver is passed to the advise() method of EventOut.
Whenever an event is generated,for that eventOut the callback() method is executed and passed the value and timestamp of the event.

HTML version of Basic Foils prepared 5 August 97

Foil 20 EventOutObserver Interface in EAI - II

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Public class MyObserver implements EventOutObserver {
public void callback(EventOut value,double timestamp) {
//cast the obtained value here into an EventOutSFVec3f
} }
.............
MyObserver observer = new MyObserver;
mover.getEventOut("translation_changed").advise(observer,null);
When the eventOut from translation occurs,observer.callback() is executed.

HTML version of Basic Foils prepared 5 August 97

Foil 21 EAI and Script Node - The difference - I

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Method of obtaining a Node pointer from inside the VRML scene is different.Script Node gets a pointer using USE construct.EAI uses getNode() method
EventOut notification done through Routing in case of Script Node,in EAI - applet calls the CALLBACK method - when the eventOut generates an event

HTML version of Basic Foils prepared 5 August 97

Foil 22 EAI and Script Node - the difference - II

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Using EAI, the Java applet controlling the VRML world can be on the same HTML page on a different frame as illustrated in Fig1
Using Script Node,the Java class controlling the world can popup a separate frame window as illustrated in Fig2

HTML version of Basic Foils prepared 5 August 97

Foil 23 An example of Java-VRML interaction through EAI -fig 1

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index

HTML version of Basic Foils prepared 5 August 97

Foil 24 An example of Java-VRML interaction through Script Node-fig 2

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index

HTML version of Basic Foils prepared 5 August 97

Foil 25 Netscape's LiveConnect with EAI

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Java applet,Javascript and VRML plugin interaction possible using Netscape's LiveConnect architecture.
Handle to the plugin object got from inside the java program using netscape's javascript package
VRML 2.0 Browser currently employing the LiveConnect architecture is CosmoPlayer 1.0

HTML version of Basic Foils prepared 5 August 97

Foil 26 VRML Browsers with Java External Authoring Interface(EAI) support

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
PC Platform:
SGI's CosmoPlayer 1.0 (shipped with Netscape Communicator 4.0)
Intervista's WorldView browser
IRIX Platform:
SGI's CosmoPlayer 1.0

HTML version of Basic Foils prepared 5 August 97

Foil 27 Useful applications of Java - VRML interaction

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Dynamic Generation of VRML nodes at Runtime.
Dynamic Generation of VRML routes at Runtime.
Development of Collaborative Virtual Environments

HTML version of Basic Foils prepared 5 August 97

Foil 28 Dynamic Generation of VRML nodes - The world

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
#VRML V2.0 utf8
DEF GEN_ROOT Transform{
children[ DEF GEN_TOUCH TouchSensor {}
Shape { geometry Sphere{} } ] }
DEF GENSCRIPT Script {
url "DynamicGen.class"
eventIn SFTime touched
eventOut MFNode addSphere }
ROUTE GEN_TOUCH.touchTime TO GENSCRIPT.touched
ROUTE GENSCRIPT.addSphere TO GEN_ROOT.addChildren

HTML version of Basic Foils prepared 5 August 97

Foil 29 Java class to dynamically generate VRML nodes at runtime - I

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Public class DynamicGenerator extends Script {
MFNode addSphere ;
Random randomNumGenerator = new Random();
float posX = 0.0f;
public void initialize() {
addSphere = (MFNode)getEventOut("addSphere"); }

HTML version of Basic Foils prepared 5 August 97

Foil 30 Java class to dynamically generate VRML nodes at runtime - II

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
public void processEvent(Event e) {
String sphereDesc1 = "Transform { translation 0.0 0.0 ";
String sphereDesc2 = "children[ Shape geometry Sphere{}";
String sphereDesc3 = "appearance Appearance { material Material { diffuseColor";
String sphereDesc4 = "} } } ] } ";

HTML version of Basic Foils prepared 5 August 97

Foil 31 Java class to dynamically generate VRML nodes at runtime - III

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Float red = randomNumGenerator.nextFloat();
float green = randomNumGenerator.nextFloat();
float blue = randomNumGenerator.nextFloat();
Browser browser = getBrowser();
BaseNode baseNodes[];
posX += 3.0f ; // X coordinate of new node.

HTML version of Basic Foils prepared 5 August 97

Foil 32 Java class to dynamically generate VRML nodes at runtime - IV

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
try {
baseNodes = browser.createVrmlFromString(sphereDesc1+
posX+ sphereDesc2+ sphereDesc3 +red+green+blue+sphereDesc4);
addSphere.setValue(baseNodes);
}
catch(Exception ex) { ex.printStackTrace() ;
} } } }

HTML version of Basic Foils prepared 5 August 97

Foil 33 Dynamic Generation of VRML nodes at runtime using Java

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
The left browser window shows only the existing node in the world i.e. a sphere.The right browser window shows the dynamically created node also

HTML version of Basic Foils prepared 5 August 97

Foil 34 Collaborative virtual environments - I

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Made possible using Java's powerful networking classes
Users represented as Avatars in shared spaces.
Concept of Shared Behaviors has to be implemented to achieve realism in these environments.

HTML version of Basic Foils prepared 5 August 97

Foil 35 Collaborative Virtual Environments - II

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
The visual element of a shared environment also provides a vehicle for enhancing the tools available in a workplace , such as scientific data visualization and process simulation
For example , a team of engineers who design an aerospace engine by testing different parts online from different locations can benefit from a display of results that show cause and effect relationships in a multi-user space.

HTML version of Basic Foils prepared 5 August 97

Foil 36 An illustration of Collaborative Virtual Environments - TeleVirtual Reality(TVR)

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
A joint project between Syracuse University(NPAC/CASE) and IBM T.J.Watson Research Center.
Scalable spaces served by multi-web servers for efficient load -balancing.
Based on the Collaborative Framework - Java Shared Data Architecture(JSDA) being under development at JavaSoft Corporation.

HTML version of Basic Foils prepared 5 August 97

Foil 37 TVR - Framework details

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Compatible with both EAI and Script Node method of Java-VRML interaction
Compatible with SGI's CosmoPlayer 1.0 and Sony's Community Place Browser
Collaborative framework based on JSDA(Java Shared Data Architecture)

HTML version of Basic Foils prepared 5 August 97

Foil 38 TeleVirtual Reality(TVR) Environments - A typical Scenario

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index

HTML version of Basic Foils prepared 5 August 97

Foil 39 TeleVirtual Reality(TVR) Environments - Design -I

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Java Script Node in the client world references a Java class which is a client in the JSDA framework
JSDA server accepts connection from client and spawns dispatch threads to handle any information from client regarding updates in position and orientation of the client's avatar

HTML version of Basic Foils prepared 5 August 97

Foil 40 TeleVirtual Reality(TVR) Environments - Design II

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Clients in turn spawn Receiver threads to handle the information received from Server-side thread
Appropriate methods on the client-side class is called to set the updated values of all the other avatars
Updated values are routed to the VRML world - consistency in avatar movement in all the client browsers is maintained.

HTML version of Basic Foils prepared 5 August 97

Foil 41 Java Shared Data Architecture(JSDA) - A Brief Overview - I

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Data Objects shared over specific instances of Channels - between two or more Clients
If interested,Client joins a Session of which the Channel is a part of and then joins the Channel itself.
Contains objects which encapsulate management policies - The Session Manager object authenticates clients and their veracity to join a session

HTML version of Basic Foils prepared 5 August 97

Foil 42 Java Shared Data Architecture (JSDA) - A Brief overview - II

From VRML97 Scripting: Java Nodes and External Authoring Interface UC Web Applications Certificate -- July 24 1997. *
Full HTML Index
Functionality supported by JSDA Channel:
Session Communication: send message to all clients in a specific session
Peer: Send message to a specific Client in a certain session
List Client,Consumer : List all the Clients and respective Consumers who have registered interest in a certain Channel

© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Nov 29 1998