#include "solid.h"

void show_scene()
/*  Traverses all object and facet descriptors. */
{
    struct solid_obj *obj_ptr;
    struct facet *facet_ptr;
    int vertex_ref_index, facet_index;
    float tmp;

    obj_ptr = obj_first;
    while (obj_ptr != (struct solid_obj *)NULL) {
        /* loop for each object */
        transform_object(obj_ptr);
        obj_ptr = obj_ptr->obj_next;
    }

    /* adjust screen coordinates for border */
    tmp = screen_x_min - border * (screen_x_max -
        screen_x_min);
    screen_x_max += border * (screen_x_max -
         screen_x_min);
    screen_x_min = tmp;
    tmp = screen_y_min - border * (screen_y_max -
        screen_y_min);
    screen_y_max += border * (screen_y_max -
         screen_y_min);
    screen_y_min = tmp;

    obj_ptr = obj_first;
    while (obj_ptr != (struct solid_obj *)NULL) {
        /* loop for each object */
        for (facet_ptr = defn_ptr[obj_ptr->obj_type]->
            facet_first, facet_index = 0; facet_index <
            defn_ptr[obj_ptr->obj_type]->facet_count;
            ++facet_index) { /* loop for each facet */
            display_facet(obj_ptr, facet_ptr, TRUE,
                obj_ptr->visible[facet_index]);
                /* project and display facet */
            facet_ptr = ADV_FACET_PTR(facet_ptr->
                vertex_count);
        }
        obj_ptr = obj_ptr->obj_next;
    }
}
