Department of Mathematical Sciences Rensselaer Polytechnic Institute Troy, NY March 22, 1996 Adrian Scott, Ph.D. CEO, Aereal Inc.These notes are on the Web at http://www.aereal.com/talks/rpi.
Virtual Reality is an immersive, computer-generated environment that can include 3-D graphics, sound and more. You can access VRML worlds using a VRML browser, which can be a stand-alone or a plug-in to a regular WWW browser.
Examples:
Perhaps you have a home page on the Web; now it's time for a home WORLD!Your First VRML World:
#VRML V1.0 ascii
Separator {
Material { diffuseColor 0 .7 0 }
Sphere { radius 5 }
Translation { translation 0 10 0 }
AsciiText { string "Hello Virtual World" }
}
Instant VRML Home World
Java can exist in two forms, applets and applications. VRML 2.0 will introduce a new form, based on "Script Nodes".
Currently, Java applets let you do things like calculate mortgages or play Pac-Man within your Web browser.
Applications to mathematics:
So, VRML is like a surface, and Java is like its derivative! :)
ProximitySensor, ClickSensor, Extension nodes defined with Java code.
Imagine surfing a derivative.
Seamless cyberspace.
You can also have Script nodes and then route between events.
Here's a look at a sample VRML reference to Java:
--script node
Script {
field SFColor currentColor 0 0 0
eventIn SFColor colorIn
eventOut SFBool isRed
scriptType "javabc"
behavior "ExampleScript.java"
}
import vrml;
class ExampleScript extends Script {
// Declare field(s)
private SFColor currentColor = (SFColor) getField("currentColor");
// Declare eventOut field(s)
private SFBool isRed = (SFBool) getEventOut("isRed");
public void colorIn(ConstSFColor newColor, ConstSFTime ts) {
// This method is called when a colorIn event is received
currentColor.setValue(newColor.getValue());
}
public void eventsProcessed() {
if (currentColor.getValue()[0] >= 0.5) // if red is at or above 50%
isRed.setValue(TRUE);
}
}
Virtual Reality provides us with an environment to do artificial life.
Again, Three concepts:
DEF OpenVault Script {
# Declarations of what's in this Script node:
eventIn SFBool vaultClosed
eventIn SFString combinationEntered
eventOut SFBool openVault
field SFString correctCombination "43-22-9"
field SFBool currentlyOpen FALSE
# Implementation of the logic:
scriptType "java"
behavior "java.class"
}
The "java.class" file will contain a compiled version of the following
Java source code:
import vrml;
class VaultScript extends Script {
// Declare fields
private SFBool currentlyOpen = (SFBool) getField("currentlyOpen");
private SFString correctCombination = (SFString) getField("correctCombination
");
// Declare eventOuts
private SFBool openVault = (SFBool) getEventOut("openVault");
// Handle eventIns
public void vaultClosed(ConstSFBool value, SFTime ts) {
currentlyOpen.setValue(FALSE);
}
public void combinationEntered(ConstSFString combo, SFTime ts) {
if (currentlyOpen.getValue() == FALSE &&
combo.getValue() == correctCombination) {
currentlyOpen.setValue(TRUE);
openVault.setValue(TRUE);
}
}
}