commit eb9dc03a5a62e74b8b1fc459c6067fc6e4aec848
Author: Mikołaj Lenczewski <mblenczewski@gmail.com>
Date: Mon, 9 Jun 2025 18:39:41 +0100
Initial commit
Diffstat:
9 files changed, 97 insertions(+), 0 deletions(-)
diff --git a/.editorconfig b/.editorconfig
@@ -0,0 +1,21 @@
+root = true
+
+[*]
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+charset = utf-8
+
+guidelines = 80, 120, 160
+
+[*.{c,h}]
+indent_style = tab
+indent_size = 8
+
+[*.{sh}]
+indent_style = tab
+indent_size = 8
+
+[*.{json,txt}]
+indent_style = space
+indent_size = 2
diff --git a/.gitignore b/.gitignore
@@ -0,0 +1,4 @@
+bin/
+
+imgui.ini
+**/.*.swp
diff --git a/LICENSE b/LICENSE
@@ -0,0 +1,18 @@
+The MIT-Zero License
+
+Copyright (c) 2025 Mikołaj Lenczewski <mikolaj@lenczewski.org>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/README b/README
@@ -0,0 +1,18 @@
+raytracer
+==============================================================================
+A follow-through of Peter Shirley's "Raytracing in X" series.
+
+Since this covers multiple different series, it is split up into the following
+subdirectories: `./rt1/` covers book 1 ("Raytracing In One Weekend"), `./rt2/`
+covers book 2 ("Raytracing The Next Week"), and `./rt3/` covers book 3
+("Raytracing The Rest Of Your Life").
+
+Written in relatively portable C99.
+
+raytracer: Building
+------------------------------------------------------------------------------
+To build, simply run `./build.sh`. To clean, similarly run `./clean.sh`.
+
+To build a specific book only, set the BOOK environment variable to the number
+of the book you want to build. For example, to build only book 1, run:
+`BOOK=1 ./build.sh`
diff --git a/build.sh b/build.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+CC="${CC:-clang}"
+
+WARNINGS="-Wall -Wextra -Wpedantic ${WERROR:+-Werror} -Wno-unused-parameter -Wno-format-pedantic"
+FLAGS="-std=c99 -Og -g"
+
+set -ex
+
+mkdir -p bin
+
+BOOKS="${BOOK:-1 2 3}"
+
+for book in $BOOKS; do
+ $CC -o bin/rt$book rt$book/main.c $WARNINGS $FLAGS
+done
diff --git a/clean.sh b/clean.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+set -ex
+
+rm -rf bin
diff --git a/rt1/main.c b/rt1/main.c
@@ -0,0 +1,5 @@
+int
+main(int argc, char **argv)
+{
+ return 0;
+}
diff --git a/rt2/main.c b/rt2/main.c
@@ -0,0 +1,5 @@
+int
+main(int argc, char **argv)
+{
+ return 0;
+}
diff --git a/rt3/main.c b/rt3/main.c
@@ -0,0 +1,5 @@
+int
+main(int argc, char **argv)
+{
+ return 0;
+}