removed wip comments in draw_bonus
This commit is contained in:
@@ -85,35 +85,6 @@ int color_percent(t_fdf *fdf, int *p_start, int *p_end, int p_numerator, int p_d
|
||||
percent /= z_total;
|
||||
else
|
||||
percent = 0;
|
||||
|
||||
/*
|
||||
if (ft_abs(percent) > 100)
|
||||
{
|
||||
ft_putchar_fd('[',1);
|
||||
ft_putnbr_fd(z_total,1);
|
||||
ft_putchar_fd(',',1);
|
||||
ft_putnbr_fd(start,1);
|
||||
ft_putchar_fd(',',1);
|
||||
ft_putnbr_fd(line,1);
|
||||
ft_putchar_fd(',',1);
|
||||
ft_putnbr_fd(p_numerator,1);
|
||||
ft_putchar_fd(',',1);
|
||||
ft_putnbr_fd(p_denominator,1);
|
||||
ft_putchar_fd(',',1);
|
||||
ft_putnbr_fd(percent,1);
|
||||
ft_putchar_fd(']',1);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
start end min max z_total start line p_numerator p_denominator percent
|
||||
( 1, -1, -1, 1)[ 2, 200, 200, 16, 61, 126]
|
||||
( -1, 1, -1, 1)[ 2, 0, 200, -8, -7, 114]
|
||||
( 2, 0, -1, 1)[ 2, 100, 200, 61, 61, 150]
|
||||
|
||||
percent = (start + line * p_numerator / p_denominator) / z_total;
|
||||
*/
|
||||
|
||||
return (percent);
|
||||
}
|
||||
|
||||
@@ -129,36 +100,18 @@ void draw_lines(t_fdf *fdf, int *start, int *end)
|
||||
{
|
||||
dx = end[0] - start[0];
|
||||
dy = end[1] - start[1];
|
||||
|
||||
/*
|
||||
ft_putchar_fd('(',1);
|
||||
ft_putnbr_fd(start[2],1);
|
||||
ft_putchar_fd(',',1);
|
||||
ft_putnbr_fd(end[2],1);
|
||||
ft_putchar_fd(',',1);
|
||||
ft_putnbr_fd(fdf->min_z,1);
|
||||
ft_putchar_fd(',',1);
|
||||
ft_putnbr_fd(fdf->max_z,1);
|
||||
ft_putchar_fd(')',1);
|
||||
|
||||
ft_putstr("\ndraw line\n");
|
||||
*/
|
||||
i = 0;
|
||||
j = 0;
|
||||
while (ft_abs(i) <= ft_abs(dx) && ft_abs(j) <= ft_abs(dy))
|
||||
{
|
||||
percent = color_percent(fdf, start, end, ft_abs(i) + ft_abs(j), ft_abs(dx) + ft_abs(dy));
|
||||
draw_color_pixel(fdf, start[0] + i, start[1] + j, percent);
|
||||
//draw_color_pixel(fdf, start[0] + i, start[1] + j, color);
|
||||
if (!ft_abs(dx) || ft_abs(j) < ft_abs(i * dy / dx))
|
||||
j += ft_sign(dy);
|
||||
else
|
||||
i += ft_sign(dx);
|
||||
}
|
||||
}
|
||||
/*
|
||||
ft_putstr("\nEND line\n");
|
||||
*/
|
||||
}
|
||||
|
||||
int get_primary_color(char primar, int percent)
|
||||
@@ -190,107 +143,10 @@ void draw_color_pixel(t_fdf *fdf, int new_x, int new_y, int percent)
|
||||
int color_b;
|
||||
int color;
|
||||
|
||||
/*
|
||||
color = COLOR_START;
|
||||
color = 0x236ad0;
|
||||
|
||||
int color_start;
|
||||
int color_end;
|
||||
|
||||
color_start = COLOR_START;
|
||||
color_end = COLOR_END;
|
||||
int color_r;
|
||||
int color_g;
|
||||
int color_b;
|
||||
|
||||
// color masks
|
||||
# define R_MASK 0xff0000
|
||||
# define G_MASK 0x00ff00
|
||||
# define B_MASK 0x0000ff
|
||||
|
||||
start: 245 0 | 0 | ? 0 ?=0 | ? 50 ?=70 | ? 30 ?=42 |
|
||||
end : 105 100 | 105-245=-140 | 140 100 | 140 100 | 140 100 |
|
||||
|
||||
start: 245 0 | 0 | ? 0 ?=0 | ? 50 ?=-70 | ? 30 ?=-42 |
|
||||
end : 105 100 | 105-245=-140 | -140 100 | -140 100 | -140 100 |
|
||||
|
||||
start: 105 0 | 0 | ? 0 ?=0 | ? 50 ?=70 | ? 30 ?=42 |
|
||||
end : 245 100 | 245-105=140 | 140 100 | 140 100 | 140 100 |
|
||||
|
||||
(end - start) * percent / 100
|
||||
|
||||
|
||||
ft_putchar('[');
|
||||
ft_putnbrbase(COLOR_START, "0123456789abcdef");
|
||||
ft_putchar(',');
|
||||
ft_putnbrbase(COLOR_END, "0123456789abcdef");
|
||||
ft_putchar(',');
|
||||
ft_putnbrbase(get_primary_color('r', percent), "0123456789abcdef");
|
||||
ft_putchar(',');
|
||||
ft_putnbrbase(get_primary_color('g', percent), "0123456789abcdef");
|
||||
ft_putchar(',');
|
||||
ft_putnbrbase(get_primary_color('b', percent), "0123456789abcdef");
|
||||
ft_putchar(',');
|
||||
ft_putnbrbase((get_primary_color('r', percent)<<16) + (get_primary_color('g', percent)<<8) + get_primary_color('b', percent), "0123456789abcdef");
|
||||
ft_putchar(']');
|
||||
*/
|
||||
|
||||
/*
|
||||
*/
|
||||
color_r = get_primary_color('r', percent);
|
||||
color_g = get_primary_color('g', percent);
|
||||
color_b = get_primary_color('b', percent);
|
||||
color = (color_r << 16) + (color_g << 8) + color_b;
|
||||
|
||||
/*
|
||||
if (ft_abs(percent) > 100)
|
||||
{
|
||||
ft_putchar('[');
|
||||
ft_putnbr(percent);
|
||||
ft_putchar(',');
|
||||
ft_putnbrbase(color, "0123456789abcdef");
|
||||
ft_putchar(']');
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
01 10 01 01
|
||||
00 11 11 11
|
||||
-----------
|
||||
00 10 01 01
|
||||
*/
|
||||
|
||||
/*
|
||||
int color;
|
||||
|
||||
color = COLOR_START;
|
||||
z -= (z * fdf->zoom) / fdf->offset;
|
||||
z /= fdf->altitude;
|
||||
if (z > fdf->min_z && fdf->z_amplitude)
|
||||
{
|
||||
color = color ^ (((0xff / fdf->z_amplitude) * (z - fdf->min_z)) << 16);
|
||||
color = color ^ (((0xff / fdf->z_amplitude) * (z - fdf->min_z)) << 0);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
int color;
|
||||
int height;
|
||||
|
||||
color = COLOR_START;
|
||||
height = z;
|
||||
if (height != 0)
|
||||
height /= fdf->altitude;
|
||||
height -= height / fdf->offset;
|
||||
if (height > fdf->min_z && fdf->z_amplitude)
|
||||
{
|
||||
color = color ^ (((0xff) * (height - fdf->min_z)) << 16);
|
||||
color = color ^ (((0xff) * (height - fdf->min_z)) << 0);
|
||||
// color = color ^ (((0xff / fdf->z_amplitude) * (height - fdf->min_z)) << 16);
|
||||
// color = color ^ (((0xff / fdf->z_amplitude) * (height - fdf->min_z)) << 0);
|
||||
}
|
||||
*/
|
||||
|
||||
draw_pixel(fdf, new_x, new_y, color);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user