@@ -1,5 +1,5 @@
|
|
1
1
|
import { TypeStore } from "./../engine_typestore"
|
2
|
-
|
2
|
+
|
3
3
|
// Import types
|
4
4
|
import { __Ignore } from "../../engine-components/codegen/components";
|
5
5
|
import { ActionBuilder } from "../../engine-components/export/usdz/extensions/behavior/BehavioursBuilder";
|
@@ -216,7 +216,7 @@
|
|
216
216
|
import { XRGrabRendering } from "../../engine-components/webxr/WebXRGrabRendering";
|
217
217
|
import { XRRig } from "../../engine-components/webxr/WebXRRig";
|
218
218
|
import { XRState } from "../../engine-components/XRFlag";
|
219
|
-
|
219
|
+
|
220
220
|
// Register types
|
221
221
|
TypeStore.add("__Ignore", __Ignore);
|
222
222
|
TypeStore.add("ActionBuilder", ActionBuilder);
|
@@ -328,8 +328,10 @@
|
|
328
328
|
return this.gameObject?.userData.tag;
|
329
329
|
}
|
330
330
|
set tag(str: string) {
|
331
|
-
if (this.gameObject)
|
331
|
+
if (this.gameObject) {
|
332
|
+
if (!this.gameObject.userData) this.gameObject.userData = {}
|
332
333
|
this.gameObject.userData.tag = str;
|
334
|
+
}
|
333
335
|
}
|
334
336
|
get static() {
|
335
337
|
return this.gameObject?.userData.static;
|
@@ -783,16 +783,19 @@
|
|
783
783
|
}
|
784
784
|
}
|
785
785
|
|
786
|
-
private
|
786
|
+
private _lastTimestamp = 0;
|
787
|
+
private internalRender(timestamp : DOMHighResTimeStamp, frame: XRFrame | null) {
|
787
788
|
this._xrFrame = frame;
|
788
789
|
|
789
790
|
this._currentFrameEvent = FrameEvent.Undefined;
|
790
|
-
|
791
|
+
|
791
792
|
if (this.isInXR === false && this.targetFrameRate !== undefined) {
|
792
|
-
this.
|
793
|
-
|
794
|
-
|
795
|
-
|
793
|
+
if(this._lastTimestamp === 0) this._lastTimestamp = timestamp;
|
794
|
+
this._accumulatedTime += (timestamp - this._lastTimestamp) /1000;
|
795
|
+
this._lastTimestamp = timestamp;
|
796
|
+
let targetFrameRate = this.targetFrameRate;
|
797
|
+
if (typeof targetFrameRate === "object") targetFrameRate = targetFrameRate.value!;
|
798
|
+
// if(debug) console.log(this._accumulatedTime, (1 / (targetFrameRate)))
|
796
799
|
if (this._accumulatedTime < (1 / (targetFrameRate + 1))) {
|
797
800
|
return;
|
798
801
|
}
|