/* * CS5600 University of Utah * Charles McGarvey * mcgarvey@eng.utah.edu */ #ifndef _VERT_H_ #define _VERT_H_ #include "color.h" #include "vec.h" /* * A vertex is a point, a normal, and a color. */ struct vert { vec_t v; vec_t n; vec_t t; color_t c; }; typedef struct vert vert_t; /* * Initialize a vertex with a point vector, normal, texture coordinates, * and a color. */ INLINE_MAYBE void vert_init(vert_t* r, vec_t v, vec_t n, vec_t t, color_t c) { r->v = v; r->n = n; r->t = t; r->c = c; } /* * Create a new vertex with a point vector. */ INLINE_MAYBE vert_t vert_new(vec_t v) { vert_t r; vert_init(&r, v, VEC_ZERO, VEC_ZERO, COLOR_WHITE); return r; } /* * Create a new vertex from vector components. */ INLINE_MAYBE vert_t vert_new2(scal_t x, scal_t y, scal_t z) { return vert_new(vec_new(x, y, z)); } #define VERT_ZERO vert_new(VEC_ZERO) #endif // _VERT_H_