Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ridaelfagrouch/FDF_42

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FDF_42


Project Overview


FDF is a 42 Project to learn about 3d programming. The program takes a map as parameter and creates its 3d representation.

In this project, you will discover the basics of graphic programming, and in particular how to place points in space, how to join them with segments, and most importantly how to observe the scene from a particular viewpoint.

The representation in 3D of a landscape is a critical aspect of modern mapping. For example, in these times of spatial exploration, to have a 3D representation of Mars is a prerequisite condition to its conquest. As another example, comparing various 3D representations of an area of high tectonic activity will allow you to better understand these phenomena and their evolution, and as a result, be better prepared.

It’s your turn today to modelize in 3D some magnificent landscapes, imaginary or not...

image

Sources


In our school we will need to do everything from scratch. In this case it meant that we weren't given any line drawing function so we had to figure ourselves how to color pixels beetween line end points with help of miniLibX library.

I used Bresenham's line algorithm for drawing a line which was the most obvious choice.

Compiling and running


Run make. An executable will compile. Currently only tested on OS X.

Run it with ./fdf [map]. A bunch of sample maps are provided in the maps directory.

  • for mandatory part :
$ make
$ ./fdf [map]

OR :

$ make
$ ./fdf [map] [map zoom(int)] [map altitude(int)]
  • for bonus part :
$ make bonus
$ ./fdf [map]

OR :

$ make bonus
$ ./fdf [map] [map zoom(int)] [map altitude(int)]

Usage


After running make to generate the fdf executable you can run the program with ./fdf [valid_fdf_file].

A valid fdf file will consist of a matrix of number delimited by spaces. Each number's position represents an (x , y) coordinate with the value of the number itself representing a height (z).

Valid fdf files will always have the same number of elements per row.

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

Output


The program will attempt to render the model described by the fdf file in a graphical window.

image

The user can interact with the graphical model with the following commands:

MVM : up/down/right/left
ZOOM : 
	- zoom_up : O
	- zoom_down : I
3D/PARALLEL : p
ROTATION :
	- axe_x : X
	- axe_y : Y
	- axe_z : Z
ALTITUDE :
	- up : +
	- down : -
EXIT : ESC
RANDOM COLOR :
	- original/random : R

image image image image image image image image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published