home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Examples / eyes / sphereEye.wwModel / initialProcs.eve < prev    next >
Encoding:
Text File  |  1995-03-22  |  6.6 KB  |  137 lines

  1. proc drawEyeWithLids {} {
  2.  
  3.   global sphere eyes eye pupil eyeLid
  4.  
  5.  
  6.     ##########
  7.     startShape Eye
  8.       # each eye should rotate the opposite of the eyes(xRotate) so that they always start off staring straight ahead
  9.       #EveCmd {Rotate -$eye(xRotate) 1 0 0}
  10.       EveCmd {Rotate $eyes(xRotate) 1 0 0}
  11.       EveCmd {Rotate $eyes(yRotate) 0 1 0}
  12.       ##########
  13.       startShape UpperEyeLid
  14.         EveCmd {Translate 0 \
  15.                           [expr {$sphere(radius)*sin(radians($eyes(xRotate)))}] \
  16.                           [expr {-$eyes(protrusion)*$sphere(radius)*cos(radians($eyes(xRotate)))}]}
  17.         # make sure this scale happens inside each eye, as it needs to be about the eye's origin 
  18.         EveCmd {Scale $eyeLid(xScale) $eyeLid(yScale) $eyeLid(zScale)}
  19.         EveCmd {Rotate $eye(xRotate) 1 0 0}
  20.         EveCmd {Rotate $eye(yRotate) 0 1 0}
  21.         # need to twist the eye lid so that manipulating theta max will do what I want
  22.         Rotate -90 0 1 0
  23.         EveCmd {Color $eyeLid(color)}
  24.         EveCmd {Surface $eyeLid(surface)}
  25.         EveCmd {Sphere [expr {$eye(radius)*$eyeLid(sizeFactor)}]\
  26.                        [expr {-$eye(radius)*$eyeLid(sizeFactor)}] \
  27.                        [expr {$eye(radius)*$eyeLid(sizeFactor)}] $eyeLid(upperTheta)}
  28.       endShape ;# UpperEyeLid
  29.       ##########
  30.       startShape EyeBall
  31.         EveCmd {Translate 0 \
  32.                           [expr {$sphere(radius)*sin(radians($eyes(xRotate)))}] \
  33.                           [expr {-$eyes(protrusion)*$sphere(radius)*cos(radians($eyes(xRotate)))}]}
  34.         # make sure this scale happens inside each eye, as it needs to be about the eye's origin 
  35.         EveCmd {Scale $eye(xScale) $eye(yScale) $eye(zScale)}
  36.         EveCmd {Rotate $eye(xRotate) 1 0 0}
  37.         EveCmd {Rotate $eye(yRotate) 0 1 0}
  38.         # each eye should rotate the opposite of the eyes(xRotate) so that they always start off staring straight ahead
  39.         EveCmd {Rotate [expr {-1*$eyes(yRotate)}] 0 1 0}
  40.         EveCmd {Sphere $eye(radius) [expr {-$eye(radius)}] $eye(radius) 360}
  41.         ##########
  42.         startShape Pupil
  43.           set xTrans 0.0
  44.           set yTrans 0.0
  45.           set zTrans [expr {-$eye(radius)*.65}]
  46.           ApplyToCTM {Translate $xTrans $yTrans $zTrans}
  47.           EveCmd {Scale $pupil(scale) $pupil(scale) $pupil(scale)}
  48.           EveCmd {Color $pupil(color)}
  49.           Sphere $pupil(radius) -$pupil(radius) $pupil(radius) 360 
  50.         endShape ;#Pupil
  51.       endShape ;#EyeBall
  52.       ##########
  53.       startShape LowerEyeLid
  54.         EveCmd {Translate 0 \
  55.                           [expr {$sphere(radius)*sin(radians($eyes(xRotate)))}] \
  56.                           [expr {-$eyes(protrusion)*$sphere(radius)*cos(radians($eyes(xRotate)))}]}
  57.         # make sure this scale happens inside each eye, as it needs to be about the eye's origin 
  58.         EveCmd {Scale $eyeLid(xScale) $eyeLid(yScale) $eyeLid(zScale)}
  59.         EveCmd {Rotate $eye(xRotate) 1 0 0}
  60.         EveCmd {Rotate $eye(yRotate) 0 1 0}
  61.         # need to twist the eye lid so that manipulating theta max will do what I want
  62.         Rotate -90 0 1 0
  63.         Rotate 180 1 0 0
  64.         EveCmd {Color $eyeLid(color)}
  65.         EveCmd {Surface $eyeLid(surface)}
  66.         EveCmd {Sphere [expr {$eye(radius)*$eyeLid(sizeFactor)}]\
  67.                        [expr {-$eye(radius)*$eyeLid(sizeFactor)}] \
  68.                        [expr {$eye(radius)*$eyeLid(sizeFactor)}] $eyeLid(lowerTheta)}
  69.       endShape ;# LowerEyeLid
  70.     endShape ;#LeftEye
  71.  
  72.     ##########
  73.     startShape LeftEye
  74.       # each eye should rotate the opposite of the eyes(xRotate) so that they always start off staring straight ahead
  75.       EveCmd {Rotate $eyes(xRotate) 1 0 0}
  76.       EveCmd {Rotate -$eyes(yRotate) 0 1 0}
  77.       ##########
  78.       startShape UpperEyeLid
  79.         EveCmd {Translate 0 \
  80.                           [expr {$sphere(radius)*sin(radians($eyes(xRotate)))}] \
  81.                           [expr {-$eyes(protrusion)*$sphere(radius)*cos(radians($eyes(xRotate)))}]}
  82.         # make sure this scale happens inside each eye, as it needs to be about the eye's origin 
  83.         EveCmd {Scale $eyeLid(xScale) $eyeLid(yScale) $eyeLid(zScale)}
  84.         EveCmd {Rotate $eye(xRotate) 1 0 0}
  85.         EveCmd {Rotate $eye(yRotate) 0 1 0}
  86.         # need to twist the eye lid so that manipulating theta max will do what I want
  87.         Rotate -90 0 1 0
  88.         EveCmd {Color $eyeLid(color)}
  89.         EveCmd {Surface $eyeLid(surface)}
  90.         EveCmd {Sphere [expr {$eye(radius)*$eyeLid(sizeFactor)}]\
  91.                        [expr {-$eye(radius)*$eyeLid(sizeFactor)}] \
  92.                        [expr {$eye(radius)*$eyeLid(sizeFactor)}] $eyeLid(upperTheta)}
  93.       endShape ;# UpperEyeLid
  94.       ##########
  95.       startShape EyeBall
  96.         EveCmd {Translate 0 \
  97.                           [expr {$sphere(radius)*sin(radians($eyes(xRotate)))}] \
  98.                           [expr {-$eyes(protrusion)*$sphere(radius)*cos(radians($eyes(xRotate)))}]}
  99.         # make sure this scale happens inside each eye, as it needs to be about the eye's origin 
  100.         EveCmd {Scale $eye(xScale) $eye(yScale) $eye(zScale)}
  101.         EveCmd {Rotate $eye(xRotate) 1 0 0}
  102.         EveCmd {Rotate $eye(yRotate) 0 1 0}
  103.         EveCmd {Rotate $eyes(yRotate) 0 1 0}
  104.         EveCmd {Sphere $eye(radius) [expr {-$eye(radius)}] $eye(radius) 360}
  105.         ##########
  106.         startShape Pupil
  107.           set xTrans 0.0
  108.           set yTrans 0.0
  109.           set zTrans [expr {-$eye(radius)*.65}]
  110.           ApplyToCTM {Translate $xTrans $yTrans $zTrans}
  111.           EveCmd {Scale $pupil(scale) $pupil(scale) $pupil(scale)}
  112.           EveCmd {Color $pupil(color)}
  113.           Sphere $pupil(radius) -$pupil(radius) $pupil(radius) 360 
  114.         endShape ;#Pupil
  115.       endShape ;#EyeBall
  116.       ############
  117.       startShape LowerEyeLid
  118.         EveCmd {Translate 0 \
  119.                           [expr {$sphere(radius)*sin(radians($eyes(xRotate)))}] \
  120.                           [expr {-$eyes(protrusion)*$sphere(radius)*cos(radians($eyes(xRotate)))}]}
  121.         # make sure this scale happens inside each eye, as it needs to be about the eye's origin 
  122.         EveCmd {Scale $eyeLid(xScale) $eyeLid(yScale) $eyeLid(zScale)}
  123.         EveCmd {Rotate $eye(xRotate) 1 0 0}
  124.         EveCmd {Rotate $eye(yRotate) 0 1 0}
  125.         # need to twist the eye lid so that manipulating theta max will do what I want
  126.         Rotate -90 0 1 0
  127.         Rotate 180 1 0 0
  128.         EveCmd {Color $eyeLid(color)}
  129.         EveCmd {Surface $eyeLid(surface)}
  130.         EveCmd {Sphere [expr {$eye(radius)*$eyeLid(sizeFactor)}]\
  131.                        [expr {-$eye(radius)*$eyeLid(sizeFactor)}] \
  132.                        [expr {$eye(radius)*$eyeLid(sizeFactor)}] $eyeLid(lowerTheta)}
  133.       endShape ;# LowerEyeLid
  134.     endShape ;#RightEye
  135. }
  136.  
  137.