#VRML V2.0 utf8 [optional comment]
#
nodeType { fields }
Grouping nodes have a children field that contains an ordered list of one or more child nodes.
Any number of node definitions follow the header. (Nodes at top level must be legal child nodes.)
#VRML V2.0 utf8 Hello world in VRML97 Shape { geometry Text {string "Hello, virtual world!" } }
(Note:LOD and Switch do not display all their children!)
SFFloat: 3.14 SFColor: 0.2 0.9 0.2 SFVec2f: 0 1
MFInt32: [ 128, 0x7FFF, 0xFFFF] MFVec2f: [ 0 1, 0.9 1, ]
Anchor { url "http://www.xxx.com/literature/widgetLit.html" description "Get latest literature about our widget" children Transform { translation 0 1.2 3.1 children Inline {url "http://www.xxx.com/vrml/widgetModel.wrl"} } }
DEF nodeName nodeTtype { fields }
USE nodeName
#VRML V2.0 utf8 # The last instance of Cube uses the second DEF, not the first. Shape {geometry DEF Cube Box {size 3 3 3}} Transform { translation 4 0 0 children Shape { # Bad style to reuse name, but legal geometry DEF Cube Box {size 1 1 1} } } Transform { translation 0 4 0 children Shape { # Uses second DEF for Cube geometry USE Cube } }
PROTO PrototypeName [ # Specifies accessible parms and defaults (and event info) Declaration ] { # Must contain at least one node, the first of which is # included in the transformation hierarchy and defines # the new node type. Definition }
#VRML V2.0 utf8 PROTO BlackBox [] { Box {} } # BlackBox = Box with no access PROTO Cube [] { Box { size 3 3 3 } } # Cube = Box with hardwired size PROTO MyBox [ # MyBox = Box with new default size field SFVec3f boxSize 3 3 3 ] { Box { size IS boxSize } } PROTO Trans [ # Trans translates its geom node field SFVec3f t 0 0 0 # amount to translate field SFNode g NULL # geom node of shape ] { Transform { translation IS t children Shape {geometry IS g} } } Trans {t -6 0 0 g BlackBox {} } Trans {t -2 0 0 g Cube {} } Trans {t 2 0 0 g MyBox {} } Trans {t 6 0 0 g MyBox {boxSize 2 4 1} }