@woosh/meep-engine 2.92.11 → 2.92.13
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-terrain.js +1 -1
- package/build/meep.cjs +33 -9
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +33 -9
- package/editor/tools/v2/prototypeTransformControls.js +13 -11
- package/package.json +1 -1
- package/src/core/bvh2/binary/2/BinaryUint32BVH.d.ts.map +1 -1
- package/src/core/bvh2/binary/2/BinaryUint32BVH.js +13 -1
- package/src/core/geom/3d/aabb/aabb3_array_combine.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_array_combine.js +34 -6
- package/src/core/geom/3d/aabb/aabb3_array_set.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_array_set.js +5 -1
- package/src/engine/animation/curve/EntityNodeAnimationClip.d.ts.map +1 -1
- package/src/engine/animation/curve/EntityNodeAnimationClip.js +9 -2
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationControllerSystem.d.ts +3 -0
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationControllerSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationControllerSystem.js +22 -3
- package/src/engine/graphics/geometry/bvh/buffered/bvh32_from_unindexed_geometry.js +1 -1
- package/src/engine/graphics/geometry/bvh/buffered/bvh32_from_unindexed_geometry.spec.js +9 -3
package/build/meep.module.js
CHANGED
|
@@ -47050,7 +47050,7 @@ function aabb3_array_set(
|
|
|
47050
47050
|
x1, y1, z1
|
|
47051
47051
|
) {
|
|
47052
47052
|
|
|
47053
|
-
result[result_offset
|
|
47053
|
+
result[result_offset] = x0;
|
|
47054
47054
|
result[result_offset + 1] = y0;
|
|
47055
47055
|
result[result_offset + 2] = z0;
|
|
47056
47056
|
|
|
@@ -54958,13 +54958,35 @@ function aabb3_array_combine(
|
|
|
54958
54958
|
b, b_offset
|
|
54959
54959
|
) {
|
|
54960
54960
|
|
|
54961
|
-
|
|
54962
|
-
|
|
54963
|
-
|
|
54961
|
+
const ax0 = a[a_offset + 0];
|
|
54962
|
+
const ay0 = a[a_offset + 1];
|
|
54963
|
+
const az0 = a[a_offset + 2];
|
|
54964
|
+
const ax1 = a[a_offset + 3];
|
|
54965
|
+
const ay1 = a[a_offset + 4];
|
|
54966
|
+
const az1 = a[a_offset + 5];
|
|
54967
|
+
|
|
54968
|
+
const bx0 = b[b_offset + 0];
|
|
54969
|
+
const by0 = b[b_offset + 1];
|
|
54970
|
+
const bz0 = b[b_offset + 2];
|
|
54971
|
+
const bx1 = b[b_offset + 3];
|
|
54972
|
+
const by1 = b[b_offset + 4];
|
|
54973
|
+
const bz1 = b[b_offset + 5];
|
|
54974
|
+
|
|
54975
|
+
const x0 = min2(ax0, bx0);
|
|
54976
|
+
const y0 = min2(ay0, by0);
|
|
54977
|
+
const z0 = min2(az0, bz0);
|
|
54978
|
+
|
|
54979
|
+
const x1 = max2(ax1, bx1);
|
|
54980
|
+
const y1 = max2(ay1, by1);
|
|
54981
|
+
const z1 = max2(az1, bz1);
|
|
54964
54982
|
|
|
54965
|
-
result[result_offset +
|
|
54966
|
-
result[result_offset +
|
|
54967
|
-
result[result_offset +
|
|
54983
|
+
result[result_offset + 0] = x0;
|
|
54984
|
+
result[result_offset + 1] = y0;
|
|
54985
|
+
result[result_offset + 2] = z0;
|
|
54986
|
+
|
|
54987
|
+
result[result_offset + 3] = x1;
|
|
54988
|
+
result[result_offset + 4] = y1;
|
|
54989
|
+
result[result_offset + 5] = z1;
|
|
54968
54990
|
|
|
54969
54991
|
}
|
|
54970
54992
|
|
|
@@ -55292,7 +55314,9 @@ class BinaryUint32BVH {
|
|
|
55292
55314
|
x1, y1, z1
|
|
55293
55315
|
) {
|
|
55294
55316
|
|
|
55295
|
-
const
|
|
55317
|
+
const leaf_block_address = this.__node_count_binary * BVH_BINARY_NODE_SIZE;
|
|
55318
|
+
|
|
55319
|
+
const address = index * BVH_LEAF_NODE_SIZE + leaf_block_address;
|
|
55296
55320
|
|
|
55297
55321
|
aabb3_array_set(
|
|
55298
55322
|
this.__data_float32,
|
|
@@ -65745,7 +65769,7 @@ function bvh32_from_indexed_geometry(bvh, vertices, indices) {
|
|
|
65745
65769
|
*/
|
|
65746
65770
|
function bvh32_from_unindexed_geometry(bvh, vertices) {
|
|
65747
65771
|
|
|
65748
|
-
const triangle_count = vertices.length /
|
|
65772
|
+
const triangle_count = vertices.length / 9;
|
|
65749
65773
|
|
|
65750
65774
|
bvh.setLeafCount(triangle_count);
|
|
65751
65775
|
bvh.initialize_structure();
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { EngineHarness } from "../../../src/engine/EngineHarness.js";
|
|
2
|
-
import Entity from "../../../src/engine/ecs/Entity.js";
|
|
3
|
-
import { ShadedGeometry } from "../../../src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js";
|
|
4
1
|
import { BoxBufferGeometry, MeshStandardMaterial } from "three";
|
|
2
|
+
import { GLTFAssetLoader } from "../../../src/engine/asset/loaders/GLTFAssetLoader.js";
|
|
3
|
+
import { TextureAssetLoader } from "../../../src/engine/asset/loaders/texture/TextureAssetLoader.js";
|
|
4
|
+
import Entity from "../../../src/engine/ecs/Entity.js";
|
|
5
|
+
import { TransformAttachmentSystem } from "../../../src/engine/ecs/transform-attachment/TransformAttachmentSystem.js";
|
|
5
6
|
import { Transform } from "../../../src/engine/ecs/transform/Transform.js";
|
|
6
|
-
import {
|
|
7
|
-
import { TransformControls } from "./TransformControls.js";
|
|
7
|
+
import { EngineHarness } from "../../../src/engine/EngineHarness.js";
|
|
8
8
|
import { Camera } from "../../../src/engine/graphics/ecs/camera/Camera.js";
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import InputControllerSystem from "../../../src/engine/input/ecs/systems/InputControllerSystem.js";
|
|
12
|
-
import { GLTFAssetLoader } from "../../../src/engine/asset/loaders/GLTFAssetLoader.js";
|
|
9
|
+
import { ShadedGeometry } from "../../../src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js";
|
|
10
|
+
import { ShadedGeometrySystem } from "../../../src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js";
|
|
13
11
|
import {
|
|
14
12
|
three_object_to_entity_composition
|
|
15
13
|
} from "../../../src/engine/graphics/ecs/mesh-v2/three_object_to_entity_composition.js";
|
|
14
|
+
import InputController from "../../../src/engine/input/ecs/components/InputController.js";
|
|
15
|
+
import InputControllerSystem from "../../../src/engine/input/ecs/systems/InputControllerSystem.js";
|
|
16
|
+
import { TransformControls } from "./TransformControls.js";
|
|
16
17
|
|
|
17
18
|
const harness = new EngineHarness();
|
|
18
19
|
|
|
@@ -57,8 +58,8 @@ async function main(engine) {
|
|
|
57
58
|
entityNode.transform.scale.multiplyScalar(0.1);
|
|
58
59
|
|
|
59
60
|
controls.build(ecd); // add controls to the scene
|
|
60
|
-
|
|
61
|
-
controls.attach(entityNode.entity.id); // make controls target the cube
|
|
61
|
+
controls.attach(cube_entity); // make controls target the cube
|
|
62
|
+
// controls.attach(entityNode.entity.id); // make controls target the cube
|
|
62
63
|
|
|
63
64
|
new Entity()
|
|
64
65
|
.add(new InputController([{
|
|
@@ -88,5 +89,6 @@ harness.initialize({
|
|
|
88
89
|
config.addSystem(new InputControllerSystem(engine.devices));
|
|
89
90
|
|
|
90
91
|
config.addLoader('gltf', new GLTFAssetLoader());
|
|
92
|
+
config.addLoader('texture', new TextureAssetLoader())
|
|
91
93
|
}
|
|
92
94
|
}).then(main);
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BinaryUint32BVH.d.ts","sourceRoot":"","sources":["../../../../../../src/core/bvh2/binary/2/BinaryUint32BVH.js"],"names":[],"mappings":"AAcA;;;GAGG;AACH,gCAFU,MAAM,CAEmB;AAEnC;;;;GAIG;AACH,mCAFU,MAAM,CAEsB;AACtC;;;GAGG;AACH,iCAFU,MAAM,CAEoB;AAiDpC;IACI;;;;OAIG;IACH,sBAAc;IAEd;;;;OAIG;IACH,gCAAe;IAEf;;;;OAIG;IACH,+BAAc;IAEd;;;;OAIG;IACH,4BAAwB;IAExB;;;;OAIG;IACH,0BAAsB;IA0CtB;;;OAGG;IACH,2BAOC;IAED,wBAEC;IAnDD;;;OAGG;IACH,oBAFa,MAAM,CAIlB;IAED,2BAEC;IAED,gCAEC;IAED,8BAEC;IAED;;;OAGG;IACH,uBAFa,MAAM,CAIlB;IAED,4BAEC;IAED,0BAEC;IAmBD;;;;OAIG;IACH,2BAHW,MAAM,GACJ,MAAM,CAalB;IAED,6BASC;IAED;;;OAGG;IACH,oBAFW,MAAM,QAgBhB;IAED;;;;;;;;;;OAUG;IACH,mBATW,MAAM,WACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,
|
|
1
|
+
{"version":3,"file":"BinaryUint32BVH.d.ts","sourceRoot":"","sources":["../../../../../../src/core/bvh2/binary/2/BinaryUint32BVH.js"],"names":[],"mappings":"AAcA;;;GAGG;AACH,gCAFU,MAAM,CAEmB;AAEnC;;;;GAIG;AACH,mCAFU,MAAM,CAEsB;AACtC;;;GAGG;AACH,iCAFU,MAAM,CAEoB;AAiDpC;IACI;;;;OAIG;IACH,sBAAc;IAEd;;;;OAIG;IACH,gCAAe;IAEf;;;;OAIG;IACH,+BAAc;IAEd;;;;OAIG;IACH,4BAAwB;IAExB;;;;OAIG;IACH,0BAAsB;IA0CtB;;;OAGG;IACH,2BAOC;IAED,wBAEC;IAnDD;;;OAGG;IACH,oBAFa,MAAM,CAIlB;IAED,2BAEC;IAED,gCAEC;IAED,8BAEC;IAED;;;OAGG;IACH,uBAFa,MAAM,CAIlB;IAED,4BAEC;IAED,0BAEC;IAmBD;;;;OAIG;IACH,2BAHW,MAAM,GACJ,MAAM,CAalB;IAED,6BASC;IAED;;;OAGG;IACH,oBAFW,MAAM,QAgBhB;IAED;;;;;;;;;;OAUG;IACH,mBATW,MAAM,WACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAsChB;IAED;;;;;OAKG;IACH,oBAJW,MAAM,eACN,MAAM,EAAE,GAAC,YAAY,sBACrB,MAAM,QAIhB;IAED;;;;OAIG;IACH,4BAHW,MAAM,GACJ,MAAM,CAQlB;IAED,qCAoBC;IAED;;;;;;;OAOG;IACH,yCAYC;IAED;;;;;;OAMG;IACH,kDAuBC;IAED,wBAUC;IAGD;;;OAGG;IACH,oBAFW,MAAM,EAAE,QAkElB;IAED;;;;;OAKG;IACH,sBAUC;IAED;;OAEG;IACH,cAsEC;CACJ"}
|
|
@@ -235,6 +235,16 @@ export class BinaryUint32BVH {
|
|
|
235
235
|
x0, y0, z0,
|
|
236
236
|
x1, y1, z1
|
|
237
237
|
) {
|
|
238
|
+
assert.isNonNegativeInteger(index, 'index');
|
|
239
|
+
assert.lessThan(index, this.__node_count_leaf, 'leaf index overflow');
|
|
240
|
+
|
|
241
|
+
assert.isNumber(x0, 'x0');
|
|
242
|
+
assert.isNumber(y0, 'y0');
|
|
243
|
+
assert.isNumber(z0, 'z0');
|
|
244
|
+
assert.isNumber(x1, 'x1');
|
|
245
|
+
assert.isNumber(y1, 'y1');
|
|
246
|
+
assert.isNumber(z1, 'z1');
|
|
247
|
+
|
|
238
248
|
assert.notNaN(x0, 'x0');
|
|
239
249
|
assert.notNaN(y0, 'y0');
|
|
240
250
|
assert.notNaN(z0, 'z0');
|
|
@@ -244,7 +254,9 @@ export class BinaryUint32BVH {
|
|
|
244
254
|
|
|
245
255
|
assert.isNonNegativeInteger(payload, 'payload');
|
|
246
256
|
|
|
247
|
-
const
|
|
257
|
+
const leaf_block_address = this.__node_count_binary * BVH_BINARY_NODE_SIZE;
|
|
258
|
+
|
|
259
|
+
const address = index * BVH_LEAF_NODE_SIZE + leaf_block_address;
|
|
248
260
|
|
|
249
261
|
aabb3_array_set(
|
|
250
262
|
this.__data_float32,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aabb3_array_combine.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_array_combine.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"aabb3_array_combine.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_array_combine.js"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,4CAPW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,iBACvC,MAAM,KACN,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,YACvC,MAAM,KACN,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,YACvC,MAAM,QA2ChB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
//
|
|
2
2
|
|
|
3
|
+
import { assert } from "../../../assert.js";
|
|
3
4
|
import { max2 } from "../../../math/max2.js";
|
|
4
5
|
import { min2 } from "../../../math/min2.js";
|
|
5
6
|
|
|
@@ -17,13 +18,40 @@ export function aabb3_array_combine(
|
|
|
17
18
|
a, a_offset,
|
|
18
19
|
b, b_offset
|
|
19
20
|
) {
|
|
21
|
+
assert.isNonNegativeInteger(a_offset, 'a_offset');
|
|
22
|
+
assert.lessThan(a_offset, a.length - 6, 'a_offset array overflow');
|
|
20
23
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
result[result_offset + 2] = min2(a[a_offset + 2], b[b_offset + 2]);
|
|
24
|
+
assert.isNonNegativeInteger(b_offset, 'b_offset');
|
|
25
|
+
assert.lessThan(b_offset, b.length - 6, 'b_offset array overflow');
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
const ax0 = a[a_offset + 0];
|
|
28
|
+
const ay0 = a[a_offset + 1];
|
|
29
|
+
const az0 = a[a_offset + 2];
|
|
30
|
+
const ax1 = a[a_offset + 3];
|
|
31
|
+
const ay1 = a[a_offset + 4];
|
|
32
|
+
const az1 = a[a_offset + 5];
|
|
33
|
+
|
|
34
|
+
const bx0 = b[b_offset + 0];
|
|
35
|
+
const by0 = b[b_offset + 1];
|
|
36
|
+
const bz0 = b[b_offset + 2];
|
|
37
|
+
const bx1 = b[b_offset + 3];
|
|
38
|
+
const by1 = b[b_offset + 4];
|
|
39
|
+
const bz1 = b[b_offset + 5];
|
|
40
|
+
|
|
41
|
+
const x0 = min2(ax0, bx0);
|
|
42
|
+
const y0 = min2(ay0, by0);
|
|
43
|
+
const z0 = min2(az0, bz0);
|
|
44
|
+
|
|
45
|
+
const x1 = max2(ax1, bx1);
|
|
46
|
+
const y1 = max2(ay1, by1);
|
|
47
|
+
const z1 = max2(az1, bz1);
|
|
48
|
+
|
|
49
|
+
result[result_offset + 0] = x0;
|
|
50
|
+
result[result_offset + 1] = y0;
|
|
51
|
+
result[result_offset + 2] = z0;
|
|
52
|
+
|
|
53
|
+
result[result_offset + 3] = x1;
|
|
54
|
+
result[result_offset + 4] = y1;
|
|
55
|
+
result[result_offset + 5] = z1;
|
|
28
56
|
|
|
29
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aabb3_array_set.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_array_set.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"aabb3_array_set.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/aabb/aabb3_array_set.js"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wCATW,UAAU,MAAM,CAAC,GAAC,YAAY,GAAC,MAAM,EAAE,iBACvC,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QAiBhB"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { assert } from "../../../assert.js";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
*
|
|
3
5
|
* @param {ArrayLike<number>|Float32Array|number[]} result
|
|
@@ -15,7 +17,9 @@ export function aabb3_array_set(
|
|
|
15
17
|
x1, y1, z1
|
|
16
18
|
) {
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
assert.lessThanOrEqual(result_offset, result.length - 6, 'result_offset overflow')
|
|
21
|
+
|
|
22
|
+
result[result_offset] = x0;
|
|
19
23
|
result[result_offset + 1] = y0;
|
|
20
24
|
result[result_offset + 2] = z0;
|
|
21
25
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityNodeAnimationClip.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/EntityNodeAnimationClip.js"],"names":[],"mappings":"AAAA;IACI,aAAS;IACT;;;OAGG;IACH,QAFU,sBAAsB,CAErB;IACX,iBAAY;IAEZ,
|
|
1
|
+
{"version":3,"file":"EntityNodeAnimationClip.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/EntityNodeAnimationClip.js"],"names":[],"mappings":"AAAA;IACI,aAAS;IACT;;;OAGG;IACH,QAFU,sBAAsB,CAErB;IACX,iBAAY;IAEZ;;;OAGG;IACH,cAFW,MAAM,QAWhB;CACJ"}
|
|
@@ -7,9 +7,16 @@ export class EntityNodeAnimationClip {
|
|
|
7
7
|
tracks = []
|
|
8
8
|
duration = 0
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {number} time time in seconds
|
|
13
|
+
*/
|
|
10
14
|
writeAt(time) {
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
const tracks = this.tracks;
|
|
16
|
+
const track_count = tracks.length;
|
|
17
|
+
|
|
18
|
+
for (let i = 0; i < track_count; i++) {
|
|
19
|
+
const track = tracks[i];
|
|
13
20
|
|
|
14
21
|
track.writeAt(time);
|
|
15
22
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import Signal from "../../../../../core/events/signal/Signal";
|
|
1
2
|
import {System} from "../../../../ecs/System";
|
|
2
3
|
import Engine from "../../../../Engine";
|
|
3
4
|
import {SGMesh} from "./SGMesh";
|
|
4
5
|
import {SGMeshAnimationController} from "./SGMeshAnimationController";
|
|
5
6
|
|
|
6
7
|
export class SGMeshAnimationControllerSystem extends System<SGMeshAnimationController,SGMesh>{
|
|
8
|
+
readonly onWorkDone: Signal<void>
|
|
9
|
+
|
|
7
10
|
constructor(engine:Engine)
|
|
8
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SGMeshAnimationControllerSystem.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationControllerSystem.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SGMeshAnimationControllerSystem.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationControllerSystem.js"],"names":[],"mappings":"AASA;IA0BI;;;OAGG;IACH,4BAeC;IAhCD;;;;OAIG;IACH,qBAFU,MAAM,CAES;IAerB,eAAoB;IAEpB,mEAGC;IAED,gIAGC;IAyCL;;;;;OAKG;IACH,WAJW,yBAAyB,QACzB,MAAM,UACN,MAAM,iBAUhB;IA+CD,sBAyBC;;CACJ;uBAhLsB,2BAA2B;mBAJ/B,6CAA6C;uBAMzC,aAAa;0CACM,gCAAgC;4CAL9B,0DAA0D"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Signal from "../../../../../core/events/signal/Signal.js";
|
|
1
2
|
import { ResourceAccessKind } from "../../../../../core/model/ResourceAccessKind.js";
|
|
2
3
|
import { ResourceAccessSpecification } from "../../../../../core/model/ResourceAccessSpecification.js";
|
|
3
4
|
import { convert_three_clip } from "../../../../animation/curve/ecd_bind_animation_curve.js";
|
|
@@ -19,6 +20,19 @@ export class SGMeshAnimationControllerSystem extends System {
|
|
|
19
20
|
*/
|
|
20
21
|
#queue = [];
|
|
21
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Fires when one or more animation clips are currently playing and are updated
|
|
25
|
+
* @readonly
|
|
26
|
+
* @type {Signal}
|
|
27
|
+
*/
|
|
28
|
+
onWorkDone = new Signal()
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* How many clips were updated during last tick
|
|
32
|
+
* @type {number}
|
|
33
|
+
*/
|
|
34
|
+
#cycle_clip_advance_count = 0;
|
|
35
|
+
|
|
22
36
|
/**
|
|
23
37
|
*
|
|
24
38
|
* @param {Engine} engine
|
|
@@ -67,8 +81,6 @@ export class SGMeshAnimationControllerSystem extends System {
|
|
|
67
81
|
const controller = ecd.getComponent(entity, SGMeshAnimationController);
|
|
68
82
|
|
|
69
83
|
controller.bound = animations;
|
|
70
|
-
|
|
71
|
-
console.log(asset, animations);
|
|
72
84
|
}
|
|
73
85
|
|
|
74
86
|
/**
|
|
@@ -125,7 +137,7 @@ export class SGMeshAnimationControllerSystem extends System {
|
|
|
125
137
|
} else {
|
|
126
138
|
t = clip.duration;
|
|
127
139
|
|
|
128
|
-
// remove active
|
|
140
|
+
// playback finished, remove active
|
|
129
141
|
active.splice(i, 1);
|
|
130
142
|
|
|
131
143
|
i--;
|
|
@@ -135,10 +147,13 @@ export class SGMeshAnimationControllerSystem extends System {
|
|
|
135
147
|
|
|
136
148
|
clip.writeAt(t);
|
|
137
149
|
|
|
150
|
+
// mark clip update
|
|
151
|
+
this.#cycle_clip_advance_count++;
|
|
138
152
|
}
|
|
139
153
|
}
|
|
140
154
|
|
|
141
155
|
update(td) {
|
|
156
|
+
this.#cycle_clip_advance_count = 0;
|
|
142
157
|
this.#time_delta = td;
|
|
143
158
|
|
|
144
159
|
for (let i = 0; i < 1000; i++) {
|
|
@@ -158,5 +173,9 @@ export class SGMeshAnimationControllerSystem extends System {
|
|
|
158
173
|
}
|
|
159
174
|
|
|
160
175
|
ecd.traverseComponents(SGMeshAnimationController, this.#visit_entity, this);
|
|
176
|
+
|
|
177
|
+
if (this.#cycle_clip_advance_count > 0) {
|
|
178
|
+
this.onWorkDone.send0();
|
|
179
|
+
}
|
|
161
180
|
}
|
|
162
181
|
}
|
|
@@ -7,7 +7,7 @@ import { bvh32_set_leaf_from_triangle } from "./bvh32_set_leaf_from_triangle.js"
|
|
|
7
7
|
*/
|
|
8
8
|
export function bvh32_from_unindexed_geometry(bvh, vertices) {
|
|
9
9
|
|
|
10
|
-
const triangle_count = vertices.length /
|
|
10
|
+
const triangle_count = vertices.length / 9;
|
|
11
11
|
|
|
12
12
|
bvh.setLeafCount(triangle_count);
|
|
13
13
|
bvh.initialize_structure();
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { BinaryUint32BVH } from "../../../../../core/bvh2/binary/2/BinaryUint32BVH.js";
|
|
2
2
|
import { bvh32_from_unindexed_geometry } from "./bvh32_from_unindexed_geometry.js";
|
|
3
3
|
|
|
4
|
-
test("1 triangle geometry", () => {
|
|
4
|
+
test("1 point triangle geometry", () => {
|
|
5
5
|
const bvh = new BinaryUint32BVH();
|
|
6
6
|
|
|
7
|
-
bvh32_from_unindexed_geometry(bvh, new Float32Array([
|
|
7
|
+
bvh32_from_unindexed_geometry(bvh, new Float32Array([
|
|
8
|
+
1, 2, 3,
|
|
9
|
+
1, 2, 3,
|
|
10
|
+
1, 2, 3
|
|
11
|
+
]));
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
expect(bvh.leaf_node_count).toEqual(1);
|
|
14
|
+
|
|
15
|
+
const address = bvh.getLeafBlockAddress();
|
|
10
16
|
|
|
11
17
|
const bounds = [];
|
|
12
18
|
|