FDF (Fil De Fer) is a project designed to represent 3D landscapes as wireframe models, where surfaces are outlined with lines. This project leverages the MLX42 graphical library to render landscapes from a specific viewpoint and interact with the 3D model.
- 3D Isometric Projection: Represents a landscape in a clean and structured wireframe format.
- Dynamic Input Handling: Reads landscape data from
.fdffiles, where each number represents a coordinate in 3D space. - Smooth Graphics Management: Efficient window rendering, minimizing, and smooth exit functionalities.
- Libft Integration: Utilizes custom library functions like
get_next_lineandft_splitfor efficient file parsing.
- Rendering:
- Displays a wireframe model using isometric projection.
- Coordinates are read from an input file in the following format:
0 0 0 3 0 1 2 0 0 2 1 0- Horizontal position: X-axis
- Vertical position: Y-axis
- Value: Altitude (Z-axis)
- Example: A file
testmap.fdfrenders a structured wireframe landscape.
- Graphic Management:
- Displays the rendered image in a window.
- Smooth handling of window events (switching, minimizing, etc.).
- Pressing
ESCor clicking the close button exits cleanly.
- C Compiler: Ensure you have a compatible C compiler (e.g.,
gcc). - MLX42 Library: MLX42 can be initialized by running
git submodule initandgit submodule updateinside the project folder after cloning this repository. - Makefile: Provided to simplify compilation.
- Clone this repository:
git clone https://github.com/ejarvinen/42Fdf.git
cd 42Fdf
- Update and initialize submodules:
git submodule init
git submodule update
- Build the project using the Makefile:
make
To render a landscape:
./fdf filename.fdf
Example:
./fdf testmap.fdf
This will open a window displaying the wireframe model of the specified landscape.
Makefile: Automates compilation and cleanup.*.cand*.hfiles: Source code and headers for the project.- Input Files: Accepts a single
.fdffile containing landscape data.
- Coding Standards: Adheres to the 42 coding norm.
- Memory Management: All heap allocations are properly freed to avoid memory leaks.
- Error Handling: No unexpected crashes (e.g., segmentation faults).
0 0 1 2 3 4 5 6 7 8 9
0 0 0 1 2 3 4 5 6 7 8
0 0 0 0 1 2 3 4 5 6 7
0 0 0 0 0 1 2 3 4 5 6
0 0 0 0 0 0 1 2 3 4 5
0 0 0 0 0 0 0 1 2 3 4
0 0 0 0 0 0 0 0 1 2 3
0 0 0 0 0 0 0 0 0 1 2
0 0 0 0 0 0 0 0 0 0 1

