OpenGL VRML Shockwave 3D
Home Tutorials Books Applications Tools Docs Models Textures

Send me bugs and suggestions, please
VRML Script Tutorial
Full list

VRML Interactive Tutorial

Introduction
VRML File Structure
Drawing: Shape node
Geometry Nodes:
Box
Sphere
Cone
Cylinder
PointSet
IndexedLineSet
IndexedFaceSet
Extrusion
ElevationGrid
Example: Chessboard
Text
FontStyle
Appearance
Material
Textures
Image Texture
Movie Texture
Pixel Texture
Texture Coordinate
Texture Transform
Let there be Light
Directional Light
Point Light
Spot Light
Materials with Colored Lights
Hierarchical Node Structures
Group
Transform
Collision
Anchor
Billboard
Switch
Inlining Files
Defining and Instancing Nodes
Defining Levels of Detail
Events in VRML
Creating Paths between events: ROUTE
Generating Events based on Timers or User Actions
Timers
Touch Sensor
Visibility Sensor
Dragging Sensors
Plane Sensor
Sphere Sensor
Cylinder Sensor
Proximity Sensors
Example: Proximity sensor
Interpolators
Color
Coordinate
Normal
Orientation
Position
Scalar
Example
Let the Music Play
Sound
AudioClip
Bindable Nodes
Who Am I: NavigationInfo
Where Am I: ViewPoint
Adding Realism to the world
Background
Fog
Information about your world
WorldInfo
Definition for Auxiliary Nodes
Coordinate
Color
Normal

ROUTES


In the section events it was mentioned that a node can send and receive events.

ROUTES are a simple way of defining a path between an event generated by a node and a node receiving an event. The syntax is:

ROUTE Node.eventOut_changed TO Node.set_eventIn
Note: because all exposed fields define implicitly an eventIn and an eventOut fields, you don't have to write the prefix 'set_' or the suffix '_changed'. The following syntax is valid in VRML as long as the eventIn and the eventOut which appear in the ROUTE sentence belong to exposed fields.
ROUTE Node.eventOut TO Node.eventIn
Because every time an exposed field is changed an event is generated it is possible to have a cascade of events being generated. A time stamp is given to each event which is generated, the same time stamp being given for all events in a cascade as if all events in a cascade occurred simultaneously.

Now there is something missing isn't it? In the section events it was mentioned the eventIn of an exposed field was used to set the value of the respective field. However looking at the syntax of ROUTE there is no explicit declaration of what the new value is. As mentioned before in this section "ROUTES are a SIMPLE way of defining a path...", and SIMPLE in this case has some limitations. The new value for the field associated with the eventIn is the value of the field which caused the eventOut to be generated.

Big deal, so what can I do with routes if I can't specify the value for the field that I'm about to set? Well, you actually can do that using a middle man, see Interpolators.

A cascade of events may result in an event being generated more than once in the same cascade, this can cause a loop of events. In VRML loops are not allowed, an event shall only be generated once in each cascade of events. You don't have to worry about this, the browser will disable any event which is repeated with the same time stamp.

It is possible that two different generated events in a cascade are linked with a ROUTE to an eventIn. Results are undefined in this case. You should try to avoid this type of situations.



Site designed and maintained by António Ramires Fernandes
Your comments, suggestions and references to further material are welcome!

Lighthouse 3D privacy statement