]> Dogcows Code - chaz/rasterize/blobdiff - light.h
add support for 3d scenes, depth testing, lighting
[chaz/rasterize] / light.h
diff --git a/light.h b/light.h
new file mode 100644 (file)
index 0000000..99c0d7c
--- /dev/null
+++ b/light.h
@@ -0,0 +1,50 @@
+
+/*
+ * CS5600 University of Utah
+ * Charles McGarvey
+ * mcgarvey@eng.utah.edu
+ */
+
+#ifndef _LIGHT_H_
+#define _LIGHT_H_
+
+#include "color.h"
+#include "vec.h"
+
+
+/*
+ * A light source.
+ */
+struct light
+{
+    color_t color;
+    vec_t   position;
+};
+typedef struct light light_t;
+
+
+/*
+ * Initialize a light with a color and position.
+ */
+INLINE_MAYBE
+void light_init(light_t* l, color_t color, vec_t position)
+{
+    l->color = color;
+    l->position = position;
+}
+
+
+/*
+ * Create a new light with a color and position.
+ */
+INLINE_MAYBE
+light_t light_new(color_t color, vec_t position)
+{
+    light_t l;
+    light_init(&l, color, position);
+    return l;
+}
+
+
+#endif // _LIGHT_H_
+
This page took 0.053714 seconds and 4 git commands to generate.