summaryrefslogtreecommitdiffstats
path: root/libdimension/tests
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2014-06-04 14:56:30 -0400
committerTavian Barnes <tavianator@tavianator.com>2014-06-04 14:58:32 -0400
commit13779f79f41e8bce483e98faa6353c07c12563c8 (patch)
tree32e9daa27f7eb687eb60692529179fb75124f976 /libdimension/tests
parent36e399810a25d5d3a41570ee0f52f8e6d1402fbc (diff)
downloaddimension-13779f79f41e8bce483e98faa6353c07c12563c8.tar.xz
triangles: Better API.
Diffstat (limited to 'libdimension/tests')
-rw-r--r--libdimension/tests/render.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/libdimension/tests/render.c b/libdimension/tests/render.c
index f12aa8b..bd0c8ca 100644
--- a/libdimension/tests/render.c
+++ b/libdimension/tests/render.c
@@ -222,9 +222,11 @@ static void
dmnsn_test_scene_add_triangle_strip(dmnsn_pool *pool, dmnsn_scene *scene)
{
dmnsn_array *strip_array = DMNSN_NEW_ARRAY(dmnsn_object *);
- dmnsn_vector a = dmnsn_zero;
- dmnsn_vector b = dmnsn_new_vector(0.0, sqrt(3.0)/2.0, 0.5);
- dmnsn_vector c = dmnsn_z;
+ dmnsn_vector vertices[] = {
+ dmnsn_zero,
+ dmnsn_new_vector(0.0, sqrt(3.0)/2.0, 0.5),
+ dmnsn_z,
+ };
dmnsn_texture *strip_textures[3] = {
dmnsn_new_texture(pool),
dmnsn_new_texture(pool),
@@ -234,13 +236,13 @@ dmnsn_test_scene_add_triangle_strip(dmnsn_pool *pool, dmnsn_scene *scene)
strip_textures[1]->pigment = dmnsn_new_solid_pigment(pool, DMNSN_TCOLOR(dmnsn_orange));
strip_textures[2]->pigment = dmnsn_new_solid_pigment(pool, DMNSN_TCOLOR(dmnsn_yellow));
for (unsigned int i = 0; i < 128; ++i) {
- dmnsn_object *triangle = dmnsn_new_flat_triangle(pool, a, b, c);
+ dmnsn_object *triangle = dmnsn_new_triangle(pool, vertices);
triangle->texture = strip_textures[i%3];
dmnsn_array_push(strip_array, &triangle);
- a = b;
- b = c;
- c = dmnsn_vector_add(a, dmnsn_z);
+ vertices[0] = vertices[1];
+ vertices[1] = vertices[2];
+ vertices[2] = dmnsn_vector_add(vertices[0], dmnsn_z);
}
dmnsn_object *strip = dmnsn_new_csg_union(pool, strip_array);