Titania X3D Editor

Bring Colours to Your Life.

Titania v4.3.3

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

Cookies and other Technologies

By clicking »Accept« or continuing to use the site, you agree to the use of CREATE3000 and third-party cookies and other similar technologies to enhance your browsing experience, analyze and measure your engagement with our content, and provide more relevant ads on CREATE3000 websites and others. Learn more about cookies. You can withdraw your consent at any time.