#VRML V2.0 utf8 # WorldInfo to give some basic information WorldInfo { title "VRML 2.0 Primitive Elements Example" } # Group to position all primitives at different locations Group { children [ # Box (size: 2x2x2) Transform { translation -6 0 0 children [ Shape { geometry Box { size 2 2 2 } appearance Appearance { material Material { diffuseColor 1 0 0 # Red } } } ] } # Sphere (radius: 1) Transform { translation -3 0 0 children [ Shape { geometry Sphere { radius 1 } appearance Appearance { material Material { diffuseColor 0 1 0 # Green } } } ] } # Cylinder (height: 2, radius: 1) Transform { translation 0 0 0 children [ Shape { geometry Cylinder { height 2 radius 1 } appearance Appearance { material Material { diffuseColor 0 0 1 # Blue } } } ] } # Cone (bottomRadius: 1, height: 2) Transform { translation 3 0 0 children [ Shape { geometry Cone { bottomRadius 1 height 2 } appearance Appearance { material Material { diffuseColor 1 1 0 # Yellow } } } ] } # Text (Example text string) Transform { translation 0 3 0 children [ Shape { geometry Text { string ["Hello", "VRML"] fontStyle FontStyle { family "SANS" size 1 justify "MIDDLE" } } appearance Appearance { material Material { diffuseColor 1 0 1 # Purple } } } ] } # IndexedLineSet (example of lines) Transform { translation 6 0 0 children [ Shape { geometry IndexedLineSet { coord Coordinate { point [ 0 0 0, # Point 0 1 0 0, # Point 1 1 1 0, # Point 2 0 1 0, # Point 3 ] } coordIndex [0, 1, 2, 3, 0, -1] # Close the square } appearance Appearance { material Material { emissiveColor 0 1 1 # Cyan } } } ] } ] }