/* * 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 and its associated color. */ struct vert { vec_t v; color_t c; }; typedef struct vert vert_t; /* * Initialize a vertex with a point vector and a color. */ __fast__ void vert_init(vert_t* r, vec_t v, color_t c) { r->v = v; r->c = c; } /* * Create a new vertex with a point vector and a color. */ __fast__ vert_t vert_new(vec_t v, color_t c) { vert_t r; vert_init(&r, v, c); return r; } /* * Create a new vertex from vector components and a color. */ __fast__ vert_t vert_new2(scal_t x, scal_t y, scal_t z, color_t c) { vec_t v = vec_new(x, y, z); return vert_new(v, c); } #define VERT_ZERO vert_new(VEC_ZERO, COLOR_CLEAR) #endif // __VERT_H__