aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2020-06-04 12:26:55 +0000
committerrodri <rgl@antares-labs.eu>2020-06-04 12:26:55 +0000
commit7e1063f4c3ec31703972a2a8de154c3ce81486bf (patch)
tree91066ad5f356c2ac707c520c3c7b750b1743c17a
parent06ffc8a2543d4cd5329516fc7ee3617d21b715bc (diff)
downloadbcardrt-master.tar.gz
bcardrt-master.tar.bz2
bcardrt-master.zip
change from binary (P6) to ascii (P3) format to make it work.HEADmaster
-rw-r--r--bcardrt.c4
-rw-r--r--readme.md8
-rw-r--r--rgl.pngbin0 -> 232202 bytes
3 files changed, 5 insertions, 7 deletions
diff --git a/bcardrt.c b/bcardrt.c
index a8bb86c..c7d3b66 100644
--- a/bcardrt.c
+++ b/bcardrt.c
@@ -93,7 +93,7 @@ main()
vec cam_forward, cam_up, cam_right, c, color, delta;
int x, y, r;
- print("P6 512 512 255 ");
+ print("P3 512 512 255\n");
cam_forward = vnorm(v(-6,-16,0));
cam_up = vmul(vnorm(vcross(v(0,0,1), cam_forward)), 0.002);
@@ -107,7 +107,7 @@ main()
delta = vadd(vmul(vmul(cam_up, R() - 0.5), 99), vmul(vmul(cam_right, R() - 0.5), 99));
color = vadd(vmul(Sample(vadd(v(17,16,8), delta), vnorm(vadd(vmul(delta, -1), vmul(vadd(vadd(vmul(cam_up, R()+x), vmul(cam_right, R()+y)), c), 16)))), 3.5), color);
}
- print("%c%c%c", (int)color.x, (int)color.y, (int)color.z);
+ print("%d %d %d\n", (int)color.x, (int)color.y, (int)color.z);
}
exits(nil);
}
diff --git a/readme.md b/readme.md
index e49d357..b596e4a 100644
--- a/readme.md
+++ b/readme.md
@@ -1,12 +1,10 @@
-# The Business Card Ray Tracer (Not Working)
+# The Business Card Ray Tracer
+
+![png version of the ppm output image](rgl.png "6.out | ppm -e9t | topng")
This is a more readable adaptation of Andrew "aek" Kensler's original
1337-size ray tracer written in plan 9 C.
-Sadly it doesn't work yet. I'll have to go through it more thoroughly
-to find out the quirkyness that makes it generate a smaller, wrong
-file.
-
You can read an updated version of his
[here](http://eastfarthing.com/blog/2016-01-12-card/).
diff --git a/rgl.png b/rgl.png
new file mode 100644
index 0000000..5c3db4e
--- /dev/null
+++ b/rgl.png
Binary files differ