Skip to content

Commit

Permalink
Deploying to gh-pages from @ 49c9440 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
hsimpson committed Nov 2, 2023
1 parent 94bcb16 commit 8298334
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 154 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ var __publicField = (obj, key, value) => {
return value;
};
(function() {
var _a, _b;
"use strict";
var EPSILON$1 = 1e-6;
var ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array;
Expand Down Expand Up @@ -650,11 +649,7 @@ var __publicField = (obj, key, value) => {
if (!rec.mat.scatter(ray, rec, attenuation, scattered)) {
return emitted;
}
return add(
create$2(),
emitted,
multiply$1(create$2(), attenuation, rayColor(scattered, background2, world2, depth - 1))
);
return add(create$2(), emitted, multiply$1(create$2(), attenuation, rayColor(scattered, background2, world2, depth - 1)));
}
const CLASSNAME_KEY = "__CLASSNAME__";
const _metaMap = /* @__PURE__ */ new Map();
Expand Down Expand Up @@ -925,16 +920,8 @@ var __publicField = (obj, key, value) => {
// return true;
// }
static surroundingBox(box0, box1) {
const small = [
Math.min(box0.min[0], box1.min[0]),
Math.min(box0.min[1], box1.min[1]),
Math.min(box0.min[2], box1.min[2])
];
const big = [
Math.max(box0.max[0], box1.max[0]),
Math.max(box0.max[1], box1.max[1]),
Math.max(box0.max[2], box1.max[2])
];
const small = [Math.min(box0.min[0], box1.min[0]), Math.min(box0.min[1], box1.min[1]), Math.min(box0.min[2], box1.min[2])];
const big = [Math.max(box0.max[0], box1.max[0]), Math.max(box0.max[1], box1.max[1]), Math.max(box0.max[2], box1.max[2])];
return new AABB(small, big);
}
};
Expand Down Expand Up @@ -1317,8 +1304,8 @@ var __publicField = (obj, key, value) => {
const node = new BVHNode();
node.level = _level;
const flatList = new HittableList();
const fillFlatList = (list2) => {
for (const object of list2.objects) {
const fillFlatList = (l) => {
for (const object of l.objects) {
if (object instanceof HittableList) {
fillFlatList(object);
} else {
Expand Down Expand Up @@ -1540,6 +1527,7 @@ var __publicField = (obj, key, value) => {
], CheckerTexture);
var __defProp$c = Object.defineProperty;
var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __decorateClass$c = (decorators, target, key, kind) => {
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
for (var i = decorators.length - 1, decorator; i >= 0; i--)
Expand All @@ -1549,7 +1537,11 @@ var __publicField = (obj, key, value) => {
__defProp$c(target, key, result);
return result;
};
let ImageTexture = (_a = class extends Texture {
var __publicField$1 = (obj, key, value) => {
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
let ImageTexture = class extends Texture {
constructor() {
super();
__publicField(this, "_width", 0);
Expand Down Expand Up @@ -1582,17 +1574,15 @@ var __publicField = (obj, key, value) => {
v = 1 - clamp(v, 0, 1);
let i = Math.trunc(u * this._width);
let j = Math.trunc(v * this._height);
if (i >= this._width)
if (i >= this._width) {
i = this._width - 1;
if (j >= this._height)
}
if (j >= this._height) {
j = this._height - 1;
}
const colorScale = 1 / 255;
let pixelOffset = j * this._bytesPerScanLine + i * ImageTexture.BytesPerPixel;
return [
this._data[pixelOffset++] * colorScale,
this._data[pixelOffset++] * colorScale,
this._data[pixelOffset++] * colorScale
];
return [this._data[pixelOffset++] * colorScale, this._data[pixelOffset++] * colorScale, this._data[pixelOffset++] * colorScale];
}
get width() {
return this._width;
Expand All @@ -1606,7 +1596,8 @@ var __publicField = (obj, key, value) => {
get url() {
return this._url;
}
}, __publicField(_a, "BytesPerPixel", 4), _a);
};
__publicField$1(ImageTexture, "BytesPerPixel", 4);
ImageTexture = __decorateClass$c([
serializable
], ImageTexture);
Expand Down Expand Up @@ -1879,6 +1870,7 @@ var __publicField = (obj, key, value) => {
}
var __defProp$b = Object.defineProperty;
var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __decorateClass$b = (decorators, target, key, kind) => {
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
for (var i = decorators.length - 1, decorator; i >= 0; i--)
Expand All @@ -1888,7 +1880,11 @@ var __publicField = (obj, key, value) => {
__defProp$b(target, key, result);
return result;
};
let Perlin = (_b = class {
var __publicField2 = (obj, key, value) => {
__defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
let Perlin = class {
constructor() {
__publicField(this, "_ranVecs");
__publicField(this, "_permX");
Expand Down Expand Up @@ -1916,10 +1912,13 @@ var __publicField = (obj, key, value) => {
[[], []],
[[], []]
];
for (let di = 0; di < 2; di++)
for (let dj = 0; dj < 2; dj++)
for (let dk = 0; dk < 2; dk++)
for (let di = 0; di < 2; di++) {
for (let dj = 0; dj < 2; dj++) {
for (let dk = 0; dk < 2; dk++) {
c[di][dj][dk] = this._ranVecs[this._permX[i + di & 255] ^ this._permY[j + dj & 255] ^ this._permZ[k + dk & 255]];
}
}
}
const noise = trilinearInterp(c, u, v, w);
return noise;
}
Expand Down Expand Up @@ -1950,7 +1949,8 @@ var __publicField = (obj, key, value) => {
array[target] = tmp;
}
}
}, __publicField(_b, "_pointCount", 256), _b);
};
__publicField2(Perlin, "_pointCount", 256);
Perlin = __decorateClass$b([
serializable
], Perlin);
Expand Down Expand Up @@ -2140,11 +2140,9 @@ var __publicField = (obj, key, value) => {
}
scatter(r_in, rec, attenuation, scattered) {
const refl = reflect(normalize$2(create$2(), r_in.direction), rec.normal);
new Ray(
rec.p,
add(create$2(), refl, scale(create$2(), randomInUnitSphere(), this._roughness)),
r_in.time
).copyTo(scattered);
new Ray(rec.p, add(create$2(), refl, scale(create$2(), randomInUnitSphere(), this._roughness)), r_in.time).copyTo(
scattered
);
copy(attenuation, this._baseColor);
return dot(scattered.direction, rec.normal) > 0;
}
Expand Down Expand Up @@ -2362,14 +2360,8 @@ var __publicField = (obj, key, value) => {
const transformedCenterT0 = transformMat4(create$2(), this.center(t0), this.transform.objectToWorld);
const transformedCenterT1 = transformMat4(create$2(), this.center(t1), this.transform.objectToWorld);
const r = fromValues(this._radius, this._radius, this._radius);
const box0 = new AABB(
sub(create$2(), transformedCenterT0, r),
add(create$2(), transformedCenterT0, r)
);
const box1 = new AABB(
sub(create$2(), transformedCenterT1, r),
add(create$2(), transformedCenterT1, r)
);
const box0 = new AABB(sub(create$2(), transformedCenterT0, r), add(create$2(), transformedCenterT0, r));
const box1 = new AABB(sub(create$2(), transformedCenterT1, r), add(create$2(), transformedCenterT1, r));
return AABB.surroundingBox(box0, box1);
}
};
Expand Down Expand Up @@ -2488,7 +2480,6 @@ var __publicField = (obj, key, value) => {
__publicField(this, "uv2");
__publicField(this, "surfaceNormal");
__publicField(this, "transform", new Transform());
__publicField(this, "material");
__publicField(this, "doubleSided", false);
this.v0 = v0;
this.v1 = v1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ var __publicField = (obj, key, value) => {
return value;
};
(function() {
var _a, _b;
"use strict";
const _metaMap = /* @__PURE__ */ new Map();
function addClassName(type) {
Expand Down Expand Up @@ -642,16 +641,8 @@ var __publicField = (obj, key, value) => {
// return true;
// }
static surroundingBox(box0, box1) {
const small = [
Math.min(box0.min[0], box1.min[0]),
Math.min(box0.min[1], box1.min[1]),
Math.min(box0.min[2], box1.min[2])
];
const big = [
Math.max(box0.max[0], box1.max[0]),
Math.max(box0.max[1], box1.max[1]),
Math.max(box0.max[2], box1.max[2])
];
const small = [Math.min(box0.min[0], box1.min[0]), Math.min(box0.min[1], box1.min[1]), Math.min(box0.min[2], box1.min[2])];
const big = [Math.max(box0.max[0], box1.max[0]), Math.max(box0.max[1], box1.max[1]), Math.max(box0.max[2], box1.max[2])];
return new AABB(small, big);
}
};
Expand Down Expand Up @@ -1151,8 +1142,8 @@ var __publicField = (obj, key, value) => {
const node = new BVHNode();
node.level = _level;
const flatList = new HittableList();
const fillFlatList = (list2) => {
for (const object of list2.objects) {
const fillFlatList = (l) => {
for (const object of l.objects) {
if (object instanceof HittableList) {
fillFlatList(object);
} else {
Expand Down Expand Up @@ -1374,6 +1365,7 @@ var __publicField = (obj, key, value) => {
], CheckerTexture);
var __defProp$c = Object.defineProperty;
var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __decorateClass$c = (decorators, target, key, kind) => {
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
for (var i = decorators.length - 1, decorator; i >= 0; i--)
Expand All @@ -1383,7 +1375,11 @@ var __publicField = (obj, key, value) => {
__defProp$c(target, key, result);
return result;
};
let ImageTexture = (_a = class extends Texture {
var __publicField$1 = (obj, key, value) => {
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
let ImageTexture = class extends Texture {
constructor() {
super();
__publicField(this, "_width", 0);
Expand Down Expand Up @@ -1416,17 +1412,15 @@ var __publicField = (obj, key, value) => {
v = 1 - clamp(v, 0, 1);
let i = Math.trunc(u * this._width);
let j = Math.trunc(v * this._height);
if (i >= this._width)
if (i >= this._width) {
i = this._width - 1;
if (j >= this._height)
}
if (j >= this._height) {
j = this._height - 1;
}
const colorScale = 1 / 255;
let pixelOffset = j * this._bytesPerScanLine + i * ImageTexture.BytesPerPixel;
return [
this._data[pixelOffset++] * colorScale,
this._data[pixelOffset++] * colorScale,
this._data[pixelOffset++] * colorScale
];
return [this._data[pixelOffset++] * colorScale, this._data[pixelOffset++] * colorScale, this._data[pixelOffset++] * colorScale];
}
get width() {
return this._width;
Expand All @@ -1440,7 +1434,8 @@ var __publicField = (obj, key, value) => {
get url() {
return this._url;
}
}, __publicField(_a, "BytesPerPixel", 4), _a);
};
__publicField$1(ImageTexture, "BytesPerPixel", 4);
ImageTexture = __decorateClass$c([
serializable
], ImageTexture);
Expand Down Expand Up @@ -1713,6 +1708,7 @@ var __publicField = (obj, key, value) => {
}
var __defProp$b = Object.defineProperty;
var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __decorateClass$b = (decorators, target, key, kind) => {
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
for (var i = decorators.length - 1, decorator; i >= 0; i--)
Expand All @@ -1722,7 +1718,11 @@ var __publicField = (obj, key, value) => {
__defProp$b(target, key, result);
return result;
};
let Perlin = (_b = class {
var __publicField2 = (obj, key, value) => {
__defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
let Perlin = class {
constructor() {
__publicField(this, "_ranVecs");
__publicField(this, "_permX");
Expand Down Expand Up @@ -1750,10 +1750,13 @@ var __publicField = (obj, key, value) => {
[[], []],
[[], []]
];
for (let di = 0; di < 2; di++)
for (let dj = 0; dj < 2; dj++)
for (let dk = 0; dk < 2; dk++)
for (let di = 0; di < 2; di++) {
for (let dj = 0; dj < 2; dj++) {
for (let dk = 0; dk < 2; dk++) {
c[di][dj][dk] = this._ranVecs[this._permX[i + di & 255] ^ this._permY[j + dj & 255] ^ this._permZ[k + dk & 255]];
}
}
}
const noise = trilinearInterp(c, u, v, w);
return noise;
}
Expand Down Expand Up @@ -1784,7 +1787,8 @@ var __publicField = (obj, key, value) => {
array[target] = tmp;
}
}
}, __publicField(_b, "_pointCount", 256), _b);
};
__publicField2(Perlin, "_pointCount", 256);
Perlin = __decorateClass$b([
serializable
], Perlin);
Expand Down Expand Up @@ -1974,11 +1978,9 @@ var __publicField = (obj, key, value) => {
}
scatter(r_in, rec, attenuation, scattered) {
const refl = reflect(normalize$2(create$2(), r_in.direction), rec.normal);
new Ray(
rec.p,
add(create$2(), refl, scale(create$2(), randomInUnitSphere(), this._roughness)),
r_in.time
).copyTo(scattered);
new Ray(rec.p, add(create$2(), refl, scale(create$2(), randomInUnitSphere(), this._roughness)), r_in.time).copyTo(
scattered
);
copy(attenuation, this._baseColor);
return dot(scattered.direction, rec.normal) > 0;
}
Expand Down Expand Up @@ -2196,14 +2198,8 @@ var __publicField = (obj, key, value) => {
const transformedCenterT0 = transformMat4(create$2(), this.center(t0), this.transform.objectToWorld);
const transformedCenterT1 = transformMat4(create$2(), this.center(t1), this.transform.objectToWorld);
const r = fromValues(this._radius, this._radius, this._radius);
const box0 = new AABB(
sub(create$2(), transformedCenterT0, r),
add(create$2(), transformedCenterT0, r)
);
const box1 = new AABB(
sub(create$2(), transformedCenterT1, r),
add(create$2(), transformedCenterT1, r)
);
const box0 = new AABB(sub(create$2(), transformedCenterT0, r), add(create$2(), transformedCenterT0, r));
const box1 = new AABB(sub(create$2(), transformedCenterT1, r), add(create$2(), transformedCenterT1, r));
return AABB.surroundingBox(box0, box1);
}
};
Expand Down Expand Up @@ -2322,7 +2318,6 @@ var __publicField = (obj, key, value) => {
__publicField(this, "uv2");
__publicField(this, "surfaceNormal");
__publicField(this, "transform", new Transform());
__publicField(this, "material");
__publicField(this, "doubleSided", false);
this.v0 = v0;
this.v1 = v1;
Expand Down
Loading

0 comments on commit 8298334

Please sign in to comment.