http://www.cs.montana.edu/hunterl/vrml/seminar/allshapes.wrl

#VRML V2.0 utf8

#A cylinder, SPHERE, CONE, BOX

 

WorldInfo {

    title "Shapes for Cs500"

    info [ "Created by Hunter Lloyd, don't mess with it."]

}

 

DEF Entry Viewpoint{

   

    position 0 0 20

    description "Entry"

}

 

NavigationInfo {

   type "EXAMINE"

}

# CYLINDER

Transform{

  translation -3 -3 0

  children [

    Shape {

      appearance Appearance{

          material Material {}

 

      }

      geometry Cylinder {

        height 2.0

        radius 1.5

        bottom FALSE   

      }

 

    }

  ]

}

#BOX

Anchor{

url "syn8.html"

children[

Transform{

  translation  -3 3 0

     

  children [

    Shape {

      appearance Appearance{

           material Material {}

      }

      geometry Box {}

    }

  ]

}

]

}

 

#Sphere

Transform{

   translation 3 -3 0  

   children [

      Shape {

          appearance Appearance{

               material Material {}

 

          }

           geometry Sphere {

               radius 1.5

          }

      }

  ]

}

 

 

#cone

Transform{

    translation 3 3 0

    children[

    Shape {

        appearance Appearance{

            material Material {}

        }

       geometry Cone {

           height 2.0

           bottomRadius 1.5

       }

 

   }

   ]

}

 

#cone

Transform{

   translation 9 0 0

   children[

      Shape {

          appearance Appearance{

              material Material {}

          }

         geometry Cone {

              height 2.0

              bottomRadius 1.5

              side FALSE

         }

    }

  ]}


##A text example

http://www.cs.montana.edu/hunterl/vrml/seminar/text.wrl

#VRML V2.0 utf8

NavigationInfo { type "EXAMINE" }

 

DEF Entry Viewpoint{

   

    position 0 0 20

    description "Entry"

}

 

Transform {

   translation -10 5 0

   children[

   Shape {

       appearance Appearance {

           material Material { }

       }

       geometry Text {

           string [ "Hunter is cruel",

                    "in SERIF BOLD" ]

           fontStyle FontStyle {

               style "BOLD"

               family "SERIF"

              

           }

       }

   }

   ]

   }

 

Transform {

   translation 2 5 0

   children[

   Shape {

       appearance Appearance {

           material Material { }

       }

       geometry Text {

           string [ "Hunter is cruel"," ",

                    "VERTICALLY and ITALIC and TYPEWRITER" ]

           fontStyle FontStyle {

               style "ITALIC"

               horizontal FALSE

               family "TYPEWRITER"

           }

       }

   }

   ]

}

 

Transform {

   translation 6 0 0

   children[

   Shape {

       appearance Appearance {

           material Material { }

       }

       geometry Text {

           string [ "Hunter is cruel",

                    "in SANS and BOLDITALIC" ]

           fontStyle FontStyle {

               style "BOLDITALIC"

               family "SANS"

           }

       }

   }

   ]

}

 

Transform {

   translation -10 -5 0

   children[

   Shape {

       appearance Appearance {

           material Material { }

       }

       geometry Text {

           string [ "Hunter is cruel",

                    "in a default kind of way" ]

           fontStyle FontStyle {

             

           }

       }

   }

   ]

}

 

Anchor {

url "syn9.html"

children[

Transform {

  

   translation -10 0.0 0

   children[

   Shape {

       appearance Appearance {

           material Material { }

       }

       geometry Text {

           string [ "Hunter is cruel",

                    "Backwards" ]

           fontStyle FontStyle {

                 leftToRight FALSE            

           }

       }

   }

   ]

}

]

}


####Elevation example, a Polygon

http://www.cs.montana.edu/hunterl/vrml/seminar/mount.wrl

 

 

#VRML V2.0 utf8

 

WorldInfo {

     title "Elevation stuff"

     }

