]> Dogcows Code - chaz/rasterize/blob - vert.h
import project 3 files; added blending
[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, a normal, and a color.
17 */
18 struct vert
19 {
20 vec_t v;
21 vec_t n;
22 vec_t t;
23 color_t c;
24 };
25 typedef struct vert vert_t;
26
27
28 /*
29 * Initialize a vertex with a point vector, normal, and a color.
30 */
31 INLINE_MAYBE
32 void vert_init(vert_t* r, vec_t v, vec_t n, vec_t t, color_t c)
33 {
34 r->v = v;
35 r->n = n;
36 r->t = t;
37 r->c = c;
38 }
39
40
41 /*
42 * Create a new vertex with a point vector.
43 */
44 INLINE_MAYBE
45 vert_t vert_new(vec_t v)
46 {
47 vert_t r;
48 vert_init(&r, v, VEC_ZERO, VEC_ZERO, COLOR_WHITE);
49 return r;
50 }
51
52 /*
53 * Create a new vertex from vector components.
54 */
55 INLINE_MAYBE
56 vert_t vert_new2(scal_t x, scal_t y, scal_t z)
57 {
58 return vert_new(vec_new(x, y, z));
59 }
60
61 #define VERT_ZERO vert_new(VEC_ZERO)
62
63
64 #endif // _VERT_H_
65
This page took 0.034086 seconds and 5 git commands to generate.