This project is part of the 42 school curriculum. The goal of fdf is to create a program that reads a 3D map from a file and displays a wireframe model of the landscape on a graphical window. The project is an introduction to graphics programming and the use of the ML42 library.
The program should be able to:
- Read map data from a
.fdffile. - Transform the 3D coordinates into a 2D projection.
- Draw lines between the points to create a wireframe model.
- Allow for different projections (e.g., isometric).
The fdf program operates in a few key stages:
-
Map Parsing: The program reads a
.fdffile, which contains a grid of numbers representing the Z-axis (height) of the map. It stores this data in a suitable data structure, like a 2D array or a linked list of points. -
3D to 2D Projection: Each point
$(x, y, z)$ from the map is transformed into a 2D point$(x', y')$ on the screen. The transformation can be a simple parallel projection or a more complex isometric projection to give a sense of depth. -
Drawing: The program uses the ML42 library to draw lines between the projected 2D points. These lines connect adjacent points in the grid (e.g.,
(x, y)to(x+1, y)and(x, y)to(x, y+1)), creating the wireframe effect. -
User Interaction: The program handles keyboard and mouse events to allow the user to control the view. Common features include zooming in/out, changing the projection angle, or moving the map.
To run fdf, you will need to have the ML42 library installed and properly configured.
You can compile your program using the provided Makefile.
makeThe program takes a .fdf map file as an argument.
./fdf maps/42.fdf0 0 0 0 0
0 0 4 0 0
0 4 0 4 0
0 0 4 0 0
0 0 0 0 0
- Ruben Finnerud - rubenfin