示例#1
0
void		*cube(void *d)
{
	int			l[3];
	long double	z[4];
	long double	tmp;
	t_thread	*m;

	m = (t_thread*)d;
	l[0] = m->lim[0] - 1;
	while (++l[0] < m->lim[2] && (l[1] = m->lim[1] - 1))
		while (++l[1] < m->lim[3] && (l[2] = -1))
		{
			z[2] = -0.7 + m->s->x / X;
			z[3] = 0.27015 + m->s->y / Y;
			z[0] = 1.5 * (l[0] - X / 2) / (0.5 * X) * m->s->z[0] + m->s->m[0];
			z[1] = (l[1] - Y / 2) / (0.5 * Y) * m->s->z[0] + m->s->m[1];
			while (++l[2] < m->s->imax && (z[0] * z[0] + z[1] * z[1]) < 4)
			{
				tmp = z[0];
				z[0] = z[0] * z[0] + z[1] * z[1] + z[2];
				z[1] = -2 * z[1] * tmp + z[3];
			}
			(l[2] == m->s->imax) ? px_img(m->s, l[0], l[1],
				ft_colors_mag(fmod(fabsl(l[2] / z[0]), 999))) :
			px_img(m->s, l[0], l[1], ft_colors_earth(fabsl(l[2] * z[1])));
		}
	return (NULL);
}
示例#2
0
int				color(float z, t_gen *g)
{
	g->tmp = z;
	if (g->rep & 0x2000)
		return (ft_colors_mag(((z * 6))));
	if (g->rep & 0x1000)
		return (ft_colors_ice(((z * 6))));
	return (ft_colors_earth(((z * 6))));
}
示例#3
0
void			put_matrix(t_struck *s)
{
	static int	c = 0;
	static char	*tab = {AZ};
	int			i;
	int			j;
	char		tmp[41];

	j = (!c) ? -20 : -10;
	c = (c > 250) ? 1 : c + 1;
	i = 0;
	while (j < MAX)
	{
		ft_memcpy(tmp, (i < 500) ? tab + i / 20 : tab + i % 500 / 20, 41);
		if (i % (c) < 10)
			ft_strrev(tmp);
		mlx_string_put(M, s->img.menu, 0, j,
			ft_colors_mag((j > 500) ? 1000 - j : j), tmp);
		i += 41 + j;
		j += 20;
	}
}