Skip to content

Commit

Permalink
bit of cleanup in raytracer demo
Browse files Browse the repository at this point in the history
  • Loading branch information
tmpvar committed Oct 18, 2015
1 parent 9c3cfa9 commit cf23eb2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions demo/raytracer.js
Expand Up @@ -50,7 +50,6 @@ fill(model, function(x, y, z) {

if (x%2 && y%2 && z%2) {


// poor mans compression
x = -modelHalfWidth + x;
y = -modelHalfWidth + y;
Expand Down Expand Up @@ -105,7 +104,6 @@ window.addEventListener('mousemove', function(ev) {
}
mouse[0] = x;
mouse[1] = y;

});

window.addEventListener('mousewheel', function(ev) {
Expand Down Expand Up @@ -139,20 +137,19 @@ var ctx = fc(function render() {
m4inverted,
m4mul(m4mvp, projection, view)
);
var step = 1;

getEye(rayOrigin, view);
var normal = [0, 0, 0];

depthSorted.sort(function depthSort(a, b) {
var da = v3distSquared(a[1], rayOrigin);
var db = v3distSquared(b[1], rayOrigin);
return da-db;
})

for (var y=0; y<h; y+=step) {
for (var y=0; y<h; y++) {
near[1] = y;

for (var x = 0; x<w; x+=step) {
for (var x = 0; x<w; x++) {
near[0] = x;

unproject(rayDirection, near, viewport, m4inverted)
Expand Down

0 comments on commit cf23eb2

Please sign in to comment.