]>
Dogcows Code - chaz/rasterize/blob - raster.h
3 * CS5600 University of Utah
5 * mcgarvey@eng.utah.edu
18 * A pixel map for storing and manipulating a 2D grid of color values.
20 typedef struct raster raster_t
;
24 * Create a new raster on the heap.
26 raster_t
* raster_alloc(int width
, int height
, color_t fill
);
29 * Free up the memory associated with the raster.
31 void raster_destroy(raster_t
* p
);
35 * Print some optimization statistics.
37 void raster_printstats(raster_t
* p
);
41 * Set the viewport rectangle. This effectively sets up a clipping rectangle
42 * where nothing is drawn outside of the rectangle. The default viewport is
43 * [0, 0, width, height], or the entire raster area.
45 void raster_viewport(raster_t
* p
, int x
, int y
, int width
, int height
);
48 * Set the model matrix. This positions the model, providing the
49 * transformation for converting to eye coordinates.
51 void raster_model(raster_t
* p
, const mat_t
* transform
);
54 * Set the view matrix. This positions the camera, providing the
55 * transformation for converting to world coordinates.
57 void raster_view(raster_t
* p
, const mat_t
* transform
);
60 * Set the projection matrix. This provides the transformation for converting
61 * to canonical coordinates.
63 void raster_projection(raster_t
* p
, const mat_t
* transform
);
67 * Set the location of the viewer in world coordinates. This is used in
68 * specular lighting calculations.
70 void raster_eye(raster_t
* p
, vec_t eye
);
73 * Set the ambient light for the scene.
75 void raster_ambient(raster_t
* p
, color_t ambient
);
78 * Add a light to the scene.
80 void raster_light(raster_t
* p
, light_t light
);
83 * Set the material properties for the scene.
85 void raster_material(raster_t
* p
, color_t specular
, scal_t shininess
);
89 * Save the raster to a PPM file.
91 int raster_export_ppm(const raster_t
* p
, const char* filename
);
94 * Save the raster to a BMP file.
96 int raster_export_bmp(const raster_t
* p
, const char* filename
);
100 * Fill the entire raster with a solid color and reset the raster statistics.
102 void raster_clear(raster_t
* p
, color_t fill
);
105 * Draw a smooth gradient triangle to the raster.
107 void raster_draw_tri(raster_t
* p
, const tri_t
* triangle
);
This page took 0.036628 seconds and 4 git commands to generate.