Computer Graphics Workshop '97 Lecture Notes | 1/30/97 |
VRML programming is mostly done in the VRML file format (see the VRML 2.0 specification), as opposed to C++ or Scheme. It is designed for ease-of-use as opposed to extensibility. However, there are Script nodes and other APIs which allow Java and VRMLScript programs to affect the scene.
#VRML V2.0 utf8
Viewpoint {
position 3.0 0.0 0.0
}
Group {
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0.8 0.2 0.2
}
}
geometry Box {}
}
Transform {
translation 3.0 0.0 0.0
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0.2 0.8 0.2
}
}
geometry Sphere {}
}
Transform {
translation 3.0 0.0 0.0
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0.2 0.2 0.8
}
}
geometry Cone {}
}
]
}
]
}
]
}
#VRML V2.0 utf8
Group {
children [
DEF SENSOR TouchSensor {}
Shape {
appearance Appearance {
material DEF MAT Material {
diffuseColor 0.2 0.2 0.8
}
}
geometry Sphere {}
}
DEF INTERP ColorInterpolator {
key [ 0.0, 0.5, 1.0]
keyValue [ 0.2 0.2 0.8,
0.8 0.2 0.2,
0.2 0.2 0.8 ]
}
DEF TIMER TimeSensor {}
]
}
ROUTE SENSOR.touchTime TO TIMER.startTime
ROUTE TIMER.fraction_changed TO INTERP.set_fraction
ROUTE INTERP.value_changed TO MAT.diffuseColor
Example: moving doors in Doom.
$Id: index.html,v 1.1 1997/01/24 17:50:06 kbrussel Exp $