* 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_