#!/bin/sh #\ exec ./gnash -f $0 $* ############################################################### # sample.gn: This file is the script to create a rendering # scene for A4. It composes of Gn commands only with no # OGL raster widget. # # by: Michael Coons, mjcoons@noether.math I.D. 91070206 ############################################################### # Parse the command line to get the resolution set x [lindex $argv 0] set y $x string trimright $x ########################################### # Now use Gn commands to create a sphere and display it using ray tracing gn_material green lambertian -ambient {0.2 0.2 0.2} \ -diffuse {0.1 0.8 0.1} \ -emission {0.0 0.0 0.0} \ -shade flat gn_material blue lambertian -ambient {0.2 0.2 0.2} \ -diffuse {0.1 0.1 0.9} \ -emission {0.0 0.0 0.0} \ -shade flat gn_material magenta lambertian -ambient {0.2 0.2 0.2} \ -diffuse {0.9 0.0 0.9} \ -emission {0.0 0.0 0.0} \ -shade flat gn_material grey lambertian -ambient {0.2 0.2 0.2} \ -diffuse {0.5 0.5 0.5} \ -emission {0.0 0.0 0.0} \ -shade flat gn_material red phong -ambient {0.5 0.5 0.5} \ -diffuse {0.8 0.0 0.0} \ -emission {0.0 0.0 0.0} \ -specular {0.7 0.7 0.7} 10 \ -shade flat gn_material orange phong -ambient {0.5 0.5 0.5} \ -diffuse {0.8 0.5 0.0} \ -emission {0.0 0.0 0.0} \ -specular {0.7 0.7 0.7} 10 \ -shade flat gn_material magentap phong -ambient {0.5 0.5 0.5} \ -diffuse {0.9 0.0 0.9} \ -emission {0.0 0.0 0.0} \ -specular {0.7 0.7 0.7} 10 \ -shade flat gn_model :sphere quadric {1 0 0 0 1 0 0 1 0 -1.5} -material red gn_model :sphere:back cylinder {20 2} -material grey gn_model :sphere:cyl cylinder {5 .1} -material blue gn_model :sphere:cyl2 cylinder {6 .1} -material blue gn_model :sphere:cyl3 cylinder {3 .1} -material blue gn_model :sphere:cyl4 cylinder {2 .1} -material blue gn_model :sphere:sphere1 sphere {.5} -material green gn_model :sphere:sphere2 sphere {.4} -material green gn_model :sphere:sphere3 sphere {.4} -material orange gn_model :sphere:sphere4 sphere {.5} -material orange gn_model :sphere:sphere5 sphere {.3} -material magentap gn_model :sphere:sphere6 sphere {.4} -material magenta :sphere translate "0.0 0.0 -10.0" :sphere:cyl2 rotate 100 { 0 0 1 } :sphere:cyl2 rotate 90 { 0 1 0 } :sphere:cyl3 rotate 240 { 0 0 1 } :sphere:cyl3 rotate 270 { 0 1 0 } :sphere:cyl3 translate {2 0 0 } :sphere:cyl4 rotate -160 { 0 1 0 } :sphere:cyl4 rotate 90 { 0 0 1 } :sphere:cyl4 translate {2 0 0 } :sphere:back translate "0.0 -5.0 -5.0" :sphere:sphere1 translate "3.0 0.0 0.0" :sphere:sphere2 translate "-2.5 0.0 0.0" :sphere:sphere3 translate "1.3 1.5 -1.8" :sphere:sphere4 translate "1.1 -1.6 -1.9" :sphere:sphere5 translate "-1.3 -1.7 1.8" :sphere:sphere6 translate "0.5 2.5 2.2" gn_light l1 point -colour {0.7 0.7 0.7} \ -position {-3.5 -1.5 3.0} \ -attenuation {1.0 0.0 0.0} gn_light l2 directional -colour {1.0 1.0 1.0} \ -direction {0.0 -1.0 -1.0} \ gn_camera c1 perspective -resolution "$x $y" \ -render ray -file sample.ppm # Call the rendering technique c1 render :sphere {l1 l2} exit