#VRML V2.0 utf8 # #
#[return] #

#ex-switch.wrl
#sept. 16, 97
# example of Switch node : the example (the same of geometry) defines
#  5 geometric objects : (0)a red box ; (1) a  green cone; (2) an yellow 
#                         sphere ; (3) a blue cylinder; (4) a text.
#  The parameter  whichChoice will define the actual displayed object


# Camera
Viewpoint {
   position    0 5 18
   orientation 1 0 0 -0.24
   fieldOfView 0.785398
}

# Illumination
PointLight{
           location 0 10 0
           }

Switch {
  whichChoice 4
  choice [
# A red box
Transform {
	translation 8 0 0
	children [
		Shape {
		    geometry Box { size .5 1 1 }
		    appearance Appearance {
		        	material Material {
					   diffuseColor 1 0 0
					           }
					   }
			}
		 ]
           }

#A green cone
# as bottom is FALSE we can not see the bottom and the cone will
#  be rendered not appropriatly
Transform {
	translation 0 5 0
# rotate on x to "show" bottom
        rotation -1 0 0 1
	children [
		Shape {
		    geometry Cone {  bottomRadius 1
                                     height 3
                                     side TRUE
                                     bottom FALSE }
		    appearance Appearance {
			material Material {
					   diffuseColor 0 1 0
					   }
					  }
			}
		 ]
	}

# An yellow sphere
Transform {
	translation -8 0 0
	children [
		Shape {
		    geometry Sphere { radius 0.7 }
		    appearance Appearance {
				   material Material {
						diffuseColor 1 1 0
						      }
					    }
		      }	
	         ]
	   }

# A blue cylinder
# note that the cylinder has no top cap (top FALSE)
Transform {
	translation 0 0 3
	children [
		Shape {
		    geometry Cylinder { 
                                         bottom TRUE
                                         height 3
                                         side TRUE
                                         top TRUE }
		    appearance Appearance {
			material Material {
					   diffuseColor 0 0 1
					   }
					  }
			}
		 ]
	}

# Text

Transform {
       translation 0 -5 0
       children [
             Shape {
                 geometry Text {
                                 string [" test "]
                                 fontStyle FontStyle {
                                          style "ITALIC"
                                          justify "MIDDLE"
                                                      }
                                 length [6]
                                 maxExtent 10
                                }
                    }
                  ]
            }
  ]
 }
#