School 42 Málaga cursus project.
This repository contains all archives for the project fdf in the School 42 Málaga core cursus.
About · Requirements · Instuctions · Testing · References · Tips · License
FDF is a project that aims to create a simple 3D height-map renderer. The program takes a map file as input and creates a graphical representation of it. The program allows for basic manipulations of the map and the rendering. You can find more information in the subject.
The code in this repository follows the rules of the Norminette.
This is the result of the program:
The project is written in C language and needs:
- Compiler
gcc
. - The following standard libraries:
<stdlib.h>
<unistd.h>
<stdlib.h>
<math.h>
- Software development tool
GLFW
.
To download the repository, go to the console and run:
git clone --recursive https://github.com/Javisanchezf/42Malaga-fdf.git
cd 42Malaga-fdf
To compile the library, go to its path and run:
make
If you have a fault, it is possible that you do not meet the aforementioned requirements. The most common is not having glfw installed, you can do it by:
brew install glfw
To delete all files generated with make, go to the path and run:
make fclean
You can test the FDF with different maps, you have several maps to test in the maps folder, try the following:
./fdf maps/42.fdf
This library have been tested by several students from Fundación 42 following the correction script provided by the school.
- MLX42 by codam: https://github.com/codam-coding-college/MLX42
- MLX42 guide https://harm-smits.github.io/42docs/libs/minilibx
- 42 Map generator https://github.com/jgigault/42MapGenerator
- Others
To rotate the figure:
At the beginning angle1 = angle2 = 0º, and to rotate the figure you only have to vary those angles.
- x (With angles) = x * cos(angle1) - y * sin(angle1)
- y (With angles) = x * sin(angle1) + y * cos(angle1) * cos(angle2) - z * sin(angle2)
- z (With angles) = y * sin(angle2) - z * cos(angle2)
Perspectives to convert in FDF:
- Isometric
- Xi = x * cos(30º) + y * sen(30º)
- Yi = x * sen(30º) + y * cos(30º) - z
- Cavalier
- Xc = (x - z * cos(45º)) - (y - z * sen(45º)) * cos(45º)
- Yc = y - z * sen(45º)
- Top view
- Xt = x
- Yt = y
- Frontal view
- Xf = x + y
- Yf = -z
Conversions:
- 1 ° × π / 180 = 0,01745 rad
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
You are free to:
- Share: copy and redistribute the material in any medium or format.
- Adapt: remix, transform, and build upon the material.
Under the following terms:
- Attribution: You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- NonCommercial: You may not use the material for commercial purposes.
- ShareAlike: If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.