@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/CHANGELOG.md +5 -0
- package/dist/{needle-engine.bundle-8cc_elhp.umd.cjs → needle-engine.bundle-C5G_xBUc.umd.cjs} +4 -4
- package/dist/{needle-engine.bundle-e1rkwlcW.js → needle-engine.bundle-D4YRjNnp.js} +16 -10
- package/dist/{needle-engine.bundle-C0Hmw0lL.min.js → needle-engine.bundle-Dujqh1WU.min.js} +3 -3
- package/dist/needle-engine.js +2 -2
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/lib/engine/engine_context.d.ts +3 -1
- package/lib/engine/engine_context.js +10 -1
- package/lib/engine/engine_context.js.map +1 -1
- package/package.json +2 -2
- package/src/engine/engine_context.ts +9 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/engine",
|
|
3
|
-
"version": "4.8.2
|
|
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
|
|
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
|
-
|
|
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
|
|