/* sp6main.c */ #include "ray.h" light_t lgt = { center: {-1.0, 0.0, 2.0}, }; obj_t ltobj = { objid: 102, objtype: 10, emissivity: {7, 7, 7}, priv: (void *)&lgt }; sphere_t sph = { center: {1.0, 0.0, -2.0}, radius: 1.0 }; obj_t obj = { next: NULL, objid: 100, objtype: 13, hits: sphere_hits, material: {{0, 0, 0}, {5, 0, 0}, {0, 0, 0}}, priv: (void *)&sph }; plane_t pln = { point: {0, 0, -8}, normal: {0, 0, 1} }; obj_t obj2 = { objid: 101, next: &obj, objtype: 14, hits: plane_hits, material: {{0, 0, 0}, {5, 0, 0}, {0, 0, 0}}, priv: (void *)&pln, hitloc: {0, 0, -8}, normal: {0, 0, 1} }; double view_point[3] = {0, 0, 4.0}; double ray_dir[3] = {0, 0, -1}; list_t obj_list = { head: &obj2, tail: &obj }; list_t light_list = { head: <obj, tail: <obj }; model_t model = { scene: &obj_list, lights: &light_list }; int main() { double ivec[3] = {0, 0, 0}; int i; for (i = 0; i < 10; i++) { fprintf(stderr, "\n"); diffuse_illumination(&model, &obj2, ivec); obj2.hitloc[0] += 1; memset(ivec, 0, 3 * sizeof(double)); } return(0); }