minerender 2.1.0-alpha.3 → 2.1.0-alpha.4
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 +3 -3
- package/dist/browser/index.d.ts +3 -3
- package/dist/browser/index.js +17 -19
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +17 -19
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +17 -19
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +3 -3
- package/dist/node/index.d.ts +3 -3
- package/dist/node/index.js +17 -19
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +17 -19
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.mts
CHANGED
|
@@ -1324,10 +1324,9 @@ declare class Renderer implements Disposable {
|
|
|
1324
1324
|
protected _stats?: Stats;
|
|
1325
1325
|
protected _dirty: boolean;
|
|
1326
1326
|
protected _animationLoop: any;
|
|
1327
|
-
protected
|
|
1328
|
-
protected _animationTimer?: NodeJS.Timeout;
|
|
1329
|
-
protected _animationFrame?: number;
|
|
1327
|
+
protected _frameInterval?: number;
|
|
1330
1328
|
protected _resizeListener?: () => void;
|
|
1329
|
+
private _nextFrameTime?;
|
|
1331
1330
|
private _disposed;
|
|
1332
1331
|
private readonly _debugHelpers;
|
|
1333
1332
|
private readonly _eventDispatchers;
|
|
@@ -1394,6 +1393,7 @@ interface CameraOptions {
|
|
|
1394
1393
|
lookingAt: Vector3 | TripleArray;
|
|
1395
1394
|
}
|
|
1396
1395
|
interface RenderOptions {
|
|
1396
|
+
/** Maximum draw rate (60 by default); zero or a negative value disables the limit. */
|
|
1397
1397
|
fpsLimit: number;
|
|
1398
1398
|
stats: boolean;
|
|
1399
1399
|
antialias: boolean;
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -1324,10 +1324,9 @@ declare class Renderer implements Disposable {
|
|
|
1324
1324
|
protected _stats?: Stats;
|
|
1325
1325
|
protected _dirty: boolean;
|
|
1326
1326
|
protected _animationLoop: any;
|
|
1327
|
-
protected
|
|
1328
|
-
protected _animationTimer?: NodeJS.Timeout;
|
|
1329
|
-
protected _animationFrame?: number;
|
|
1327
|
+
protected _frameInterval?: number;
|
|
1330
1328
|
protected _resizeListener?: () => void;
|
|
1329
|
+
private _nextFrameTime?;
|
|
1331
1330
|
private _disposed;
|
|
1332
1331
|
private readonly _debugHelpers;
|
|
1333
1332
|
private readonly _eventDispatchers;
|
|
@@ -1394,6 +1393,7 @@ interface CameraOptions {
|
|
|
1394
1393
|
lookingAt: Vector3 | TripleArray;
|
|
1395
1394
|
}
|
|
1396
1395
|
interface RenderOptions {
|
|
1396
|
+
/** Maximum draw rate (60 by default); zero or a negative value disables the limit. */
|
|
1397
1397
|
fpsLimit: number;
|
|
1398
1398
|
stats: boolean;
|
|
1399
1399
|
antialias: boolean;
|
package/dist/browser/index.js
CHANGED
|
@@ -6190,8 +6190,6 @@ var MapControls = class extends OrbitControls {
|
|
|
6190
6190
|
var _Renderer = class _Renderer {
|
|
6191
6191
|
constructor(options) {
|
|
6192
6192
|
this._dirty = true;
|
|
6193
|
-
this._animationTimer = void 0;
|
|
6194
|
-
this._animationFrame = void 0;
|
|
6195
6193
|
this._resizeListener = void 0;
|
|
6196
6194
|
this._disposed = false;
|
|
6197
6195
|
this._debugHelpers = [];
|
|
@@ -6201,7 +6199,7 @@ var _Renderer = class _Renderer {
|
|
|
6201
6199
|
};
|
|
6202
6200
|
this.options = (0, import_ts_deepmerge10.default)({}, _Renderer.DEFAULT_OPTIONS, options ?? {});
|
|
6203
6201
|
this._animationLoop = this.animate.bind(this);
|
|
6204
|
-
this.
|
|
6202
|
+
this._frameInterval = this.options.render.fpsLimit > 0 ? 1e3 / this.options.render.fpsLimit : void 0;
|
|
6205
6203
|
this._scene = this.createScene();
|
|
6206
6204
|
this._camera = this.createCamera();
|
|
6207
6205
|
this._renderer = this.createRenderer();
|
|
@@ -6382,12 +6380,7 @@ var _Renderer = class _Renderer {
|
|
|
6382
6380
|
stop() {
|
|
6383
6381
|
if (this._disposed) return;
|
|
6384
6382
|
this.renderer.setAnimationLoop(null);
|
|
6385
|
-
|
|
6386
|
-
clearTimeout(this._animationTimer);
|
|
6387
|
-
this._animationTimer = void 0;
|
|
6388
|
-
if (this._animationFrame)
|
|
6389
|
-
cancelAnimationFrame(this._animationFrame);
|
|
6390
|
-
this._animationFrame = void 0;
|
|
6383
|
+
this._nextFrameTime = void 0;
|
|
6391
6384
|
}
|
|
6392
6385
|
/**
|
|
6393
6386
|
* Stops rendering and releases owned resources. Repeated calls have no effect, and a disposed
|
|
@@ -6431,21 +6424,26 @@ var _Renderer = class _Renderer {
|
|
|
6431
6424
|
this.renderer.dispose();
|
|
6432
6425
|
this.renderer.forceContextLoss();
|
|
6433
6426
|
}
|
|
6434
|
-
animate(t) {
|
|
6427
|
+
animate(t = performance.now()) {
|
|
6435
6428
|
if (this._disposed) return;
|
|
6436
|
-
if (this._stats) {
|
|
6437
|
-
this._stats.begin();
|
|
6438
|
-
}
|
|
6439
6429
|
if (this._controls?.enabled) {
|
|
6440
6430
|
this._controls.update();
|
|
6441
6431
|
}
|
|
6442
6432
|
if (this._disposed) return;
|
|
6443
|
-
if (this.dirty
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6433
|
+
if (!this.dirty && !this.options.render.renderAlways) return;
|
|
6434
|
+
const interval = this._frameInterval;
|
|
6435
|
+
if (interval) {
|
|
6436
|
+
const next = this._nextFrameTime;
|
|
6437
|
+
if (next !== void 0 && t + 0.1 < next) return;
|
|
6438
|
+
this._nextFrameTime = next !== void 0 && t - next < interval ? next + interval : t + interval;
|
|
6439
|
+
}
|
|
6440
|
+
if (this._stats) {
|
|
6441
|
+
this._stats.begin();
|
|
6442
|
+
}
|
|
6443
|
+
if (this.options.composer.enabled) {
|
|
6444
|
+
this.composer.render();
|
|
6445
|
+
} else {
|
|
6446
|
+
this.renderer.render(this.scene, this.camera);
|
|
6449
6447
|
}
|
|
6450
6448
|
this.dirty = false;
|
|
6451
6449
|
if (this._stats) {
|