Skip to content

This is the implementation code for a 3D wireframe viewer, using MinilibX and C.

Notifications You must be signed in to change notification settings

caroldaniel/42sp-cursus-fdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fdf

42cursus' project #5

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.


Final score

cado-car's 42Project Score

Completed + Bonus

cado-car's 42Project Badge

Mandatory

fdf must have:

  • isometric projection;
  • Exiting of screen by pressing 'ESC';
  • Use of MinilibX's 'images' is strongly reccomended.

Bonus

fdf can have:

  • Extra projections;
  • Zoom in and map translation;
  • Rotate map.

The project

FdF

Implementation files

Header files

Main function

Initialization

Parsing and reading

Render and drawing

Transformation and projections

Key handling

Error management and program closing

Features

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.

Different projections

By pressing I, O and P keys on your keyboard, you will switch projection views to Isometric, Top View and Perspective, respectively.

Isometric View

FdF Isometric

Top View

FdF Top View

Perspective View

FdF Perspective

Scaling Z

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.

Z Scaling

FdF Z Scale

Zoom

By pressing - or +, you can Zoom Out and Zoom In, respectively.

Zoom Out

FdF Zoom Out

Zoom In

FdF Zoom In

Rotate

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.

Rotate X

FdF Rotate X

Rotate Y

FdF Rotate Y

Rotate Z

FdF Rotate Z

Color

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.

Default - No predifined colors

FdF Colors 2

Default - With predifined colors

FdF Colors 2

Reset and Close

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.


Usage

Requirements

fdf requires a gcc compiler, MinilibX, X-Window and some standard libraries. At the moment, this particular project runs only on Ubuntu systems.

Instructions

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 program
  • make all or simply make compiles fdf in its mandatory format
  • make bonus compiles fdf in its bonus format
  • make clean deletes the .o files generated during compilation
  • make fclean deletes the .o and the fdf file generated
  • make re executes fclean and all in sequence, recompiling the program
  • make rebonus executes fclean and bonus in sequence, recompiling the program with the bonus functions
  • make leaks executes valgrind to check for any possible leaks and puts it into a log file
  • make cleanleaks cleans the leaks log file

To run fdf, type:

./fdf maps/<choose-your-map.fdf>

About

This is the implementation code for a 3D wireframe viewer, using MinilibX and C.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published