DEF Entry Viewpoint{

   

    position 0 0 20

    description "Entry"

}

NavigationInfo { type "EXAMINE" }

 

Anchor {

url "syn9.html"

children[

Shape {

      appearance Appearance {

            material Material { }

      }

      geometry ElevationGrid {

            xDimension  9

            zDimension  9

            xSpacing    1.0

            zSpacing    1.0

            solid       FALSE

            creaseAngle 0.785

            height [

                  0.0, 0.0, 0.5, 1.0, 0.5, 0.0, 0.0, 0.0, 0.0,

                  0.0, 0.0, 0.0, 0.0, 2.5, 0.5, 0.0, 0.0, 0.0,

                  0.0, 0.0, 0.5, 0.5, 3.0, 1.0, 0.5, 0.0, 1.0,

                  0.0, 0.0, 0.5, 2.0, 4.5, 2.5, 1.0, 1.5, 0.5,

                  1.0, 2.5, 3.0, 4.5, 5.5, 3.5, 3.0, 1.0, 0.0,

                  0.5, 2.0, 2.0, 2.5, 3.5, 4.0, 2.0, 0.5, 0.0,

                  0.0, 0.0, 0.5, 1.5, 1.0, 2.0, 3.0, 1.5, 0.0,

                  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.0, 1.5, 0.5,

                  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0,

            ]

            colorPerVertex TRUE

            color Color {

                  color [

                        0.0 0.3 1.0,  0.0 0.3 1.0,  0.0 0.5 0.1,

                        0.2 0.6 0.0,  0.0 0.5 0.1,  0.0 0.3 1.0,

                        0.0 0.3 1.0,  0.0 0.3 1.0,  0.0 0.3 1.0,

                       

                        0.0 0.3 1.0,  0.0 0.3 1.0,  0.0 0.3 1.0,

                        0.0 0.3 1.0,  0.5 0.4 0.0,  0.0 0.5 0.1,

                        0.0 0.3 1.0,  0.0 0.3 1.0,  0.0 0.3 1.0,

                       

                        0.0 0.3 1.0,  0.0 0.3 1.0,  0.0 0.5 0.1,

                        0.0 0.5 0.1,  0.5 0.4 0.0,  0.2 0.6 0.0,

                        0.0 0.5 0.1,  0.0 0.3 1.0,  0.2 0.6 0.0,

                       

                        0.0 0.3 1.0,  0.0 0.3 1.0,  0.0 0.5 0.1,

                        0.4 0.3 0.1,  0.7 0.7 0.7,  0.5 0.4 0.0,

                        0.2 0.6 0.1,  0.3 0.6 0.6,  0.0 0.5 0.1,

                       

                        0.2 0.6 0.0,  0.5 0.4 0.0,  0.5 0.4 0.0,

                        0.7 0.7 0.7,  0.8 0.8 0.8,  0.5 0.5 0.7,

                        0.5 0.5 0.7,  0.2 0.6 0.0,  0.0 0.3 1.0,

                       

                        0.0 0.5 0.1,  0.2 0.6 0.1,  0.2 0.6 0.1,

                        0.2 0.6 0.1,  0.5 0.5 0.7,  0.7 0.7 0.7,

                        0.5 0.4 0.0,  0.0 0.5 0.1,  0.0 0.3 1.0,

                       

                        0.0 0.5 0.1,  0.0 0.3 1.0,  0.0 0.5 0.1,

                        0.2 0.6 0.1,  0.2 0.6 0.0,  0.5 0.4 0.0,

                        0.5 0.5 0.7,  0.2 0.6 0.0,  0.0 0.3 1.0,

                       

                        0.0 0.3 1.0,  0.0 0.3 1.0,  0.0 0.3 1.0,

                        0.0 0.3 1.0,  0.0 0.3 1.0,  0.0 0.5 0.1,

                        0.5 0.4 0.0,  0.2 0.6 0.0,  0.0 0.5 0.1,

                       

                        0.0 0.3 1.0,  0.0 0.3 1.0,  0.0 0.3 1.0,

                        0.0 0.3 1.0,  0.0 0.3 1.0,  0.0 0.3 1.0,

                        0.0 0.5 0.1,  0.0 0.3 1.0,  0.0 0.3 1.0,

                  ]

            }

      }

}

]

}

 

 


