############################################################################ # #Fighter - a simple SLIDE example # # This example shows how to do the following: # 1) Comment Code # 2) Specify Geometry # 3) Add Color # 4) Create Sliders with Tcl/Tk ############################################################################ # 1) Comment Code # # "#" - comments out a single line, like "//" in C++ (* "(* text *)" - comments out all text in between, like "/* */" in C++ *) ############################################################################ # 2) Specify Geometry # # 2a) First specify the primitive objects (spheres, cones, etc) and their parameters. # The complete SLIDE syntax is http://www.cs.berkeley.edu/~ug/slide/docs/slide/spec/ cone Hat radius 0.6 height 0.6 endcone sphere Head radius 0.5 endsphere sphere Nose radius 0.1 endsphere sphere Eye radius 0.12 endsphere sphere Fist radius 0.4 endsphere cylinder Body radius 0.7 zmin 0 zmax 2 endcylinder cylinder ForeArm radius 0.3 zmin 0 zmax 1.3 endcylinder cylinder Leg radius 0.3 zmin 0 zmax 3 endcylinder group Arm instance ForeArm endinstance instance Fist surface sSkin translate (0 0 1.7) endinstance endgroup group Man instance Head surface sFace translate ( 0 0 2.5) endinstance instance Nose surface sGreen translate( 0 0.5 2.5) endinstance instance Eye surface sEye translate(0.2 0.5 2.65) endinstance instance Eye surface sEye translate(-0.2 0.5 2.65) endinstance instance Hat surface sYellow translate (0 0 3.0) endinstance instance Body surface sRed endinstance #Left Arm instance Arm rotate (1 0 0)({expr 240 + ( sin ($dancer_sped * $SLF_TIME) * -90)} ) translate (-1 0 1.7) surface sSkin endinstance # Right Arm instance Arm rotate (1 0 0) ({expr 240 + ( sin ($dancer_sped * $SLF_TIME) * 90)} ) translate (1 0 1.7) surface sSkin endinstance #Left Leg instance Leg rotate (1 0 0 ) ({expr 180 + ( sin ($dancer_sped * $SLF_TIME) * 30)} ) translate (0.4 0 0 ) surface sGreen endinstance #Right instance Leg rotate (1 0 0 ) ({expr 180 - ( sin ($dancer_sped * $SLF_TIME) * 30)} ) translate (-0.4 0 0 ) surface sBlue endinstance endgroup group Tetra instance Man scale ( {expr $dancer_size} {expr $dancer_size} {expr $dancer_size} ) rotate (0 1 0) (180) rotate (0 0 1) (30) rotate (1 0 0) (90) rotate (0 1 0 ) ({expr ($SLF_TIME) * 60 } ) endinstance endgroup ############################################################################ # 3) Add Color # # In the Barbell group we specified the surface color of each instance. # Now we need to define these surfaces. surface sEye color (0 0 2.56 ) endsurface surface sBlue color (0.0 0.2 0.4) endsurface surface sRed color (2.51 0.52 0.02) endsurface surface sGreen color (0.0 0.4 0.0) endsurface surface sYellow color (2.55 2.55 0.21) endsurface surface sSkin color (1.0 0.8 0.6) endsurface surface sFace color (1.0 {expr 0.8 - 0.1 * $dancer_shy} {expr 0.6 - 0.1 * $dancer_shy}) endsurface