diff options
-rw-r--r-- | main.c | 6 | ||||
-rw-r--r-- | pgm.c | 2 | ||||
-rw-r--r-- | pgm.h | 2 | ||||
-rw-r--r-- | test.png | bin | 60983 -> 65535 bytes |
4 files changed, 5 insertions, 5 deletions
@@ -55,13 +55,13 @@ int main() add_sphere(&s, vector_set(NULL, 8, 8, 3), 2, &m2); add_plane(&s, vector_set(NULL, 0, 0, 2), vector_set(NULL, 0, 0, 1), &mpl); //add_plane(&s, vector_set(NULL, 0, -20, 0), vector_set(NULL, 0, 1, 0), &mpl); - add_light(&s, vector_set(NULL, 20, 10, 30), color_set(NULL, 1, 1, 1), color_set(NULL, 0.5, 0.5, 0.5)); - //add_light(&s, vector_set(NULL, 0, 10, 20), color_set(NULL, 255, 255, 255), color_set(NULL, 150, 150, 150)); + add_light(&s, vector_set(NULL, 20, 10, 30), color_set(NULL, 0.2, 0.2, 0.2), color_set(NULL, 0.5, 0.5, 0.5)); + add_light(&s, vector_set(NULL, 0, 10, 20), color_set(NULL, 0.5, 0.5, 0.5), color_set(NULL, 0.5, 0.5, 0.5)); pgm_write_header(stdout, TESTW, TESTH); for (int y = TESTH; y; y--) { for (int x = TESTW; x; x--) { - color_t *c = ray_trace(&s, x, y, 8); + color_t *c = ray_trace(&s, x, y, 2); if (c) { pgm_write_pixel(stdout, c); @@ -15,7 +15,7 @@ int pgm_write_pixel(FILE *fp, color_t *c) return fprintf(fp, "%.0lf %.0lf %.0lf\n", c->r * COLOR_MAX, c->g * COLOR_MAX, c->b * COLOR_MAX); } -color_t *color_set(color_t *c, uint8_t r, uint8_t g, uint8_t b) +color_t *color_set(color_t *c, COORD_T r, COORD_T g, COORD_T b) { if (!c) { c = (color_t *) malloc(sizeof(color_t)); @@ -9,7 +9,7 @@ typedef struct { COORD_T r, g, b; } color_t; -color_t *color_set(color_t *c, uint8_t r, uint8_t g, uint8_t b); +color_t *color_set(color_t *c, COORD_T r, COORD_T g, COORD_T b); color_t *color_scale(color_t *dest, color_t *a, COORD_T b); color_t *color_add(color_t *dest, color_t *a, color_t *b); color_t *color_scale_vector(color_t *dest, color_t *a, vector_t *v); Binary files differ |