/* Bruce A. Maxwell Fall 2014 Example of a 3D scene model */ #include #include #include "graphics.h" /* Adds to the module a unit cylinder, aligned along the Y-axis Takes in the number of subdivisions to use */ void cylinder( Module *mod, int sides ); void cylinder( Module *mod, int sides ) { Polygon p; Point xtop, xbot; double x1, x2, z1, z2; int i; polygon_init( &p ); point_set3D( &xtop, 0, 1.0, 0.0 ); point_set3D( &xbot, 0, 0.0, 0.0 ); // make a fan for the top and bottom sides // and quadrilaterals for the sides for(i=0;iviewer), &(view.vrp) ); ds->shade = ShadeGouraud; light = lighting_create(); lighting_add(light, LightPoint, &White, NULL, &(view.vrp), 0.0, 0.0); // draw into the scene module_draw( scene, &vtm, >m, ds, light, src ); image_write( src, "test9b.ppm" ); polygon_clear( &p ); module_delete( scene ); module_delete( wing ); module_delete( wings ); module_delete( laser ); module_delete( body ); module_delete( engine ); image_free( src ); return(0); }