Prototypes let authors define a new X3D node made up of other X3D nodes,
extending the language for any scenes in new and interesting ways.
X3D extensibility includes a tremendous capability:
authors can create prototype declarations and instances to define new X3D nodes.
This is a powerful feature that puts the full power of this graphics language in the hands of Web authors.
Prototype templates are themselves built using
ProtoDeclare
definitions or corresponding
ExternProtoDeclare
references.
ProtoDeclare field definitions are found in the
ProtoInterface
tag, which can include multiple
field
declarations that define a name, initial value (if appropriate),
accessType
(inputOnly, outputOnly, initializeOnly and inputOutput)
and
type
for each field.
The
IS
and
connect
statements allow an internal field inside the ProtoBody to directly relay values and events via the exposed ProtoInterface field.
The node type of each ProtoDeclare is defined by the first node inside the
ProtoBody
declaration.
Copies of a new node are created by name with
ProtoInstance
nodes.
Default values for ProtoInstance fields can be overridden with
fieldValue
initializations.
A ProtoInstance node can replace any other node in the scene graph having the same node type.
The supporting
Chapter 14 slideset
and course videos
(NPS,
YouTube)
for X3D for Web Authors are available online via
X3dGraphics.com.
Also available:
X3D Scene Authoring Hints
for
Inline Scenes and Prototype Templates
and
URL Links.
|