void module_alphabet_S(Module *md){ //1 module_cube(md); for(int i=0; i<3; i++){ module_translate(md, 2, 0, 0); module_cube(md); } //2 for(int i=0; i<3; i++){ module_translate(md, 0, 0, -2); module_cube(md); } //3 for(int i=0; i<3; i++){ module_translate(md, -2, 0, 0); module_cube(md); } //4 for(int i=0; i<3; i++){ module_translate(md, 0, 0, -2); module_cube(md); } //5 for(int i=0; i<3; i++){ module_translate(md, 2, 0, 0); module_cube(md); } }
void module_alphabet_A(Module *md){ //1 module_cube(md); for(int i=0; i<6; i++){ module_translate(md, 0, 0, -2); module_cube(md); } //2 module_cube(md); for(int i=0; i<3; i++){ module_translate(md, 2, 0, 0); module_cube(md); } //3 for(int i=0; i<6; i++){ module_translate(md, 0, 0, 2); module_cube(md); } //4 module_translate(md, 0, 0, -6); for(int i=0; i<3; i++){ module_translate(md, -2, 0, 0); module_cube(md); } }
void module_alphabet_I(Module *md){ //1 module_translate(md, 2,0,0); module_cube(md); for(int i=0; i<6; i++){ module_translate(md, 0, 0, -2); module_cube(md); } //2 module_translate(md, -2,0,0); module_cube(md); for(int i=0; i<2; i++){ module_translate(md, 2, 0, 0); module_cube(md); } //3 module_translate(md, 0,0,12); module_cube(md); for(int i=0; i<2; i++){ module_translate(md, -2, 0, 0); module_cube(md); } }
void module_alphabet_G(Module *md){ //3 module_cube(md); module_translate(md, 2, 0 ,0); module_cube(md); module_translate(md, 2, 0 ,0); module_cube(md); module_translate(md, 2, 0 ,0); //4 module_cube(md); module_translate(md, 0, 0 ,-2); module_cube(md); module_translate(md, 0, 0 ,-2); module_cube(md); module_translate(md, 0, 0 ,-2); module_cube(md); //5 module_translate(md, -2, 0, 0); module_cube(md); //2 module_identity(md); for(int i=0; i<6; i++){ module_translate(md, 0,0,-2); module_cube(md); } //1 for(int i=0; i<3; i++){ module_translate(md, 2, 0 ,0); module_cube(md); } }
int main( int argc, char *argv[]){ //set up the images Image *src; Image *myImage; //set up the modules!! Module *basket; Module *connector; Module *connector1; Line l; Point pts[2]; Module *circle; Module *hotAirBalloon; Module *teamOfBalloons; Module *scene; //pick the colors Color colors[6]; Color brown; Color blue; Color green; Color grey; //set up view stuff, and image file stuff Matrix vtm, gtm; int rows; int cols; View3D view; DrawState *ds; char filename[256]; int i, j, k, m, n; //Set the colors up color_set(&brown, 0.2, 0.1, 0.0); color_set(&blue, 0.6, 0.8, 1.0); color_set(&green, 0.1, 0.4, 0.0); color_set(&grey, 0.3, 0.3, 0.3); color_set(&colors[0], 1.0, 0.0, 0.0);//Red color_set(&colors[1],1.0, 0.5, 0.0);//orange color_set(&colors[2],1.0, 1.0, 0.1);//yellow color_set(&colors[3], 0.0, 1.0, 0.0);//green color_set(&colors[4], 0.0, 0.0, 1.0);//blue color_set(&colors[5], 0.4, 0.0, 0.8);//purple //if you want to supply a background image you can, otherwise I set a default sky blue background! if(argc>1){ printf("you supplied an image\n"); myImage = image_read(argv[1]); rows = myImage->rows; cols = myImage->cols; printf("%d %d\n", rows, cols); }else{ printf("We are giving your image a default size!\n"); rows = 500; cols = 500; myImage = image_create(rows, cols); for(m = 0; m< rows; m++){ for(n = 0; n<cols; n++){ image_setColor(myImage, m, n, blue); } } } //Loop over the scene 300 times moving the scene around!! for(k = 0; k<300; k++){ //Set up the view point_set( &(view.vrp), 150, 100, 200, 1.0); vector_set( &(view.vpn), -view.vrp.val[0], -view.vrp.val[1], -view.vrp.val[2]); vector_set( &(view.vup), 0, 1.0, 0); view.d = 20; view.du = 10; view.dv = view.du* (float)rows/cols; view.f = 0; view.b = 5; view.screenx = rows; view.screeny = cols; matrix_setView3D( &vtm, &view); matrix_identity( >m ); // basket: cube (will need 1 in hot air balloon module) basket = module_create(); module_color(basket, &brown); module_cube(basket, 1); //connectors: lines need 4 connector = module_create(); point_set3D(&pts[0],1,1,1 ); point_set3D(&pts[1],2,4.2,1); line_set(&l, pts[0], pts[1]); module_line(connector, &l); connector1 = module_create(); point_set3D(&pts[0], 1,1 , 1); point_set3D(&pts[1], 0,4.2 ,1 ); line_set(&l, pts[0], pts[1]); module_line(connector1, &l); // balloon: circles nested on top of eachother circle = module_create(); module_color(circle, &colors[0]); module_rotateX(circle, 0, 1); module_translate2D(circle, 0, 3); module_circle(circle, 1); module_color(circle, &colors[1]); module_rotateX(circle, 1, 0); module_translate2D(circle, 0, 1); module_circle(circle, 2.5); module_color(circle, &colors[2]); module_rotateX(circle, 1, 0); module_translate2D(circle, 0, 1); module_circle(circle, 3); module_color(circle, &colors[3]); module_rotateX(circle, 1, 0); module_translate2D(circle, 0, 1); module_circle(circle, 4); module_color(circle, &colors[4]); module_rotateX(circle, 1, 0); module_translate2D(circle, 0, 1); module_circle(circle, 5); module_color(circle, &colors[5]); module_rotateX(circle, 1, 0); module_translate2D(circle, 0, 1); module_circle(circle, 6); module_color(circle, &colors[0]); module_rotateX(circle, 1,0); module_translate2D(circle, 0, 1); module_circle(circle, 7); module_color(circle, &colors[1]); module_rotateX(circle, 1, 0); module_translate2D(circle, 0, 1); module_circle(circle, 7); module_color(circle, &colors[2]); module_rotateX(circle, 1, 0); module_translate2D(circle, 0,1); module_circle(circle, 7); module_color(circle, &colors[3]); module_rotateX(circle, 1, 0); module_translate2D(circle, 0, 1); module_circle(circle, 7); module_color(circle, &colors[4]); module_rotateX(circle, 1, 0); module_translate2D(circle, 0, 1); module_circle(circle, 6); module_color(circle, &colors[5]); module_rotateX(circle, 1, 0); module_translate2D(circle, 0, 1); module_circle(circle, 5); module_color(circle, &colors[0]); module_rotateX(circle, 1, 0); module_translate2D(circle, 0, 1); module_circle(circle, 4); module_color(circle, &colors[1]); module_rotateX(circle, 1, 0); module_translate2D(circle, 0, 0.5); module_circle(circle, 3); module_color(circle, &colors[2]); module_rotateX(circle, 1, 0); module_translate2D(circle, 0, 0.5); module_circle(circle, 2); //hotAirBalloon: put the above parts together hotAirBalloon = module_create(); module_module(hotAirBalloon, basket); module_module(hotAirBalloon, connector); module_translate(hotAirBalloon, -2,0 ,0 ); module_module(hotAirBalloon, connector1); module_translate(hotAirBalloon, 0, 0, -2); module_module(hotAirBalloon, connector1); module_translate(hotAirBalloon, 2, 0, 0); module_module(hotAirBalloon, connector); module_module(hotAirBalloon, circle); //make a team of balloons teamOfBalloons = module_create(); module_translate(teamOfBalloons, 0,-30,-15); module_module(teamOfBalloons, hotAirBalloon); module_translate(teamOfBalloons, 0, 0+(k*0.1),15); module_module(teamOfBalloons, hotAirBalloon); module_translate(teamOfBalloons, 0, 0+(k*0.1),15); module_module(teamOfBalloons, hotAirBalloon); //make a scene of balloons scene = module_create(); module_translate(scene, -40, 10+(k*0.1), 10); module_module(scene, teamOfBalloons); module_translate(scene, 140, 10, 55); module_module(scene, teamOfBalloons); module_translate(scene, -50, 10+(k*0.1), -40); module_module(scene, teamOfBalloons); module_translate(scene, 30, 10+(k*0.2) , -55); module_module(scene, teamOfBalloons); //set up the image src = image_create(rows, cols); //Either draw the background image you supplied or use my default background for (i = 0; i<rows; i++){ for (j = 0; j<cols; j++){ blue = image_getColor(myImage, i, j); image_setColor(src,i, j, blue); } } //set up the draw state if you want filled polygons need to use ShadeConstant instead of ShadeFrame ds = drawstate_create(); ds->shade = ShadeFrame; //draw the modules! module_draw( scene, &vtm, >m, ds, NULL, src); //put the files in the right place with the right name!! sprintf(filename, "/export/home/vedwards/Desktop/Graphics/images/hotAirBalloons3/frame-%04d.ppm", k ); printf("Writing image\n"); image_write( src, filename ); } //Clean up, delete all of the modules, images, and drawState module_delete(basket); module_delete(connector); module_delete(connector1); module_delete(circle); module_delete(hotAirBalloon); module_delete(teamOfBalloons); free(ds); image_free( src ); image_free( myImage ); return(0); }
/* * Sourced from coursework file test6b.c (Bruce Maxwell) */ void module_cone( Module *mod, int sides, int fill, int size, float x, float y, float z) { Polygon p; Point xtop, xbot; Element *e; Line l; double x1, x2, z1, z2; int i; if(!mod){ printf("Null md passed to module_cylinder\n"); return; } // set cone parameters module_scale(mod, (int)size, (int)size, (int)size); module_translate(mod, (float)x, (float)y, (float)z); printf("parameters set\n"); polygon_init( &p ); point_set3D( &xtop, 0, 1.0, 0.0 ); point_set3D( &xbot, 0, 0.0, 0.0 ); if (fill == 1){ // make a fan for the top and bottom sides // and quadrilaterals for the sides for(i=0;i<sides;i++) { Point pt[6]; x1 = cos( i * M_PI * 2.0 / sides ); z1 = sin( i * M_PI * 2.0 / sides ); x2 = cos( ( (i+1)%sides ) * M_PI * 2.0 / sides ); z2 = sin( ( (i+1)%sides ) * M_PI * 2.0 / sides ); point_copy( &pt[0], &xbot ); point_set3D( &pt[1], x1, 0.0, z1 ); point_set3D( &pt[2], x2, 0.0, z2 ); polygon_set( &p, 3, pt ); e = element_init(ObjPolygon, &p); module_insert(mod, e); point_set3D( &pt[3], x1, 0.0, z1 ); point_set3D( &pt[4], x2, 0.0, z2 ); point_copy( &pt[5], &xtop); polygon_set( &p, 3, &pt[3] ); e = element_init(ObjPolygon, &p); module_insert(mod, e); } } else{ // make a fan for the top and bottom sides // and quadrilaterals for the sides for(i=0;i<sides;i++) { Point pt[8]; x1 = cos( i * M_PI * 2.0 / sides ); z1 = sin( i * M_PI * 2.0 / sides ); x2 = cos( ( (i+1)%sides ) * M_PI * 2.0 / sides ); z2 = sin( ( (i+1)%sides ) * M_PI * 2.0 / sides ); point_copy( &pt[0], &xbot ); point_set3D( &pt[1], x1, 0.0, z1 ); point_set3D( &pt[2], x2, 0.0, z2 ); line_set( &l, pt[0], pt[1] ); e = element_init(ObjLine, &l); module_insert(mod, e); line_set( &l, pt[1], pt[2] ); e = element_init(ObjLine, &l); module_insert(mod, e); line_set( &l, pt[2], pt[0]); e = element_init(ObjLine, &l); module_insert(mod, e); point_set3D( &pt[3], x1, 0.0, z1 ); point_set3D( &pt[4], x2, 0.0, z2 ); point_set3D( &pt[5], x2, 1.0, z2 ); point_set3D( &pt[6], x1, 1.0, z1 ); point_copy( &pt[7], &xtop); line_set( &l, pt[0], pt[7] ); e = element_init(ObjLine, &l); module_insert(mod, e); line_set( &l, pt[1], pt[7] ); e = element_init(ObjLine, &l); module_insert(mod, e); line_set( &l, pt[2], pt[7]); e = element_init(ObjLine, &l); module_insert(mod, e); line_set( &l, pt[3], pt[7]); e = element_init(ObjLine, &l); module_insert(mod, e); } } polygon_clear( &p ); }
/* * insert a pyramid into the module */ void module_pyramid(Module *md, int solid, float size, float x, float y, float z){ if(!md){ printf("Null md passed to module_pyramid\n"); return; } Polygon side; Point tv[3]; Point v[5]; Line l; Element *e; int i; polygon_init(&side); // corners of the pyramid point_set3D(&v[0], -1, -1, -1 ); point_set3D(&v[1], 1, -1, -1 ); point_set3D(&v[2], 1, -1, 1 ); point_set3D(&v[3], -1, -1, 1 ); point_set3D(&v[4], 0, 0, 0); //printf("points created\n"); // set pyramid parameters module_scale(md, (int)size, (int)size, (int)size); module_translate(md, (float)x, (float)y, (float)z); //printf("parameters set\n"); if (solid == 0){ // add only lines // foundation for(i=0;i<3;i++){ line_set( &l, v[i], v[i+1] ); e = element_init(ObjLine, &l); module_insert(md, e); } line_set( &l, v[3], v[0] ); e = element_init(ObjLine, &l); module_insert(md, e); // connecting lines line_set( &l, v[4], v[0] ); e = element_init(ObjLine, &l); module_insert(md, e); line_set( &l, v[1], v[4] ); e = element_init(ObjLine, &l); module_insert(md, e); line_set( &l, v[2], v[4] ); e = element_init(ObjLine, &l); module_insert(md, e); line_set( &l, v[3], v[4] ); e = element_init(ObjLine, &l); module_insert(md, e); //printf("successfully passed to module\n"); } else{ // front side point_copy(&tv[0], &v[0]); point_copy(&tv[1], &v[1]); point_copy(&tv[2], &v[4]); polygon_set(&side, 3, tv); e = element_init(ObjPolygon, &side); module_insert(md, e); // back side point_copy(&tv[0], &v[3]); point_copy(&tv[1], &v[2]); point_copy(&tv[2], &v[4]); polygon_set(&side, 3, tv); e = element_init(ObjPolygon, &side); module_insert(md, e); // bottom side polygon_set(&side, 4, &(v[0])); e = element_init(ObjPolygon, &side); module_insert(md, e); // left side point_copy(&tv[0], &v[0]); point_copy(&tv[1], &v[3]); point_copy(&tv[2], &v[4]); polygon_set(&side, 3, tv); e = element_init(ObjPolygon, &side); module_insert(md, e); // right side point_copy(&tv[0], &v[1]); point_copy(&tv[1], &v[2]); point_copy(&tv[2], &v[4]); polygon_set(&side, 3, tv); e = element_init(ObjPolygon, &side); module_insert(md, e); //printf("successfully passed to module\n"); } polygon_clear(&side); }
int main(int argc, char* argv[]){ Image* src; Module *scene; Module* GRAPHICS; View3D view; Matrix vtm, gtm; DrawState *ds; Lighting *light; Point center;//center of animation Polygon poly;//polygon that holds the animation path points int frameNum;//holds the frame number for animation char filename[100];//holds the frame name Color Red; Color Blue; Color Green; Color Grey; Color Lemon; Color Black; Color White; Color Yellow; Color DarkAmbiant; Color randColor[10]; //setting colors Color_set(&Red, 1.0, 0.2, 0.1 ); Color_set(&Blue, 0.1, 0.1, 1.0); Color_set(&Green, 0.1, 1, 0.1 ); Color_set(&White, 1, 1, 1 ); Color_set(&Grey, 0.7, 0.7, 0.7 ); Color_set(&Lemon, 1.0, 1.0, 0.8); Color_set(&Black, 0.05, 0.05, 0.05); Color_set(&Yellow, 1, 0.894118, 0.709804); Color_set(&DarkAmbiant, 0.3, 0.3, 0.3); Color_set(&randColor[0], 0, 1, 1); Color_set(&randColor[1], 0.498039, 1, 0); Color_set(&randColor[2], 1, 0.54902, 0); Color_set(&randColor[3], 1, 0.0784314, 0.576471); Color_set(&randColor[4], 1, 0.843137, 0); Color_set(&randColor[5], 0.960784, 1, 0.980392); Color_set(&randColor[6], 1, 0.647059, 0); Color_set(&randColor[7], 1, 0.270588, 0); Color_set(&randColor[8], 0, 1, 0.498039); Color_set(&randColor[9], 1, 1, 0); // setting the view point_set3D( &(view.vrp), 35, 60, 30 ); vector_set( &(view.vpn), -view.vrp.val[0]+35, -view.vrp.val[1], -view.vrp.val[2]); vector_set( &(view.vup), 0, 1, 0 ); view.d = 1; view.du = 1.6; view.dv = 0.9; view.f = 1; view.b = 200; view.screenx = 1280; view.screeny = 720; matrix_setView3D( &vtm, &view ); matrix_identity( >m ); //creating GRAPHICS module GRAPHICS = module_create(); module_alphabet_G(GRAPHICS); module_identity(GRAPHICS); module_translate(GRAPHICS, 10, 0, 0); module_alphabet_R(GRAPHICS); module_identity(GRAPHICS); module_translate(GRAPHICS, 20, 0, 0); module_alphabet_A(GRAPHICS); module_identity(GRAPHICS); module_translate(GRAPHICS, 30, 0, 0); module_alphabet_P(GRAPHICS); module_identity(GRAPHICS); module_translate(GRAPHICS, 40, 0, 0); module_alphabet_H(GRAPHICS); module_identity(GRAPHICS); module_translate(GRAPHICS, 50, 0, 0); module_alphabet_I(GRAPHICS); module_identity(GRAPHICS); module_translate(GRAPHICS, 56, 0, 0); module_alphabet_C(GRAPHICS); module_identity(GRAPHICS); module_translate(GRAPHICS, 68, 0, 0); module_alphabet_S(GRAPHICS); // setting the light light = lighting_create(); lighting_add( light, LightAmbient, &Lemon, NULL, NULL, 0, 0); lighting_add(light, LightPoint, &White , NULL, &view.vrp, 0, 0); lighting_add(light, LightSpot, &White, &view.vpn, &view.vrp, cos(10*M_PI/180), 40); //setting drawstate ds = drawstate_create(); point_copy(&(ds->viewer), &(view.vrp) ); ds->shade = ShadePhong; // ds->shade = ShadeDepth; drawstate_setBody(ds, Black); drawstate_setSurface(ds, Red); drawstate_setSurfaceCoeff(ds, 10); //Animation frameNum =0; //path #1 point_set3D(¢er, 40, 0, -10); view_rotate_circle(&poly, ¢er, 100, 50, 0, 0, 0); polygon_print(&poly, stdout); for(int k=0; k<100; k++){ frameNum++; point_set3D( &(view.vrp), poly.vertex[k].val[0], poly.vertex[k].val[1], poly.vertex[k].val[2]); vector_set( &(view.vpn), -view.vrp.val[0], -view.vrp.val[1], -view.vrp.val[2] ); matrix_setView3D( &vtm, &view ); //creating scene module scene = module_create(); module_module(scene, GRAPHICS); // image src = image_create( view.screeny, view.screenx ); image_fillrgb(src, 1.0, 1.0, 0.8); //Drawing module_draw( scene, &vtm, >m, ds, light, src ); sprintf(filename, "../images/frame_%.4d.ppm",frameNum); image_write( src, filename); } //path #2 point_set3D(¢er, 40, 0, -10); view_rotate_circle(&poly, ¢er, 100, 90, 0, 0 , 0); // polygon_print(&poly, stdout); for(int k=0; k<100; k++){ if(frameNum == 119){ point_print(&view.vrp, stdout); break; } view_rotate_circle(&poly, ¢er, 50, 50+k, 0-2*k, 0 , 0); frameNum++; point_set3D( &(view.vrp), poly.vertex[k].val[0], poly.vertex[k].val[1], poly.vertex[k].val[2]); vector_set( &(view.vpn), -view.vrp.val[0], -view.vrp.val[1], -view.vrp.val[2] ); matrix_setView3D( &vtm, &view ); //creating scene module scene = module_create(); module_module(scene, GRAPHICS); // image src = image_create( view.screeny, view.screenx ); image_fillrgb(src, 1.0, 1.0, 0.8); //Drawing module_draw( scene, &vtm, >m, ds, light, src ); sprintf(filename, "../images/frame_%.4d.ppm",frameNum); image_write( src, filename); } //path #3 for(int k=0; k<120; k++){ frameNum++; if(frameNum <= 160){ point_set3D( &(view.vrp), -3.345+(k), 36.298+(k), 28.391-(k/2.0)); vector_set( &(view.vpn), -view.vrp.val[0]+k, -view.vrp.val[1], -view.vrp.val[2]); matrix_setView3D( &vtm, &view ); } //creating scene module scene = module_create(); module_module(scene, GRAPHICS); if(frameNum == 160){ light = lighting_create(); lighting_add( light, LightAmbient, &Grey, NULL, NULL, 0, 0); } // setting the light if(frameNum == 165){ Point plight1; point_set3D(&plight1, -5, 10, -10); lighting_add(light, LightSpot, &White, &view.vpn, &plight1, cos(10*M_PI/180), 40); } if(frameNum == 175){ Point plight2; point_set3D(&plight2, 85, 10, -10); lighting_add(light, LightSpot, &White, &view.vpn, &plight2, cos(10*M_PI/180), 40); } if(frameNum == 180){ lighting_add(light, LightSpot, &White, &view.vpn, &view.vrp, cos(10*M_PI/180), 40); } if(frameNum >= 183){ light = lighting_create(); lighting_add( light, LightAmbient, &Grey, NULL, NULL, 0, 0); int output1 = 0 + (rand() % (int)(10 - 0 + 1)); int output2 = 0 + (rand() % (int)(10 - 0 + 1)); int output3 = 0 + (rand() % (int)(10 - 0 + 1)); Point plight1; point_set3D(&plight1, -5, 10, -10); lighting_add(light, LightSpot, &randColor[output1], &view.vpn, &plight1, cos(10*M_PI/180), 40); Point plight2; point_set3D(&plight2, 85, 10, -10); lighting_add(light, LightSpot, &randColor[output2], &view.vpn, &plight2, cos(10*M_PI/180), 40); lighting_add(light, LightSpot, &randColor[output3], &view.vpn, &view.vrp, cos(10*M_PI/180), 40); } // image src = image_create( view.screeny, view.screenx ); image_fillrgb(src, 1.0, 1.0, 0.8); //setting drawstate ds = drawstate_create(); point_copy(&(ds->viewer), &(view.vrp) ); ds->shade = ShadePhong; // ds->shade = ShadeDepth; drawstate_setBody(ds, Black); drawstate_setSurface(ds, Red); drawstate_setSurfaceCoeff(ds, 10); //Drawing module_draw( scene, &vtm, >m, ds, light, src ); sprintf(filename, "../images/frame_%.4d.ppm",frameNum); image_write( src, filename); } //***Uncomment for making the .gif animation*** printf("Making the demo.gif file....\n"); system("convert -delay 10 ../images/frame_*.ppm ../images/demo.gif"); printf("Cleaning up...\n"); system("rm -f ../images/frame_*.ppm"); printf("Finished Successfully :)\n"); return(0); }
/*we are going to draw a cube using our new module hiearchy*/ int main( int argc, char *argv[]){ Image *src; Module *cube1; Module *cube2; Module *cube3; Module *cube4; Module *cube5; Module *cube6; Module *cube7; Module *cube8; Module *manyCubes; Color Blue; View3D view; Matrix vtm, gtm; int rows = 320; int cols = 320; DrawState *ds; int count; char filename[256]; //Set the colors up color_set(&Blue, 0.0, 0, 1.0); // set up the view point_set( &(view.vrp), 1, 2, 0,0 ); vector_set( &(view.vpn), -view.vrp.val[0], -view.vrp.val[1], -view.vrp.val[2] ); vector_set( &(view.vup),0, 1.0, 0); view.d = 5; view.du = 5; view.dv = view.du * (float)rows/cols; view.f = 0; view.b = 5; view.screenx = rows; view.screeny = cols; matrix_setView3D( &vtm, &view ); matrix_identity( >m ); for (count = 0; count< 205; count++){ //Start first cube cube1 = module_create(); module_color( cube1, &Blue); module_translate(cube1, 0, 0, 0-count*0.01); module_cube(cube1, 0); //Set the colors up color_set(&Blue, 0.1, 0.1, 1.0); //Start second cube cube2 = module_create(); module_color(cube2, &Blue); module_translate(cube2, 0, 0, 0+count*0.01); module_cube(cube2, 0); //Set the colors up color_set(&Blue, 0.2, 0.2, 1.0); //start third cube cube3 = module_create(); module_color(cube3, &Blue); module_translate(cube3, 0+count*0.01,0, 0); module_cube(cube3, 0); //Set the colors up color_set(&Blue, 0.3, 0.3, 1.0); //start fourth cube cube4 = module_create(); module_color(cube4, &Blue); module_translate(cube4, 0-count*0.01,0, 0); module_cube(cube4, 0); //Set the colors up color_set(&Blue, 0.4, 0.4, 1.0); //start fifth cube cube5 = module_create(); module_color(cube5, &Blue); module_translate(cube5, 0-count*0.01, 0, 0-count*0.01); module_cube(cube5, 0); //Set the colors up color_set(&Blue, 0.5, 0.5, 1.0); cube6 = module_create(); module_color(cube6, &Blue); module_translate(cube6, 0+count*0.01, 0, 0+count*0.01); module_cube(cube6, 0); //Set the colors up color_set(&Blue, 0.6, 0.6, 1.0); cube7 = module_create(); module_color(cube7, &Blue); module_translate(cube7, 0-count*0.01, 0, 0+count*0.01); module_cube(cube7, 0); //Set the colors up color_set(&Blue, 0.7, 0.7, 1.0); cube8 = module_create(); module_color(cube8, &Blue); module_translate(cube8, 0+count*0.01, 0, 0-count*0.01); module_cube(cube8, 0); //put the cubes into a scene! manyCubes = module_create(); module_module(manyCubes, cube5); module_module(manyCubes, cube6); module_module(manyCubes, cube7); module_module(manyCubes, cube8); module_module(manyCubes, cube1); module_module(manyCubes, cube2); module_module(manyCubes, cube3); module_module(manyCubes, cube4); //Create the image draw state src = image_create(rows, cols); ds = drawstate_create(); ds->shade = ShadeConstant; //Draw the scene module_draw( manyCubes, &vtm, >m, ds, NULL, src ); //write out the scene sprintf(filename, "/export/home/vedwards/Desktop/Graphics/images/blueCube/frame-%04d.ppm", count ); printf("Writing image\n"); image_write( src, filename ); //image_write(src, "blueCubeNew.ppm"); } //free the modules module_delete( manyCubes ); module_delete( cube1 ); module_delete( cube2 ); module_delete( cube3 ); module_delete( cube4 ); module_delete( cube5 ); module_delete( cube6 ); module_delete( cube7 ); module_delete( cube8 ); //free the drawState free(ds); //free the image image_free( src ); return(0); }