Skip to content

Commit

Permalink
Update RayTracer.java
Browse files Browse the repository at this point in the history
`fillRect()` should use width and height (the original MS TS code had the same bug). i've opened a PR there, too.
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillRect
  • Loading branch information
gabrielsroka authored Aug 12, 2018
1 parent 8ed4393 commit 0701037
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/jsweet/examples/raytracer/RayTracer.java
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ void render(Scene scene, CanvasRenderingContext2D ctx, int screenWidth, int scre
Color color = this.traceRay(new Ray(scene.camera.pos, getPoint.apply(x, y, scene.camera)), scene, 0);
Color c = Color.toDrawingColor(color);
ctx.fillStyle = union("rgb(" + new String(c.r) + ", " + new String(c.g) + ", " + new String(c.b) + ")");
ctx.fillRect(x, y, x + 1, y + 1);
ctx.fillRect(x, y, 1, 1);
}
}
}
Expand Down Expand Up @@ -394,4 +394,4 @@ static void main() {
rayTracer.render(defaultScene(), ctx, size, size);
}

}
}

0 comments on commit 0701037

Please sign in to comment.