##################################################
# IcosaVolution.slf
# Hamiltonian Cycle on an icosahedron forms the frame
# to hold a minimal surface with 2 tunnels
# Mesh was generated with Surface Evolver 
# -- use offset surfaces to make a thick shell for fabrication
# CHS 2004/09/08
###################################################

tclinit {
  package require slideui

  toplevel .slfWindow.uiOffset
  CreateSLIDEOffsetObject oOffset
  set widget [CreateSLIDEOffsetUI .slfWindow.uiOffset oOffset]
  pack $widget
}


include "icovol2.m"

#######################################################

offset oOffset
  lod {expr $oOffset(lod)}
  shading {expr $oOffset(shading)}

  type {expr $oOffset(type)}

  height {expr $oOffset(height)}
  width {expr $oOffset(width)}
  drawcontrols {expr $oOffset(drawcontrols)}

  instance mPatchA
  endinstance

endoffset

#######################################################

group oMySurface
  instance oOffset
    scale(0.2 0.2 0.2)
  endinstance 
endgroup

surface YEL color (1 1 0) endsurface

group gWorld
  instance oMySurface
    surface YEL
  endinstance

  instance amb
    id main_amb
  endinstance
  instance sun
    id front_sun
    rotate (0 1 0) (-30)
    rotate (0 0 1) (-45)
  endinstance
  instance anti_sun
    id back_sun
    rotate (1 0 0) (180)
    rotate (0 1 0) (-30)
    rotate (0 0 1) (-45)
  endinstance
endgroup

group gCam
  instance cam
    id iCam
    translate ( 0.0 0.0 1 )
  endinstance
endgroup

camera cam
  projection SLF_PARALLEL
  #projection SLF_PERSPECTIVE
  #frustum ( -0.1 -0.1 -2.0 ) ( 0.1 0.1 -0.01)
  frustum ( -0.2 -0.2 -2.0 ) ( 0.2 0.2 -0.01)
endcamera

light amb
  type SLF_AMBIENT
  color (0.2 0.2 0.2)
endlight

light sun
  type SLF_DIRECTIONAL
  color (0.8 0.8 0.8)
endlight

light anti_sun
  type SLF_DIRECTIONAL
  color (0.4 0.4 0.4)
endlight

window Window
  background (0.2 0.5 0.8)
endwindow

viewport vp Window
endviewport

render vp gCam.iCam.cam gWorld 
  light gWorld.front_sun.sun
  light gWorld.back_sun.anti_sun
  light gWorld.main_amb.amb
endrender