diff --git a/camera.c b/camera.c index ad0a453..6466cdf 100644 --- a/camera.c +++ b/camera.c @@ -288,19 +288,20 @@ process_pixel(int i, int j) p.col.g += (16.0 / p.scene_dist); p.col.b += (16.0 / p.scene_dist); } else { - // p.col.r -= p.iterations; - // p.col.g -= p.iterations; - // p.col.b -= p.iterations; } - double fade_intensity = 10; + p.col.r -= p.iterations / 2; + p.col.g -= p.iterations / 2; + p.col.b -= p.iterations / 2; - if (p.travel_dist < DRAW_DIST) { - p.col.r -= fade_intensity * p.travel_dist / DRAW_DIST; - p.col.g -= fade_intensity * p.travel_dist / DRAW_DIST; - p.col.b -= fade_intensity * p.travel_dist / DRAW_DIST; + double fade_intensity = 50; + + // if (p.travel_dist < DRAW_DIST) { + p.col.r += fade_intensity * p.travel_dist / DRAW_DIST; + p.col.g += fade_intensity * p.travel_dist / DRAW_DIST; + p.col.b += fade_intensity * p.travel_dist / DRAW_DIST; - } + //} p.col.r = clamp(p.col.r, 0, 255); p.col.g = clamp(p.col.g, 0, 255); diff --git a/distfuncs.c b/distfuncs.c index 2fb4b75..5d9acc2 100644 --- a/distfuncs.c +++ b/distfuncs.c @@ -298,8 +298,13 @@ new_object(struct vec* position, double rotation, double scale, return new_obj; } +struct colour yeet_whit(struct ray *ray, struct object* obj) { + struct colour c = {.r = 200, .g = 200, .b = 0, .a = 255, .sp=CS_RGB}; + return c; +} + struct object new_plane(struct vec* position, double rotation, double scale) { - return new_object(position, rotation, scale, sdf_hplane, yeet_pho); + return new_object(position, rotation, scale, sdf_hplane, yeet_whit); } struct object new_sphere(struct vec* position, double rotation, double scale) { @@ -324,11 +329,6 @@ struct object new_vert_line(struct vec* position, double rotation, double scale) return new_object(position, rotation, scale, sdf_phat_vert_line, yeet_pho); } -struct colour yeet_whit(struct ray *ray, struct object* obj) { - struct colour c = {.r = 200, .g = 200, .b = 200, .a = 255, .sp=CS_RGB}; - return c; -} - struct colour yeet_green(struct ray *ray, struct object* obj) { struct colour c = {.r = 0, .g = (rand() % 127) + 127, .b = 0, .a = 255, .sp=CS_RGB}; return c; @@ -349,12 +349,13 @@ struct colour yeet_brown(struct ray *ray, struct object* obj) { struct object* new_tree(struct vec* position, double rotation, double scale) { struct object* tree = malloc(2 * sizeof(struct object)); struct object trunk = new_object(position, rotation, scale, sdf_phat_vert_line, yeet_pho); - trunk.base_col = (struct colour){.r = 210, .g = 105, .b = 30, .sp = CS_RGB}; + trunk.base_col = (struct colour){.r = 0x92, .g = 0x2D, .b = 0x50, .sp = CS_RGB}; + trunk.base_col.g += rand() % 20; struct vec* leaf_pos = add_vec_ip(new_vec3(0, -1.5, 0), position); struct object leaves = new_object(leaf_pos, rotation, scale, sdf_3ellipsoid, yeet_pho); - leaves.base_col = (struct colour){.r = 0, .g = 255, .b = 0, .sp = CS_RGB}; - leaves.base_col = (struct colour){.r = 30 + random() % 20, .g = 155 + random() % 100, .b = random() % 90, .sp = CS_RGB}; + leaves.base_col = (struct colour){.r = 0xC0, .g = 0xDA, .b = 0x74, .sp = CS_RGB}; + // leaves.base_col = (struct colour){.r = 30 + random() % 20, .g = 155 + random() % 100, .b = random() % 90, .sp = CS_RGB}; tree[0] = trunk; tree[1] = leaves; diff --git a/main.c b/main.c index 292f082..f0197a2 100644 --- a/main.c +++ b/main.c @@ -145,6 +145,7 @@ void setup_camera_scene() camera->x->elements[0] = 1; camera->y->elements[1] = 1; camera->z->elements[2] = 1; + camera->pos->elements[2] = 4; camera->light = new_vec4(0, 1000, -1000, 0); diff --git a/scene.c b/scene.c index d137b57..6e91cde 100644 --- a/scene.c +++ b/scene.c @@ -51,7 +51,7 @@ new_scene(int num_scene_objects, struct object* scene_objects) for (int i = 0; i < num_scene_objects; i++) { place(&(scene.objects[i].sol)); } - */ + */ struct object *scene_rep = malloc(sizeof(struct object)); scene_rep->sol.dist = distance_function;