static void create_fuzzy(t_env *env) { t_fract fract; ft_bzero(&fract, sizeof(t_fract)); while (fract.y < WIN_H) { fract.x = -1; while (++fract.x < WIN_W) { fract.z.r = (fract.x - WIN_W * 0.5) * RATIO / (env->key.zoom * WIN_W) + env->key.move_sides; fract.z.i = (fract.y - WIN_H * 0.5) / (env->key.zoom * WIN_H) + env->key.move_updown; //fract.c.r = -0.375; //fract.c.i = 0.002; fuzzy_iter(&fract, env->maxiter); if (fract.iter > 8 && fract.iter < env->maxiter) my_pixel_put_to_image(env, get_color(fract.iter), fract.x, fract.y); else if (fract.iter <= 8) my_pixel_put_to_image(env, 0xffffff, fract.x, fract.y); else my_pixel_put_to_image(env, 0x000000, fract.x, fract.y); } fract.y++; } }
static void create_glynn(t_env *env) { t_fract fract; ft_bzero(&fract, sizeof(t_fract)); while (fract.y < WIN_H) { fract.x = 0; while (fract.x < WIN_W) { fract.z.r = (fract.x - WIN_W / 2) / (1.2 * env->key.zoom * WIN_W) + env->key.move_sides; fract.z.i = (fract.y - WIN_H / 2) / (1.2 * env->key.zoom * WIN_H) + env->key.move_updown; fract.c.r = 0.291 + fract.c.r / 10; fract.c.i = 0.006 + (fract.c.i/ 100) / 4; glynn_iter(&fract, env->maxiter); if (fract.iter < env->maxiter) my_pixel_put_to_image(env, get_color(fract.z.r), fract.x, fract.y); // else if (fract.z.r <= 5) // my_pixel_put_to_image(env, 0xffffff, fract.x, fract.y); else my_pixel_put_to_image(env, 0x000000, fract.x, fract.y); fract.x++; } fract.y++; } }
void trace_back(t_system *sys) { int i; int j; i = 0; j = HEIGHT * sys->image.sizeline / 2; while (i < HEIGHT * sys->image.sizeline / 2) { my_pixel_put_to_image(sys->image.data, i, 0xFF404000); my_pixel_put_to_image(sys->image.data, j, 0x00C80000); i += 4; j += 4; } }
void compute_rt(t_all *all, char *path) { t_info *result; int fd_isback[2]; t_coor coord; time_t begin; t_image *ldbar; ldbar = get_loadimage(all); begin = compute_init(all, fd_isback, path, &result); coord.y = -1; while (++(coord.y) < WIN_Y && fd_isback[0]) { coord.x = -1; while (++(coord.x) < WIN_X) { print_loadbar(all, ldbar, (((((coord.y * WIN_X) + (coord.x))) * 100) / (WIN_X * WIN_Y)), begin); if (!(back_is_right(&fd_isback[1], &result, fd_isback[0]))) back_is_wrong(fd_isback[0], &result, all, &coord); my_pixel_put_to_image(all->result, coord.x, coord.y, (result) ? result->color : all->sc->bg_color); } } compute_free(all, ldbar, &coord, fd_isback[0]); xfree(result); }
void *calcul_all3(void *init2) { t_mlx *init; t_cod *cor; t_sph *obj_a; t_obj *obc; t_tmp *tmp; init = (t_mlx *) init2; malloc_calc(&cor, &obc, &tmp); if ((obj_a = parse(init->filename, cor, init, NULL)) == NULL) exit(EXIT_FAILURE); cor->y = 2 * (HAUTEUR / 4); while (cor->y != (3 * (HAUTEUR / 4))) { while (cor->x != (LARGEUR * 4)) { my_pixel_put_to_image(cor->x, cor->y, init, calc(tmp, obc, cor, obj_a)); cor->x = cor->x + 4; obc->coeff_k = 100000; } func_download(cor->y, HAUTEUR, init); cor->x = 0; cor->y = cor->y + 1; } return (NULL); }
void pixel_put_to_img(t_env *e, int x, int y) { int color; color = (int)(e->color.z * 256) % 256; color += ((int)(e->color.y * 256) % 256) * 256; color += ((int)(e->color.x * 256) % 256) * 256 * 256; my_pixel_put_to_image(e->img, x, y, color); }
void my_floor_and_sky(t_param *ptr) { int x; int y; x = 0; while (x < X) { y = 0; while (y < (Y / 2)) { my_pixel_put_to_image(ptr, x, y, 0x00000055); y++; } while (y < Y) { my_pixel_put_to_image(ptr, x, y, 0x00005500); y++; } x++; } }
void trace_wall(t_system *sys) { int i; int k; int a; int set; int color; set = sys->image.sizeline * HEIGHT / 2; a = -1; while (++a < WIDTH) { i = set + a * 4; k = -1; while (++k < HEIGHT / 2 + 1 && k < HEIGHT / (2 * sys->vecs[a].k)) { color = 0xFFFFFFFF; my_pixel_put_to_image(sys->image.data, i, color); my_pixel_put_to_image(sys->image.data, set + a * 4 - sys->image.sizeline * k, color);q i += sys->image.sizeline; } } }
int my_wall_draw(float k, int x, t_my_img *img) { int i; if (k > 0) { i = 300 - (600 / (2 * k)); while (i <= 300 + (600 / (2 * k))) { my_pixel_put_to_image(*img, x, i, 0x7F7F7F); i = i + 1; } } return (0); }
void draw_rectangle(t_img *img, t_pos pos_rec, t_pos size_rec, int color) { t_pos rec; init_pos(&rec, pos_rec.x, pos_rec.y); while (rec.y <= pos_rec.y + size_rec.y) { rec.x = pos_rec.x; while (rec.x <= pos_rec.x + size_rec.x) { my_pixel_put_to_image(rec, img->mlx_ptr, img, color); rec.x++; } rec.y++; } }
void my_wall(t_param *ptr) { int x; int y; x = 0; while (x < X) { y = ((Y / 2) - (ptr->wall / 2)); while (y < ((Y / 2) + (ptr->wall / 2))) { my_pixel_put_to_image(ptr, x, y, 0x00555555); y++; } x++; } }
int remplis_image(t_win *mlxwin) { int x; int y; y = 0; while (y != 999) { x = 0; while (x != 999) { my_pixel_put_to_image(x, y, calc(x, y, mlxwin), mlxwin); x++; } y++; } }
int remplis_image(t_rt *rt) { t_pixel pixel; pixel.x = 0; pixel.y = 0; pixel.size = 400; while (pixel.y <= 400) { while (pixel.x <= 400) { calc(&pixel, rt); my_pixel_put_to_image(&pixel, rt); //printf("x:%d y:%d\n", pixel.x, pixel.y); pixel.x = pixel.x + 1; } pixel.x = 0; pixel.y = pixel.y + 1; } }
int raytracer(t_imgdata *imgdata, t_pov *pov, t_object *objects, t_coordinate *lightsource) { t_pixel pixel; int color; pixel.x = 0; pixel.y = 0; while (pixel.y < WIN_HEIGHT) { while (pixel.x < WIN_WIDTH) { color = calculate_pixel(pov, &pixel, objects, lightsource); my_pixel_put_to_image(imgdata, pixel.x, pixel.y, color); pixel.x++; } pixel.x = 0; pixel.y++; } return (0); }
void mymandel(t_struct *mystruct) { double thex1; double they1; if(mystruct->etat == 1) { thex1 = mystruct->mandel->x1; they1 = mystruct->mandel->y1; } else { thex1 = 0; they1 = 0; } mystruct->mandel->x = 0; while (mystruct->mandel->x < mystruct->mandel->zoom_x) { mystruct->mandel->y = 0; while (mystruct->mandel->y < mystruct->mandel->zoom_y) { mystruct->mandel->cx = mystruct->mandel->xmin + (mystruct->mandel->xmax - mystruct->mandel->xmin) * mystruct->mandel->x / mystruct->mandel->zoom_x; mystruct->mandel->cy = mystruct->mandel->ymin + (mystruct->mandel->ymax - mystruct->mandel->ymin) * mystruct->mandel->y / mystruct->mandel->zoom_y; mystruct->mandel->x1 = thex1; mystruct->mandel->y1 = they1; mystruct->mandel->x2 = 0; mystruct->mandel->y2 = 0; mystruct->mandel->i = 0; while ((mystruct->mandel->x2 + mystruct->mandel->y2 <= 4) && (mystruct->mandel->i < mystruct->ite)) { mandel_give(mystruct->mandel); } if(ok_draw2(mystruct->mandel->x , mystruct->mandel->y)) my_pixel_put_to_image(mystruct->img, mystruct->mandel->x , mystruct->mandel->y, RGB(0,0, mystruct->mandel->i*210/mystruct->ite)); mystruct->mandel->y++; } mystruct->mandel->x++; } }