-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mohammad abir Abbas
committed
Dec 10, 2022
1 parent
2859b05
commit ae564c6
Showing
63 changed files
with
47 additions
and
14 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: mabbas <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2022/12/08 14:30:35 by mabbas #+# #+# */ | ||
/* Updated: 2022/12/10 00:34:28 by mabbas ### ########.fr */ | ||
/* Updated: 2022/12/10 23:39:41 by mabbas ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -63,3 +63,32 @@ int color_init(t_mlx *mlx) | |
} | ||
return (trgb_gen(color[0], color[1], color[2], color[3])); | ||
} | ||
|
||
/** Experimental Color conversions **/ | ||
// int color_init(t_mlx *mlx) | ||
// { | ||
// double t; | ||
// int color[4]; | ||
|
||
// t = (double)mlx->iter / (double)mlx->iter_max; | ||
// color[0] = 0; | ||
// if (mlx->shift == 1) | ||
// { | ||
// color[1] = (rand()) * 255 * t; | ||
// color[2] = (rand()) * 1 * t; | ||
// color[3] = (rand()) * 125 * (1 - t); | ||
// } | ||
// if (mlx->shift == 2) | ||
// { | ||
// color[2] = (int)(9 * (1 - t) * pow(t, 3) * 235); | ||
// color[1] = (int)(13 * pow((1 - t), 2) * pow(t, 2) * 255); | ||
// color[3] = (int)(7 * pow((1 - t), 3) * t * 225); | ||
// } | ||
// if (mlx->shift == 3) | ||
// { | ||
// color[3] = (int)(9 * (1 - t) * pow(t, 3) * 255); | ||
// color[2] = (int)(15 * pow((1 - t), 2) * pow(t, 2) * 121); | ||
// color[1] = (int)(8.5 * pow((1 - t), 3) * t * 225); | ||
// } | ||
// return (trgb_gen(color[0], color[1], color[2], color[3])); | ||
// } |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: mabbas <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2022/12/08 20:43:36 by mabbas #+# #+# */ | ||
/* Updated: 2022/12/10 14:50:21 by mabbas ### ########.fr */ | ||
/* Updated: 2022/12/10 22:20:26 by mabbas ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: mabbas <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2022/12/08 19:23:34 by mabbas #+# #+# */ | ||
/* Updated: 2022/12/10 00:54:55 by mabbas ### ########.fr */ | ||
/* Updated: 2022/12/10 22:50:38 by mabbas ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -18,37 +18,41 @@ | |
* An extra check is there for the coeff value range. | ||
**/ | ||
|
||
// double lerp(double start, double end, double inter_coeff) | ||
// { | ||
// if (inter_coeff <= 0.0) | ||
// return (start); | ||
// if (inter_coeff >= 1.0) | ||
// return (end); | ||
// return ((1 - inter_coeff) * start + inter_coeff * end); | ||
// } | ||
|
||
double lerp(double start, double end, double inter_coeff) | ||
{ | ||
if (inter_coeff <= 0.0) | ||
return (start); | ||
if (inter_coeff >= 1.0) | ||
return (end); | ||
return ((1 - inter_coeff) * start + inter_coeff * end); | ||
return (start + ((end - start) * inter_coeff)); | ||
} | ||
|
||
int ctrl_mouse(int key, int x, int y, t_mlx *mlx) | ||
{ | ||
t_oper mouse; | ||
double zoom; | ||
|
||
zoom = 0.0; | ||
if (key == 1) | ||
mlx->press = 1; | ||
mouse.r = (mlx->min.r + x * ((mlx->max.r - mlx->min.r) | ||
/ (WIDTH))); | ||
mouse.i = (mlx->max.i - y * ((mlx->max.i - mlx->min.i) | ||
/ (HEIGHT))); | ||
if (key == 5) | ||
zoom = 1.10; | ||
zoom = 1.20; | ||
else if (key == 4) | ||
zoom = 0.75; | ||
zoom = 0.80; | ||
else | ||
zoom = 1; | ||
zoom = 1.0; | ||
mlx->min.r = lerp(mouse.r, mlx->min.r, zoom); | ||
mlx->min.i = lerp(mouse.i, mlx->min.i, zoom); | ||
mlx->max.r = lerp(mouse.r, mlx->max.r, zoom); | ||
mlx->min.i = lerp(mouse.i, mlx->min.r, zoom); | ||
mlx->max.i = lerp(mouse.i, mlx->max.i, zoom); | ||
render_fractal(mlx); | ||
return (0); | ||
} | ||
|
@@ -61,7 +65,7 @@ int julia_key_press(int key, int x, int y, t_mlx *mlx) | |
(void) x; | ||
(void) y; | ||
if (key == 1) | ||
mlx->press = KEY_A; | ||
mlx->press = 0; | ||
return (0); | ||
} | ||
|
||
|
Binary file not shown.