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. |
14 X3D Models | X3D Model Descriptions | |
---|---|---|
Art Deco Examples Excerpt | Example ExternProtoDeclare/ProtoInstance usage of X3D/VRML materials, originally converted from SGI's Open Inventor material examples. Excerpted from original. | |
Art Deco Prototypes Excerpt | Prototype declarations defining values for X3D/VRML materials, originally converted from SGI's Open Inventor material examples. Excerpted from original. | |
Heads Up Display Example | Prototype definition that demonstrates use of a simple HeadsUpDisplay (HUD) prototype that maintains a stable position for its children on the screen. | |
Heads Up Display Prototype | Reusable Prototype definition that applies a ProximitySensor for a simple HeadsUpDisplay (HUD) prototype that maintains a stable position for its children on the screen. | |
Hud Kelp Forest | Demonstrates use of a ProximitySensor in building a HUD, with display values showing current view location. | |
Material Modulator | Mimic a Material node and modulate the diffuseColor field as an animation effect, provided as a prototype for reusability. | |
Material Modulator Examples | Demonstrate multiple instances of an external prototype. | |
Material Modulator Prototype Expanded | Provide example for expansion of a MaterialModulator as regular X3D nodes, rather than a ProtoDeclare/ProtoInstance combination. MaterialModulator mimics a Material node and modulates diffuseColor field as an animation effect. | |
Text String Prototype | Simple Prototype for the display of text strings, combining functionality of Text and FontStyle nodes. | |
View Frustum Example | Display view frustum associated with a given pair of Viewpoint and NavigationInfo nodes, illustrating ProtoInstance reuse of a separately declared prototype. | |
View Frustum Prototype | Define a view frustum associated with a given pair of Viewpoint and NavigationInfo nodes, provided as a reusable prototype. | |
Where Am IExample | Example use of prototype node for displaying current viewpoint location and orientation in the player console. | |
Where Am IPrototype | Prototype node declaration for displaying current viewpoint location and orientation in the player console. | |
X3D Architecture Concepts Prototype Body Validation Example |
Prototype example to illustrate why additional non-rendering nodes might be needed after first node in ProtoBody Specification reference: X3D Architecture, ISO/IEC 19775-1: 202x, Clause 4 Concepts, 4.4.4.3 PROTO definition semantics |
Online at https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter14Prototypes Master source-code model archive is under version control at |
The X3D Resources: Examples page and Savage Developers Guide provide more information about the production of this archive.