Skip to content

ferri17/FdF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Repo stars GitHub top language GitHub code size in bytes GitHub last commit (by committer) MacOS compatibility

FdF 42 school project

This project is about creating a simple wireframe model representation of a 3D landscape by linking various points (x, y, z) thanks to line segments (edges). (Only compatible with macOS)

About The Project

FdF demo intro

FdF is a computer graphics introductory project in 42 school. The goal of the project is to visually represent a 3D landscape in isometric projection. The coordinates of the landscape are stored in a .fdf file passed as a parameter to the program.

Here is an example:

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 10 10  0  0 10 10  0  0  0 10 10 10 10 10  0  0  0
0  0 10 10  0  0 10 10  0  0  0  0  0  0  0 10 10  0  0
0  0 10 10  0  0 10 10  0  0  0  0  0  0  0 10 10  0  0
0  0 10 10 10 10 10 10  0  0  0  0 10 10 10 10  0  0  0
0  0  0 10 10 10 10 10  0  0  0 10 10  0  0  0  0  0  0
0  0  0  0  0  0 10 10  0  0  0 10 10  0  0  0  0  0  0
0  0  0  0  0  0 10 10  0  0  0 10 10 10 10 10 10  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

Each number represents a point in space:

  • The horizontal position corresponds to its axis.
  • The vertical position corresponds to its ordinate.
  • The value corresponds to its altitude.

Getting Started

In order to run the program first clone the repository:

git clone git@github.com:ferri17/FdF.git

Open the folder:

cd FdF/

Compile the program:

make

Run the program with a valid map as argument(test maps can be found in /maps)

./fdf maps/42.fdf

Controls

Action Key
Move map Mouse right click + drag
Rotate map Mouse left click + drag
Lock rotation axis Hold X,Y,Z while rotating
Color themes 1, 2, 3
Change map heights N,M
Edge/Vertex mode G
Snap rotation Hold H while rotating
Isometric/Paralel projection I,P

Gallery

Screen Shot 2023-08-10 at 3 30 30 PM Screen Shot 2023-08-10 at 5 38 26 PM Screen Shot 2023-08-10 at 5 37 03 PM

Resources

Minilibx

Really good guides to start using minilibx functions.

How to draw a line in a pixel map

How to represent a 3D figure in a 2D space

Gradients

Best walkthrough to understand how to calculate a gradient between 2 points

Virtual keys macOS

Clipping lines to optimise render with Cohen-Sutherland algorithm

About

This project is about creating a simple wireframe model representation of a 3D landscape by linking various points (x, y, z) thanks to line segments (edges).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors