]>
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 * Get the color value at a particular point.
44 color_t
raster_color(const raster_t
* p
, vec_t pt
);
48 * Set the viewport rectangle. This effectively sets up a clipping rectangle
49 * where nothing is drawn outside of the rectangle. The default viewport is
50 * [0, 0, width, height], or the entire raster area.
52 void raster_viewport(raster_t
* p
, int x
, int y
, int width
, int height
);
55 * Set the model matrix. This positions the model, providing the
56 * transformation for converting to eye coordinates.
58 void raster_model(raster_t
* p
, const mat_t
* transform
);
61 * Set the view matrix. This positions the camera, providing the
62 * transformation for converting to world coordinates.
64 void raster_view(raster_t
* p
, const mat_t
* transform
);
67 * Set the projection matrix. This provides the transformation for converting
68 * to canonical coordinates.
70 void raster_projection(raster_t
* p
, const mat_t
* transform
);
74 * Set the location of the viewer in world coordinates. This is used in
75 * specular lighting calculations.
77 void raster_eye(raster_t
* p
, vec_t eye
);
80 * Set the ambient light for the scene.
82 void raster_ambient(raster_t
* p
, color_t ambient
);
85 * Add a light to the scene.
87 void raster_light(raster_t
* p
, light_t light
);
90 * Set the material properties for the scene.
92 void raster_material(raster_t
* p
, color_t specular
, scal_t shininess
);
96 * Save the raster to a PPM file.
98 int raster_export_ppm(const raster_t
* p
, const char* filename
);
101 * Save the raster to a BMP file.
103 int raster_export_bmp(const raster_t
* p
, const char* filename
);
107 * Load the raster from an image file. The file extension is used to
108 * determine which importer is actually called.
110 raster_t
* raster_import(const char* filename
);
113 * Load the raster from a PPM file.
115 raster_t
* raster_import_ppm(const char* filename
);
118 * Load the raster from a BMP file.
120 raster_t
* raster_import_bmp(const char* filename
);
124 * Fill the entire raster with a solid color and reset the raster statistics.
126 void raster_clear(raster_t
* p
, color_t fill
);
129 * Draw a model to the raster.
131 void raster_draw_model(raster_t
* p
, const model_t
* model
);
134 * Draw a triangle to the raster.
136 void raster_draw_tri(raster_t
* p
, const tri_t
* triangle
);
This page took 0.044809 seconds and 5 git commands to generate.