Table of Contents Previous Chapter Summary Chapter Viewpoint Slideshow Javadoc for translated java source Next Chapter Summary X3D Resources

X3D Example Archives: X3D for Web Authors, Chapter 14 Prototypes

MaterialModulator prototype demonstration       ViewFrustum prototype demonstration

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 or ExternProtoDeclare definitions. 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 type of each node 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.

  12 X3D Scenes       Scene Descriptions
ArtDecoExamplesExcerpt Art Deco Examples Excerpt Example ExternProtoDeclare/ProtoInstance usage of X3D/VRML materials, originally converted from SGI's Open Inventor material examples. Excerpted from original.
ArtDecoPrototypesExcerpt Art Deco Prototypes Excerpt Prototype declarations defining values for X3D/VRML materials, originally converted from SGI's Open Inventor material examples. Excerpted from original.
HeadsUpDisplayExample 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.
HeadsUpDisplayPrototype 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.
HudKelpForest Hud Kelp Forest Demonstrates use of a ProximitySensor in building a HUD, with display values showing current view location.
MaterialModulator Material Modulator Mimic a Material node and modulate the diffuseColor field as an animation effect, provided as a prototype for reusability.
MaterialModulatorPrototypeExpanded 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.
TextStringPrototype Text String Prototype Simple Prototype for the display of text strings, combining functionality of Text and FontStyle nodes.
ViewFrustumExample View Frustum Example Display view frustum associated with a given pair of Viewpoint and NavigationInfo nodes, illustrating ProtoInstance reuse of a separately declared prototype.
ViewFrustumPrototype View Frustum Prototype Define a view frustum associated with a given pair of Viewpoint and NavigationInfo nodes, provided as a reusable prototype.
WhereAmIExample Where Am IExample Example use of prototype node for displaying current viewpoint location and orientation in the player console.
WhereAmIPrototype Where Am IPrototype Prototype node declaration for displaying current viewpoint location and orientation in the player console.

Online at http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes

Validate XHTML 1.1

Master source-code model archive is under subversion control at
http://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter14Prototypes

The X3D Resources: Examples page and Savage Developers Guide provide more information about the production of this archive.

Table of Contents Previous Chapter Summary Chapter Viewpoint Slideshow Javadoc for translated java source Next Chapter Summary X3D Resources