+static int _scene_add_triangle(scene_t* s, FILE* file)
+{
+ double x1, y1, z1, x2, y2, z2, x3, y3, z3, r, g, b;
+ if (fscanf(file, " %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf",
+ &x1, &y1, &z1, &x2, &y2, &z2, &x3, &y3, &z3, &r, &g, &b) != 12) {
+ fprintf(stderr, "Cannot read triangle values from scene.\n");
+ return -1;
+ }
+ rt::element* triangle = new rt::triangle(
+ vec_new((scal_t)x1, (scal_t)y1, (scal_t)z1),
+ vec_new((scal_t)x2, (scal_t)y2, (scal_t)z2),
+ vec_new((scal_t)x3, (scal_t)y3, (scal_t)z3)
+ );
+ triangle->material(color_new((scal_t)r, (scal_t)g, (scal_t)b, S(1.0)));
+ list_push2(&s->objects, triangle, DTOR(rt::triangle_destroy));
+ return 0;
+}
+
+
+list_t* scene_elements(const scene_t* s)
+{
+ return s->objects;
+}
+
+list_t* scene_lights(const scene_t* s)
+{
+ return s->lights;
+}
+
+color_t scene_ambient(const scene_t* s)
+{
+ return s->ambient;
+}
+