From f0c91f6b3496d77099cab1d6c713583e1d96509a Mon Sep 17 00:00:00 2001 From: Gabriel Sroka Date: Sat, 11 Aug 2018 12:31:20 -0700 Subject: [PATCH] Update raytracer.ts `ctx.fillRect()` last 2 args should be width and height (not x2, y2) https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillRect will this fix https://www.typescriptlang.org/play/index.html too? --- raytracer/raytracer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/raytracer/raytracer.ts b/raytracer/raytracer.ts index 450d8a5..6b15fc7 100644 --- a/raytracer/raytracer.ts +++ b/raytracer/raytracer.ts @@ -244,7 +244,7 @@ class RayTracer { var color = this.traceRay({ start: scene.camera.pos, dir: getPoint(x, y, scene.camera) }, scene, 0); var c = Color.toDrawingColor(color); ctx.fillStyle = "rgb(" + String(c.r) + ", " + String(c.g) + ", " + String(c.b) + ")"; - ctx.fillRect(x, y, x + 1, y + 1); + ctx.fillRect(x, y, 1, 1); } } }