#VRML V1.0 ascii Separator { Info { string "My testbed for VRML primitives" } # Define some light sources DirectionalLight { color 1 1 1 direction -1 -1 -1 intensity 1 on TRUE } DirectionalLight { color 1 1 1 direction 1 1 1 intensity 0.5 on TRUE } PointLight { on TRUE intensity 1 color 1 1 1 location 0 0 -2 } SpotLight { on TRUE intensity 1 color 1 1 1 location 0 0 -2 direction 0 0 1 dropOffRate 0 cutOffAngle 0.1 } # Camera attributes PerspectiveCamera { position 0 0 10 orientation 1 0 0 0 focalDistance 10 } # TEXT Separator { Transform { translation 1.1 -1 1 } FontStyle { size 0.2 family SERIF style NONE } AsciiText { string "VRML example" spacing 1 justification LEFT width 0 } } # Cube Separator { Material { diffuseColor 0.8 0.2 0.2 } Transform { translation 2 -1 0 } Cube { width 0.8 height 0.15 depth 0.8 } } # Cone Separator { Material { diffuseColor 0.5 0.6 0.4 specularColor 0.5 0.5 0.5 shininess 0.2 transparency 0.5 } Transform { translation 2 0.2 0 } Scale { scaleFactor 0.5 0.5 0.5 } Cone { parts ALL bottomRadius 1 height 2 } } # Cylinder Separator { Material { diffuseColor 0 0 0.7 } Transform { translation 2 -0.5 0 } Scale { scaleFactor 0.2 0.5 0.2 } Cylinder { parts ALL radius 1 height 2 } } # Sphere, this is also a link to a WWW page WWWAnchor { name "http://bourke.gen.nz/paul.html" Separator { Material { diffuseColor 0 0.7 0.7 } Transform { translation 2 1.5 0 } Sphere { radius 0.2 } } } # IndexedFaceSet Separator { ShapeHints { vertexOrdering COUNTERCLOCKWISE shapeType SOLID faceType CONVEX } Material { specularColor 0.5 0.5 0.5 shininess 0.1 diffuseColor [ 0 0 1, 1 0 0, 0.5 0.5 0.5, 0.5 0.5 0.5, 0 1 0, 0.5 0.5 0.5, ] } MaterialBinding { value PER_FACE } Coordinate3 { point [ -1 -1 -1, 1 -1 -1, 1 1 -1, -1 1 -1, -1 -1 1, 1 -1 1, 1 1 1, -1 1 1, ] } Normal { vector [ 0 -1 0, 1 0 0, 0 1 0, -1 0 0, 0 0 1, 0 0 -1, ] } NormalBinding { value PER_FACE } IndexedFaceSet { coordIndex [ 0, 1, 5, 4, -1, 1, 2, 6, 5, -1, 2, 3, 7, 6, -1, 3, 0, 4, 7, -1, 4, 5, 6, 7, -1, 0, 3, 2, 1, -1, ] } } # IndexedLineSet Separator { Material { emissiveColor [.9 .9 .9] } Coordinate3 { point [ -2 -2 0, 2 -2 0, 2 2 0, -2 2 0, ] } MaterialBinding { value OVERALL } IndexedLineSet { coordIndex [ 0, 1, 2, 3, 0, -1, ] } } # IndexedFaceSet, example of a texture Separator { ShapeHints { vertexOrdering COUNTERCLOCKWISE faceType CONVEX } Material { diffuseColor [0.2 0.2 0.2] } MaterialBinding { value PER_FACE } Coordinate3 { point [ -3 -2.1 -3, 3 -2.1 -3, 3 -2.1 3, -3 -2.1 3, ] } Normal { vector [0 0 1] } NormalBinding { value PER_FACE } Texture2 { filename "satin1.gif" wrapS REPEAT wrapT REPEAT } Texture2Transform { translation 0 0 rotation 45 scaleFactor 2 2 center 0 0 } IndexedFaceSet { coordIndex [0, 1, 2, 3, -1] } } }