Titania X3D Editor

Bring Colours to Your Life.

Titania v4.3.1

Bring Colours to Your Life.

X3D Reference

Naming nodes

Motivation

  • If several shapes have the same geometry or appearance, you must use multiple duplicate nodes, one for each use
  • Instead, define a name for the first occurrence of a node
  • Later, use that name to share the same node in a new context

Syntax: DEF

The DEF syntax gives a name to a node.

XML Encoding

Classic Encoding

Using DEF

  • DEF must be in upper-case
  • You can name any node
  • Names can be most any sequence of letters and numbers
    • Names must be unique within a file

Syntax: USE

The USE syntax uses a previously named node

XML Encoding

Classic Encoding

Using USE

  • USE must be in upper-case
  • A re-use of a named node is called an instance
  • A named node can have any number of instances
    • Each instance shares the same node description
    • You can only instance names defined in the same file

Using named nodes

Naming and using nodes:

  • Saves typing
  • Reduces file size
  • Enables rapid changes to shapes with the same attributes
  • Speeds browser processing

Names are also necessary for animation ...

A sample use of node names

XML Encoding

Classic Encoding

Summary

  • DEF names a node
  • USE uses a named node