VRML
2.0 Prototype Concepts
-
Prototypes are the mechanism used for expanding the VRML language
-
A prototype has a new type name followed by a list of fields and events in
brackets
-
These may have default values associated with them (a good idea)
-
Now VRML describing the prototype is written
-
Fields and Nodes in the VRML section are associated with the fields of
the prototype declaration using the word IS
-
The prototype is invoked by referencing its name and supplying some or
all of its field values within curly brackets (just like referencing an
inbuilt node)
-
If you want fields of the prototype to be able to receive events
declare them as exposed
-
The prototype can be referenced anywhere that a node which is the same
type as the first node in its VRML section could be referenced
-
The externproto declaration references a proto in another file by
adding a url at the end of the declaration
-
externproto is a convenient way to build up a library of prototypes
that are reusable
-
The field and event declartions of the externproto must be a subset of
those in the prototype declaration
-
The name of the externproto has no connection to the name of the
prototype, only the url associates them
This will all become clearer with some examples.