home *** CD-ROM | disk | FTP | other *** search
- source $modelPath/initialDefines.eve
-
-
- #
- # all measurements are in feet
- #
- proc declareShaderAttributes {} {
-
- ### plastic shader stuff
- Declare "Ks" "float"
- Declare "Kd" "float"
- Declare "Ka" "float"
- Declare "roughness" "float"
- Declare "specularcolor" "color"
-
- ### VGBlisteredPaintedMetal shader stuff
- Declare "Name" "string"
- Declare "MetalColor" "color"
- Declare "Age" "float"
- Declare "HeightScale" "float"
- Declare "Ambient" "float"
- Declare "Gloss" "float"
- Declare "Specular" "float"
- Declare "Roughness" "float"
- Declare "Displacement" "string"
- Declare "Origin" "point"
- Declare "UpVector" "point"
- Declare "AtVector" "point"
- Declare "Unit" "string"
- Declare "Scale" "float"
- Declare "AntiAlias" "float"
-
- }
-
- proc buildSphereHead {{xOrigin 0.0} {yOrigin 0.0} {zOrigin 0.0}} {
- global nodAngle shakeAngle
- global kindOfHead headRadius eyeRadius eyeProtrusion
- global pupilRadius pupilScale
- global noseLength noseWidth
- global initialEyeYaw initialEyePitch
- global eyeYaw eyePitch eyeRoll
- global eyeScale
- global headColor eyeColor pupilColor noseColor
-
-
- ##########
- startShape Neck
- ApplyToCTM {Translate $xOrigin $yOrigin $zOrigin}
- ApplyToCTM {Rotate 90 1 0 0}
- Cylinder [expr {$headRadius/3.0}] 0 [expr {2*$headRadius}] 360
- endShape
-
-
- startShape Head
- ApplyToCTM {Translate $xOrigin $yOrigin $zOrigin}
- #EveCmd {Color $headColor}
- EveCmd {Rotate $nodAngle 1 0 0 }
- EveCmd {Rotate $shakeAngle 0 1 0 }
- Sphere $headRadius [expr {-$headRadius}] $headRadius 360
-
- ##########
- startShape LeftEye
- #Surface plastic
- EveCmd {Rotate $initialEyeYaw 1 0 0}
- EveCmd {Rotate $initialEyePitch 0 1 0}
- EveCmd {Translate 0 \
- [expr {$headRadius*sin([dToR $initialEyeYaw])}] \
- [expr {-$eyeProtrusion*$headRadius*cos([dToR $initialEyeYaw])}]}
- ##########
- startShape EyeBall
- EveCmd {Scale $eyeScale $eyeScale $eyeScale}
- EveCmd {Rotate $eyeYaw 1 0 0}
- EveCmd {Rotate $eyePitch 0 1 0}
- EveCmd {Rotate $eyeRoll 0 0 1}
- #EveCmd {Color $eyeColor}
- Sphere $eyeRadius [expr {-$eyeRadius}] $eyeRadius 360
- ##########
- startShape Pupil
- set xTrans 0.0
- set yTrans 0.0
- set zTrans [expr {-$eyeRadius*.7}]
- ApplyToCTM {Translate $xTrans $yTrans $zTrans}
- EveCmd {Scale $pupilScale $pupilScale $pupilScale}
- EveCmd {Color $pupilColor}
- Sphere $pupilRadius [expr {-$pupilRadius}] $pupilRadius 360
- endShape ;#Pupil
- endShape ;#EyeBall
- endShape ;#LeftEye
-
- ##########
- startShape RightEye
- #Surface plastic
- EveCmd {Rotate $initialEyeYaw 1 0 0}
- EveCmd {Rotate -$initialEyePitch 0 1 0}
- EveCmd {Translate 0 \
- [expr {$headRadius*sin([dToR $initialEyeYaw])}] \
- [expr {-$eyeProtrusion*$headRadius*cos([dToR $initialEyeYaw])}]}
- ##########
- startShape EyeBall
- EveCmd {Scale $eyeScale $eyeScale $eyeScale}
- EveCmd {Rotate $eyeYaw 1 0 0}
- EveCmd {Rotate $eyePitch 0 1 0}
- EveCmd {Rotate $eyeRoll 0 0 1}
- #EveCmd {Color $eyeColor}
- Sphere $eyeRadius [expr {-$eyeRadius}] $eyeRadius 360
- ##########
- startShape Pupil
- set xTrans 0.0
- set yTrans 0.0
- set zTrans [expr {-$eyeRadius*.7}]
- ApplyToCTM {Translate $xTrans $yTrans $zTrans}
- EveCmd {Scale $pupilScale $pupilScale $pupilScale}
- EveCmd {Color $pupilColor}
- Sphere $pupilRadius [expr {-$pupilRadius}] $pupilRadius 360
- endShape ;#Pupil
- endShape ;#EyeBall
- endShape ;#RightEye
-
- ##########
- startShape Nose
- set tenDegreesInRadians [dToR 10.0]
- set xTrans 0.0
- set yTrans [expr {$headRadius*sin($tenDegreesInRadians)}]
- set zTrans [expr {.8*-$headRadius}]
- ApplyToCTM {Translate $xTrans $yTrans $zTrans}
- ApplyToCTM {Rotate 180.0 1 0 0}
- #EveCmd {Color $noseColor}
- Cone $noseLength $noseWidth 360
- endShape ;#Nose
-
- ##########
- if {[string match martian* $kindOfHead]} { buildAntenna } {}
- if {[string match punk* $kindOfHead]} { buildCrest } {}
-
- endShape ;#Head
- }
-
-
- proc buildCrest {} {
- global crestCount crestLength crestWidth crestColor crestYawStep
-
- ##########
- startShape Crest
- #EveCmd {Color $crestColor}
- Rotate -110 1 0 0
-
- ##########
- startShape LeftRow
- ApplyToCTM {Rotate -30 0 0 1}
- for {set i 0} {$i < $crestCount} {incr i} \
- { EveCmd {Cone $crestLength $crestWidth 360}
- EveCmd {Rotate $crestYawStep 1 0 0}
- }
- endShape ;#LeftRow
-
- ##########
- startShape MiddleRow
- for {set i 0} {$i < $crestCount} {incr i} \
- { EveCmd {Cone $crestLength $crestWidth 360}
- EveCmd {Rotate $crestYawStep 1 0 0}
- }
- endShape ;#MiddleRow
-
- ##########
- startShape RightRow
- ApplyToCTM {Rotate 30 0 0 1}
- for {set i 0} {$i < $crestCount} {incr i} \
- { EveCmd {Cone $crestLength $crestWidth 360}
- EveCmd {Rotate $crestYawStep 1 0 0}
- }
- endShape ;#RightRow
- endShape ;#Crest
- }
-
- proc buildAntenna {} {
- global antennaColor antennaRadius antennaTilt antennaLength antennaKnobColor antennaKnobRadius
-
-
- startShape Antenna
- #EveCmd {Color $antennaColor}
- ApplyToCTM {Rotate -90 1 0 0}
-
- ##########
- startShape LeftShaft
- EveCmd {Rotate -$antennaTilt 0 1 0}
- EveCmd {Cylinder $antennaRadius 0 $antennaLength 360}
-
- ##########
- startShape Knob
- #EveCmd {Color $antennaKnobColor}
- EveCmd {Translate 0 0 $antennaLength}
- EveCmd {Sphere $antennaKnobRadius -$antennaKnobRadius $antennaKnobRadius 360}
- endShape ;#Knob
- endShape ;#LeftShaft
-
- ##########
- startShape RightShaft
- EveCmd {Rotate $antennaTilt 0 1 0}
- EveCmd {Cylinder $antennaRadius 0 $antennaLength 360}
-
- ##########
- startShape Knob
- #EveCmd {Color $antennaKnobColor}
- EveCmd {Translate 0 0 $antennaLength}
- EveCmd {Sphere $antennaKnobRadius -$antennaKnobRadius $antennaKnobRadius 360}
- endShape ;#Knob
- endShape ;#LeftShaft
- endShape ;#Antenna
- }
-
- set kindOfTorso Blistered.5
- set torsoXScale 1
- set torsoYScale 1.55
- set torsoZScale 1
- set torsoRadius .4
- set torsoColor {.391522 .378109 1}
- set torsoSurfaceAge .5
-
- proc buildSphereTorso {{xOrigin 0.0} {yOrigin 0.0} {zOrigin 0.0}} {
- global torsoXScale torsoYScale torsoZScale
- global torsoRadius torsoColor
- global torsoSurfaceAge
-
-
- Declare "Age" "float"
- Declare "HeightScale" "float"
- Declare "Gloss" "float"
- Declare "Roughness" "float"
- Declare "Displacement" "string"
-
- startShape Torso
- ApplyToCTM {Translate $xOrigin $yOrigin $zOrigin}
- #EveCmd {Color $torsoColor}
- EveCmd {Scale $torsoXScale $torsoYScale $torsoZScale}
- # need to think about this...
- #Surface VGBlisteredPaintedMetal Age $torsoSurfaceAge HeightScale 5 Gloss 1 Roughness 1 Displacement 1
- EveCmd {Sphere $torsoRadius [expr {-$torsoRadius}] $torsoRadius 360 }
- endShape ;#Torso
- }
-
-
- set armColor {.7 1 .7}
-
- set shoulderRadius [expr 6.0*$headRadius/8.0]
- set upperArmRadius [expr $headRadius/2]
- set leftUpperArmRotate 0.0
- set rightUpperArmRotate 0.0
-
- set elbowRadius [expr $shoulderRadius*.7]
- set foreArmRadius [expr $upperArmRadius*.8]
- set leftForeArmRotate 0.0
- set rightForeArmRotate 0.0
-
-
- proc buildSphereArm {{side Left} {xOrigin 0.0} {yOrigin 0.0} {zOrigin 0.0}} {
- global shoulderRadius armColor
- global upperArmRadius leftUpperArmRotate rightUpperArmRotate
- global elbowRadius
- global foreArmRadius leftForeArmRotate rightForeArmRotate
-
-
- startShape ${side}Arm
- ApplyToCTM {Translate $xOrigin $yOrigin $zOrigin}
- ApplyToCTM {Rotate 90 0 1 0}
- ApplyToCTM {Rotate 90 1 0 0}
- #EveCmd {Color $armColor}
-
- ##########
- startShape Shoulder
- Sphere $shoulderRadius [expr {-$shoulderRadius}] $shoulderRadius 360
-
- ##########
- startShape UpperArm
- set upperArmYScale 4.0
- set upperArmLength [expr {$upperArmRadius*$upperArmYScale}]
- set yTrans [expr {$upperArmLength + [expr {$shoulderRadius/2.0}]}]
-
- ApplyToCTM {Rotate 90 0 0 1}
- if {[string compare Left $side]} \
- {} \
- { set leftUpperArmRotate 45.0;
- EveCmd {Rotate $leftUpperArmRotate 0 1 0}
- }
- if {[string compare Right $side]} \
- {} \
- { set rightUpperArmRotate -45.0;
- EveCmd {Rotate $rightUpperArmRotate 0 1 0}
- }
- set varName ${side}UpperArmRotate
-
- Cylinder $upperArmRadius 0 $upperArmLength 360
-
- ##########
- startShape Elbow
- ApplyToCTM {Translate 0 0 $upperArmLength}
- Sphere $elbowRadius [expr {-$elbowRadius}] $elbowRadius 360
-
- ##########
- startShape foreArm
- set foreArmLength [expr {$upperArmLength*1.2}]
- set yTrans [expr {$foreArmLength + [expr {$elbowRadius/2.0}]}]
-
- if {[string compare Left $side]} \
- {} \
- { set leftForeArmRotate -65.0;
- EveCmd {Rotate $leftForeArmRotate 0 1 0}
- }
- if {[string compare Right $side]} \
- {} \
- { set rightForeArmRotate 65.0;
- EveCmd {Rotate $rightForeArmRotate 0 1 0}
- }
- Cylinder $foreArmRadius 0 $foreArmLength 360
- endShape ;# foreArm
- endShape ;# Elbow
- endShape ;#UpperArm
- endShape ;#Shoulder
- endShape ;#Arm
- }
-
- proc buildRobot {} {
- global kindOfHead headRadius initialEyePitch eyeScale antennaRadius antennaLength
- global kindOfTorso torsoRadius torsoYScale torsoSurfaceAge
- global fork tire gasket surface topOfFork hubcap piston
- global xR yR zR xT yT zT xS yS zS modelPath
-
-
- if {[string compare $kindOfHead fish]} \
- {} \
- { set initialEyePitch 45;
- set eyeScale 2;
- }
-
- if {[string compare $kindOfHead insect]} \
- {} \
- { set initialEyePitch 80;
- set eyeScale 3;
- }
-
- if {[string compare $kindOfHead martianFish]} \
- {} \
- { set initialEyePitch 45;
- set eyeScale 2;
- }
-
- if {[string compare $kindOfHead martianInsect]} \
- {} \
- { set initialEyePitch 80;
- set eyeScale 3;
- set antennaRadius 0.01;
- set antennaLength 0.7;
- }
-
- if {[string compare $kindOfHead punkFish]} \
- {} \
- { set initialEyePitch 45;
- set eyeScale 2;
- }
-
- if {[string compare $kindOfHead punkInsect]} \
- {} \
- { set initialEyePitch 80;
- set eyeScale 3;
- }
-
- if {[string compare $kindOfTorso Blistered.1]} \
- {} \
- { set torsoSurfaceAge .1
- }
- if {[string compare $kindOfTorso Blistered.2]} \
- {} \
- { set torsoSurfaceAge .2
- }
- if {[string compare $kindOfTorso Blistered.3]} \
- {} \
- { set torsoSurfaceAge .3
- }
- if {[string compare $kindOfTorso Blistered.4]} \
- {} \
- { set torsoSurfaceAge .4
- }
- if {[string compare $kindOfTorso Blistered.5]} \
- {} \
- { set torsoSurfaceAge .5
- }
- if {[string compare $kindOfTorso Blistered.5]} \
- {} \
- { set torsoSurfaceAge .5
- }
- if {[string compare $kindOfTorso Blistered.6]} \
- {} \
- { set torsoSurfaceAge .6
- }
- if {[string compare $kindOfTorso Blistered.7]} \
- {} \
- { set torsoSurfaceAge .7
- }
- if {[string compare $kindOfTorso Blistered.8]} \
- {} \
- { set torsoSurfaceAge .8
- }
-
- startShape Robot
- declareShaderAttributes
- source $modelPath/support.eve
- buildSphereTorso
- buildSphereHead 0 [expr {1.2 * $headRadius + [expr {$torsoRadius * $torsoYScale}]}] 0
- buildSphereArm Left [expr {$torsoRadius * .9}] [expr {.7 * $torsoRadius * $torsoYScale}] 0
- buildSphereArm Right -[expr {$torsoRadius * .9}] [expr {.7 * $torsoRadius * $torsoYScale}] 0
- endShape
- }
-
- proc nod {{howManySteps 4} {nodIncrement 10}} {
- global nodAngle
-
-
- # lift up a bit, then nod twice, then settle back to original angle
- set nodAngle [expr {$nodAngle+$nodIncrement}]; updateView
- for {set i 0} {$i < $howManySteps} {incr i} {set nodAngle [expr {$nodAngle-$nodIncrement}]; updateView}
- for {set i 0} {$i < $howManySteps} {incr i} {set nodAngle [expr {$nodAngle+$nodIncrement}]; updateView}
- for {set i 0} {$i < $howManySteps} {incr i} {set nodAngle [expr {$nodAngle-$nodIncrement}]; updateView}
- for {set i 0} {$i < $howManySteps} {incr i} {set nodAngle [expr {$nodAngle+$nodIncrement}]; updateView}
- set nodAngle [expr {$nodAngle-$nodIncrement}]; updateView
- }
-
- proc shake {{howManySteps 4} {shakeIncrement 10}} {
- global shakeAngle
-
-
- for {set i 0} {$i < $howManySteps} {incr i} {set shakeAngle [expr {$shakeAngle+$shakeIncrement}]; updateView}
- for {set i 0} {$i < $howManySteps} {incr i} {set shakeAngle [expr {$shakeAngle-$shakeIncrement}]; updateView}
- for {set i 0} {$i < $howManySteps} {incr i} {set shakeAngle [expr {$shakeAngle+$shakeIncrement}]; updateView}
- for {set i 0} {$i < $howManySteps} {incr i} {set shakeAngle [expr {$shakeAngle-$shakeIncrement}]; updateView}
- }
-
-
- set kindOfHead punkInsect
-
- buildRobot
-
-