############################################################################
# Surfaces
############################################################################

surface sRed
  color (1.0 0.0 0.0)
endsurface

surface sGreen
  color (0.0 1.0 0.0)
endsurface

surface sBlue
  color (0.0 0.0 1.0)
endsurface

############################################################################
# Geometry
############################################################################

#
# Remove the sphere below and add your geometry.  Make sure you instance 
# your new geometry in the World group
#

sphere SomeGeometry
   radius {expr $slider_var1}
endsphere










group World
  instance SomeGeometry
  endinstance
endgroup

############################################################################
# Tcl Sliders
############################################################################

tclinit {
  set winName .slfWINDOW

  source SLIDEUI.tcl
  source MATH.tcl

  proc CreateSliders { parent name } {

    set subname "slf_[subst $name]"

    if { $parent == {} } {
	set root .$subname
    } elseif { $parent == "." } {
	set root .$subname
    } else {
	set root $parent.$subname
    }

    toplevel $root

    ###
    ### Add your own variables and sliders
    ###

    ### variable name       variable name    slider text
    ###  |                             |     |
    ###  V                             V     V       

    set var1 [CreateScale $name $root var1 "var1"  1  1  10 0.5 1 horizontal]
    set var2 [CreateScale $name $root var2 "var2"  4  1  10 0.5 1 horizontal]	

    ###                                            ^  ^   ^  ^
    ###                                            |  |   |  |
    ###                     initial slider value---'  |   |  |
    ###                     minimum slider value------'   |  |
    ###                     maximum slider value----------'  `- slider step value



    ### Make sure you pack your sliders

    pack $var1 $var2 -side top -fill x
  }

  CreateSliders $winName slider
}


########################################################################################
# The code below this line specifies the camera, lighting, and rendering.
# Don't worry too much about this for now.


#################### 
# CAMERA
#################### 

camera cam
  projection SLF_PARALLEL
  frustum ( -10 -10 -100 ) ( 10 10 100 )
endcamera

group gCamera
  instance cam
    id instCam
    translate ( 0.0 0.0 1.0 )
  endinstance
endgroup

#################### 
# LIGHTS
#################### 

light lite
  type SLF_DIRECTIONAL
endlight

group gLight
  instance lite
    id instLite
    lookat
      eye ( 1.0 1.0 1.0 )
      target ( 0.0 0.0 0.0 )
      up ( 0.0 1.0 0.0 )
    endlookat
  endinstance
endgroup

light lite2
  type SLF_AMBIENT
  color (0.5 0.5 0.5)
endlight

group gLight2
  instance lite2
    id instLite2
  endinstance
endgroup

####################
# RENDER
####################

window WINDOW
endwindow

viewport VIEWPORT WINDOW
  origin ( 0.0 0.0 )
  size ( 1.0 1.0 )
endviewport

render VIEWPORT gCamera.instCam.cam World
  light gLight.instLite.lite
  light gLight2.instLite2.lite2
endrender