@needle-tools/engine 2.35.3-pre → 2.35.5-pre
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 +11 -0
- package/dist/needle-engine.d.ts +58 -34
- package/dist/needle-engine.js +394 -343
- package/dist/needle-engine.js.map +4 -4
- package/dist/needle-engine.min.js +96 -45
- package/dist/needle-engine.min.js.map +4 -4
- package/lib/engine/api.d.ts +3 -0
- package/lib/engine/api.js +3 -0
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/debug/debug.d.ts +3 -0
- package/lib/engine/debug/debug.js +8 -0
- package/lib/engine/debug/debug.js.map +1 -0
- package/lib/engine/debug/debug_overlay.d.ts +7 -0
- package/lib/engine/debug/debug_overlay.js +202 -0
- package/lib/engine/debug/debug_overlay.js.map +1 -0
- package/lib/engine/engine.js +1 -1
- package/lib/engine/engine.js.map +1 -1
- package/lib/engine/engine_element_loading.js +19 -8
- package/lib/engine/engine_element_loading.js.map +1 -1
- package/lib/engine/engine_networking.js +4 -0
- package/lib/engine/engine_networking.js.map +1 -1
- package/lib/engine/engine_networking_utils.d.ts +1 -0
- package/lib/engine/engine_networking_utils.js +3 -0
- package/lib/engine/engine_networking_utils.js.map +1 -1
- package/lib/engine/engine_serialization_core.js +35 -0
- package/lib/engine/engine_serialization_core.js.map +1 -1
- package/lib/engine/engine_types.d.ts +5 -1
- package/lib/engine/engine_types.js.map +1 -1
- package/lib/engine/extensions/NEEDLE_render_objects.d.ts +2 -2
- package/lib/engine/extensions/NEEDLE_render_objects.js +2 -2
- package/lib/engine/extensions/NEEDLE_render_objects.js.map +1 -1
- package/lib/engine-components/AudioSource.d.ts +1 -1
- package/lib/engine-components/AudioSource.js +2 -2
- package/lib/engine-components/AudioSource.js.map +1 -1
- package/lib/engine-components/Component.js +4 -2
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/Renderer.d.ts +8 -3
- package/lib/engine-components/Renderer.js +9 -1
- package/lib/engine-components/Renderer.js.map +1 -1
- package/lib/engine-components/WebXRController.js +6 -2
- package/lib/engine-components/WebXRController.js.map +1 -1
- package/lib/engine-components/js-extensions/ExtensionUtils.js +1 -1
- package/lib/engine-components/js-extensions/ExtensionUtils.js.map +1 -1
- package/package.json +1 -1
- package/src/engine/api.ts +3 -0
- package/src/engine/debug/debug.ts +9 -0
- package/src/engine/debug/debug_overlay.ts +217 -0
- package/src/engine/engine.ts +1 -1
- package/src/engine/engine_element_loading.ts +20 -9
- package/src/engine/engine_networking.ts +7 -3
- package/src/engine/engine_networking_utils.ts +4 -0
- package/src/engine/engine_serialization_core.ts +34 -0
- package/src/engine/engine_types.ts +6 -1
- package/src/engine/extensions/NEEDLE_render_objects.ts +4 -4
- package/src/engine-components/AudioSource.ts +3 -3
- package/src/engine-components/Component.ts +4 -2
- package/src/engine-components/Renderer.ts +737 -724
- package/src/engine-components/WebXRController.ts +6 -2
- package/src/engine-components/js-extensions/ExtensionUtils.ts +1 -1
- package/lib/engine/debug/error_overlay.d.ts +0 -1
- package/lib/engine/debug/error_overlay.js +0 -114
- package/lib/engine/debug/error_overlay.js.map +0 -1
- package/src/engine/debug/error_overlay.ts +0 -126
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { SourceIdentifier } from "../engine_types";
|
|
3
3
|
import { GLTF, GLTFLoaderPlugin, GLTFParser } from "three/examples/jsm/loaders/GLTFLoader";
|
|
4
|
-
import { IComponent as Component, IRenderer
|
|
4
|
+
import { IComponent as Component, IRenderer } from "../engine_types";
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
// stencil funcs
|
|
@@ -49,7 +49,7 @@ export class NEEDLE_render_objects implements GLTFLoaderPlugin {
|
|
|
49
49
|
|
|
50
50
|
private static stencils: { [key: string]: StencilSettingsModel[] } = {};
|
|
51
51
|
|
|
52
|
-
static applyStencil(obj?:
|
|
52
|
+
static applyStencil(obj?: IRenderer | null) {
|
|
53
53
|
if (!obj) return;
|
|
54
54
|
const source = obj.sourceId;
|
|
55
55
|
if (debug)
|
|
@@ -62,9 +62,9 @@ export class NEEDLE_render_objects implements GLTFLoaderPlugin {
|
|
|
62
62
|
if (matchesLayer(stencil.layer, obj)) {
|
|
63
63
|
if (debug)
|
|
64
64
|
console.log(stencil);
|
|
65
|
-
const mat = obj.
|
|
65
|
+
const mat = obj.sharedMaterial?.clone();
|
|
66
66
|
if (mat) {
|
|
67
|
-
obj.
|
|
67
|
+
obj.sharedMaterial = mat;
|
|
68
68
|
// you can have 50 renderer features per event until this breaks
|
|
69
69
|
obj.gameObject.renderOrder = stencil.event * 1000 + stencil.index * 50;
|
|
70
70
|
|
|
@@ -83,7 +83,7 @@ export class AudioSource extends Behaviour {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
@serializeable()
|
|
86
|
-
|
|
86
|
+
clip: string = "";
|
|
87
87
|
|
|
88
88
|
@serializeable()
|
|
89
89
|
playOnAwake: boolean = false;
|
|
@@ -321,7 +321,7 @@ export class AudioSource extends Behaviour {
|
|
|
321
321
|
if (debug) console.log("Pause", this);
|
|
322
322
|
this._hasEnded = true;
|
|
323
323
|
this.shouldPlay = false;
|
|
324
|
-
if (this.sound && this.sound.isPlaying) {
|
|
324
|
+
if (this.sound && this.sound.isPlaying && this.sound.source) {
|
|
325
325
|
this._lastContextTime = this.sound?.context.currentTime;
|
|
326
326
|
this.sound.pause();
|
|
327
327
|
}
|
|
@@ -331,7 +331,7 @@ export class AudioSource extends Behaviour {
|
|
|
331
331
|
if (debug) console.log("Pause", this);
|
|
332
332
|
this._hasEnded = true;
|
|
333
333
|
this.shouldPlay = false;
|
|
334
|
-
if (this.sound) {
|
|
334
|
+
if (this.sound && this.sound.source) {
|
|
335
335
|
this._lastContextTime = this.sound?.context.currentTime;
|
|
336
336
|
if (debug)
|
|
337
337
|
console.log(this._lastContextTime)
|
|
@@ -382,8 +382,9 @@ class Component implements IComponent, EventTarget {
|
|
|
382
382
|
if (this.__didEnable) return false;
|
|
383
383
|
// console.trace("INTERNAL ENABLE");
|
|
384
384
|
this.__didEnable = true;
|
|
385
|
-
this.__isEnabled = true;
|
|
386
385
|
this.onEnable();
|
|
386
|
+
// if we do this after processing the callback
|
|
387
|
+
this.__isEnabled = true;
|
|
387
388
|
return true;
|
|
388
389
|
}
|
|
389
390
|
|
|
@@ -391,9 +392,10 @@ class Component implements IComponent, EventTarget {
|
|
|
391
392
|
if (!this.__didEnable) return;
|
|
392
393
|
this.__didEnable = false;
|
|
393
394
|
this._collisionExitRoutine = undefined;
|
|
394
|
-
this.__isEnabled = false;
|
|
395
395
|
this.onDisable();
|
|
396
396
|
this._collisions?.clear();
|
|
397
|
+
// if we do this after processing the callback
|
|
398
|
+
this.__isEnabled = false;
|
|
397
399
|
}
|
|
398
400
|
|
|
399
401
|
__internalDestroy() {
|