initial commit
[chaz/rasterize] / main.c
1
2 /*
3 * CS5600 University of Utah
4 * Charles McGarvey
5 * mcgarvey@eng.utah.edu
6 */
7
8 #include <stdio.h>
9
10 #include "pixmap.h"
11 #include "scene.h"
12
13
14 /*
15 * Read a scene file, construct the scene object, draw the scene to a pixmap,
16 * and export the pixmap in PPM and BMP formats.
17 */
18 int main(int argc, char* argv[])
19 {
20 scene_t* scene = scene_alloc("scene.u2d");
21 if (scene == NULL) {
22 fprintf(stderr, "An error prevented the scene from loading. Aborting!\n");
23 return 1;
24 }
25
26 pixmap_t* raster = scene_render(scene);
27 scene_destroy(scene);
28
29 pixmap_export_ppm(raster, "scene.ppm");
30 pixmap_export_bmp(raster, "scene.bmp");
31
32 pixmap_destroy(raster);
33
34 #ifndef NDEBUG
35 int _blocks = mem_blocks();
36 if (_blocks != 0) {
37 fprintf(stderr, " *** Leaked %d blocks of memory! ***\n", _blocks);
38 return 1;
39 }
40 #endif
41 return 0;
42 }
43
This page took 0.03815 seconds and 4 git commands to generate.