####

#http://www.cs.montana.edu/hunterl/vrml/seminar/lightng.wrl

#VRML V2.0 utf8

NavigationInfo { type "EXAMINE" }

Background {

     skyColor [

         0.0 0.8 0.8,

         0.0 0.8 0.8,

         0.4 0.4 0.0,

         0.4 0.0 0.0,

     ]

     skyAngle [

         1.371,

         1.571,

         1.771,

     ]

}

#bolt #1

Transform{

  translation -5 -5 -6

  rotation 0 1 0 .78

children[

Shape {

      appearance Appearance {

            material Material {

                  diffuseColor 1.0 1.0 0.0

            }

      }

      geometry IndexedFaceSet {

                coord DEF C Coordinate {

                  point [

                  # Lighting bolt tip

                        0.0  0.0  0.0,

                  # Front perimeter

                        5.5  5.0  0.88,

                        4.0  5.5  0.968,

                        7.0  8.0  1.408,

                        4.0  9.0  1.584,

                        1.0  5.0  0.88,

                        2.5  4.5  0.792,

                  # Back perimeter

                        5.5  5.0 -0.88,

                        4.0  5.5 -0.968,

                        7.0  8.0 -1.408,

                        4.0  9.0 -1.584,

                        1.0  5.0 -0.88,

                        2.5  4.5 -0.792,

                  ]

            }

            coordIndex [

            # Front

                  0,  1,  2,  3,  4,  5,  6, -1,

            # Back

                  0, 12, 11, 10,  9,  8,  7, -1,

            # Sides

                  0,  7,  1, -1,

                  1,  7,  8,  2, -1,

                  2,  8,  9,  3, -1,

                  3,  9, 10,  4, -1,

                  4, 10, 11,  5, -1,

                  5, 11, 12,  6, -1,

                  6, 12,  0, -1,

            ]

            convex FALSE

      }

}

Transform{

  translation 7 0 3

  children [

     

       Shape{

           appearance Appearance{

                material Material {

                       diffuseColor 1 1 0

                }

          }

          geometry IndexedLineSet {

              coord USE C

            coordIndex [

            # Front

                  0,  1,  2,  3,  4,  5,  6, -1,

            # Back

                  0, 12, 11, 10,  9,  8,  7, -1,

            # Sides

                  0,  7,  1, -1,

                  1,  7,  8,  2, -1,

                  2,  8,  9,  3, -1,

                  3,  9, 10,  4, -1,

                  4, 10, 11,  5, -1,

                  5, 11, 12,  6, -1,

                  6, 12,  0, -1,

            ]

 

         }

       }

     ]

  }

 ]

}


#http://www.cs.montana.edu/hunterl/vrml/seminar/lights/light1.wrl

 

#VRML V2.0 utf8

 

DirectionalLight {

    direction 1 0 0

}

 

DirectionalLight {

    direction -1 0 0

}

 

Anchor {

  url "light2.wrl"

   children[

     Transform {

       translation -2 0 0

       children Shape {

           appearance Appearance {

                material Material { diffuseColor 0.3 0.3 0 }

           }

           geometry Cone { }

       }

     }

   ]

}

Transform {

    translation 2 0 0

    children Shape {

        appearance Appearance {

            material Material { diffuseColor 0 0 0.4 }

        }

        geometry Sphere { }

    }

}

 

 

#http://www.cs.montana.edu/hunterl/vrml/seminar/lights/light2.wrl

#VRML V2.0 utf8

 

 

