#VRML V2.0 utf8 # Kelp - a single strand # Drawing an extruded shape # Uses an inline node: bulb.wrl # # 5/12 - replaced stipe (stem) extrusion with cone # 5/13 - changed blade movement # 5/15 - added horizontal stipe and blades # 5/21 - changed to natural colors # - added the exposed fields so could stagger vertical blades # 6/2 - removed 90deg bend between horiz and vertical stipes # 6/4 - added LOD for blades # PROTO Kelp [ exposedField SFVec3f frontSideBladeHeight 0.0 4.0 0.0 exposedField SFVec3f rightSideBladeHeight 0.0 12.0 0.0 exposedField SFVec3f rearSideBladeHeight 0.0 20.0 0.0 exposedField SFVec3f leftSideBladeHeight 0.0 24.0 0.0 exposedField SFVec3f frontBladeSize 0.7 0.7 0.7 exposedField SFVec3f rightBladeSize 0.7 0.7 0.7 exposedField SFVec3f rearBladeSize 0.4 0.4 0.4 exposedField SFVec3f leftBladeSize 0.4 0.4 0.4 ] { Group { children [ # The main vertical stem DEF stipe Transform { translation 0.0 14.0 0.0 rotation 0.0 0.0 0.0 0.0 center 0.0 -16.0 0.0 children [ DEF stemShape Shape { appearance DEF kelpColor Appearance { material Material { # use same color as bulbs diffuseColor 0.882 0.757 0.184 } } geometry Cylinder { radius 0.2 # height 32.0 height 28.0 top FALSE bottom FALSE } },# stemShape # horizontal stipe DEF horizontalStipe Transform { center 0.0 16.0 0.0 # note: the following translation is in conjunction with all movements # in the stemShape DEF above translation 1.3 0.0 0.0 rotation 0.0 0.0 1.0 1.571 scale 0.5 0.3 0.5 children [ Transform { children USE stemShape }, # attach the blades to the horizontal stipe DEF blade_X1 Transform { translation 0.0 12.0 0.0 rotation 0.0 1.0 0.0 1.0 children [ DEF bladeRotateZ Transform { rotation 0.0 0.0 1.0 -1.2 children [ DEF BLADE Transform { translation 1.0 0.0 0.0 center -0.5 0.0 0.0 children [ LOD { range [ 90.0 ] level [ # high resolution Inline { url "bulb.wrl" }, # low resolution Inline { url "bulb_lowres.wrl" } ] } #LOD ] } #BLADE Transform ] }# Transform ] }, #blade_X1 Transform DEF blade_X2 Transform { # translation 0.0 0.0 0.0 rotation 0.0 1.0 0.0 -1.0 children USE bladeRotateZ }, DEF blade_X3 Transform { translation 0.0 -12.0 0.0 rotation 0.0 1.0 0.0 4.342 children USE bladeRotateZ }, ] },# horizontalStipe Transform # the stipe connector from vertical to horiz Transform { translation 0.0 14.0 0.0 children [ Shape { appearance USE kelpColor geometry Extrusion { creaseAngle 1.57 crossSection [ # Circle 0.2 0.0, 0.184 -0.076, 0.142 -0.142, 0.076 -0.184, 0.0 -0.2, -0.076 -0.184, -0.142 -0.142, -0.184 -0.076, -0.2 -0.0, -0.184 0.076, -0.142 0.142, -0.076 0.184, 0.0 0.2, 0.076 0.184, 0.142 0.142, 0.184 0.076, 0.2 0.0 ] spine [ # the bend 0.0 0.0 0.0, 0.15 0.77 0.0, 0.59 1.41 0.0, 1.23 1.85 0.0, 2.0 2.0 0.0 ] scale [ 1.0 1.0, 0.8 0.8, 0.7 0.7, 0.6 0.6, 0.5 0.5 ] } #extrusion } #shape ] } # stipe connector transform ] }# end stipe Transform # the blades on the vertical stipe # made 4 independent blades, one for each quadrant of the stipe # We say the "front" of the stipe is the direction pointed to # by the horizontal stipe # bottom most blade - a front blade DEF blade_Y1 Transform { rotation 0.0 0.0 1.0 1.2 translation IS frontSideBladeHeight scale IS frontBladeSize children USE BLADE } #blade 2 - a right side blade DEF blade_Y2 Transform { rotation 0.0 1.0 0.0 4.2 translation IS rightSideBladeHeight scale IS rightBladeSize children [ # rotate in x DEF bladeToTheSide Transform { rotation 1.0 0.0 0.0 3.142 children [ # rotate in z Transform { rotation 0.0 0.0 1.0 -1.2 children [ DEF rotateBlade90 Transform { rotation 1.0 0.0 0.0 1.571 translation 1.0 0.0 0.0 center -0.5 0.0 0.0 children [ LOD { range [ 90.0 ] level [ # high resolution Inline { url "bulb.wrl" }, # low resolution Inline { url "bulb_lowres.wrl" } ] } #LOD ] } # rotateBlade90 Transform ] } ] }# Transform DEF bladeToTheSide ] } # Transform Blade2 #blade 3 - a rear blade DEF blade_Y3 Transform { rotation 0.0 1.0 0.0 3.2 translation IS rearSideBladeHeight scale IS rearBladeSize children [ # rotate in x DEF Blade-Z Transform { rotation 1.0 0.0 0.0 3.142 children [ # rotate in z Transform { rotation 0.0 0.0 1.0 -1.2 children USE BLADE } ] }# Transform DEF Blade-Z ] } # top most blade - a blade to rear DEF blade_Y4 Transform { rotation 0.0 1.0 0.0 1.2 translation IS leftSideBladeHeight scale IS leftBladeSize children USE bladeToTheSide }, # Animation Clock DEF Clock TimeSensor { cycleInterval 5.5 loop TRUE }, # horizontal stipe mover DEF horizontalStipeMover OrientationInterpolator { key [ 0.0, 0.25, 0.5, 0.75, 1.0 ] keyValue [ 0.0 0.0 1.0 1.471 0.0 0.0 1.0 1.571 0.0 0.0 1.0 1.671 0.0 0.0 1.0 1.571 0.0 0.0 1.0 1.471 ] } # vertical stipe mover DEF verticalStipeMover OrientationInterpolator { key [ 0.0, 0.25, 0.5, 0.75, 1.0 ] keyValue [ 0.0 0.0 1.0 0.1 0.0 0.0 1.0 0.0 0.0 0.0 1.0 -0.1 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.1 ] }, # whole blade movement DEF bladePath1 OrientationInterpolator { key [ 0.0, 0.5, 1.0 ] keyValue [ 0.0 0.0 1.0 0.3 0.0 0.0 1.0 -0.3 0.0 0.0 1.0 0.3 ] } ] }# end Group ROUTE Clock.fraction_changed TO horizontalStipeMover.set_fraction ROUTE Clock.fraction_changed TO verticalStipeMover.set_fraction ROUTE horizontalStipeMover.value_changed TO horizontalStipe.set_rotation }# end PROTO