Skip to content

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.

Notifications You must be signed in to change notification settings

Javisanchezf/42Malaga-fdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

42 Malaga FDF

School 42 Málaga cursus project.

This repository contains all archives for the project fdf in the School 42 Málaga core cursus.

About

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:

Requirements

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.

Instructions

1. Download the repository

To download the repository, go to the console and run:

git clone --recursive https://github.com/Javisanchezf/42Malaga-fdf.git
cd 42Malaga-fdf

2. Compiling the library

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

3. Cleaning all binary (.o) executable files (.a) and the program

To delete all files generated with make, go to the path and run:

make fclean

4. Using it

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

Testing

This library have been tested by several students from Fundación 42 following the correction script provided by the school.

References

Tips

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

License

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.

Share the content!

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published