Anchor{

url "../light.html"

children[

 

Transform {

    translation -2 0 0

    children [

        DirectionalLight {

            direction 1 0 0

        }

        Shape {

            appearance Appearance {

                material Material { diffuseColor 0.3 0.3 0 }

            }

            geometry Cone { }

        }

    ]

}

]

}

Transform {

    translation 2 0 0

    children [

        DirectionalLight {

            direction -1 0 0

        }

        Shape {

            appearance Appearance {

                material Material { diffuseColor 0 0 0.4 }

            }

            geometry Sphere { }

        }

    ]

}

#VRML V2.0 utf8

 

NavigationInfo {

   type "EXAMINE"

   headlight FALSE

}

 

#cone1

Anchor{

url "../light.html"

children[

Transform {

    translation -2 0 1

    children [

             

        Shape {

            appearance Appearance {

                material Material { diffuseColor 0.7 0.7 0.3 }

            }

            geometry Cone { }

        }

    ]

}

]

}

 

#cone2

Transform {

    translation 2 0 1

    children [

      

        Shape {

            appearance Appearance {

                material Material { diffuseColor 0.7 0.7 0.3 }

            }

            geometry Cone { }

        }

    ]

}

#cone3

Transform {

    translation 0 0 -3

    children [

        DirectionalLight {

            direction 1 0 0

        }

        Shape {

            appearance Appearance {

                material Material { diffuseColor 0.7 0.7 0.3 }

            }

            geometry Cone { }

        }

    ]

}

 

Anchor{

url "../light.html"

children[

Transform {

    translation 0 2 0

    children [

        PointLight {

            color 1 1 1

            location 0 0 0

            on TRUE

        }

        Shape {

            appearance Appearance {

                material Material { emissiveColor 1.0 1.0 1.0  }

            }

            geometry Sphere { radius .5 }

        }

    ]

  }

]

}

 

Transform{

   translation 0 3.0 0

   children [

       Shape {

          appearance Appearance {

              material Material { }

          }

          geometry Cone {

             bottom        FALSE

             bottomRadius .8

             height        2.5

          }

       }

   ]}

 

#http://www.cs.montana.edu/hunterl/vrml/seminar/lights/light4.wrl

 

#VRML V2.0 utf8

 

WorldInfo {

   title "Hunter's world"

   info [ "Created by Hunter Lloyd, don't mess with it."]

}

 

DEF start Viewpoint {

   position 0 2 15

   description "Entry"

}

 

NavigationInfo {

      type ["EXAMINE"]

      headlight TRUE

      speed 2.0

}

 

Anchor {

   url "../light.html"

children [

Transform {

    translation -11.5 0.0 -11.5

    children [ Shape {

        appearance Appearance {

            material Material {

                ambientIntensity 0.5

                diffuseColor 1.0 0.5 0.5

            }

         }

         geometry ElevationGrid {

            xDimension 8

            zDimension 8

            xSpacing   3.0

            zSpacing   3.0

            solid      FALSE

            height [

               0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

               0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0         

               0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

               0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

               0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

               0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

               0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

               0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

               0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0

            ]

         }

     }

   ]

}

]

}

 

SpotLight {

   ambientIntensity 1

   beamWidth 1.570796

   cutOffAngle .78

   color  1 1 1

   direction 0 -1 0

   intensity 1

   location 1 1 0

   on       TRUE

   radius   100

}

 

 

 

 

http://www.cs.montana.edu/hunterl/vrml/seminar/slabs.wrl

 

#VRML V2.0 utf8

 

#  the main shading color (diffuseColor), glow color (emissiveColor), and

#  transparency level of a shape.

#

#  Seven slabs are created, each using a Box node.  Each slab is shaded

#  a different material:

#

#        Slab       Diffuse     Emissive    Transparency

#        White      white       black       0.0

#        Red        black       red         0.0

#        Green      green       black       0.5

#        Blue       blue        white       0.25

#        Yellow     yellow      black       0.5

#        Cyan       cyan        black       0.0

#        Magenta    red         magenta     0.0

