#!/bin/csh -f

switch ($4)
case 0:
  
  touch $2 t tt ttt

  cp ttt tttt
  cp tt  ttt
  cp t   tt

  set n = `/grads/scharein/knotplot/resource/sgi/random 360 0 12`

  cp header $1
  echo "Draw = f" >> $1
  echo light reset >> $1
  echo light unbind 0 >> $1

  echo light hcolour $n[1] 1 1 >> $1
  set x = `echo "$n[2] * .166 - 30" | bc -l`
  set y = `echo "$n[3] * .166 - 30" | bc -l`
  set z = `echo "$n[4] * .166 - 30" | bc -l`
  echo light pos $x $y $z 1 >> $1
  echo light define 2 >> $1
  echo light bind 2 2 >> $1

  echo light hcolour $n[5] 1 1 >> $1
  set x = `echo "$n[6] * .166 - 30" | bc -l`
  set y = `echo "$n[7] * .166 - 30" | bc -l`
  set z = `echo "$n[8] * .166 - 30" | bc -l`
  echo light pos $x $y $z 1 >> $1
  echo light define 3 >> $1
  echo light bind 3 3 >> $1

  echo light hcolour $n[9] 1 1 >> $1
  set x = `echo "$n[10] * .166 - 30" | bc -l`
  set y = `echo "$n[11] * .166 - 30" | bc -l`
  set z = `echo "$n[12] * .166 - 30" | bc -l`
  echo light pos $x $y $z 1 >> $1
  echo light define 4 >> $1
  echo light bind 4 4 >> $1

  echo "Draw = t" >> $1

  cp $1 t

  breaksw
endsw

