/* Bruce A. Maxwell Fall 2014 Example of a 3D scene model Draws three 3D X-wings as line drawings */ #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 when creating the cylinder */ 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;ishade = ShadeFrame; // draw into the scene module_draw( scene, &vtm, >m, ds, NULL, src ); // write out the scene image_write( src, "wings.ppm" ); // free the polygon data polygon_clear( &p ); // free the modules module_delete( scene ); module_delete( wing ); module_delete( wings ); module_delete( laser ); module_delete( body ); module_delete( engine ); // free the drawstate free(ds); // free the image image_free( src ); return(0); }