http://tecfa.unige.ch/ico/navi/tex2html/top.gifhttp://tecfa.unige.ch/ico/icons/vrml97-icon.gif next up previous contents index
Next: 2.3 Prototyping Up: 2. Modularization and Abstraction Previous: 2.1 Multiple instances of

   
2.2 Inlining other VRML files

VRML code can be inlined. The Inline node has three fields:

1.
The name defines the URL

2.
The bboxSize gives the size of the scene to inline. It defines the bounding box, i.e. a rectangle that encloses all the geometry of the scene to be loaded. It's purpose to optimize loading. By default the size value is (-1,-1,-1) and must be calculated by the browser.

3.
The bboxCenter field defines the center of the bounding box, i.e. where to insert the objects.

Here is a simple example that shows how to reuse several times the same object defined in an other file.

Example 2.2.1   Inlining other VRML files  

VRML: ../examples/inter/inter-inline-2.wrl
Source: ../examples/inter/inter-inline-2.text

Alternatively you can also look at the source code of the naming/rotation examples in section 2.1 above which imports an x, y and z axis.

#VRML V2.0 utf8
 
Inline {
   url      "inter-inline-1.wrl"
   bboxSize 0.5 2.5 0.5
}
Transform {
   translation 3 0 0
   children [
      Inline {
         url      "inter-inline-1.wrl"
         bboxSize 0.5 2.5 0.5
      }
     ]
}
Note: insted of a translation one could use the bboxCenter field.

You can also look at our version of the Castle Example created by Mike McCue at Paper Software, Inc. (Note that this example has disappeared from the Web, if you know where the original is, please mail me.)

Example 2.2.2   The Castle Example  

VRML: ../examples/castle/castle.wrl

In addition it shows how to define multiple cameras and how to use GIFs for texturing. Note, that this example needs some polishing. In order to look at the files just cd to the ../examples/castle/castle.wrl directory and click on the *.text files. They are identical with the *.wrl files.


next up previous contents index http://tecfa.unige.ch/ico/navi/tex2html/top.gifhttp://tecfa.unige.ch/ico/icons/vrml97-icon.gif
Next: 2.3 Prototyping Up: 2. Modularization and Abstraction Previous: 2.1 Multiple instances of
D.K.S. - 1998-03-18