#

#  Some PC browsers may not support transparency.  Others may not support

#  shading using both diffuse and emissive colors.  So, your results may

#  vary.

#

#  Things to experiment with:

#        Try different transparency levels.

#

#        Turn off the headlight on your VRML browser and observe which

#        slabs glow.

#

 

 

DEF Entry Viewpoint {

    position 0.0 1.6 20.0

    description "Entry View"

}

 

NavigationInfo {

    type "EXAMINE"

    headlight TRUE

}

 

Background {

    skyColor [ 0.0 0.0 0.0 ]

}

 

#

#  Slabs

#

# White slab (shaded)

Anchor{

  url "slabs2.wrl"

  children[

Transform {

    translation 0.0 2.0 4.0

    children [

                Shape {

                    appearance Appearance {

                                material Material {

                    diffuseColor 1.0 0.0 0.0

                                }

                    }

                    geometry DEF Slab Box {

                                size 2.0 4.0 0.3

                    }

                }

    ]

}

]

}

 

# Red slab (emissive)

Transform {

    translation 0.0 2.0 0.0

    children [

                Shape {

                    appearance Appearance {

                                material Material {

                                    diffuseColor  0.0 0.0 0.0

                                    emissiveColor 1.0 0.0 0.0

                                }

                    }

                    geometry DEF Slab Box {

                                size 2.0 4.0 0.3

                    }

                }

    ]

}

 

# Green slab (shaded + transparent)

Transform {

    translation -3.0 2.0 2.0

    children [

                Shape {

                    appearance Appearance {

                                material Material {

                                    diffuseColor 0.0 1.0 0.0

                                    transparency 0.5

                                }

                    }

                    geometry USE Slab

                }

    ]

}

 

# Blue slab (shaded + emissive + transparent)

Transform {

    translation 4.0 2.0 -2.0

    children [

                Shape {

                    appearance Appearance {

                                material Material {

                                    diffuseColor 0.2 0.2 0.2

                                    emissiveColor 0.0 0.0 0.8

                                    transparency 0.25

                                }

                    }

                    geometry USE Slab

                }

    ]

}

 

# Yellow slab (shaded + transparent)

Transform {

    translation 4.5 2.0 3.0

    children [

                # Outer

                Shape {

                    appearance Appearance {

                                material Material {

                                    diffuseColor 1.0 1.0 0.0

                                    transparency 0.5

                                }

                    }

                    geometry USE Slab

                }

    ]

}

 

# Cyan slab (shaded)

Transform {

    translation -3.5 2.0 -5.0

    children [

                Shape {

                    appearance Appearance {

                                material Material {

                                    diffuseColor 0.0 1.0 1.0

                                }

                    }

                    geometry USE Slab

                }

    ]

}

 

# Magenta slab (shaded + emissive)

Transform {

    translation 2.0 2.0 -6.0

    children [

                Shape {

                    appearance Appearance {

                                material Material {

                                    diffuseColor 0.5 0.0 0.0

                                    emissiveColor 0.5 0.0 0.5

                                }

                    }

                    geometry USE Slab

                }

    ]

}

 

 

http://www.cs.montana.edu/hunterl/vrml/seminar/can.wrl

 

#VRML V2.0 utf8

NavigationInfo { type "EXAMINE" }

 

Shape {

    appearance Appearance {

      material Material { }

      texture ImageTexture { url "cantop.jpg" }

    }

    geometry Cylinder {

      height      2.7

      side  FALSE

      bottom      FALSE

    }

}

Shape {

    appearance Appearance {

      material Material { }

      texture ImageTexture { url "canbot.jpg" }

    }

    geometry Cylinder {

      height      2.7

      side  FALSE

      top   FALSE

    }

}

Shape {

    appearance Appearance {

      material Material { }

      texture ImageTexture { url "canlabel.jpg" }

    }

    geometry Cylinder {

      height      2.8

      top   FALSE

      bottom      FALSE

    }

}