]>
Dogcows Code - chaz/rasterize/blob - raster.h
3 * CS5600 University of Utah
5 * mcgarvey@eng.utah.edu
19 * A pixel map for storing and manipulating a 2D grid of color values.
21 typedef struct raster raster_t
;
25 * Create a new raster on the heap.
27 raster_t
* raster_alloc(int width
, int height
, color_t fill
);
30 * Free up the memory associated with the raster.
32 void raster_destroy(raster_t
* p
);
36 * Print some optimization statistics.
38 void raster_printstats(raster_t
* p
);
42 * Set the viewport rectangle. This effectively sets up a clipping rectangle
43 * where nothing is drawn outside of the rectangle. The default viewport is
44 * [0, 0, width, height], or the entire raster area.
46 void raster_viewport(raster_t
* p
, int x
, int y
, int width
, int height
);
49 * Set the model matrix. This positions the model, providing the
50 * transformation for converting to eye coordinates.
52 void raster_model(raster_t
* p
, const mat_t
* transform
);
55 * Set the view matrix. This positions the camera, providing the
56 * transformation for converting to world coordinates.
58 void raster_view(raster_t
* p
, const mat_t
* transform
);
61 * Set the projection matrix. This provides the transformation for converting
62 * to canonical coordinates.
64 void raster_projection(raster_t
* p
, const mat_t
* transform
);
68 * Set the location of the viewer in world coordinates. This is used in
69 * specular lighting calculations.
71 void raster_eye(raster_t
* p
, vec_t eye
);
74 * Set the ambient light for the scene.
76 void raster_ambient(raster_t
* p
, color_t ambient
);
79 * Add a light to the scene.
81 void raster_light(raster_t
* p
, light_t light
);
84 * Set the material properties for the scene.
86 void raster_material(raster_t
* p
, color_t specular
, scal_t shininess
);
90 * Save the raster to a PPM file.
92 int raster_export_ppm(const raster_t
* p
, const char* filename
);
95 * Save the raster to a BMP file.
97 int raster_export_bmp(const raster_t
* p
, const char* filename
);
101 * Fill the entire raster with a solid color and reset the raster statistics.
103 void raster_clear(raster_t
* p
, color_t fill
);
106 * Draw a model to the raster.
108 void raster_draw_model(raster_t
* p
, const model_t
* model
);
111 * Draw a triangle to the raster.
113 void raster_draw_tri(raster_t
* p
, const tri_t
* triangle
);
This page took 0.038098 seconds and 4 git commands to generate.