Skip to content
 
 

Repository files navigation

42 São Paulo - miniRT

42 São Paulo License Code size in bytes Lines of code Top language Last commit

Norminette v3

A fully-featured ray tracer in pure C.


/-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\
|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^|
|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^|
|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^~~!777777!~~^^^^^^^^^^^^^^^^^^^|
|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^~!7??????????7!~^^^^^^^^^^^^^^^^^|
|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^~~~~~~^~7??????????????7~^^^^^^^^^^^^^^^^|
|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^~!7JJYYYYJJJJ???????????????!^^^^^^^^^^^^^^^^|
!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^~7JYYYYYYYYYYYYYJ?????????????7^^^^^^^^^^^^^^^^!
!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^~JYYYYYYYYYYYYYYYYY????????????!^^^^^^^^^^^^^^^^!
!^^^^^^^^^^^^^^^^^^~~~!!!~~^^^~JYYYYYYYYYYYYYYYYYYY??????????!^^^^^^^^^^^^^^^^^!
:^^^^^^^^^^^^^^~!?Y55PPPPP55J77YYYYYYYYYYYYYYYYYYYYJ???????7~^^^^^^^^^^^^^^^^^^:
:^^^^^^^^^^^^~?5PPPPPPPPPPPPPPPP5YYYYYYYYYYYYYYYYYY?7777!!~^^^^^^^^^^^^^^^^^^^^:
.^^^^^^^^^^^?PPPPPPPPPPPPPPPPPPP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|-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|
|                                                                              |
|            ┏━┓┏━┓━━━━━━━━━━━┓━━━━━━━━━━━━━━━┓━━━┓━━━┓━━━┓━━━┓━━━┓           |
|            ┃┃┗┛┃┃━━━━━━━━┏━┓┃━━━━━━━━━━━┏┓┏┓┃┏━┓┃┏━┓┃┏━┓┃┏━━┛┏━┓┃           |
|            ┃┏┓┏┓┃┓━┓━┓━━━┗━┛┃━━┓━┓━┏┓━━━┛┃┃┗┛┗━┛┃┃━┃┃┃━┗┛┗━━┓┗━┛┃           |
!            ┃┃┃┃┃┃┫┏┓┓┫━━━┏┓┏┛━┓┃━┃━┃┃━━━━┃┃━━┏┓┏┛┗━┛┃┃━┏┓┏━━┛┏┓┏┛           !
!            ┃┃┃┃┃┃┃┃┃┃┃━━━┃┃┗┓┗┛┗┓┗━┛┃━━━┏┛┗┓━┃┃┗┓┏━┓┃┗━┛┃┗━━┓┃┃┗┓           !
:            ┗┛┗┛┗┛┛┛┗┛┛━━━┛┗━┛━━━┛━┓┏┛━━━┗━━┛━┛┗━┛┛━┗┛━━━┛━━━┛┛┗━┛           :
:            ━━━━━━━━━━━━━━━━━━━━━━━┛┃━━━━━━━━━━━━━━━━━━━━━━━━━━━━━           :
.            ━━━━━━━━━━━━━━━━━━━━━━━━┛━━━━━━━━━━━━━━━━━━by lpaulo-m           .
.                                                                              .
:                      __ __     ___ __  __     __                             :
:                     /  /  \|\ | | |__)/  \|  (_                              :
!                     \__\__/| \| | | \ \__/|____)                             !
!                                                                              !
|                     - Esc or q: Exits program                                |
|                     - Left and Right Arrows: Switch camera                   |
|                     - s: Saves viewport to bitmap                            |
|                                                                              |
\-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=/

📜 Table of Contents

🧐 About

A ray tracer written in C that handles scene files, spheres, planes, cylinders, multiple cameras and hard shadows with multiple light. Traces the scene described in a file and displays it in an interactive window. It can also save the rendered scene to a .bmp file.

Based on my implementation of Ray Tracing in One Weekend:

For more details and examples you can read the Docs and the Checklist.

🏁 Getting Started

⚙️ Prerequisites

This project will only compile on Linux and FreeBSD.

You will need a C compiler (gcc or clang) and minilibx, an X-Window API made by 42 Paris:

# Clone the repo
git clone https://github.com/42Paris/minilibx-linux.git
cd minilibx-linux

# Install dependencies and build
sudo apt install libxext-dev libxrandr-dev libx11-dev libbsd-dev libssl-dev
make

# Copy archive and headers to system path
sudo cp libmlx.a /usr/local/lib/
sudo cp mlx.h /usr/local/include/

# Add pages to man (optional)
sudo mkdir /usr/local/man/man1
sudo cp man/man1/* /usr/local/man/man1/
man mlx

🖥️ Installing

Clone the repo and run make:

$ git clone https://github.com/librity/ft_minirt.git
$ cd ft_minirt
$ make run

A beautiful image should pop out of your terminal like magic.

🎨 Gallery

and much, much more...

📝 Notes

See the Docs.

🐙 Github Actions

Norminette Github Action by @AdrianWR

🛸 42 São Paulo

Part of the larger 42 Network, 42 São Paulo is a software engineering school that offers a healthy alternative to traditional education:

  • It doesn't have any teachers and classes.
  • Students learn by cooperating and correcting each other's work (peer-to-peer learning).
  • Its focus is as much on social skills as it is on technical skills.
  • It's completely free to anyone that passes its selection process - The Piscine

It's an amazing school, and I'm grateful for the opportunity.

📚 Resources

See the Docs.

About

42 São Paulo - miniRT

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages