<<   Verschiedene Skripte (ungeordnet) >>

#VRML V2.0 utf8

#Beispiel 01
#die erste Zeile MUSS ganz genau so aussehen, keine Abweichung moeglich!!
#die einfachen geometrischen Objekte in Grundstellung:
#Koerpermittelpunkt bzw. Mittelpunkt der Achsenstrecke im Ursprung
#Farben: rot-gruen-blau, Anteil jeweils von 0 bis 1(=100%)

Background { skyColor 0.5 0.5 1.0 }
Shape
  { appearance Appearance   { material Material {} }   
    geometry   Cone         { bottomRadius 2.0 height 8.0 }
  }
Shape 
  { appearance Appearance   { material Material { diffuseColor 1.0 0.5 0} }
    geometry   Cylinder     { radius 1 height 6.0 }
  }  
Shape 
  { appearance Appearance   { material Material { emissiveColor 0.0 0.0 1.0} }
    geometry   Sphere       { radius 2}
  }  
Shape 
  { appearance Appearance   { material Material { diffuseColor 1.0 0.0 0.0} }
    geometry   Box          { size 5 0.1 5}
  }  
#VRML V2.0 utf8

#Beispiel 02
#Bewegungen von Grundkoerpern
#Syntax: Transform { children [ ... ] translation .. .. .. }
#Moeglichkeiten: translation mit Schiebungsvektor, 
#rotation mit Drehachse und Winkel und 
#scale mit drei Zahlen, die die Massstabsaenderungen auf den 
#Koordinatenachsen angeben.  

Background { skyColor 0.6 0.6 0.6 }
Shape 
  { appearance Appearance 
    { material Material    {diffuseColor 1 0 0  transparency 0.3 } }
      geometry   Box       { size 3 0.5 5 }
  }  
Transform  
  { children
      [ Shape 
          { appearance Appearance { material Material  { diffuseColor  0 0.4 0.4  specularColor  0 1 1 shininess  0.8 } }
            geometry   Sphere     { radius 1.0 }
          }
      ] 
      translation 0 2 0
  }
Transform
  { children
      [ Shape 
          { appearance Appearance { material Material  { diffuseColor 0.6 0.2 0.4 } }
            geometry   Cylinder   { radius 1 height 4}
          }
      ] 
      rotation 0 0 1  1.57
  }
#VRML V2.0 utf8

#Beispiel 06
#Das Flaechenmodell eines Polyeders: Jeder Punkt erhaelt eine eigene Farbe. 
#colorPerVertex TRUE gestaltet Farbuebergaenge.

Background { skyColor 0.3 0.3 0.3 }

Shape 
  { appearance Appearance { material Material {} }
    geometry   IndexedFaceSet 
               { solid FALSE
                 coord Coordinate 
                 { point [  2, 2,0,  -2, 2,0,   -2,-2,0,  2,-2,0, 0, 0,3  ] 
                 }
                 coordIndex  
                  [  0,1,4,0,-1,  1,2,4,1,-1,  2,3,4,2,-1,  3,0,4,3,-1 ] 
                 colorPerVertex TRUE   
                 color Color { color [  0 0 1   0 1 0   0 0 1   0 1 0   1 0 0 ] }
               } 
  } 
#VRML V2.0 utf8

#Beispiel 07
#Drehkegel in verschiedenen Lagen

DEF meinKegel Shape 
   { appearance Appearance { material Material  { diffuseColor 1 0 1  transparency 0.1 } } 
     geometry   Cone       { bottomRadius 2 height 4 side TRUE bottom TRUE }
   } 
Transform 
   {  translation  -3 0 0    rotation      1 0 0   1.571   children [ USE meinKegel ]  } 
Transform 
   { translation    3 0 0    rotation      1 0 0  -1.571   children   [ USE meinKegel ] 
   } 
#VRML V2.0 utf8

#Beispiel 08
#Entwurf einer Treppe

DEF  Stufe Group 
  {  children 
     [  Shape
        {  geometry   Box {size 4 1 0.1}
           appearance Appearance { material Material { diffuseColor 1 0 0 } }
        }
        Shape
        {  geometry   Box {size 3 0.4 0.2}
           appearance Appearance { material Material { diffuseColor 0 1 0 } }
        }
     ]
  }

DEF  Stiege Group     
  {   children 
     [  Transform { children [USE Stufe]  translation 0 1 0.5 }
        Transform { children [USE Stufe]  translation 0 2 1.0 }
        Transform { children [USE Stufe]  translation 0 3 1.5 }
     ]
  }
#VRML V2.0 utf8

#Beispiel 17
#Ein TouchSensor wird durch Anklicken in den Zustand isActive #versetzt und aktiviert ueber ROUTE die Lichtquelle L

 Group 
 { children 
   [ Shape 
     { geometry Sphere {radius 2}
       appearance Appearance 
       { material Material { diffuseColor 1 0 0.4 } }
     }
     DEF T TouchSensor {}
   ] 
 }

 DEF L PointLight { location -5 4 1  on FALSE }

 ROUTE T.isActive TO L.on

 

 
#VRML V2.0 utf8

#Beispiel 20
#Ein Zylinder Sensor oeffnet eine Tuere in einer Wand

NavigationInfo {type "EXAMINE" headlight TRUE}         

Transform 
{ translation -1 1.5 0
  children 
  [  DEF Dreher CylinderSensor {minAngle -1.5 maxAngle 1.5 }
     DEF Objekt Transform 
     { children 
       [ Transform 
         { translation 1 -2 0 
           children 
           [ Shape { appearance Appearance { material Material { diffuseColor 1 0 1 } } 
                     geometry   Box { size 2 3 0.2}
                   }
           ]
         }
       ] 
     }
  ] 
}

DEF Wand Transform 
{ children 
  [ Shape { appearance Appearance  { material Material { diffuseColor 0 1 1 } } 
            geometry   Box { size 4 4 0.2}
          }
  ] 
  translation 3 0 0
}

Transform { children [ USE Wand ]  translation -6 0 0   }

ROUTE Dreher.rotation_changed TO Objekt.set_rotation
#VRML V2.0 utf8
# Mit Switch { choice [ ... ] } koennen vorläufig unsichtbare Objekte definiert werden, die
# dann bei Bedarf zur Verfuegung stehen
 
Switch 
{  choice 
   [  DEF Hugo Shape 
      {  appearance Appearance{ material Material { diffuseColor  1 0.5 0.5  }  } 
         geometry   Sphere {radius 2} 
      } 
      DEF Anton Shape 
      {  appearance Appearance{ material  Material { diffuseColor   0.3 0.7 1}  } 
          geometry   Box { size 1 4 1} 
      } 
      DEF Franz Shape 
      {   appearance Appearance{ material Material { diffuseColor  0 1 0.5  }   } 
          geometry   Cylinder {radius 2 height 0.5} 
        } 
      ] 
} 

Transform {  translation 3 0 0    children [ USE Hugo  ] }
Transform {  translation 3 3 0    children [ USE Franz ] }
Transform {  translation 0 3 0    children [ USE Anton ] }
#VRML V2.0 utf8

WorldInfo {
        title " Eine Rutsche "
        info [" VRML 2.0-Tutorial, Robert Warnke","Homepage: http://rowa.giso.de "]
}

Shape {
        appearance Appearance { material Material { } }
        geometry Extrusion { creaseAngle 1.57  endCap  FALSE   beginCap  FALSE   solid  FALSE
                crossSection 
                [ -1  0,   -0.92 -.38,   -0.71 -0.71,   -0.38 -0.92,
                   0 -1,    0.38 -.92,    0.71 -.71,    .92 -.38,   1 0,
                ]
                # Spirale
                spine 
                [    2     0    -0,        1.85  0.12 -.77,  
                     1.41  0.24 -1.41,     0.77  0.36 -1.85, 
                     0     0.48 -2,       -0.77  0.60 -1.85,
                    -1.41  0.72 -1.41,    -1.85  0.84 -0.77,  
                    -2     0.97  0,       -1.85  1.08  0.77,
                    -1.41  1.20  1.41,    -0.77  1.32  1.85,
                     0     1.44  2,        0.77  1.56  1.85, 
                     1.41  1.68  1.41,     1.85  1.80  0.77,  
                     2     1.92  0,        1.85  2.04 -0.77,
                     1.41  2.16 -1.41,     0.77  2.28 -1.85,
                     0     2.40 -2,       -0.77  2.52 -1.85,  
                    -1.41  2.64 -1.41,    -1.85  2.76 -0.77,  
                    -2     2.88  0,       -1.85  3.00  0.77,
                    -1.41  3.12  1.41,    -0.77  3.24  1.85, 
                     0     3.36  2,        0.77  3.48  1.85,   
                     1.41  3.60  1.41,     1.85  3.72  0.77,    
                     2     3.84  0,
                ] 
        }
}
#VRML V2.0 utf8

Viewpoint { jump FALSE description "Starting Point" }

Group { 
    children 
    [   DirectionalLight { direction 0 -1 0 }
        Transform 
        {   translation -8 0 10
            children 
            Shape { appearance Appearance { material Material { transparency 0.5 } }
                    geometry Sphere { radius 1}
                  }
        }
        Transform 
        {   translation 0 -1 0
            children 
            Shape { appearance Appearance { material Material { diffuseColor 0 1 0 } }
                    geometry Box { size 30 0.2 30 }
                  }
        }  
        Transform 
        {   translation 2 0 0 
            children 
            Shape { appearance Appearance { material Material { diffuseColor 0 0.2 0.7 } }
                    geometry Cylinder { }
                  }
        }

        DEF GuideTransform Transform 
        {   children 
            [   DEF TourGuide Viewpoint { jump FALSE },
                DEF ProxSensor ProximitySensor { size 50 50 50 }
                DEF StartTour TouchSensor { },
                Transform 
                {   translation 0.6 0.4 8
                    children 
                    Shape  
                    {   appearance Appearance { material Material { diffuseColor 1 0.6 0 } }
                        geometry Sphere { radius 0.2 } 
                    } 
                }
            ]
        }
    ]
}

DEF GuidePI PositionInterpolator {
    key      [ 0       0.2     0.3      0.5      0.6       0.8      0.9     1 ]
    keyValue [ 0 0 0   0 0 -5  2 0 -5   2 6 -15  -4 6 -15  -4 0 -5  0 0 -5  0 0 0
    ]
}

DEF GuideRI OrientationInterpolator {
    key      [ 0,       0.2,     0.3,       0.5,     0.6,       0.8,     0.9,     1 ]
    keyValue [ 0 1 0 0, 0 1 0 0, 0 1 0 1.2, 0 1 0 3, 0 1 0 3.5, 0 1 0 5, 0 1 0 0, 0 1 0 0, 
    ]
}

DEF TS TimeSensor { cycleInterval 30 } # 60 second tour

ROUTE ProxSensor.isActive TO StartTour.set_enabled
ROUTE StartTour.touchTime TO TS.startTime
ROUTE TS.isActive TO TourGuide.set_bind
ROUTE TS.fraction_changed TO GuidePI.set_fraction
ROUTE TS.fraction_changed TO GuideRI.set_fraction
ROUTE GuidePI.value_changed TO GuideTransform.set_translation
ROUTE GuideRI.value_changed TO GuideTransform.set_rotation
#VRML V2.0 utf8

Viewpoint { jump FALSE description "Starting Point" }

Group { 
    children 
    [   DirectionalLight { direction 0 -1 0 }
        Transform 
        {   translation -8 0 10
            children 
            Shape { appearance Appearance { material Material { transparency 0.5 } }
                    geometry Sphere { radius 1}
                  }
        }
        Transform 
        {   translation 0 -1 0
            children 
            Shape { appearance Appearance { material Material { diffuseColor 0 1 0 } }
                    geometry Box { size 30 0.2 30 }
                  }
        }  
        Transform 
        {   translation 2 0 0 
            children 
            Shape { appearance Appearance { material Material { diffuseColor 0 0.2 0.7 } }
                    geometry Cylinder { }
                  }
        }

        DEF GuideTransform Transform 
        {   children 
            [   DEF TourGuide Viewpoint { jump FALSE },
                DEF ProxSensor ProximitySensor { size 50 50 50 }
                DEF StartTour TouchSensor { },
                Transform 
                {   translation 0.6 0.4 8
                    children 
                    Shape  
                    {   appearance Appearance { material Material { diffuseColor 1 0.6 0 } }
                        geometry Sphere { radius 0.2 } 
                    } 
                }
            ]
        }
    ]
}

DEF GuidePI PositionInterpolator {
    key      [ 0       0.2     0.3      0.5      0.6       0.8      0.9     1 ]
    keyValue [ 0 0 0   0 0 -5  2 0 -5   2 6 -15  -4 6 -15  -4 0 -5  0 0 -5  0 0 0
    ]
}

DEF GuideRI OrientationInterpolator {
    key      [ 0,       0.2,     0.3,       0.5,     0.6,       0.8,     0.9,     1 ]
    keyValue [ 0 1 0 0, 0 1 0 0, 0 1 0 1.2, 0 1 0 3, 0 1 0 3.5, 0 1 0 5, 0 1 0 0, 0 1 0 0, 
    ]
}

DEF TS TimeSensor { cycleInterval 30 } # 60 second tour

ROUTE ProxSensor.isActive TO StartTour.set_enabled
ROUTE StartTour.touchTime TO TS.startTime
ROUTE TS.isActive TO TourGuide.set_bind
ROUTE TS.fraction_changed TO GuidePI.set_fraction
ROUTE TS.fraction_changed TO GuideRI.set_fraction
ROUTE GuidePI.value_changed TO GuideTransform.set_translation
ROUTE GuideRI.value_changed TO GuideTransform.set_rotation
#VRML V2.0 utf8

DEF Schmal Group{
children [
Transform { translation  0 0 0   children [ Inline { url "saeule1.wrl" } ] }
Transform { translation  1.6 0 0 children [ Inline { url "saeule1.wrl" } ] }
Transform { translation  3.2 0 0 children [ Inline { url "saeule1.wrl" } ] }
Transform { translation  4.8 0 0 children [ Inline { url "saeule1.wrl" } ] }
Transform { translation  6.4 0 0 children [ Inline { url "saeule1.wrl" } ] }
Transform { translation  8 0 0   children [ Inline { url "saeule1.wrl" } ] }
         ] }

DEF langli Group {
children [ Transform { translation   9.6 0 0 children [ USE Schmal ]}
           Transform { translation  19.2 0 0 children [ Inline     {url "saeule1.wrl"}]}]}

DEF langre Group {
children [ Transform { translation   0   0 8 children [ USE Schmal ]}
           Transform { translation   9.6 0 8 children [USE Schmal] }
           Transform { translation  19.2 0 8 children [ Inline     {url "saeule1.wrl"}]}]}

DEF schmalvorn Group {
children [Transform { rotation 0 1 0 -1.57 children [ USE Schmal]}]}

DEF schmalhintn Group {
children [Transform { translation 19.2 0 0 children [ USE schmalvorn ]}]}
#VRML V2.0 utf8  

 Transform 
 { children  
   Shape         { appearance Appearance { material Material {}}  
   geometry Extrusion { endCap FALSE beginCap FALSE solid FALSE
   crossSection 
 [  3       0,    2.97  0.39,   2.89  0.78,   2.77  1.14,   2.59  1.50,   2.38  1.82,   2.12  2.12,   
    1.82  2.38,   1.50   2.59,  1.14  2.77,   0.78  2.89,   0.39  2.97,   0     3,     -0.39  2.97, 
   -0.78  2.89,  -1.14  2.77,  -1.50  2.59,  -1.82  2.38,  -2.12  2.12,  -2.38  1.82,  -2.59  1.50,  
   -2.77  1.14,  -2.89  0.78,  -2.97  0.39,  -3     0,     -2.97 -0.39,  -2.89 -0.78,  -2.77 -1.14, 
   -2.59 -1.50,  -2.38 -1.82,  -2.12 -2.12,  -1.82 -2.38,  -1.50 -2.59,  -1.14 -2.77,  -0.78 -2.89,  
   -0.39 -2.97,   0    -3,      0.39 -2.97,   0.78 -2.89,   1.14 -2.77,   1.50 -2.59,   1.82 -2.38,   
    2.12 -2.12,   2.38 -1.82,   2.59 -1.50,   2.77 -1.14,   2.89 -0.78,   2.97 -0.39,   3     0  
  ]  
spine 
[ 0    0   0,  0 -0.130 0, 0 -0.258 0, 0 -0.382 0, 
  0   -0.5 0,  0 -0.608 0, 0 -0.707 0, 0 -0.793 0,
  0 -0.866 0,  0 -0.923 0, 0 -0.965 0, 0 -0.991 0, 
  0    -1  0,  0 -0.991 0, 0 -0.965 0, 0 -0.923 0, 
  0 -0.866 0,  0 -0.793 0, 0 -0.707 0, 0 -0.608 0, 
  0  -0.5  0,  0 -0.382 0, 0 -0.258 0, 0 -0.130 0, 
  0    0   0 ]
scale 
[  1     1    , 0.997 0.997, 0.988 0.988, 0.974 0.974, 
   0.955 0.955, 0.931 0.931, 0.902 0.902, 0.869 0.869, 
   0.833 0.833, 0.794 0.794, 0.752 0.752, 0.710 0.710, 
   0.666 0.666, 0.623 0.623, 0.580 0.580, 0.539 0.539, 
   0.5   0.5  , 0.463 0.463, 0.430 0.430, 0.402 0.402, 
   0.377 0.377, 0.358 0.358, 0.344 0.344, 0.336 0.336, 
   0.333 0.333 ] 
    }  
  } 
} 

<<     >>