#VRML V2.0 utf8 # SardineProto.wrl # Ildeniz Duman, 1998, for Kelp Forest Project # This is a proto for a sardine PROTO SardineProto[ exposedField MFString skinTexture [ "sardineScalesPatch.jpg" ] exposedField SFVec3f fishScale 0.3 0.25 0.25 exposedField SFColor fishDifColor 0.7 0.7 0.7 ] { Transform{ scale IS fishScale children[ DEF MySardine Transform{ translation 5 0 0 #rotation 1 0 0 90 children [ Shape { appearance Appearance { material Material { diffuseColor IS fishDifColor } texture ImageTexture{ url IS skinTexture } } geometry DEF FISH_SHAPE Extrusion { creaseAngle 1.57 crossSection [ -0.1 1.0 ,0.1 1,0.5 0.5, 0.5 -0.5, 0.1 -1,-0.1 -1, -0.5 -0.5, -0.5 0.5, -0.1 1 ] spine [ 0 2.51 0, 0 1.80 0, 0 0.5 0, 0 0 0, 0 -0.6 0 ] scale[ 0.03 0.03 0.3 0.4, 0.1 0.2, 0.1 0.15, 0.03 0.4, ] } } Shape { appearance DEF FIN_SKIN Appearance { material Material { diffuseColor 0.5 0.5 0.5 transparency 0.2 } } } Transform{ translation 2.3 0.1 0.1 children DEF EYE Shape{ appearance Appearance { material Material { shininess 1 diffuseColor 0.5 0.5 0.5 specularColor 0.3 0.3 0.3 } } geometry Sphere{ radius 0.04 } } } Transform{ translation 2.3 0.1 -0.1 children USE EYE } Transform{ #Mouth scale 2.6 1 0.7 translation 2.45 0 0 children USE EYE } DEF LEFT_PECTORAL Transform{ translation 1.85 -0.15 -0.1 children Shape{ appearance USE FIN_SKIN geometry IndexedFaceSet { coord Coordinate{ point[ 0 0 0, 0.2 0 0, -0.2 0 -0.2, ] } coordIndex[ 0, 1, 2, -1 ] solid FALSE } } } DEF RIGHT_PECTORAL Transform{ translation 1.85 -0.15 0.1 children Shape{ appearance USE FIN_SKIN geometry IndexedFaceSet { coord Coordinate{ point[ 0 0 0, 0.2 0 0, -0.2 0 0.2, ] } coordIndex[ 0, 1, 2, -1 ] solid FALSE } } } ] } DEF TIMER TimeSensor { #default cycleInterval 1 loop TRUE } DEF WAGGLER CoordinateInterpolator { key [ 0.0, 0.15,0.28,0.4,0.55,0.7,0.85,1] keyValue [ # time 0.0 position 2.51 0 0, 1.80 0 0, 0.5 0 0, 0 0 0, -0.6 0 0, # time 0.15 position 2.51 0 0, 1.80 0 0, 0.5 0 .1 , 0 0 0.3 , -0.6 0 0.5 , # time 0.28 position 2.51 0 0, 1.80 0 0, 0.5 0 0, 0 0 0, -0.6 0 0, #time 0.4 2.51 0 0, 1.80 0 0, 0.5 0 -0.1, 0 0 -0.3, -0.6 0 -0.5, #time .55 2.51 0 0, 1.80 0 0, 0.5 0 0, 0 0 0, -0.6 0 0, #time 0.7 2.51 0 0, 1.80 0 0, 0.5 0 0.1, 0 0 0.3, -0.6 0 0.5, #time 0.85 2.51 0 0, 1.80 0 0, 0.5 0 0, 0 0 0, -0.6 0 0, #time 1 2.51 0 0, 1.80 0 0, 0.5 0 -0.1, 0 0 -0.3, -0.6 0 -0.5, ] } DEF LEFT_PECTORAL_ROT OrientationInterpolator{ key[ 0 0.3 0.7 1 ] keyValue[ 1 0 0 -30 1 0 0 0 1 0 0 0 1 0 0 -30 ] } DEF RIGHT_PECTORAL_ROT OrientationInterpolator{ key[ 0 0.3 0.7 1 ] keyValue[ 1 0 0 -30 1 0 0 0 1 0 0 0 1 0 0 -30 ] } # orbiting time DEF OrbitClock TimeSensor {# route period cycleInterval 30.0 loop TRUE }, DEF Orbit OrientationInterpolator{# fish path key [0.0 , 0.25, 0.5, 0.750, 1] keyValue[ 0 1 0 6.28 # 360 0 1 0 1.57 # 90 0 1 0 3.14 # 180 0 1 0 4.71 # 270 0 1 0 6.28 # 360 ] }, DEF SardinePath PositionInterpolator{ key [0.0 , 0.125, 0.25, 0.375, 0.5, 0.625, 0.750, 0.875,1] keyValue [5 0 0, 5 0 -5, 0 0 -5, -5 0 -5, -5 0 0 , -5 0 5, 0 0 5, 5 0 5, 5 0 0] } ] } ROUTE TIMER.fraction_changed TO WAGGLER.set_fraction ROUTE WAGGLER.value_changed TO FISH_SHAPE.set_spine ROUTE TIMER.fraction_changed TO LEFT_PECTORAL_ROT.set_fraction ROUTE LEFT_PECTORAL_ROT.value_changed TO LEFT_PECTORAL.set_rotation ROUTE TIMER.fraction_changed TO RIGHT_PECTORAL_ROT.set_fraction ROUTE RIGHT_PECTORAL_ROT.value_changed TO RIGHT_PECTORAL.set_rotation ROUTE OrbitClock.fraction_changed TO Orbit.set_fraction ROUTE OrbitClock.fraction_changed TO SardinePath.set_fraction ROUTE Orbit.value_changed TO MySardine.set_rotation ROUTE SardinePath.value_changed TO MySardine.set_translation } # end of file SardineProto.wrl