Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Release 0.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
elfrank committed May 9, 2020
1 parent f56fc43 commit e91c4a2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
8 changes: 3 additions & 5 deletions build/RayTracingRenderer.es5.js
Original file line number Diff line number Diff line change
Expand Up @@ -1934,11 +1934,6 @@
}

var dim = maximumExtent(centroidBounds);

if (centroidBounds.max[dim] === centroidBounds.min[dim]) {
return makeLeafNode(primitiveInfo.slice(start, end), bounds);
}

var mid = Math.floor((start + end) / 2); // middle split method
// const dimMid = (centroidBounds.max[dim] + centroidBounds.min[dim]) / 2;
// mid = partition(primitiveInfo, p => p.center[dim] < dimMid, start, end);
Expand All @@ -1952,6 +1947,9 @@
nthElement(primitiveInfo, function (a, b) {
return a.center[dim] < b.center[dim];
}, start, end, mid);
} else if (centroidBounds.max[dim] === centroidBounds.min[dim]) {
// can't split primitives based on centroid bounds. terminate.
return makeLeafNode(primitiveInfo.slice(start, end), bounds);
} else {
var buckets = [];

Expand Down
7 changes: 4 additions & 3 deletions build/RayTracingRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1672,9 +1672,6 @@ vec3 getMatNormal(int materialIndex, vec2 uv, vec3 normal, vec3 dp1, vec3 dp2, v
}
const dim = maximumExtent(centroidBounds);

if (centroidBounds.max[dim] === centroidBounds.min[dim]) {
return makeLeafNode(primitiveInfo.slice(start, end), bounds);
}

let mid = Math.floor((start + end) / 2);

Expand All @@ -1690,7 +1687,11 @@ vec3 getMatNormal(int materialIndex, vec2 uv, vec3 normal, vec3 dp1, vec3 dp2, v
// surface area heuristic method
if (nPrimitives <= 4) {
nthElement(primitiveInfo, (a, b) => a.center[dim] < b.center[dim], start, end, mid);
} else if (centroidBounds.max[dim] === centroidBounds.min[dim]) {
// can't split primitives based on centroid bounds. terminate.
return makeLeafNode(primitiveInfo.slice(start, end), bounds);
} else {

const buckets = [];
for (let i = 0; i < 12; i++) {
buckets.push({
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ray-tracing-renderer",
"version": "0.9.1",
"version": "0.9.2",
"description": "A [Three.js](https://github.com/mrdoob/three.js/) renderer which utilizes path tracing to render a scene with true photorealism. The renderer supports global illumination, reflections, soft shadows, and realistic environment lighting.",
"main": "build/RayTracingRenderer.js",
"scripts": {
Expand Down

0 comments on commit e91c4a2

Please sign in to comment.