GithubHelp home page GithubHelp logo

miou-zora / zaytracer Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 1.0 3.97 MB

Raytracer in Zig

License: MIT License

Zig 95.28% Nix 3.88% Shell 0.84%
graphics-programming nix nix-flake qoi raytracing zig

zaytracer's Introduction

Zaytracer (Raytracer in zig)

Rendered image of the raytracer

๐Ÿ“‘ Requirements

  • ๐ŸŒธ Nix

Important

You will need to enable nix-command and flakesexperimental features If you get an error about it, consider this command: mkdir -p ~/.config/nix && echo "experimental-features = nix-command flakes" | tee ~/.config/nix/nix.conf

โšก Usage

๐Ÿ”ง Setup

Clone this repository and run nix develop to enter the development environment

git clone https://github.com/Miou-zora/Zaytracer.git
cd Zaytracer
nix develop

๐Ÿ‘ท Building

Release

zig build -Doptimize=ReleaseFast
# or
nix build

Debug

zig build

๐Ÿš€ Running

With zig build or zig build -Doptimize=ReleaseFast

# It will build the project and run it. (do nothing if the project is already built)
zig build run
# or you can run the executable directly
./zig-out/bin/Zaytracer

With nix build

./result/bin/Zaytracer

โž• Using direnv

You may load the devShell automatically using direnv shell integration.

echo "use flake" | tee .envrc
direnv allow

Coding with codespace

If you want to works on the project using codespace, follow these instructions:

I. Create a codespace with current configuration

II. Execute mkdir -p ~/.config/nix && echo "experimental-features = nix-command flakes" | tee ~/.config/nix/nix.conf

III. Execute eval "$(direnv hook bash)" for bash or you can find your hook command here

IV. Execute:

echo "use flake" | tee .envrc
direnv allow

Perf

Performance measures

To take performance measures you can use th perf tool like this:

perf record -g ./Zaytracer
perf report -g 'graph,0.5,caller'

You will need a debug build for that, else you won't have debug symbols.

Time measures

You can use the hyperfine tool to measure the time of execution of the program.

If you use nix build:

hyperfine "./result/bin/Zaytracer" --warmup 10

or if you use zig build -Doptimize=ReleaseFast:

hyperfine "./zig-out/bin/Zaytracer" --warmup 10

zaytracer's People

Contributors

emneo-dev avatar miou-zora avatar sigmanificient avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

angluca

zaytracer's Issues

Create `Scene` struct

Create a Scene struct which contains all data used to run raytracing (like shape, light, camera)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.