]> Dogcows Code - chaz/rasterize/blobdiff - vert.h
add support for 3d scenes, depth testing, lighting
[chaz/rasterize] / vert.h
diff --git a/vert.h b/vert.h
index 232a0cf7d8a78b87a91f549239c1834dc1a65765..48b3e2db1c59bbcafb9538b92c89d9232e29502c 100644 (file)
--- 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_
 
This page took 0.019829 seconds and 4 git commands to generate.