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.
@@ -6029,8 +6029,6 @@ var MapControls = class extends OrbitControls {
6029
6029
  var _Renderer = class _Renderer {
6030
6030
  constructor(options) {
6031
6031
  this._dirty = true;
6032
- this._animationTimer = void 0;
6033
- this._animationFrame = void 0;
6034
6032
  this._resizeListener = void 0;
6035
6033
  this._disposed = false;
6036
6034
  this._debugHelpers = [];
@@ -6040,7 +6038,7 @@ var _Renderer = class _Renderer {
6040
6038
  };
6041
6039
  this.options = (0, import_ts_deepmerge10.default)({}, _Renderer.DEFAULT_OPTIONS, options ?? {});
6042
6040
  this._animationLoop = this.animate.bind(this);
6043
- this._fpsTimer = this.options.render.fpsLimit > 0 ? 1e3 / this.options.render.fpsLimit : void 0;
6041
+ this._frameInterval = this.options.render.fpsLimit > 0 ? 1e3 / this.options.render.fpsLimit : void 0;
6044
6042
  this._scene = this.createScene();
6045
6043
  this._camera = this.createCamera();
6046
6044
  this._renderer = this.createRenderer();
@@ -6222,12 +6220,7 @@ var _Renderer = class _Renderer {
6222
6220
  stop() {
6223
6221
  if (this._disposed) return;
6224
6222
  this.renderer.setAnimationLoop(null);
6225
- if (this._animationTimer)
6226
- clearTimeout(this._animationTimer);
6227
- this._animationTimer = void 0;
6228
- if (this._animationFrame)
6229
- cancelAnimationFrame(this._animationFrame);
6230
- this._animationFrame = void 0;
6223
+ this._nextFrameTime = void 0;
6231
6224
  }
6232
6225
  /**
6233
6226
  * Stops rendering and releases owned resources. Repeated calls have no effect, and a disposed
@@ -6272,22 +6265,27 @@ var _Renderer = class _Renderer {
6272
6265
  this.renderer.dispose();
6273
6266
  this.renderer.forceContextLoss();
6274
6267
  }
6275
- animate(t) {
6268
+ animate(t = performance.now()) {
6276
6269
  var _a;
6277
6270
  if (this._disposed) return;
6278
- if (this._stats) {
6279
- this._stats.begin();
6280
- }
6281
6271
  if ((_a = this._controls) == null ? void 0 : _a.enabled) {
6282
6272
  this._controls.update();
6283
6273
  }
6284
6274
  if (this._disposed) return;
6285
- if (this.dirty || this.options.render.renderAlways) {
6286
- if (this.options.composer.enabled) {
6287
- this.composer.render();
6288
- } else {
6289
- this.renderer.render(this.scene, this.camera);
6290
- }
6275
+ if (!this.dirty && !this.options.render.renderAlways) return;
6276
+ const interval = this._frameInterval;
6277
+ if (interval) {
6278
+ const next = this._nextFrameTime;
6279
+ if (next !== void 0 && t + 0.1 < next) return;
6280
+ this._nextFrameTime = next !== void 0 && t - next < interval ? next + interval : t + interval;
6281
+ }
6282
+ if (this._stats) {
6283
+ this._stats.begin();
6284
+ }
6285
+ if (this.options.composer.enabled) {
6286
+ this.composer.render();
6287
+ } else {
6288
+ this.renderer.render(this.scene, this.camera);
6291
6289
  }
6292
6290
  this.dirty = false;
6293
6291
  if (this._stats) {