- color_t color1 = _get_vertex_color(p, temp.a);
-#if SMOOTH_COLOR
- color_t color2 = _get_vertex_color(p, temp.b);
- color_t color3 = _get_vertex_color(p, temp.c);
+
+#if LIGHTING == 1
+ vert_t tv = vert_new(tri_midpoint(tl));
+ tv.n = vec_normalize(tri_normal(tl));
+ tv.c = tri_color(tl);
+ color_t color = _do_phong_lighting(p, tv);
+#elif LIGHTING == 2 && SMOOTH_COLOR
+ color_t color1 = _do_phong_lighting(p, tl.a);
+ color_t color2 = _do_phong_lighting(p, tl.b);
+ color_t color3 = _do_phong_lighting(p, tl.c);
+#elif LIGHTING == 2 && !SMOOTH_COLOR
+ color_t c = tri_color(t);
+ tl.a.c = tl.b.c = tl.c.c = c;
+ color_t color1 = _do_phong_lighting(p, tl.a);
+ color_t color2 = _do_phong_lighting(p, tl.b);
+ color_t color3 = _do_phong_lighting(p, tl.c);
+#elif !LIGHTING && SMOOTH_COLOR
+ color_t color1 = t.a.c;
+ color_t color2 = t.b.c;
+ color_t color3 = t.c.c;
+#else
+ color_t color = tri_color(t);