point pZ (0.0 0.0 1.0) endpoint point pRight ({expr sqrt(3)/2} 0.0 -0.5) endpoint point pLeft ({expr sqrt(3)/-2} 0.0 -0.5) endpoint face Triangle (pZ pRight pLeft) endface object oTriangle (Triangle) endobject group sides2 instance oTriangle rotate (1.0 0.0 0.0) (180) rotate (0.0 1.0 0.0) (180) endinstance instance oTriangle translate ({expr sqrt(3)/4} 0.0 -0.25) rotate (0.5 0.0 {expr sqrt(3)/2}) (70.52877937) translate ({expr sqrt(3)/-4} 0.0 0.25) endinstance endgroup group sides3 instance sides2 rotate (0.0 1.0 0.0) (120) endinstance instance oTriangle translate ({expr sqrt(3)/4} 0.0 -0.25) rotate (0.5 0.0 {expr sqrt(3)/2}) (70.52877937) translate ({expr sqrt(3)/-4} 0.0 0.25) endinstance endgroup group sides4 instance sides3 rotate (0.0 1.0 0.0) (120) endinstance instance oTriangle translate ({expr sqrt(3)/4} 0.0 -0.25) rotate (0.5 0.0 {expr sqrt(3)/2}) (70.52877937) translate ({expr sqrt(3)/-4} 0.0 0.25) endinstance endgroup group Tetra instance sides4 scale (0.5 0.5 0.5) translate(0.0 -0.4924235601 0.0) endinstance endgroup group Statue ################################ #Insert here ################################ endgroup # 2c) Finally we need to add the triangles to the World. group World instance Statue translate(0.0 0.0 0.0) scale(0.2 0.2 0.2) endinstance endgroup # 3) Add Color # # In the Triangle group we specified the surface color of each instance. # Now we need to define these surfaces. surface sBlue color (0.0 0.0 1.0) endsurface surface sGreen color (0.0 1.0 0.0) endsurface surface sRed color (1.0 0.0 0.0) endsurface surface sWhite color (1.0 1.0 1.0) endsurface surface sCyan color (0.0 1.0 1.0) endsurface surface sPurple color (1.0 0.0 1.0) endsurface surface s4 color (0.5 0.5 0.0) endsurface surface s5 color (0.5 1.0 0.0) endsurface surface s6 color (1.0 0.5 0.0) endsurface surface sYellow color (1.0 1.0 0.0) endsurface ############################################################################ # 4) Create Sliders with Tcl/Tk # # The following Tcl/Tk code shows how to create the sliders and variables # that we referenced above. # Make a Tcl initialization block tclinit { set winName .slfWINDOW ### include some tcl libraries source SLIDEUI.tcl source MATH.tcl ### This defines a procedure called CreateSliders proc CreateSliders { parent name } { ### Don't worry about this stuff ... set subname "slf_[subst $name]" if { $parent == {} } { set root .$subname } elseif { $parent == "." } { set root .$subname } else { set root $parent.$subname } toplevel $root ############### change all "var" to correct variable and "file" to file name. ### This is where the sliders are actually created ! ! ! ### variable name variable name slider text ### | | | ### V V V set var [CreateScale $name $root var "var" 0.0 0.0 1.0 0.1 1 horizontal] ### ^ ^ ^ ^ ### | | | | ### initial slider value---' | | | ### minimum slider value------' | | ### maximum slider value----------' `- slider step value ### This line is important too. This tells the window to display the sliders. pack $var -side top -fill x } ### This calls the procedure that creates the sliders CreateSliders $winName file } ######################################################################################## # 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_PERSPECTIVE frustum ( -0.5 -0.5 -2 ) ( 0.5 0.5 -0.2 ) endcamera group gCamera instance cam id instCam translate ( 0.0 0.0 1.0 ) endinstance endgroup #################### # LIGHTS #################### light lAmbient type SLF_AMBIENT color ( 0.2 0.2 0.2 ) endlight light lTop type SLF_DIRECTIONAL color ( 1.0 1.0 1.0 ) endlight group gLight instance lTop id iTop lookat eye ( 0 0 0 ) target ( -1 -1 -1 ) up ( 0 1 0 ) endlookat translate ( 1 1 1 ) endinstance endgroup #################### # RENDER #################### window WINDOW # background ( 0.25 0.60 1.0 ) endwindow viewport VIEWPORT WINDOW endviewport render VIEWPORT gCamera.instCam.cam World light lAmbient light gLight.iTop.lTop endrender