The fdf program is a wireframe generator that takes .fdf format files and transforms them into tridimensional representations of relief landscapes. It manages colors and basic transformation, such as zoom, translation, rotation and Z axis scaling. This project aims for the student to get familiarized with window management and pixel insertion on screen, using MinilibX library and pure C coding.
fdf must have:
- isometric projection;
- Exiting of screen by pressing 'ESC';
- Use of MinilibX's 'images' is strongly reccomended.
fdf can have:
- Extra projections;
- Zoom in and map translation;
- Rotate map.
Header files
Main function
Initialization
Parsing and reading
Render and drawing
Transformation and projections
Key handling
Error management and program closing
It was, ultimately, very hard not to extrapolate this project scope and go any further in implementing more functions, interactivity and color pallets. At some point, though, we had to stop.
For this implementation we chose to deal with all the mandatory requirements, all the bonus requirements and some bonus' bonuses, such as color gradients, top view and Z axis scaling.
By pressing I
, O
and P
keys on your keyboard, you will switch projection views to Isometric
, Top View
and Perspective
, respectively.
By pressing Z
or X
, you can decrease or increse, respectively, de Z Scale Factor
on your map, maxing out at 100% on either direction.
By pressing -
or +
, you can Zoom Out
and Zoom In
, respectively.
By pressing S
or W
, you can Rotate on the X axis
.
By pressing Q
or E
, you can Rotate on the Y axis
.
By pressing A
or D
, you can Rotate on the Z axis
.
By pressing SPACE
, you can change the color's pallet
from default
(the passed-through-map colors) to orange-blue
and back on. More color pallets can be configured by changing apply_color
function on render.c
. More built-in pallets will be added in the future.
Press R
to reset definitions on Scale
, Zoom
and Rotation
. Current colors and projection view remains.
Press ESC
to Close
window. All memory allocation will be dealt with automatically.
fdf
requires a gcc compiler, MinilibX, X-Window and some standard libraries. At the moment, this particular project runs only on Ubuntu systems.
Clone this repository in your local computer:
$> git clone https://github.com/caroldaniel/42sp-cursus-fdf.git path/to/fdf
In your local repository, run make
$> make
make
suports 9 flags:
make install
makes sure your system has all the prerequisites for running the programmake all
or simplymake
compiles fdf in its mandatory formatmake bonus
compiles fdf in its bonus formatmake clean
deletes the.o
files generated during compilationmake fclean
deletes the.o
and thefdf
file generatedmake re
executesfclean
andall
in sequence, recompiling the programmake rebonus
executesfclean
andbonus
in sequence, recompiling the program with the bonus functionsmake leaks
executes valgrind to check for any possible leaks and puts it into a log filemake cleanleaks
cleans the leaks log file
To run fdf
, type:
./fdf maps/<choose-your-map.fdf>