@needle-tools/engine 4.8.2-alpha → 4.8.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/engine",
3
- "version": "4.8.2-alpha",
3
+ "version": "4.8.2",
4
4
  "description": "Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.",
5
5
  "main": "dist/needle-engine.min.js",
6
6
  "exports": {
@@ -93,7 +93,7 @@
93
93
  ],
94
94
  "dependencies": {
95
95
  "@dimforge/rapier3d-compat": "^0.14.0",
96
- "@needle-tools/gltf-progressive": "3.3.0-next.3a5f32f",
96
+ "@needle-tools/gltf-progressive": "3.3.0",
97
97
  "@webxr-input-profiles/motion-controllers": "^1.0.0",
98
98
  "flatbuffers": "2.0.4",
99
99
  "md5": "^2.3.0",
@@ -979,9 +979,15 @@ export class Context implements IContext {
979
979
  get isVisibleToUser() {
980
980
  if (this.isInXR) return true;
981
981
  if (!this._isVisible) return false;
982
+ // Make sure not to call getComputedStyle multiple times per frame
983
+ if (this.time.frame === this._lastStyleComputedFrame) return this._lastStyleComputedResult;
984
+ this._lastStyleComputedFrame = this.time.frame;
982
985
  const style = getComputedStyle(this.domElement);
983
- return style.visibility !== "hidden" && style.display !== "none" && style.opacity !== "0";
986
+ this._lastStyleComputedResult = style.visibility !== "hidden" && style.display !== "none" && style.opacity !== "0";
987
+ return this._lastStyleComputedResult;
984
988
  }
989
+ private _lastStyleComputedFrame: number = -1;
990
+ private _lastStyleComputedResult: boolean = true;
985
991
 
986
992
  private _createId: number = 0;
987
993
  private async internalOnCreate(opts?: ContextCreateArgs): Promise<boolean> {
@@ -1601,6 +1607,8 @@ export class Context implements IContext {
1601
1607
  }
1602
1608
  this.handleRendererContextLost();
1603
1609
 
1610
+ if(this.time.frame % 10 !== 0) return;
1611
+
1604
1612
  this._isRendering = true;
1605
1613
  this.renderRequiredTextures();
1606
1614