- _group_t* g = (_group_t*)mem_alloc(sizeof(_group_t));
- g->triangles = NULL;
- g->modelview = MAT_IDENTITY;
-
- double x1, y1, z1, x2, y2, z2, x3, y3, z3;
- while (fscanf(file, " %lf %lf %lf %lf %lf %lf %lf %lf %lf",
- &x1, &y1, &z1, &x2, &y2, &z2, &x3, &y3, &z3) == 9) {
- tri_t* t = tri_alloc(
- vert_new2((scal_t)x1, (scal_t)y1, (scal_t)z1, COLOR_WHITE),
- vert_new2((scal_t)x2, (scal_t)y2, (scal_t)z2, COLOR_WHITE),
- vert_new2((scal_t)x3, (scal_t)y3, (scal_t)z3, COLOR_WHITE)
- );
- list_push2(&g->triangles, t, mem_free);
- }
- list_reverse(&g->triangles);
+ scene_t* s = (scene_t*)mem_alloc(sizeof(scene_t));
+ s->models = NULL;
+ s->w = w;
+ s->h = h;
+ s->view = MAT_LOOKAT(vec_new( (scal_t)eyeX, (scal_t)eyeY, (scal_t)eyeZ),
+ vec_new((scal_t)spotX, (scal_t)spotY, (scal_t)spotZ),
+ vec_new( (scal_t)upX, (scal_t)upY, (scal_t)upZ));
+ s->eye = vec_new(eyeX, eyeY, eyeZ);
+ s->projection = MAT_PERSPECTIVE((scal_t)fovy, (scal_t)aspect, (scal_t)near, (scal_t)far);
+ s->lights = NULL;
+ s->ambient = color_new(S(0.05), S(0.05), S(0.05), S(1.0));