Example #1
0
static void		bres_put(t_env *env, t_fdf_pxi p1, t_fdf_pxi p2, \
				t_bres_info info)
{
	int			e;
	int			c;

	c = (info.clr ? 0 : bres_color(p1[Color], p2[Color]));
	e = info.d1;
	info.d1 =  e * 2;
	info.d2 *= 2;
	while (42)
	{
		mlx_pixel_put(env->mlx, env->win, p1[X_scr], p1[Y_scr], c);
		p1[info.id] += info.i1;
		if (p1[info.id] == p2[info.id])
			break ;
		e += info.i0 * info.d2;
		if ((info.c1 && e < 0) || (!info.c1 && e > 0) || (info.c2 && e == 0))
		{
			mlx_pixel_put(env->mlx, env->win, p1[X_scr], p1[Y_scr], c);
			p1[info.id_e] += info.i2;
			e += info.d1;
		}
	}
}
Example #2
0
void		bres_draw(t_env *e, t_p3d a, t_p3d b)
{
	int		color;

	e->dx = (int)b.x - (int)a.x;
	e->dy = (int)b.y - (int)a.y;
	if (e->color == 0)
		color = e->color;
	else
		color = bres_color(fdf_getcolor(a.z), fdf_getcolor(b.z));
	if (e->dx > 0)
		bres_draw_dx_sup(e, a, b, color);
	else if (e->dx < 0)
		bres_draw_dx_inf(e, a, b, color);
	else
		bres_dx_null(e, a, b, color);
}