@@ -1,6 +1,6 @@
|
|
1
1
|
import { GLTF } from "three/examples/jsm/loaders/GLTFLoader.js";
|
2
|
-
import { ContextEvent, ContextRegistry } from "../engine/engine_context_registry
|
3
|
-
import { findAnimations } from "../engine/engine_scenetools
|
2
|
+
import { ContextEvent, ContextRegistry } from "../engine/engine_context_registry";
|
3
|
+
import { findAnimations } from "../engine/engine_scenetools";
|
4
4
|
|
5
5
|
|
6
6
|
ContextRegistry.registerCallback(ContextEvent.ContextCreated, args => {
|
@@ -150,10 +150,12 @@
|
|
150
150
|
if (this._currentlyCreatingPanel) return;
|
151
151
|
this._currentlyCreatingPanel = true;
|
152
152
|
|
153
|
+
let offset = .015;
|
154
|
+
// if (this.Root) offset = .02 * (1 / this.Root.gameObject.scale.z);
|
153
155
|
const opts = {
|
154
156
|
backgroundColor: this.color,
|
155
157
|
backgroundOpacity: this.color.alpha,
|
156
|
-
offset:
|
158
|
+
offset: offset, // without a tiny offset we get z fighting
|
157
159
|
};
|
158
160
|
this.onBeforeCreate(opts);
|
159
161
|
this.applyEffects(opts);
|
@@ -343,6 +343,7 @@
|
|
343
343
|
export const $particleLife = Symbol("particleLife");
|
344
344
|
const $trailLifetime = Symbol("trailLifetime");
|
345
345
|
const $trailStartLength = Symbol("trailStartLength");
|
346
|
+
const $trailWidthRandom = Symbol("trailWidthRandom");
|
346
347
|
|
347
348
|
class TrailBehaviour extends ParticleSystemBaseBehaviour {
|
348
349
|
type: string = "NeedleTrail";
|
@@ -355,6 +356,7 @@
|
|
355
356
|
particle.life += particle[$trailLifetime];
|
356
357
|
}
|
357
358
|
particle[$trailStartLength] = particle.length;
|
359
|
+
particle[$trailWidthRandom] = Math.random();
|
358
360
|
}
|
359
361
|
|
360
362
|
}
|
@@ -370,7 +372,12 @@
|
|
370
372
|
const cur = iter.next();
|
371
373
|
const state = cur.value as RecordState;
|
372
374
|
const pos01 = 1 - (i / (length - 1));
|
373
|
-
|
375
|
+
let size = particle.size;
|
376
|
+
if (size <= 0 && !this.system.trails.sizeAffectsWidth) {
|
377
|
+
// Not sure where we get to 100* from, tested in SOC trong com
|
378
|
+
size = 100 * this.system.trails.widthOverTrail.evaluate(.5, trailParticle[$trailWidthRandom]);
|
379
|
+
}
|
380
|
+
state.size = this.system.trails.getWidth(size, age01, pos01, trailParticle[$trailWidthRandom]);
|
374
381
|
state.color.copy(particle.color);
|
375
382
|
this.system.trails.getColor(state.color, age01, pos01);
|
376
383
|
}
|
@@ -663,8 +670,12 @@
|
|
663
670
|
}
|
664
671
|
}
|
665
672
|
|
666
|
-
|
667
|
-
|
673
|
+
get playOnAwake(): boolean {
|
674
|
+
return this.main.playOnAwake;
|
675
|
+
}
|
676
|
+
set playOnAwake(val: boolean) {
|
677
|
+
this.main.playOnAwake = val;
|
678
|
+
}
|
668
679
|
|
669
680
|
@serializable(ColorOverLifetimeModule)
|
670
681
|
readonly colorOverLifetime!: ColorOverLifetimeModule;
|
@@ -362,7 +362,6 @@
|
|
362
362
|
}
|
363
363
|
run(time: number): number {
|
364
364
|
if (time <= this.time) {
|
365
|
-
this.reset();
|
366
365
|
return 0;
|
367
366
|
}
|
368
367
|
let amount = 0;
|
@@ -429,7 +428,7 @@
|
|
429
428
|
if (this.burstCount > 0) {
|
430
429
|
for (let i = 0; i < this.burstCount; i++) {
|
431
430
|
const burst = this.bursts[i];
|
432
|
-
if (burst.time >= this.system.time) {
|
431
|
+
if (this.system.main.loop && burst.time >= this.system.time) {
|
433
432
|
burst.reset();
|
434
433
|
}
|
435
434
|
amount += Math.round(burst.run(this.system.time));
|
@@ -973,9 +972,8 @@
|
|
973
972
|
@serializable()
|
974
973
|
worldSpace: boolean = false;
|
975
974
|
|
976
|
-
getWidth(size: number, _life01: number, pos01: number) {
|
977
|
-
let res = this.widthOverTrail.evaluate(pos01);
|
978
|
-
if (pos01 === 0) res = size;
|
975
|
+
getWidth(size: number, _life01: number, pos01: number, t : number) {
|
976
|
+
let res = this.widthOverTrail.evaluate(pos01, t);
|
979
977
|
size *= res;
|
980
978
|
return size;
|
981
979
|
}
|
@@ -1072,9 +1070,9 @@
|
|
1072
1070
|
// if (this.space === ParticleSystemSimulationSpace.World) {
|
1073
1071
|
// this._temp.applyQuaternion(this._system.worldQuaternionInverted);
|
1074
1072
|
// }
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1073
|
+
if (this._system.main.simulationSpace === ParticleSystemSimulationSpace.World) {
|
1074
|
+
this._temp.applyQuaternion(this._system.worldQuaternion);
|
1075
|
+
}
|
1078
1076
|
}
|
1079
1077
|
|
1080
1078
|
if (this._hasOrbital) {
|
@@ -33,7 +33,6 @@
|
|
33
33
|
get parent() {
|
34
34
|
return this._parentRectTransform;
|
35
35
|
}
|
36
|
-
offset: number = .01;
|
37
36
|
|
38
37
|
// @serializable(Object3D)
|
39
38
|
// root? : Object3D;
|
@@ -108,8 +107,6 @@
|
|
108
107
|
|
109
108
|
this.lastMatrix = new Matrix4();
|
110
109
|
this.rectBlock = new Object3D();
|
111
|
-
// Is this legacy? Not sure if this is still needed
|
112
|
-
this.rectBlock.position.z = .1;
|
113
110
|
this.rectBlock.name = this.name;
|
114
111
|
|
115
112
|
// TODO: get rid of the initial position
|
@@ -213,9 +210,8 @@
|
|
213
210
|
// calc anchors and offset and apply
|
214
211
|
tempVec.set(0, 0, 0);
|
215
212
|
this.applyAnchoring(tempVec);
|
216
|
-
tempVec.z +=
|
217
|
-
|
218
|
-
|
213
|
+
if(this.Canvas?.screenspace) tempVec.z += .1;
|
214
|
+
else tempVec.z += .01;
|
219
215
|
tempMatrix.identity();
|
220
216
|
tempMatrix.setPosition(tempVec.x, tempVec.y, tempVec.z);
|
221
217
|
uiobject.matrix.premultiply(tempMatrix);
|
@@ -307,7 +303,7 @@
|
|
307
303
|
const opts = {
|
308
304
|
width: this.sizeDelta!.x,
|
309
305
|
height: this.sizeDelta!.y,// * this.context.mainCameraComponent!.aspect,
|
310
|
-
offset:
|
306
|
+
offset: 0,
|
311
307
|
backgroundOpacity: 0,
|
312
308
|
borderWidth: 0, // if we dont specify width here a border will automatically propagated to child blocks
|
313
309
|
borderRadius: 0,
|