minerender 2.1.0-alpha.3 → 2.1.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.mts +20 -20
- package/dist/browser/index.d.ts +20 -20
- package/dist/browser/index.js +36 -30
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +37 -31
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +31 -26
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +20 -20
- package/dist/node/index.d.ts +20 -20
- package/dist/node/index.js +38 -31
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +39 -32
- package/dist/node/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/bundle.js
CHANGED
|
@@ -37267,8 +37267,8 @@ var MineRender = (() => {
|
|
|
37267
37267
|
} else {
|
|
37268
37268
|
if (warned === false) {
|
|
37269
37269
|
warned = true;
|
|
37270
|
-
var
|
|
37271
|
-
|
|
37270
|
+
var warn = process$1.emitWarning ? process$1.emitWarning : console.warn.bind(console);
|
|
37271
|
+
warn("assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.", "DeprecationWarning", "DEP0094");
|
|
37272
37272
|
}
|
|
37273
37273
|
if (argsLen === 2) operator = "!=";
|
|
37274
37274
|
}
|
|
@@ -68378,6 +68378,7 @@ return ${compiler2.callType("value", tagType)}
|
|
|
68378
68378
|
}
|
|
68379
68379
|
static loadInBackground(src, format2 = RGBAFormat, rotation = 0) {
|
|
68380
68380
|
const texture = this.createTexture();
|
|
68381
|
+
texture.colorSpace = SRGBColorSpace;
|
|
68381
68382
|
const image = ImageLoader.loadElement(src);
|
|
68382
68383
|
image.onload = function() {
|
|
68383
68384
|
texture.needsUpdate = true;
|
|
@@ -68389,6 +68390,7 @@ return ${compiler2.callType("value", tagType)}
|
|
|
68389
68390
|
}
|
|
68390
68391
|
static load(src, format2 = RGBAFormat, rotation = 0) {
|
|
68391
68392
|
const texture = new Texture();
|
|
68393
|
+
texture.colorSpace = SRGBColorSpace;
|
|
68392
68394
|
ImageLoader.getData(src).then((image) => {
|
|
68393
68395
|
texture.needsUpdate = true;
|
|
68394
68396
|
texture.image = image;
|
|
@@ -68414,7 +68416,9 @@ return ${compiler2.callType("value", tagType)}
|
|
|
68414
68416
|
return new Texture();
|
|
68415
68417
|
}
|
|
68416
68418
|
static createCanvasTexture(canvas) {
|
|
68417
|
-
|
|
68419
|
+
const texture = new CanvasTexture(canvas);
|
|
68420
|
+
texture.colorSpace = SRGBColorSpace;
|
|
68421
|
+
return this.initTextureProps(texture);
|
|
68418
68422
|
}
|
|
68419
68423
|
static getImage(key) {
|
|
68420
68424
|
const keyStr = serializeTextureKey(key);
|
|
@@ -68531,6 +68535,9 @@ return ${compiler2.callType("value", tagType)}
|
|
|
68531
68535
|
gl_FragColor = vec4(lift + color.rgb * light2, 1.0);
|
|
68532
68536
|
|
|
68533
68537
|
}
|
|
68538
|
+
|
|
68539
|
+
#include <tonemapping_fragment>
|
|
68540
|
+
#include <colorspace_fragment>
|
|
68534
68541
|
}
|
|
68535
68542
|
`;
|
|
68536
68543
|
try {
|
|
@@ -85191,8 +85198,6 @@ uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuf
|
|
|
85191
85198
|
var _Renderer = class _Renderer {
|
|
85192
85199
|
constructor(options) {
|
|
85193
85200
|
this._dirty = true;
|
|
85194
|
-
this._animationTimer = void 0;
|
|
85195
|
-
this._animationFrame = void 0;
|
|
85196
85201
|
this._resizeListener = void 0;
|
|
85197
85202
|
this._disposed = false;
|
|
85198
85203
|
this._debugHelpers = [];
|
|
@@ -85202,7 +85207,7 @@ uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuf
|
|
|
85202
85207
|
};
|
|
85203
85208
|
this.options = (0, import_ts_deepmerge10.default)({}, _Renderer.DEFAULT_OPTIONS, options ?? {});
|
|
85204
85209
|
this._animationLoop = this.animate.bind(this);
|
|
85205
|
-
this.
|
|
85210
|
+
this._frameInterval = this.options.render.fpsLimit > 0 ? 1e3 / this.options.render.fpsLimit : void 0;
|
|
85206
85211
|
this._scene = this.createScene();
|
|
85207
85212
|
this._camera = this.createCamera();
|
|
85208
85213
|
this._renderer = this.createRenderer();
|
|
@@ -85249,13 +85254,13 @@ uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuf
|
|
|
85249
85254
|
renderer.setClearColor(0, 0);
|
|
85250
85255
|
renderer.shadowMap.enabled = true;
|
|
85251
85256
|
renderer.shadowMap.type = PCFSoftShadowMap;
|
|
85252
|
-
renderer.
|
|
85257
|
+
renderer.outputColorSpace = SRGBColorSpace;
|
|
85253
85258
|
renderer.setSize(this.viewWidth, this.viewHeight);
|
|
85254
85259
|
return renderer;
|
|
85255
85260
|
}
|
|
85256
85261
|
createComposer() {
|
|
85262
|
+
if (!this.options.composer.enabled) return void 0;
|
|
85257
85263
|
const composer = new EffectComposer(this.renderer);
|
|
85258
|
-
if (!this.options.composer.enabled) return composer;
|
|
85259
85264
|
composer.setSize(this.viewWidth, this.viewHeight);
|
|
85260
85265
|
composer.addPass(new RenderPass(this.scene, this.camera));
|
|
85261
85266
|
return composer;
|
|
@@ -85364,7 +85369,7 @@ uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuf
|
|
|
85364
85369
|
this.camera.updateProjectionMatrix();
|
|
85365
85370
|
}
|
|
85366
85371
|
this.renderer.setSize(width, height);
|
|
85367
|
-
this.composer
|
|
85372
|
+
this.composer?.setSize(width, height);
|
|
85368
85373
|
this._dirty = true;
|
|
85369
85374
|
}
|
|
85370
85375
|
//<editor-fold desc="RENDER">
|
|
@@ -85383,12 +85388,7 @@ uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuf
|
|
|
85383
85388
|
stop() {
|
|
85384
85389
|
if (this._disposed) return;
|
|
85385
85390
|
this.renderer.setAnimationLoop(null);
|
|
85386
|
-
|
|
85387
|
-
clearTimeout(this._animationTimer);
|
|
85388
|
-
this._animationTimer = void 0;
|
|
85389
|
-
if (this._animationFrame)
|
|
85390
|
-
cancelAnimationFrame(this._animationFrame);
|
|
85391
|
-
this._animationFrame = void 0;
|
|
85391
|
+
this._nextFrameTime = void 0;
|
|
85392
85392
|
}
|
|
85393
85393
|
/**
|
|
85394
85394
|
* Stops rendering and releases owned resources. Repeated calls have no effect, and a disposed
|
|
@@ -85428,25 +85428,30 @@ uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuf
|
|
|
85428
85428
|
}
|
|
85429
85429
|
}
|
|
85430
85430
|
this._debugHelpers.length = 0;
|
|
85431
|
-
this.composer
|
|
85431
|
+
this.composer?.dispose();
|
|
85432
85432
|
this.renderer.dispose();
|
|
85433
85433
|
this.renderer.forceContextLoss();
|
|
85434
85434
|
}
|
|
85435
|
-
animate(t5) {
|
|
85435
|
+
animate(t5 = performance.now()) {
|
|
85436
85436
|
if (this._disposed) return;
|
|
85437
|
-
if (this._stats) {
|
|
85438
|
-
this._stats.begin();
|
|
85439
|
-
}
|
|
85440
85437
|
if (this._controls?.enabled) {
|
|
85441
85438
|
this._controls.update();
|
|
85442
85439
|
}
|
|
85443
85440
|
if (this._disposed) return;
|
|
85444
|
-
if (this.dirty
|
|
85445
|
-
|
|
85446
|
-
|
|
85447
|
-
|
|
85448
|
-
|
|
85449
|
-
|
|
85441
|
+
if (!this.dirty && !this.options.render.renderAlways) return;
|
|
85442
|
+
const interval = this._frameInterval;
|
|
85443
|
+
if (interval) {
|
|
85444
|
+
const next = this._nextFrameTime;
|
|
85445
|
+
if (next !== void 0 && t5 + 0.1 < next) return;
|
|
85446
|
+
this._nextFrameTime = next !== void 0 && t5 - next < interval ? next + interval : t5 + interval;
|
|
85447
|
+
}
|
|
85448
|
+
if (this._stats) {
|
|
85449
|
+
this._stats.begin();
|
|
85450
|
+
}
|
|
85451
|
+
if (this.options.composer.enabled && this.composer) {
|
|
85452
|
+
this.composer.render();
|
|
85453
|
+
} else {
|
|
85454
|
+
this.renderer.render(this.scene, this.camera);
|
|
85450
85455
|
}
|
|
85451
85456
|
this.dirty = false;
|
|
85452
85457
|
if (this._stats) {
|