]> Dogcows Code - chaz/rasterize/blob - vert.h
initial commit
[chaz/rasterize] / vert.h
1
2 /*
3 * CS5600 University of Utah
4 * Charles McGarvey
5 * mcgarvey@eng.utah.edu
6 */
7
8 #ifndef __VERT_H__
9 #define __VERT_H__
10
11 #include "color.h"
12 #include "vec.h"
13
14
15 /*
16 * A vertex is a point and its associated color.
17 */
18 struct vert
19 {
20 vec_t v;
21 color_t c;
22 };
23 typedef struct vert vert_t;
24
25
26 /*
27 * Initialize a vertex with a point vector and a color.
28 */
29 __fast__
30 void vert_init(vert_t* r, vec_t v, color_t c)
31 {
32 r->v = v;
33 r->c = c;
34 }
35
36
37 /*
38 * Create a new vertex with a point vector and a color.
39 */
40 __fast__
41 vert_t vert_new(vec_t v, color_t c)
42 {
43 vert_t r;
44 vert_init(&r, v, c);
45 return r;
46 }
47
48 /*
49 * Create a new vertex from vector components and a color.
50 */
51 __fast__
52 vert_t vert_new2(scal_t x, scal_t y, scal_t z, color_t c)
53 {
54 vec_t v = vec_new(x, y, z);
55 return vert_new(v, c);
56 }
57
58 #define VERT_ZERO vert_new(VEC_ZERO, COLOR_CLEAR)
59
60
61 #endif // __VERT_H__
62
This page took 0.034838 seconds and 5 git commands to generate.