This document is part of a collection of VRML2.0 history at http://www.mitra.biz/vrml/vrml2/mw_history.html

Sony's extensions to the VRML 1.0 standard(V 1.2)

Kouichi Matsuda, Yasuaki Honda
matsuda@csl.sony.co.jp
Sony Computer Science Laboratories Inc. 
also with Central Research Center, Sony Corporation

History

Thu Jun 15 15:51:16 JST 1995: The first version(V 1.0).
Tue Sep 14 20:43:14 JST 1995: This document was added to WWW.csl.sony.co.jp
Tue Sep 26 12:24:59 JST 1995: Bug fix (MOUSE_DOWN -> BUTTON_DOWN) and WORLD_IN, WORLD_OUT was added.
Mon Oct 2 18:19:25 JST 1995: Add a few examples to demonstrate script sharing and multi-scripting language supporting.
Tue Oct 3 10:06:56 JST 1995: Add description on the arguments of event handler, and KEY_UP/KEY_DOWN event.
Tue Oct 3 20:13:51 JST 1995: Version 1.1. the callback interface was changed.
Wed Oct 4 11:04:07 JST 1995: A new example about attaching two event handlers to one object is added.
Wed Oct 4 14:55:28 JST 1995: "method" and INLINE script type is added.
Thu Oct 5 16:25:57 JST 1995: Version 1.2. BUTTON_DOWN -> GRAB, BUTTON_UP -> RELEASE. Move "filename" of Script node to Event Handler node.

Introduction

Following is a list of nodes that constitute our Sony's extensions to the current VRML 1.0 standard. We extended VRML 1.0 about scripting, object attributes and sound features.

There are seven extension nodes for it: Script node, EventHandler node, SporadicTask node, PeriodicTask node , CalendarTask node, Attributes node, and ambientSound node. Notice that "fields" field is necessary in extension nodes but it is removed from the following descriptions for simplyfing.

Scripting

There are seven extension nodes for it: Script node, EventHandler node, SporadicTask node, PeriodicTask node, and CalendarTask node.

Requirement

Syntactic Extension

Five node types are necessary for the scripting extension to VRML: Script node, EventHandler node, SporadicTask node, PeriodicTask node and CalendarTask node. The first one is for defining functions; others are for registering them to objects.

Defining Functions

Registering Tasks

Method

A tiny language can be embedded in the "function" field of EventHandler node, SporadicTask node, PeriodicTask node, and CalendarTask node directly to describe some simple methods. The methods also are invoked by events or messages according to the node type.

For example,

In this example, when user clicks the cube, its diffuse color is changed to red. It isn't necessary to specify scriptType, becuase INLINE is default script type.

Only the following syntax can be used for describing method.

This idea came from Mitra's paper.

object attributes

Node scope

AmbientSound Node

This property node defines an ambient sound source. If user enters the bounding cube of it, it plays sound automatically and adjust its volume according to a distance between the node and user.

    	filename:   specify the sound data(URL).
        		.wav     Windows WAVE (PCM)
        		.mid     Windows MIDI
    	bboxSize, bboxCenter:    specify the bounding cube.
    	autoPlay: specify if the sound plays automatically 
		when user enters the bounding cube.
    	loop:     auto repeat

	FILE FORMAT/DEFAULT

    	AmbientSound {
       		filename    ""      # SFString
       		bboxSize    0 0 0   # SFVec3f
       		bboxCenter  0 0 0   # SFVec3f
       		autoplay    TRUE    # SFBool
       		loop        TRUE    # SFBool
    	}

Scripting example

In the following examples, we suppose that content of "change.tcl" likes this: Notice that "fields" field is necessary in extension nodes but it is removed from the following descriptions for simplyfing.

  • Event Handler Example

    In the following example, the first cube has the name "foo" and the event handler.

  • Script Sharing Example

    In the following example, two event handlers share the same script.

  • Attaching two event handlers example

    In the following example, two event handlers are attached to the same cube.

    When user presses button, the color of cube is changed to red, then button is released, that of cube is changed to blue.

  • Multiple scripting language support example

    In the following example, the first cube has TCL event handler and the second cube has PYTHON event handler to change their color.

  • Built-in C function example

    If a browser has a built-in function "change_color", an event handler can be specified like the following:

  • Multiple events example

    In the following example, a cube has the same event handler for GRAB and KEY_DOWN.

  • Inline scripting example