X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Frasterize;a=blobdiff_plain;f=vert.h;h=48b3e2db1c59bbcafb9538b92c89d9232e29502c;hp=232a0cf7d8a78b87a91f549239c1834dc1a65765;hb=c875478cdd823c7df8fdc859941bd9e5948c9315;hpb=0f2508a4f227523a6b7e54798487af19d06a6ce9 diff --git a/vert.h b/vert.h index 232a0cf..48b3e2d 100644 --- a/vert.h +++ b/vert.h @@ -5,58 +5,59 @@ * mcgarvey@eng.utah.edu */ -#ifndef __VERT_H__ -#define __VERT_H__ +#ifndef _VERT_H_ +#define _VERT_H_ #include "color.h" #include "vec.h" /* - * A vertex is a point and its associated color. + * A vertex is a point, a normal, and a color. */ struct vert { vec_t v; + vec_t n; color_t c; }; typedef struct vert vert_t; /* - * Initialize a vertex with a point vector and a color. + * Initialize a vertex with a point vector, normal, and a color. */ -__fast__ -void vert_init(vert_t* r, vec_t v, color_t c) +INLINE_MAYBE +void vert_init(vert_t* r, vec_t v, vec_t n, color_t c) { r->v = v; + r->n = n; r->c = c; } /* - * Create a new vertex with a point vector and a color. + * Create a new vertex with a point vector. */ -__fast__ -vert_t vert_new(vec_t v, color_t c) +INLINE_MAYBE +vert_t vert_new(vec_t v) { vert_t r; - vert_init(&r, v, c); + vert_init(&r, v, VEC_ZERO, COLOR_WHITE); return r; } /* - * Create a new vertex from vector components and a color. + * Create a new vertex from vector components. */ -__fast__ -vert_t vert_new2(scal_t x, scal_t y, scal_t z, color_t c) +INLINE_MAYBE +vert_t vert_new2(scal_t x, scal_t y, scal_t z) { - vec_t v = vec_new(x, y, z); - return vert_new(v, c); + return vert_new(vec_new(x, y, z)); } -#define VERT_ZERO vert_new(VEC_ZERO, COLOR_CLEAR) +#define VERT_ZERO vert_new(VEC_ZERO) -#endif // __VERT_H__ +#endif // _VERT_H_