@woosh/meep-engine 2.94.2 → 2.94.5
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/build/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +138 -73
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +138 -73
- package/editor/ecs/component/editors/ecs/Trail2DEditor.js +1 -1
- package/package.json +1 -1
- package/src/core/assert.d.ts +6 -0
- package/src/core/assert.d.ts.map +1 -1
- package/src/core/assert.js +13 -0
- package/src/core/binary/BitSet.js +3 -3
- package/src/core/binary/BitSet.spec.js +14 -12
- package/src/core/geom/2d/aabb/AABB2.d.ts.map +1 -1
- package/src/core/geom/2d/aabb/AABB2.js +34 -4
- package/src/core/geom/3d/util/make_justified_point_grid.d.ts +2 -1
- package/src/core/geom/3d/util/make_justified_point_grid.d.ts.map +1 -1
- package/src/core/geom/3d/util/make_justified_point_grid.js +6 -3
- package/src/core/geom/Quaternion.d.ts.map +1 -1
- package/src/core/geom/Quaternion.js +29 -18
- package/src/core/geom/Quaternion.spec.js +27 -1
- package/src/core/geom/vec3/v3_distance_sqr.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_distance_sqr.js +4 -1
- package/src/core/json/resolvePath.d.ts +1 -1
- package/src/core/json/resolvePath.d.ts.map +1 -1
- package/src/core/json/resolvePath.js +5 -1
- package/src/core/math/clamp.js +1 -1
- package/src/core/math/clamp01.d.ts +5 -0
- package/src/core/math/clamp01.d.ts.map +1 -1
- package/src/core/math/clamp01.js +6 -0
- package/src/core/math/iabs.d.ts +9 -0
- package/src/core/math/iabs.d.ts.map +1 -0
- package/src/core/math/iabs.js +15 -0
- package/src/core/math/iabs.spec.d.ts +2 -0
- package/src/core/math/iabs.spec.d.ts.map +1 -0
- package/src/core/math/iabs.spec.js +9 -0
- package/src/engine/EngineConfiguration.d.ts.map +1 -1
- package/src/engine/EngineConfiguration.js +7 -0
- package/src/engine/EngineHarness.d.ts.map +1 -1
- package/src/engine/EngineHarness.js +0 -3
- package/src/engine/animation/AnimationUtils.d.ts.map +1 -1
- package/src/engine/animation/AnimationUtils.js +2 -1
- package/src/engine/ecs/System.d.ts.map +1 -1
- package/src/engine/ecs/System.js +6 -0
- package/src/engine/ecs/transform/Transform.d.ts.map +1 -1
- package/src/engine/ecs/transform/Transform.js +18 -13
- package/src/engine/ecs/transform/Transform.spec.js +50 -11
- package/src/engine/ecs/util/hideEntityGracefully.d.ts.map +1 -1
- package/src/engine/ecs/util/hideEntityGracefully.js +12 -11
- package/src/engine/graphics/ecs/trail2d/Trail2D.d.ts +10 -6
- package/src/engine/graphics/ecs/trail2d/Trail2D.d.ts.map +1 -1
- package/src/engine/graphics/ecs/trail2d/Trail2D.js +61 -13
- package/src/engine/graphics/ecs/trail2d/Trail2DFlags.d.ts +8 -0
- package/src/engine/graphics/ecs/trail2d/Trail2DFlags.d.ts.map +1 -0
- package/src/engine/graphics/ecs/trail2d/Trail2DFlags.js +10 -0
- package/src/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/trail2d/Trail2DSystem.js +14 -33
- package/src/engine/graphics/ecs/trail2d/makeGradientTrail.d.ts.map +1 -1
- package/src/engine/graphics/ecs/trail2d/makeGradientTrail.js +2 -1
- package/src/engine/graphics/ecs/trail2d/prototypeTrail2D.d.ts +2 -0
- package/src/engine/graphics/ecs/trail2d/prototypeTrail2D.d.ts.map +1 -0
- package/src/engine/graphics/ecs/trail2d/prototypeTrail2D.js +65 -0
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +1 -1
- package/src/engine/graphics/trail/x/RibbonX.d.ts +2 -2
- package/src/engine/graphics/trail/x/RibbonX.d.ts.map +1 -1
- package/src/engine/graphics/trail/x/RibbonX.js +16 -8
- package/src/engine/graphics/trail/x/simulator/RibbonXFixedPhysicsSimulator.d.ts.map +1 -1
- package/src/engine/graphics/trail/x/simulator/RibbonXFixedPhysicsSimulator.js +2 -1
|
@@ -6,27 +6,22 @@
|
|
|
6
6
|
import { BvhClient } from "../../../../core/bvh2/bvh3/BvhClient.js";
|
|
7
7
|
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
8
8
|
import Vector4 from "../../../../core/geom/Vector4.js";
|
|
9
|
+
import { clamp01 } from "../../../../core/math/clamp01.js";
|
|
9
10
|
import ThreeFactory from "../../three/ThreeFactory.js";
|
|
11
|
+
import { RIBBON_ATTRIBUTE_ADDRESS_AGE } from "../../trail/x/ribbon_attributes_spec.js";
|
|
10
12
|
import { RibbonX } from "../../trail/x/RibbonX.js";
|
|
11
13
|
import { RibbonXMaterialSpec } from "../../trail/x/RibbonXMaterialSpec.js";
|
|
12
14
|
import { makeGradientTrail } from "./makeGradientTrail.js";
|
|
15
|
+
import { Trail2DFlags } from "./Trail2DFlags.js";
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
* @readonly
|
|
16
|
-
* @enum {number}
|
|
17
|
-
*/
|
|
18
|
-
export const Trail2DFlags = {
|
|
19
|
-
Spawning: 1,
|
|
20
|
-
Aging: 2,
|
|
21
|
-
Built: 4,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const DEFAULT_FLAGS = Trail2DFlags.Spawning | Trail2DFlags.Aging;
|
|
17
|
+
const DEFAULT_FLAGS = Trail2DFlags.Spawning | Trail2DFlags.Aging | Trail2DFlags.BoundsNeedUpdate;
|
|
25
18
|
|
|
26
19
|
const DEFAULT_MAX_AGE = 5;
|
|
27
20
|
|
|
28
21
|
const DEFAULT_WIDTH = 1;
|
|
29
22
|
|
|
23
|
+
const v3_array = new Float32Array(3);
|
|
24
|
+
|
|
30
25
|
class Trail2D {
|
|
31
26
|
|
|
32
27
|
/**
|
|
@@ -97,9 +92,13 @@ class Trail2D {
|
|
|
97
92
|
flags = DEFAULT_FLAGS;
|
|
98
93
|
|
|
99
94
|
dispose() {
|
|
100
|
-
if (this.ribbon
|
|
101
|
-
|
|
95
|
+
if (this.ribbon === null) {
|
|
96
|
+
// nothing to dispose
|
|
97
|
+
return;
|
|
102
98
|
}
|
|
99
|
+
|
|
100
|
+
this.ribbon.dispose();
|
|
101
|
+
this.ribbon = null;
|
|
103
102
|
}
|
|
104
103
|
|
|
105
104
|
get textureURL() {
|
|
@@ -217,6 +216,55 @@ class Trail2D {
|
|
|
217
216
|
;
|
|
218
217
|
}
|
|
219
218
|
|
|
219
|
+
/**
|
|
220
|
+
*
|
|
221
|
+
* @param {number} x
|
|
222
|
+
* @param {number} y
|
|
223
|
+
* @param {number} z
|
|
224
|
+
* @param {number} head_age
|
|
225
|
+
* @returns {boolean}
|
|
226
|
+
*/
|
|
227
|
+
updateHead(x, y, z, head_age) {
|
|
228
|
+
const ribbon = this.ribbon;
|
|
229
|
+
|
|
230
|
+
const maxAge = this.maxAge;
|
|
231
|
+
|
|
232
|
+
const refitTimeDelta = maxAge / ribbon.getCount();
|
|
233
|
+
|
|
234
|
+
let head_index = ribbon.getHeadIndex();
|
|
235
|
+
ribbon.getPointPosition(v3_array, head_index);
|
|
236
|
+
|
|
237
|
+
const head_position_changed = x !== v3_array[0]
|
|
238
|
+
|| y !== v3_array[1]
|
|
239
|
+
|| z !== v3_array[2];
|
|
240
|
+
|
|
241
|
+
if (this.timeSinceLastUpdate >= refitTimeDelta) {
|
|
242
|
+
|
|
243
|
+
if (
|
|
244
|
+
head_position_changed
|
|
245
|
+
) {
|
|
246
|
+
// make sure that this is a new position before rotating new segment
|
|
247
|
+
this.timeSinceLastUpdate = 0;
|
|
248
|
+
|
|
249
|
+
// rotating segment
|
|
250
|
+
ribbon.rotate();
|
|
251
|
+
|
|
252
|
+
head_index = ribbon.getHeadIndex();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (head_position_changed) {
|
|
257
|
+
ribbon.setPointPosition(head_index, x, y, z);
|
|
258
|
+
|
|
259
|
+
this.setFlag(Trail2DFlags.BoundsNeedUpdate);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// set head to fresh value
|
|
263
|
+
ribbon.setPointAttribute_Scalar(head_index, RIBBON_ATTRIBUTE_ADDRESS_AGE, head_age);
|
|
264
|
+
ribbon.setPointAlpha(head_index, clamp01(head_age / maxAge));
|
|
265
|
+
|
|
266
|
+
return head_position_changed;
|
|
267
|
+
}
|
|
220
268
|
|
|
221
269
|
}
|
|
222
270
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Trail2DFlags.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/trail2d/Trail2DFlags.js"],"names":[],"mappings":"2BAEU,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Trail2DSystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/trail2d/Trail2DSystem.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Trail2DSystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/trail2d/Trail2DSystem.js"],"names":[],"mappings":";AA8BA;IAkCI;;;OAGG;IACH,4BA4BC;IAjED,oDAAoC;IAEpC,+DAEE;IAEF;;;OAGG;IACH,WAFU,4BAA4B,CAES;IAE/C;;;;OAIG;IACH,wBAAiC;IAGjC;;;;OAIG;IACH,oBAAgB;IAEhB;;;OAGG;IACH,YAAgB;IAcZ;;;;OAIG;IACH,iBAAsB;IAEtB;;;OAGG;IACH,UAFU,cAAc,CAEO;IAE/B;;;OAGG;IACH,aAFU,cAAY,IAAI,CAEH;IAK3B,mFAgBC;IAED,2EAMC;IAED;;;;;OAKG;IACH,sBAoDC;IAED;;;;;OAKG;IACH,YAHW,OAAO,aADP,SAAS,YAET,MAAM,QAahB;IAED;;;;;OAKG;IACH,kBAJW,OAAO,aACP,SAAS,UACT,MAAM,QAShB;IAED;;;;OAIG;IACH,yBAHW,OAAO,aACP,SAAS,QAoCnB;IAED,6BAWC;CACJ;uBAnQsB,wBAAwB;0BACrB,qCAAqC;oBAY3C,cAAc;4CAdU,uDAAuD;6CAYtD,yDAAyD;+BARvE,yBAAyB"}
|
|
@@ -23,12 +23,11 @@ import { RibbonX } from "../../trail/x/RibbonX.js";
|
|
|
23
23
|
import { RibbonXPlugin } from "../../trail/x/RibbonXPlugin.js";
|
|
24
24
|
import { RibbonXFixedPhysicsSimulator } from "../../trail/x/simulator/RibbonXFixedPhysicsSimulator.js";
|
|
25
25
|
|
|
26
|
-
import Trail2D
|
|
26
|
+
import Trail2D from './Trail2D.js';
|
|
27
|
+
import { Trail2DFlags } from "./Trail2DFlags.js";
|
|
27
28
|
|
|
28
29
|
const v3Temp1 = new Vector3();
|
|
29
30
|
|
|
30
|
-
const v3_array = [];
|
|
31
|
-
|
|
32
31
|
class Trail2DSystem extends System {
|
|
33
32
|
dependencies = [Trail2D, Transform];
|
|
34
33
|
|
|
@@ -176,8 +175,8 @@ class Trail2DSystem extends System {
|
|
|
176
175
|
}
|
|
177
176
|
|
|
178
177
|
trail.bvh.resize(
|
|
179
|
-
position_x,position_y,position_z,
|
|
180
|
-
position_x,position_y,position_z
|
|
178
|
+
position_x, position_y, position_z,
|
|
179
|
+
position_x, position_y, position_z
|
|
181
180
|
);
|
|
182
181
|
|
|
183
182
|
trail.setFlag(Trail2DFlags.Built);
|
|
@@ -234,46 +233,28 @@ class Trail2DSystem extends System {
|
|
|
234
233
|
const newPosition = v3Temp1;
|
|
235
234
|
|
|
236
235
|
newPosition.copy(trail.offset);
|
|
237
|
-
newPosition.
|
|
238
|
-
newPosition.applyQuaternion(transform.rotation);
|
|
239
|
-
|
|
240
|
-
newPosition.add(transform.position);
|
|
236
|
+
newPosition.applyMatrix4(transform.matrix);
|
|
241
237
|
|
|
242
238
|
trail.timeSinceLastUpdate += timeDelta;
|
|
243
239
|
trail.time += timeDelta;
|
|
244
240
|
|
|
245
241
|
const ageOffset = max2(0, trail.maxAge - trail.time);
|
|
246
242
|
|
|
247
|
-
|
|
248
|
-
const refitTimeDelta = trail.maxAge / trail.ribbon.getCount();
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
if (trail.timeSinceLastUpdate >= refitTimeDelta) {
|
|
252
|
-
|
|
253
|
-
ribbon.getPointPosition(v3_array, ribbon.getHeadIndex());
|
|
254
|
-
|
|
255
|
-
if (newPosition.x !== v3_array[0] || newPosition.y !== v3_array[1] || newPosition.z !== v3_array[2]) {
|
|
256
|
-
//make sure that this is a new position before rotating new segment
|
|
257
|
-
trail.timeSinceLastUpdate = 0;
|
|
258
|
-
//rotating segment
|
|
259
|
-
|
|
260
|
-
ribbon.rotate();
|
|
261
|
-
}
|
|
262
|
-
}
|
|
243
|
+
this.simulator.update(ribbon, trail.maxAge, timeDelta);
|
|
263
244
|
|
|
264
|
-
|
|
245
|
+
if (trail.getFlag(Trail2DFlags.Spawning)) {
|
|
246
|
+
trail.updateHead(newPosition.x, newPosition.y, newPosition.z, ageOffset);
|
|
247
|
+
}
|
|
265
248
|
|
|
266
|
-
|
|
249
|
+
if (trail.getFlag(Trail2DFlags.BoundsNeedUpdate)) {
|
|
250
|
+
const bvh = trail.bvh;
|
|
267
251
|
|
|
268
|
-
|
|
269
|
-
|
|
252
|
+
ribbon.computeBoundingBox(bvh.bounds);
|
|
253
|
+
bvh.write_bounds();
|
|
270
254
|
|
|
255
|
+
trail.clearFlag(Trail2DFlags.BoundsNeedUpdate);
|
|
271
256
|
}
|
|
272
257
|
|
|
273
|
-
ribbon.computeBoundingBox(trail.bvh.bounds);
|
|
274
|
-
trail.bvh.write_bounds();
|
|
275
|
-
|
|
276
|
-
this.simulator.update(ribbon, trail.maxAge, timeDelta);
|
|
277
258
|
}
|
|
278
259
|
|
|
279
260
|
update(timeDelta) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeGradientTrail.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/trail2d/makeGradientTrail.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"makeGradientTrail.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/trail2d/makeGradientTrail.js"],"names":[],"mappings":"AAUA;;;;;;;;;;GAUG;AACH,kGATW,MAAM,EAAE,GAON,OAAO,CAiDnB;oBA7DmB,cAAc"}
|
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
RIBBON_ATTRIBUTE_ADDRESS_THICKNESS,
|
|
6
6
|
RIBBON_ATTRIBUTE_ADDRESS_UV_OFFSET
|
|
7
7
|
} from "../../trail/x/ribbon_attributes_spec.js";
|
|
8
|
-
import Trail2D
|
|
8
|
+
import Trail2D from "./Trail2D.js";
|
|
9
|
+
import { Trail2DFlags } from "./Trail2DFlags.js";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototypeTrail2D.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/trail2d/prototypeTrail2D.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { OrbitingBehavior } from "../../../../../../model/game/util/behavior/OrbitingBehavior.js";
|
|
2
|
+
import { AABB3 } from "../../../../core/geom/3d/aabb/AABB3.js";
|
|
3
|
+
import { make_justified_point_grid } from "../../../../core/geom/3d/util/make_justified_point_grid.js";
|
|
4
|
+
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
5
|
+
import { TextureAssetLoader } from "../../../asset/loaders/texture/TextureAssetLoader.js";
|
|
6
|
+
import Entity from "../../../ecs/Entity.js";
|
|
7
|
+
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
8
|
+
import { EngineHarness } from "../../../EngineHarness.js";
|
|
9
|
+
import { BehaviorComponent } from "../../../intelligence/behavior/ecs/BehaviorComponent.js";
|
|
10
|
+
import { BehaviorSystem } from "../../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
11
|
+
import Trail2D from "./Trail2D.js";
|
|
12
|
+
import Trail2DSystem from "./Trail2DSystem.js";
|
|
13
|
+
|
|
14
|
+
const harness = new EngineHarness();
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @param {Engine} engine
|
|
19
|
+
* @return {Promise<void>}
|
|
20
|
+
*/
|
|
21
|
+
async function main(engine) {
|
|
22
|
+
await EngineHarness.buildBasics({
|
|
23
|
+
engine,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const ecd = engine.entityManager.dataset;
|
|
27
|
+
|
|
28
|
+
const bounds = new AABB3(2, 1, 2, 18, 1, 18);
|
|
29
|
+
|
|
30
|
+
const grid_points = make_justified_point_grid(bounds, 0.2, (x, y, z) => {
|
|
31
|
+
|
|
32
|
+
const entity = new Entity();
|
|
33
|
+
|
|
34
|
+
entity.add(Trail2D.fromJSON({
|
|
35
|
+
textureURL: "data/textures/trail/rainbow.png",
|
|
36
|
+
width: 0.01
|
|
37
|
+
}));
|
|
38
|
+
entity.add(Transform.fromJSON({
|
|
39
|
+
position: { x, y, z }
|
|
40
|
+
}));
|
|
41
|
+
entity.add(BehaviorComponent.fromOne(OrbitingBehavior.from({
|
|
42
|
+
center: new Vector3(x,y,z),
|
|
43
|
+
radius: 0.1-0.02
|
|
44
|
+
})))
|
|
45
|
+
|
|
46
|
+
entity.build(ecd)
|
|
47
|
+
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
console.log("Grid Points:",grid_points);
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
harness.initialize({
|
|
55
|
+
configuration(config, engine) {
|
|
56
|
+
|
|
57
|
+
config.addLoader("texture", new TextureAssetLoader());
|
|
58
|
+
|
|
59
|
+
config.addManySystems(
|
|
60
|
+
new Trail2DSystem(engine),
|
|
61
|
+
new BehaviorSystem(engine)
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
}).then(main)
|
|
@@ -68,10 +68,10 @@ export class RibbonX {
|
|
|
68
68
|
initializeAttribute_Index(): void;
|
|
69
69
|
/**
|
|
70
70
|
*
|
|
71
|
-
* @param {number[]} result
|
|
71
|
+
* @param {number[]|Float32Array} result
|
|
72
72
|
* @param {number} index
|
|
73
73
|
*/
|
|
74
|
-
getPointPosition(result: number[], index: number): void;
|
|
74
|
+
getPointPosition(result: number[] | Float32Array, index: number): void;
|
|
75
75
|
/**
|
|
76
76
|
*
|
|
77
77
|
* @param {number} point_index
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RibbonX.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/trail/x/RibbonX.js"],"names":[],"mappings":"AAwBA;IAGQ;;;;OAIG;IACH,mBAAsC;IAEtC;;;;OAIG;IACH,eAAuD;IAEvD;;;;OAIG;IACH,qBAAqB;IAErB;;;;OAIG;IACH,qBAAqB;IAErB;;;;OAIG;IACH,0BAA0B;IAE1B;;;;OAIG;IACH,gBAAgB;IAGpB,gBAEC;IAED;;;OAGG;IACH,eAFa,cAAc,CAI1B;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED,uBAEC;IAED,uBAEC;IAED,sBA6CC;IAvCG,8BAAqD;IACrD,gCAA8D;IAE9D,2CAAoF;IAEpF,oDAA6F;IAC7F,gDAA0F;IAE1F,wCAAgF;IAChF,yCAAiF;IAEjF,qCAA8E;IAC9E,sCAA+E;IAC/E,wCAAiF;IACjF,4CAAsF;IAGtF,4BAAmE;IAwBvE,mCAWC;IAED;;OAEG;IACH,kCAqBC;IAED;;;;OAIG;IACH,yBAHW,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"RibbonX.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/trail/x/RibbonX.js"],"names":[],"mappings":"AAwBA;IAGQ;;;;OAIG;IACH,mBAAsC;IAEtC;;;;OAIG;IACH,eAAuD;IAEvD;;;;OAIG;IACH,qBAAqB;IAErB;;;;OAIG;IACH,qBAAqB;IAErB;;;;OAIG;IACH,0BAA0B;IAE1B;;;;OAIG;IACH,gBAAgB;IAGpB,gBAEC;IAED;;;OAGG;IACH,eAFa,cAAc,CAI1B;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED,uBAEC;IAED,uBAEC;IAED,sBA6CC;IAvCG,8BAAqD;IACrD,gCAA8D;IAE9D,2CAAoF;IAEpF,oDAA6F;IAC7F,gDAA0F;IAE1F,wCAAgF;IAChF,yCAAiF;IAEjF,qCAA8E;IAC9E,sCAA+E;IAC/E,wCAAiF;IACjF,4CAAsF;IAGtF,4BAAmE;IAwBvE,mCAWC;IAED;;OAEG;IACH,kCAqBC;IAED;;;;OAIG;IACH,yBAHW,MAAM,EAAE,GAAC,YAAY,SACrB,MAAM,QAYhB;IAED;;;;;;;OAOG;IACH,uCANW,MAAM,mBACN,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QAchB;IAED;;;;;OAKG;IACH,sCAJW,MAAM,mBACN,MAAM,SACN,MAAM,QAShB;IAED;;;;;;OAMG;IACH,4CALW,MAAM,mBACN,MAAM,SACN,MAAM,GACJ,MAAM,CAgBlB;IAED;;;;;;OAMG;IACH,+CALW,MAAM,0BACN,MAAM,2BACN,MAAM,yBACN,MAAM,QAYhB;IAED,2DA8DC;IAGD;;;;;;OAMG;IACH,qBALW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QAMhB;IAED;;;;OAIG;IACH,qBAHW,MAAM,SACN,MAAM,QAShB;IAED;;;;OAIG;IACH,yBAHW,MAAM,SACN,MAAM,QAShB;IAED;;;OAGG;IACH,gBAFW,MAAM,QAmDhB;IAED;;;OAGG;IACH,2BAFW,QAAM,UAAU,MAAM,CAAC,QA+CjC;IAGD;;OAEG;IACH,eAgFC;CACJ;+BA3jBM,OAAO;kCAAP,OAAO;2CAAP,OAAO;gCAAP,OAAO"}
|
|
@@ -184,7 +184,7 @@ export class RibbonX {
|
|
|
184
184
|
|
|
185
185
|
/**
|
|
186
186
|
*
|
|
187
|
-
* @param {number[]} result
|
|
187
|
+
* @param {number[]|Float32Array} result
|
|
188
188
|
* @param {number} index
|
|
189
189
|
*/
|
|
190
190
|
getPointPosition(result, index) {
|
|
@@ -459,18 +459,26 @@ export class RibbonX {
|
|
|
459
459
|
|
|
460
460
|
for (let i = 0; i < n; i += 2) {
|
|
461
461
|
const thickness = data.readCellValue(i, RIBBON_ATTRIBUTE_ADDRESS_THICKNESS);
|
|
462
|
-
const half_thickness = thickness
|
|
462
|
+
const half_thickness = thickness * 0.5;
|
|
463
463
|
|
|
464
464
|
const x = data.readCellValue(i, RIBBON_ATTRIBUTE_ADDRESS_POSITION);
|
|
465
465
|
const y = data.readCellValue(i, RIBBON_ATTRIBUTE_ADDRESS_POSITION + 1);
|
|
466
466
|
const z = data.readCellValue(i, RIBBON_ATTRIBUTE_ADDRESS_POSITION + 2);
|
|
467
467
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
468
|
+
const x0 = x - half_thickness;
|
|
469
|
+
const y0 = y - half_thickness;
|
|
470
|
+
const z0 = z - half_thickness;
|
|
471
|
+
|
|
472
|
+
const x1 = x + half_thickness;
|
|
473
|
+
const y1 = y + half_thickness;
|
|
474
|
+
const z1 = z + half_thickness;
|
|
475
|
+
|
|
476
|
+
_x0 = min2(_x0, x0);
|
|
477
|
+
_y0 = min2(_y0, y0);
|
|
478
|
+
_z0 = min2(_z0, z0);
|
|
479
|
+
_x1 = max2(_x1, x1);
|
|
480
|
+
_y1 = max2(_y1, y1);
|
|
481
|
+
_z1 = max2(_z1, z1);
|
|
474
482
|
|
|
475
483
|
}
|
|
476
484
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RibbonXFixedPhysicsSimulator.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/trail/x/simulator/RibbonXFixedPhysicsSimulator.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RibbonXFixedPhysicsSimulator.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/trail/x/simulator/RibbonXFixedPhysicsSimulator.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IAKI;;;;;OAKG;IACH,iCAHW,MAAM,aACN,MAAM,QAkBhB;CACJ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { RIBBON_ATTRIBUTE_ADDRESS_AGE, RIBBON_ATTRIBUTE_ADDRESS_UV_OFFSET } from "../ribbon_attributes_spec.js";
|
|
2
1
|
import { clamp01 } from "../../../../../core/math/clamp01.js";
|
|
2
|
+
import { RIBBON_ATTRIBUTE_ADDRESS_AGE, RIBBON_ATTRIBUTE_ADDRESS_UV_OFFSET } from "../ribbon_attributes_spec.js";
|
|
3
|
+
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Fixed function simulation engine for ribbons
|