@needle-tools/engine 2.65.0-pre → 2.65.1-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 +10 -0
- package/dist/needle-engine.js +9884 -9857
- package/dist/needle-engine.umd.cjs +211 -207
- package/lib/engine/engine_element.d.ts +2 -0
- package/lib/engine/engine_element.js +26 -4
- package/lib/engine/engine_element.js.map +1 -1
- package/lib/engine/engine_license.js +9 -5
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine-components/ParticleSystem.d.ts +12 -8
- package/lib/engine-components/ParticleSystem.js +59 -30
- package/lib/engine-components/ParticleSystem.js.map +1 -1
- package/lib/engine-components/ParticleSystemModules.d.ts +1 -0
- package/lib/engine-components/ParticleSystemModules.js +12 -5
- package/lib/engine-components/ParticleSystemModules.js.map +1 -1
- package/lib/engine-components/Skybox.js +18 -5
- package/lib/engine-components/Skybox.js.map +1 -1
- package/package.json +1 -1
- package/src/engine/engine_element.ts +31 -5
- package/src/engine/engine_license.ts +9 -5
- package/src/engine-components/ParticleSystem.ts +68 -37
- package/src/engine-components/ParticleSystemModules.ts +12 -6
- package/src/engine-components/Skybox.ts +15 -5
|
@@ -522,10 +522,10 @@ export class ShapeModule implements EmitterShape {
|
|
|
522
522
|
private readonly _worldSpaceMatrix: Matrix4 = new Matrix4();
|
|
523
523
|
private readonly _worldSpaceMatrixInverse: Matrix4 = new Matrix4();
|
|
524
524
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
525
|
+
constructor() {
|
|
526
|
+
if (debug)
|
|
527
|
+
console.log(this);
|
|
528
|
+
}
|
|
529
529
|
|
|
530
530
|
update(system: IParticleSystem, _context: Context, simulationSpace: ParticleSystemSimulationSpace, obj: Object3D) {
|
|
531
531
|
this.system = system;
|
|
@@ -571,6 +571,7 @@ export class ShapeModule implements EmitterShape {
|
|
|
571
571
|
if (this.enabled) {
|
|
572
572
|
switch (this.shapeType) {
|
|
573
573
|
case ParticleSystemShapeType.Box:
|
|
574
|
+
if(debug) Gizmos.DrawBox(this.position, this.scale, 0xdddddd, 1);
|
|
574
575
|
this._vector.x = Math.random() * this.scale.x - this.scale.x / 2;
|
|
575
576
|
this._vector.y = Math.random() * this.scale.y - this.scale.y / 2;
|
|
576
577
|
this._vector.z = Math.random() * this.scale.z - this.scale.z / 2;
|
|
@@ -605,6 +606,10 @@ export class ShapeModule implements EmitterShape {
|
|
|
605
606
|
this._vector.applyQuaternion(this.system.worldQuaternion);
|
|
606
607
|
this._vector.add(this.system.worldPos);
|
|
607
608
|
}
|
|
609
|
+
|
|
610
|
+
if (debug) {
|
|
611
|
+
Gizmos.DrawSphere(this._vector, .03, 0xff0000, .5, true);
|
|
612
|
+
}
|
|
608
613
|
}
|
|
609
614
|
|
|
610
615
|
|
|
@@ -631,14 +636,15 @@ export class ShapeModule implements EmitterShape {
|
|
|
631
636
|
const ry = pos.y;
|
|
632
637
|
const rz = pos.z;
|
|
633
638
|
this._dir.set(rx, ry, rz)
|
|
634
|
-
|
|
639
|
+
if (this.system?.worldspace)
|
|
640
|
+
this._dir.sub(this.system.worldPos)
|
|
635
641
|
break;
|
|
636
642
|
default:
|
|
637
643
|
this._dir.set(0, 0, 1);
|
|
638
644
|
break;
|
|
639
645
|
}
|
|
640
646
|
if (this._space === ParticleSystemSimulationSpace.World) {
|
|
641
|
-
this._dir.
|
|
647
|
+
this._dir.applyQuaternion(this.system.worldQuaternion);
|
|
642
648
|
}
|
|
643
649
|
if (this.updateRotation())
|
|
644
650
|
this._dir.applyEuler(this._rotation);
|
|
@@ -5,6 +5,9 @@ import { EXRLoader } from "three/examples/jsm/loaders/EXRLoader";
|
|
|
5
5
|
import { EquirectangularRefractionMapping, sRGBEncoding, Texture, TextureLoader } from "three"
|
|
6
6
|
import { syncField } from "../engine/engine_networking_auto";
|
|
7
7
|
import { Camera } from "./Camera";
|
|
8
|
+
import { getParam, getPath } from "../engine/engine_utils";
|
|
9
|
+
|
|
10
|
+
const debug = getParam("debugskybox");
|
|
8
11
|
|
|
9
12
|
export class RemoteSkybox extends Behaviour {
|
|
10
13
|
|
|
@@ -44,10 +47,17 @@ export class RemoteSkybox extends Behaviour {
|
|
|
44
47
|
|
|
45
48
|
async setSkybox(url: string | undefined | null) {
|
|
46
49
|
if (!url) return;
|
|
47
|
-
if (!url?.endsWith(".hdr") && !url.endsWith(".exr")) {
|
|
50
|
+
if (!url?.endsWith(".hdr") && !url.endsWith(".exr") && !url.endsWith(".jpg") && !url.endsWith(".png") && !url.endsWith(".jpeg")) {
|
|
48
51
|
console.warn("Potentially invalid skybox url", this.url, "on", this.name);
|
|
49
52
|
}
|
|
50
53
|
|
|
54
|
+
if(debug) console.log("Remote skybox url?: " + url);
|
|
55
|
+
|
|
56
|
+
if (!url.startsWith("http") && !url.startsWith("www.") && !url.startsWith("data:")) {
|
|
57
|
+
url = getPath(this.sourceId, url);
|
|
58
|
+
if(debug) console.log("Remote skybox resolved to " + url);
|
|
59
|
+
}
|
|
60
|
+
|
|
51
61
|
if (this._prevUrl === url && this._prevLoadedEnvironment) {
|
|
52
62
|
this.applySkybox();
|
|
53
63
|
return;
|
|
@@ -74,7 +84,7 @@ export class RemoteSkybox extends Behaviour {
|
|
|
74
84
|
this._loader = new TextureLoader();
|
|
75
85
|
}
|
|
76
86
|
|
|
77
|
-
console.log("Loading skybox: " + url);
|
|
87
|
+
if(debug) console.log("Loading skybox: " + url);
|
|
78
88
|
const envMap = await this._loader.loadAsync(url);
|
|
79
89
|
if (!envMap) return;
|
|
80
90
|
// Check if we're still enabled
|
|
@@ -103,7 +113,7 @@ export class RemoteSkybox extends Behaviour {
|
|
|
103
113
|
if (this.context.scene.environment !== envMap)
|
|
104
114
|
this._prevEnvironment = this.context.scene.environment;
|
|
105
115
|
|
|
106
|
-
console.log("Set remote skybox", this.url);
|
|
116
|
+
if(debug) console.log("Set remote skybox", this.url);
|
|
107
117
|
if (this.environment)
|
|
108
118
|
this.context.scene.environment = envMap;
|
|
109
119
|
if (this.background && !Camera.backgroundShouldBeTransparent(this.context))
|
|
@@ -140,12 +150,12 @@ export class RemoteSkybox extends Behaviour {
|
|
|
140
150
|
for (const type of e.dataTransfer.types) {
|
|
141
151
|
if (type === "text/uri-list") {
|
|
142
152
|
const url = e.dataTransfer.getData(type);
|
|
143
|
-
console.log(type, url);
|
|
153
|
+
if(debug) console.log(type, url);
|
|
144
154
|
let name = new RegExp(/polyhaven.com\/asset_img\/.+?\/(?<name>.+)\.png/).exec(url)?.groups?.name;
|
|
145
155
|
if (!name) {
|
|
146
156
|
name = new RegExp(/polyhaven\.com\/a\/(?<name>.+)/).exec(url)?.groups?.name;
|
|
147
157
|
}
|
|
148
|
-
console.log(name);
|
|
158
|
+
if(debug) console.log(name);
|
|
149
159
|
if (name) {
|
|
150
160
|
const envurl = "https://dl.polyhaven.org/file/ph-assets/HDRIs/exr/1k/" + name + "_1k.exr";
|
|
151
161
|
this.setSkybox(envurl);
|