pedromelocf / 42_fdf

All programs that you wrote until now were executed in text mode on your terminal. Now, let’s discover something more exciting: how to open a graphics window and draw inside? To start your journey in graphic programming, FdF offers to represent “iron wire” meshing in 3D.
2 stars 0 forks source link

Display pixels in isometric projection #6

Closed pedromelocf closed 9 months ago

pedromelocf commented 10 months ago

Image

Using this ajusted formula but still not working properly.

Function as follow:

void draw_pixels(t_map s_map, mlx_image_t img) { float x_iso; float y_iso;

draw_background(img);
while (s_map != NULL)
{
    x_iso = (s_map->s_coordinate->x - s_map->s_coordinate->y) * 0.707106781;
    y_iso = ((s_map->s_coordinate->x + s_map->s_coordinate->y) * 0.40824829) - 0.816496581 * s_map->s_coordinate->z;
    mlx_put_pixel(img, (x_iso + WIDTH / 2), (y_iso + HEIGHT / 2), 0xFFF222);
    s_map = s_map->next;
}
return ;

}