- for (const list_t* i = model_geometry(m); i; i = i->link) {
- tri_t* t = (tri_t*)i->val;
- t->a.c = color_new((colorchan_t)r, (colorchan_t)g, (colorchan_t)b, (colorchan_t)a);
- t->b.c = color_new((colorchan_t)r, (colorchan_t)g, (colorchan_t)b, (colorchan_t)a);
- t->c.c = color_new((colorchan_t)r, (colorchan_t)g, (colorchan_t)b, (colorchan_t)a);
+ color_t color = color_new((colorchan_t)r, (colorchan_t)g, (colorchan_t)b, (colorchan_t)a);
+
+ array_it_t it = array_begin(model_geometry(m));
+ for (tri_t* t; t = array_it_tri_next(&it);) {
+ t->a.c = color;
+ t->b.c = color;
+ t->c.c = color;