The three types of objects are:

  • objbg: background objects that appear on each scene
  • objbgafter: background objects that appear on each scene but are rendered after the foreground elements
  • objfg: foreground objects that usually are either different in form or have different transformations applied to them in each scene definition

All three are basically the same. Each scene definition consists of the objects defined as objbg, objfg and objbgafter.

We will describe objfg and this description applies equally well to the other two type of objects.

objfg

This is a typical definition of a foreground object:

      <objfg transform="translate(-145,-64,80) roty(45)">
        <obj class="wdm3" href="wdm01" transform="rotz(60)" />
        <obj class="wdm4"  href="wdm02" transform="rotz(60)" />
      </objfg>

Each objfg element contains a sequence of obj elements. Normally, the obj elements are the individual parts of an object, say a bicycle, and the objfg element is the complete object, our bicycle. Transformations can be applied to individual obj elements (pedals, wheels, handlebars) and the objfg element itself. This allows the complete bicycle to move forward with the pedals and wheels rotating. Each obj element has three attributes:

  • href: indicates the path defining the element
  • class: defines the styling to apply to the obj element
  • transform: a 3D transformation similar to the SVG transform element in that any number of individual transformations can be defined and they are applied from right to left

The possible transformations are:

translate(x,y,z)
Defines a translation of (x,y,z)
rotx(deg),roty(deg),rotz(deg)
Defines a rotation of deg degrees about one of three main axes
scale(sx,sy,sz)
Scales by sx in the x-direction etc. As for SVG, if only one parameter is given, scaling is the same in all 3 axes.
matrix(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)
Defines a 4 by 4 matrix transformation of the coordinates

Each transformation is converted to a 4 by 4 matrix. The matrices are combined to give a single transformation to apply to the coordinates of the object.