https://github.com/link-wolf/fdf
42 project - Program for wireframe modeling from a given file
https://github.com/link-wolf/fdf
42 42born2code 42school c macos
Last synced: 2 months ago
JSON representation
42 project - Program for wireframe modeling from a given file
- Host: GitHub
- URL: https://github.com/link-wolf/fdf
- Owner: Link-Wolf
- Created: 2022-03-17T06:50:19.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-10-21T19:49:48.000Z (over 2 years ago)
- Last Synced: 2025-03-22T13:26:56.915Z (over 1 year ago)
- Topics: 42, 42born2code, 42school, c, macos
- Language: C
- Homepage:
- Size: 119 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Table of Contents
## About The Project
This project consists of graphically creating the schematic representation
of raised terrain
The program takes a file `.fdf` as a parameter and show the 3D representation of the file content
To do this, we're allowed to use our [libft](https://github.com/Link-Wolf/libft), [get next line](https://github.com/Link-Wolf/get_next_line), the C `math` library, and a tiny local graphic library : the [minilibx](https://harm-smits.github.io/42docs/libs/minilibx/introduction.html) (also called mlx)
- The file contains `n` lines with the same size
- The file must contain only integers, separated by space
- Each integer represents the altitude of the related point
- Each point must be joined to the 2 / 3 / 4 others around it
This is an example of a valid file
```
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 1 0 0 1 1 0 0 0 1 1 1 1 1 0 0 0
0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 1 1 0 0
0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 1 1 0 0
0 0 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0
0 0 0 1 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0
0 0 0 0 0 0 1 1 0 0 0 1 1 0 0 0 0 0 0
0 0 0 0 0 0 1 1 0 0 0 1 1 1 1 1 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
```
We have to render the result in an isometric projection and be able to close the window either by the red cross or by press `ESC`
### Bonus features
- Include an additional projection (you can switch by pressing `TAB`)
- Implement zoom in and out (scroll wheel)
- Implement translation (press `WASD`)
- Implement at least one rotation (I added all of them by pressing `JL`/`IK`/`UO`)
- Add an additional bonus of my choice. I added colors for the wireframe when the map is big enough. The next picture is an illustration of it with a big, big map
## Getting Started
It's a simple C program but
/!\\ sadly the mlx used is only available locally on 42 iMacs /!\\
**However** you can use the [improved one](https://github.com/codam-coding-college/MLX42), it will *just* need to edit some includes, the [Makefile](https://github.com/Link-Wolf/FdF/blob/master/Makefile) and maybe some other little things
### Prerequisites
Having a C compiler like cc, gcc or clang
Be on a 42 iMac or get the MLX42 described above
### Installation
Assuming you are on a 42 iMac
If you use the MLX42, use its [documentation](https://github.com/codam-coding-college/MLX42)
1. Clone the repo
```sh
git clone https://github.com/Link-Wolf/FdF.git
```
2. Compile FdF
```sh
cd FdF; make
```
3. Execute the program with a `.fdf` file
```sh
./fdf [your file].fdf
```
## Usage
Test this FdF with any map you want !
The first picture is the result from this command :
```sh
./fdf 42.fdf
```
*(You can find some example [maps](https://github.com/Link-Wolf/FdF/tree/master/maps) in the maps folder)*
## Roadmap
- [x] Add all bonus features
- [x] Add some examples maps
- [x] Add back to top links
See the [open issues](https://github.com/Link-Wolf/FdF/issues) for a full list of proposed features (and known issues).
## Contributing
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## Contact
Mail : xxxxxxx@student.42mulhouse.fr
Project Link: [https://github.com/Link-Wolf/FdF](https://github.com/Link-Wolf/FdF)