]> Dogcows Code - chaz/rasterize/blob - vert.h
fixes for compiling with mingw32
[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, texture coordinates,
30 * and a color.
31 */
32 INLINE_MAYBE
33 void vert_init(vert_t* r, vec_t v, vec_t n, vec_t t, color_t c)
34 {
35 r->v = v;
36 r->n = n;
37 r->t = t;
38 r->c = c;
39 }
40
41
42 /*
43 * Create a new vertex with a point vector.
44 */
45 INLINE_MAYBE
46 vert_t vert_new(vec_t v)
47 {
48 vert_t r;
49 vert_init(&r, v, VEC_ZERO, VEC_ZERO, COLOR_WHITE);
50 return r;
51 }
52
53 /*
54 * Create a new vertex from vector components.
55 */
56 INLINE_MAYBE
57 vert_t vert_new2(scal_t x, scal_t y, scal_t z)
58 {
59 return vert_new(vec_new(x, y, z));
60 }
61
62 #define VERT_ZERO vert_new(VEC_ZERO)
63
64
65 #endif // _VERT_H_
66
This page took 0.035312 seconds and 4 git commands to generate.