@woosh/meep-engine 2.85.9 → 2.85.11

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.
Files changed (48) hide show
  1. package/package.json +1 -1
  2. package/src/core/geom/Quaternion.d.ts.map +1 -1
  3. package/src/core/geom/Quaternion.js +3 -0
  4. package/src/core/geom/Vector3.d.ts.map +1 -1
  5. package/src/core/geom/Vector3.js +9 -4
  6. package/src/engine/EngineHarness.d.ts +3 -1
  7. package/src/engine/EngineHarness.d.ts.map +1 -1
  8. package/src/engine/EngineHarness.js +5 -3
  9. package/src/engine/animation/curve/Keyframe.d.ts.map +1 -1
  10. package/src/engine/animation/curve/Keyframe.js +14 -0
  11. package/src/engine/animation/curve/ecd_bind_animation_curve.d.ts +14 -4
  12. package/src/engine/animation/curve/ecd_bind_animation_curve.d.ts.map +1 -1
  13. package/src/engine/animation/curve/ecd_bind_animation_curve.js +309 -2
  14. package/src/engine/animation/curve/prototypeGLTF.d.ts +2 -0
  15. package/src/engine/animation/curve/prototypeGLTF.d.ts.map +1 -0
  16. package/src/engine/animation/curve/prototypeGLTF.js +81 -0
  17. package/src/engine/asset/Asset.d.ts.map +1 -1
  18. package/src/engine/asset/Asset.js +16 -0
  19. package/src/engine/asset/STATIC_ASSET_CACHE.d.ts +7 -0
  20. package/src/engine/asset/STATIC_ASSET_CACHE.d.ts.map +1 -0
  21. package/src/engine/asset/STATIC_ASSET_CACHE.js +19 -0
  22. package/src/engine/ecs/EntityManager.d.ts.map +1 -1
  23. package/src/engine/ecs/EntityManager.js +7 -2
  24. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMesh.d.ts.map +1 -1
  25. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMesh.js +13 -4
  26. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationController.d.ts +19 -0
  27. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationController.d.ts.map +1 -0
  28. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationController.js +23 -0
  29. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationControllerSystem.d.ts +24 -0
  30. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationControllerSystem.d.ts.map +1 -0
  31. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationControllerSystem.js +132 -0
  32. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshSystem.d.ts.map +1 -1
  33. package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshSystem.js +34 -24
  34. package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/AnimatedValueBinding.d.ts +27 -0
  35. package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/AnimatedValueBinding.d.ts.map +1 -0
  36. package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/AnimatedValueBinding.js +61 -0
  37. package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundQuaternionWriter.d.ts +7 -0
  38. package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundQuaternionWriter.d.ts.map +1 -0
  39. package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundQuaternionWriter.js +20 -0
  40. package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundValueWriter.d.ts +8 -0
  41. package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundValueWriter.d.ts.map +1 -0
  42. package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundValueWriter.js +10 -0
  43. package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundVector3Writer.d.ts +7 -0
  44. package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundVector3Writer.d.ts.map +1 -0
  45. package/src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundVector3Writer.js +19 -0
  46. package/src/engine/graphics/texture/sampler/Sampler2D.d.ts +4 -0
  47. package/src/generation/filtering/numeric/CellFilterCache.d.ts +0 -1
  48. package/src/generation/filtering/numeric/CellFilterCache.d.ts.map +1 -1
@@ -0,0 +1,19 @@
1
+ import { Cache } from "../../core/cache/Cache.js";
2
+ import { invokeObjectEquals } from "../../core/model/object/invokeObjectEquals.js";
3
+ import { invokeObjectHash } from "../../core/model/object/invokeObjectHash.js";
4
+
5
+ /**
6
+ * Asset instance objects for read-only usage, so we can just keep 1 copy instead of calling {@link Asset#create} every time
7
+ * @type {Cache<Asset, any>}
8
+ */
9
+ export const STATIC_ASSET_CACHE = new Cache({
10
+ maxWeight: 128 * 1024 * 1024, //128 Mb,
11
+ keyEqualityFunction: invokeObjectEquals,
12
+ keyHashFunction: invokeObjectHash,
13
+ keyWeigher(asset) {
14
+ return asset.byteSize + 64;
15
+ },
16
+ valueWeigher(v) {
17
+ return 1;
18
+ }
19
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"EntityManager.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityManager.js"],"names":[],"mappings":";;;wBAkBU,MAAM;;;;;;iCAWN,MAAM;;;;;;;;;AAWhB;IAEI;;;OAGG;IACH,kBAFU,iCAAQ,CAEL;IAEb;;;OAGG;IACH,gCAFU,iCAAQ,CAES;IAE3B;;;OAGG;IACH,0BAFU,cAAc,EAAE,CAEL;IAErB;;OAEG;IACH;;;QAGI;;WAEG;qBADO,uCAAc;;MAI1B;IAEF;;;OAGG;IACH,OAFU,kBAAkB,CAEO;IAEnC;;;;OAIG;IACH,gDAA2C;IAE3C;;;;OAIG;IACH,qBAFU,MAAM,CAEY;IAE5B;;;OAGG;IACH,gCAAe;IAEf;;;;OAIG;IACH,uCAAsC;IAEtC;;;OAGG;IACH,6BA8EC;IAED,sBAcC;IAED;;;OAGG;IACH,uBAFa,OAAO,CAuBnB;IAED;;;;;OAKG;IACH,qDAsBC;IAED;;;;OAIG;IACH,qCAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,6CAcC;IAED;;;;;OAKG;IACH,wCAHW,MAAM,GACJ,IAAI,aAAS,CAezB;IAED;;;OAGG;IACH,oBAFW,MAAM,QA6DhB;IAED;;;;;OAKG;IACH,iEAmEC;IAED;;;;OAIG;IACH,uDAFa,QAAQ,OAAO,CAAC,CA2C5B;IAED;;;;;OAKG;IACH,mBA6BC;IAED;;;;;OAKG;IACH,oBAwCC;IAED;;;;OAIG;IACH,gEAwEC;IAED;;;;OAIG;IACH,mCAFa,wCAAgB,CA0B5B;IAED;;;;;OAKG;IACH,8DAFa,wCAAgB,CAsB5B;IAED;;;;OAIG;IACH,iEAkEC;CACJ;uBAjxBsD,aAAa;+BADrC,qBAAqB;mBALjC,oCAAoC"}
1
+ {"version":3,"file":"EntityManager.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/EntityManager.js"],"names":[],"mappings":";;;wBAkBU,MAAM;;;;;;iCAWN,MAAM;;;;;;;;;AAWhB;IAEI;;;OAGG;IACH,kBAFU,iCAAQ,CAEL;IAEb;;;OAGG;IACH,gCAFU,iCAAQ,CAES;IAE3B;;;OAGG;IACH,0BAFU,cAAc,EAAE,CAEL;IAErB;;OAEG;IACH;;;QAGI;;WAEG;qBADO,uCAAc;;MAI1B;IAEF;;;OAGG;IACH,OAFU,kBAAkB,CAEO;IAEnC;;;;OAIG;IACH,gDAA2C;IAE3C;;;;OAIG;IACH,qBAFU,MAAM,CAEY;IAE5B;;;OAGG;IACH,gCAAe;IAEf;;;;OAIG;IACH,uCAAsC;IAEtC;;;OAGG;IACH,6BA8EC;IAED,sBAcC;IAED;;;OAGG;IACH,uBAFa,OAAO,CAuBnB;IAED;;;;;OAKG;IACH,qDAsBC;IAED;;;;OAIG;IACH,qCAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,6CAcC;IAED;;;;;OAKG;IACH,wCAHW,MAAM,GACJ,IAAI,aAAS,CAezB;IAED;;;OAGG;IACH,oBAFW,MAAM,QA6DhB;IAED;;;;;OAKG;IACH,iEA0EC;IAED;;;;OAIG;IACH,uDAFa,QAAQ,OAAO,CAAC,CAyC5B;IAED;;;;;OAKG;IACH,mBA6BC;IAED;;;;;OAKG;IACH,oBAwCC;IAED;;;;OAIG;IACH,gEAwEC;IAED;;;;OAIG;IACH,mCAFa,wCAAgB,CA0B5B;IAED;;;;;OAKG;IACH,8DAFa,wCAAgB,CAsB5B;IAED;;;;OAIG;IACH,iEAkEC;CACJ;uBAtxBsD,aAAa;+BADrC,qBAAqB;mBALjC,oCAAoC"}
@@ -437,6 +437,13 @@ export class EntityManager {
437
437
  startup_promise = Promise.resolve();
438
438
  }
439
439
 
440
+ // Link EntityManager
441
+ if(system.entityManager === null){
442
+ system.entityManager = this;
443
+ }else if(system.entityManager !== this){
444
+ throw new Error(`System is bound to another EntityManager`);
445
+ }
446
+
440
447
  if (this.dataset !== null) {
441
448
 
442
449
  // link dependency components
@@ -461,7 +468,6 @@ export class EntityManager {
461
468
  assert.defined(system, "system");
462
469
  assert.isInstanceOf(system, System, 'system', 'System');
463
470
 
464
-
465
471
  const systemIndex = this.systems.indexOf(system);
466
472
 
467
473
  if (systemIndex === -1) {
@@ -475,7 +481,6 @@ export class EntityManager {
475
481
 
476
482
  assert.notEqual(systemObserver, undefined, "System observer is undefined, it was possibly removed illegally or was not created");
477
483
 
478
-
479
484
  //shutdown system
480
485
  this.systems.splice(systemIndex, 1);
481
486
 
@@ -1 +1 @@
1
- {"version":3,"file":"SGMesh.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/mesh-v2/aggregate/SGMesh.js"],"names":[],"mappings":";;;;;AAmBA;IAmOI;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAUlB;IAzOD;;;OAGG;IACH,OAFU,MAAM,CAEM;IAEtB;;;OAGG;IACH,OAFU,MAAM,GAAC,IAAI,CAER;IAEb;;;;OAIG;IACH,eAAc;IAEd;;;;OAIG;IACH,yBAA+B;IAE/B;;;;OAIG;IACH,cAHW,MAAM,GACJ,OAAO,CAUnB;IAED,eAEC;IAED;;;OAGG;IACH,YAFW,MAAM,QAOhB;IAED;;;OAGG;IACH,SAFa,MAAM,CAQlB;IAED;;;OAGG;IACH,oCAYC;IAED,iCAEC;IAED,8BAYC;IAUD;;;OAGG;IACH,qBAOC;IAnBD;;;OAGG;IACH,kBAEC;IAeD;;;;OAIG;IACH,4BAHW,KAAK,GACH,OAAO,CAUnB;IAED;;;OAGG;IACH,yCAFW,KAAK,QAIf;IAED;;;;OAIG;IACH,cAHW,MAAM;;;;KAAY,GAChB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM;;;;KAAY,GAChB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM;;;;KAAY,SAClB,OAAO,QAQjB;IAED;;;;OAIG;IACH,cAHW,MAAM;;;;KAAY,GAChB,OAAO,CAInB;IAUD;;;OAGG;IACH,6BAEC;IAdD;;;OAGG;IACH,0BAEC;IAkBD;;;OAGG;IACH,gCAEC;IAdD;;;OAGG;IACH,6BAEC;;CAwBJ;;;;sBApQmB,2CAA2C"}
1
+ {"version":3,"file":"SGMesh.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/mesh-v2/aggregate/SGMesh.js"],"names":[],"mappings":";;;;;AAmBA;IA4OI;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CAUlB;IAlPD;;;OAGG;IACH,OAFU,MAAM,CAEM;IAEtB;;;OAGG;IACH,OAFU,MAAM,GAAC,IAAI,CAER;IAEb;;;;OAIG;IACH,eAAc;IAEd;;;;OAIG;IACH,yBAA+B;IAE/B;;;;OAIG;IACH,gBAEC;IAED;;;;OAIG;IACH,cAHW,MAAM,GACJ,OAAO,CAUnB;IAED,eAEC;IAED;;;OAGG;IACH,YAFW,MAAM,QAOhB;IAED;;;OAGG;IACH,SAFa,MAAM,CAQlB;IAED;;;OAGG;IACH,oCAYC;IAED,iCAEC;IAED,8BAYC;IAUD;;;OAGG;IACH,qBAOC;IAnBD;;;OAGG;IACH,kBAEC;IAeD;;;;OAIG;IACH,4BAHW,KAAK,GACH,OAAO,CAUnB;IAED;;;OAGG;IACH,yCAFW,KAAK,QAIf;IAED;;;;OAIG;IACH,cAHW,MAAM;;;;KAAY,GAChB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM;;;;KAAY,GAChB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM;;;;KAAY,SAClB,OAAO,QAQjB;IAED;;;;OAIG;IACH,cAHW,MAAM;;;;KAAY,GAChB,OAAO,CAInB;IAUD;;;OAGG;IACH,6BAEC;IAdD;;;OAGG;IACH,0BAEC;IAkBD;;;OAGG;IACH,gCAEC;IAdD;;;OAGG;IACH,6BAEC;;CAwBJ;;;;sBA7QqB,2CAA2C"}
@@ -1,7 +1,7 @@
1
- import {AABB3} from "../../../../../core/geom/3d/aabb/AABB3.js";
2
- import {computeStringHash} from "../../../../../core/primitives/strings/computeStringHash.js";
3
- import {entity_node_compute_bounding_box} from "../../../../ecs/parent/entity_node_compute_bounding_box.js";
4
- import {ShadedGeometry} from "../ShadedGeometry.js";
1
+ import { AABB3 } from "../../../../../core/geom/3d/aabb/AABB3.js";
2
+ import { computeStringHash } from "../../../../../core/primitives/strings/computeStringHash.js";
3
+ import { entity_node_compute_bounding_box } from "../../../../ecs/parent/entity_node_compute_bounding_box.js";
4
+ import { ShadedGeometry } from "../ShadedGeometry.js";
5
5
 
6
6
  export const SGMeshFlags = {
7
7
  CastShadow: 1,
@@ -50,6 +50,15 @@ export class SGMesh {
50
50
  */
51
51
  __initial_bounds = new AABB3();
52
52
 
53
+ /**
54
+ * Contents are generated by the system
55
+ * Do not modify contents unless you know exactly what you're doing
56
+ * @returns {EntityNode|null}
57
+ */
58
+ get node(){
59
+ return this.__node;
60
+ }
61
+
53
62
  /**
54
63
  *
55
64
  * @param {SGMesh} other
@@ -0,0 +1,19 @@
1
+ export class SGMeshAnimationController {
2
+ /**
3
+ *
4
+ * @type {AnimationPlayback[]}
5
+ */
6
+ active: AnimationPlayback[];
7
+ /**
8
+ *
9
+ * @type {EntityNodeAnimationClip[]}
10
+ */
11
+ bound: EntityNodeAnimationClip[];
12
+ getBoundByName(name: any): EntityNodeAnimationClip;
13
+ }
14
+ export class AnimationPlayback {
15
+ clip_name: string;
16
+ time: number;
17
+ loop: boolean;
18
+ }
19
+ //# sourceMappingURL=SGMeshAnimationController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SGMeshAnimationController.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationController.js"],"names":[],"mappings":"AAAA;IACI;;;OAGG;IACH,QAFU,iBAAiB,EAAE,CAElB;IAEX;;;OAGG;IACH,OAFU,yBAAyB,CAEzB;IAEV,mDAEC;CACJ;AAED;IACI,kBAAc;IACd,aAAQ;IACR,cAAY;CACf"}
@@ -0,0 +1,23 @@
1
+ export class SGMeshAnimationController {
2
+ /**
3
+ *
4
+ * @type {AnimationPlayback[]}
5
+ */
6
+ active = []
7
+
8
+ /**
9
+ *
10
+ * @type {EntityNodeAnimationClip[]}
11
+ */
12
+ bound = []
13
+
14
+ getBoundByName(name) {
15
+ return this.bound.find(b => b.name === name);
16
+ }
17
+ }
18
+
19
+ export class AnimationPlayback {
20
+ clip_name = ""
21
+ time = 0
22
+ loop = false
23
+ }
@@ -0,0 +1,24 @@
1
+ export class SGMeshAnimationControllerSystem extends System<any, any, any, any, any> {
2
+ /**
3
+ *
4
+ * @param {Engine} engine
5
+ */
6
+ constructor(engine: Engine);
7
+ engine: Engine;
8
+ dependencies: (typeof SGMesh | typeof SGMeshAnimationController)[];
9
+ components_used: (ResourceAccessSpecification<typeof SGMesh> | ResourceAccessSpecification<typeof SGMeshAnimationController>)[];
10
+ /**
11
+ *
12
+ * @param {SGMeshAnimationController} anim
13
+ * @param {SGMesh} mesh
14
+ * @param {number} entity
15
+ */
16
+ link(anim: SGMeshAnimationController, mesh: SGMesh, entity: number): Promise<void>;
17
+ update(td: any): void;
18
+ #private;
19
+ }
20
+ import { System } from "../../../../ecs/System.js";
21
+ import { SGMesh } from "./SGMesh.js";
22
+ import { SGMeshAnimationController } from "./SGMeshAnimationController.js";
23
+ import { ResourceAccessSpecification } from "../../../../../core/model/ResourceAccessSpecification.js";
24
+ //# sourceMappingURL=SGMeshAnimationControllerSystem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SGMeshAnimationControllerSystem.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshAnimationControllerSystem.js"],"names":[],"mappings":"AAQA;IAII;;;OAGG;IACH,4BAeC;IAZG,eAAoB;IAEpB,mEAGC;IAED,gIAGC;IAuCL;;;;;OAKG;IACH,WAJW,yBAAyB,QACzB,MAAM,UACN,MAAM,iBAUhB;IAED,sBA8CC;;CACJ;uBAhIsB,2BAA2B;uBAE3B,aAAa;0CACM,gCAAgC;4CAL9B,0DAA0D"}
@@ -0,0 +1,132 @@
1
+ import { ResourceAccessKind } from "../../../../../core/model/ResourceAccessKind.js";
2
+ import { ResourceAccessSpecification } from "../../../../../core/model/ResourceAccessSpecification.js";
3
+ import { convert_three_clip } from "../../../../animation/curve/ecd_bind_animation_curve.js";
4
+ import { System } from "../../../../ecs/System.js";
5
+ import { assetTypeByPath } from "../../mesh/assetTypeByPath.js";
6
+ import { SGMesh } from "./SGMesh.js";
7
+ import { SGMeshAnimationController } from "./SGMeshAnimationController.js";
8
+
9
+ export class SGMeshAnimationControllerSystem extends System {
10
+
11
+ #queue = [];
12
+
13
+ /**
14
+ *
15
+ * @param {Engine} engine
16
+ */
17
+ constructor(engine) {
18
+ super();
19
+
20
+ this.engine = engine;
21
+
22
+ this.dependencies = [
23
+ SGMeshAnimationController,
24
+ SGMesh
25
+ ];
26
+
27
+ this.components_used = [
28
+ ResourceAccessSpecification.from(SGMesh, ResourceAccessKind.Read | ResourceAccessKind.Write),
29
+ ResourceAccessSpecification.from(SGMeshAnimationController, ResourceAccessKind.Read)
30
+ ];
31
+
32
+ }
33
+
34
+ async #process(entity) {
35
+ const em = this.entityManager;
36
+
37
+ const ecd = em.dataset;
38
+
39
+ const mesh = ecd.getComponent(entity, SGMesh);
40
+
41
+ if (mesh.node === null) {
42
+ // requeue
43
+ this.#enqueue(entity);
44
+ return;
45
+ }
46
+
47
+ const assetType = assetTypeByPath(mesh.url);
48
+
49
+ const asset = await this.engine.assetManager.promise(mesh.url, assetType);
50
+
51
+ const three_animations = asset.animations ?? [];
52
+
53
+ const animations = three_animations.map(three_animation => {
54
+
55
+ return convert_three_clip(mesh.node, three_animation)
56
+ });
57
+
58
+ const controller = ecd.getComponent(entity, SGMeshAnimationController);
59
+
60
+ controller.bound = animations;
61
+
62
+ console.log(asset, animations);
63
+ }
64
+
65
+ #enqueue(entity) {
66
+ this.#queue.push(entity);
67
+ }
68
+
69
+ /**
70
+ *
71
+ * @param {SGMeshAnimationController} anim
72
+ * @param {SGMesh} mesh
73
+ * @param {number} entity
74
+ */
75
+ async link(anim, mesh, entity) {
76
+
77
+ if (mesh.node === null) {
78
+ this.#enqueue(entity);
79
+ return;
80
+ }
81
+
82
+ await this.#process(entity);
83
+ }
84
+
85
+ update(td) {
86
+
87
+ for (let i = 0; i < 1000; i++) {
88
+ if (this.#queue.length === 0) {
89
+ break;
90
+ }
91
+
92
+ const entity = this.#queue.pop();
93
+
94
+ this.#process(entity);
95
+ }
96
+
97
+ const ecd = this.entityManager.dataset;
98
+
99
+ if (ecd === null) {
100
+ return;
101
+ }
102
+
103
+ ecd.traverseComponents(SGMeshAnimationController, (controller) => {
104
+
105
+ const active = controller.active;
106
+
107
+ for (let i = 0; i < active.length; i++) {
108
+ const playback = active[i];
109
+
110
+ playback.time += td;
111
+
112
+ const clip = controller.getBoundByName(playback.clip_name);
113
+
114
+ if (clip !== undefined) {
115
+ let t= playback.time;
116
+
117
+ if (t > clip.duration) {
118
+ if (playback.loop) {
119
+ t = t%clip.duration;
120
+ }else{
121
+ t = clip.duration;
122
+ }
123
+ }
124
+
125
+ clip.writeAt(t);
126
+ }
127
+
128
+ }
129
+
130
+ });
131
+ }
132
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"SGMeshSystem.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshSystem.js"],"names":[],"mappings":"AA8BA;IACI;;;OAGG;IACH,4BA4CC;IAzCG;;;;OAIG;IACH,iBAAsB;IAEtB;;;;OAIG;IACH,uBAAyC;IAEzC,mDAAuC;IACvC,+NAKC;IAED;;;;OAIG;IACH,qBAAsB;IACtB;;;;OAIG;IACH,mCAAmC;IAEnC;;;;OAIG;IACH,6BAAqC;IAGzC,0EAOC;IAED;;;;;OAKG;IACH,gBAJW,MAAM,QACN,MAAM,aACN,SAAS,iBA8GnB;IAED;;;;;OAKG;IACH,WAJW,MAAM,aACN,SAAS,UACT,MAAM,QAiBhB;IAED;;;;;OAKG;IACH,aAJW,MAAM,aACN,SAAS,UACT,MAAM,QAehB;IAED,8BAqDC;CACJ;uBA3SoB,2BAA2B;0BAGxB,wCAAwC;uBAK3C,aAAa;4CAXQ,0DAA0D;oCAIlE,6DAA6D;+BAIlE,sBAAsB"}
1
+ {"version":3,"file":"SGMeshSystem.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshSystem.js"],"names":[],"mappings":"AA8CA;IACI;;;OAGG;IACH,4BAsCC;IAnCG;;;;OAIG;IACH,iBAAsB;IAEtB;;;;OAIG;IACH,uBAAyC;IAEzC,mDAAuC;IACvC,+NAKC;IAED;;;;OAIG;IACH,qBAAsB;IACtB;;;;OAIG;IACH,mCAAmC;IAIvC,0EAOC;IAED;;;;;OAKG;IACH,gBAJW,MAAM,QACN,MAAM,aACN,SAAS,iBA8GnB;IAED;;;;;OAKG;IACH,WAJW,MAAM,aACN,SAAS,UACT,MAAM,QAiBhB;IAED;;;;;OAKG;IACH,aAJW,MAAM,aACN,SAAS,UACT,MAAM,QAehB;IAED,8BAqDC;CACJ;uBApTsB,2BAA2B;0BAGxB,wCAAwC;uBAK3C,aAAa;4CAZQ,0DAA0D;oCAKlE,6DAA6D;+BAIlE,sBAAsB"}
@@ -1,18 +1,19 @@
1
- import {min2} from "../../../../../core/math/min2.js";
2
- import {ResourceAccessKind} from "../../../../../core/model/ResourceAccessKind.js";
3
- import {ResourceAccessSpecification} from "../../../../../core/model/ResourceAccessSpecification.js";
4
- import {EntityNode} from "../../../../ecs/parent/EntityNode.js";
5
- import {ParentEntity} from "../../../../ecs/parent/ParentEntity.js";
6
- import {System} from "../../../../ecs/System.js";
7
- import {TransformAttachment} from "../../../../ecs/transform-attachment/TransformAttachment.js";
8
- import {TransformAttachmentSystem} from "../../../../ecs/transform-attachment/TransformAttachmentSystem.js";
9
- import {Transform} from "../../../../ecs/transform/Transform.js";
10
- import {assetTypeByPath} from "../../mesh/assetTypeByPath.js";
11
- import {ShadedGeometry} from "../ShadedGeometry.js";
12
- import {ShadedGeometryFlags} from "../ShadedGeometryFlags.js";
13
- import {three_object_to_entity_composition} from "../three_object_to_entity_composition.js";
14
- import {SGMesh} from "./SGMesh.js";
15
- import {SGMeshEvents} from "./SGMeshEvents.js";
1
+ import { min2 } from "../../../../../core/math/min2.js";
2
+ import { ResourceAccessKind } from "../../../../../core/model/ResourceAccessKind.js";
3
+ import { ResourceAccessSpecification } from "../../../../../core/model/ResourceAccessSpecification.js";
4
+ import { STATIC_ASSET_CACHE } from "../../../../asset/STATIC_ASSET_CACHE.js";
5
+ import { EntityNode } from "../../../../ecs/parent/EntityNode.js";
6
+ import { ParentEntity } from "../../../../ecs/parent/ParentEntity.js";
7
+ import { System } from "../../../../ecs/System.js";
8
+ import { TransformAttachment } from "../../../../ecs/transform-attachment/TransformAttachment.js";
9
+ import { TransformAttachmentSystem } from "../../../../ecs/transform-attachment/TransformAttachmentSystem.js";
10
+ import { Transform } from "../../../../ecs/transform/Transform.js";
11
+ import { assetTypeByPath } from "../../mesh/assetTypeByPath.js";
12
+ import { ShadedGeometry } from "../ShadedGeometry.js";
13
+ import { ShadedGeometryFlags } from "../ShadedGeometryFlags.js";
14
+ import { three_object_to_entity_composition } from "../three_object_to_entity_composition.js";
15
+ import { SGMesh } from "./SGMesh.js";
16
+ import { SGMeshEvents } from "./SGMeshEvents.js";
16
17
 
17
18
 
18
19
  /**
@@ -28,6 +29,21 @@ const MAX_CYCLE_COUNT = 128;
28
29
  */
29
30
  const MAX_CYCLE_TIME = 40;
30
31
 
32
+
33
+ /**
34
+ *
35
+ * @param {string} url
36
+ * @param {AssetManager} assetManager
37
+ * @returns {Promise<THREE.Object3D>}
38
+ */
39
+ async function getAsset(url, assetManager) {
40
+
41
+ const assetType = assetTypeByPath(url);
42
+
43
+ const asset = await assetManager.promise(url, assetType);
44
+ }
45
+
46
+
31
47
  export class SGMeshSystem extends System {
32
48
  /**
33
49
  *
@@ -71,12 +87,6 @@ export class SGMeshSystem extends System {
71
87
  */
72
88
  this.__wait_queue_process_index = 0;
73
89
 
74
- /**
75
- * Cache THREE.js objects as we don't use them directly, so we can just keep 1 copy instead of calling {@link Asset#create} every time
76
- * @type {Map<Asset, THREE.Object3D>}
77
- * @private
78
- */
79
- this.__asset_object_cache = new Map();
80
90
  }
81
91
 
82
92
  async startup(em, ready_callback, error_callback) {
@@ -132,14 +142,14 @@ export class SGMeshSystem extends System {
132
142
  }
133
143
 
134
144
  let object;
135
- const cached_object = this.__asset_object_cache.get(asset);
145
+ const cached_object = STATIC_ASSET_CACHE.get(asset);
136
146
 
137
- if (cached_object !== undefined) {
147
+ if (cached_object !== null) {
138
148
  object = cached_object;
139
149
  } else {
140
150
  object = asset.create();
141
151
 
142
- this.__asset_object_cache.set(asset, object);
152
+ STATIC_ASSET_CACHE.set(asset, object);
143
153
  }
144
154
 
145
155
  let entity_node = three_object_to_entity_composition(object);
@@ -0,0 +1,27 @@
1
+ export class AnimatedValueBinding {
2
+ /**
3
+ *
4
+ * @param {BoundValueWriter} writer
5
+ * @param {AnimationCurve[]} curves
6
+ * @returns {AnimatedValueBinding}
7
+ */
8
+ static from(writer: BoundValueWriter, curves: AnimationCurve[]): AnimatedValueBinding;
9
+ constructor(itemSize: any);
10
+ /**
11
+ *
12
+ * @type {BoundValueWriter|null}
13
+ */
14
+ writer: BoundValueWriter | null;
15
+ /**
16
+ *
17
+ * @type {AnimationCurve[]}
18
+ */
19
+ curves: AnimationCurve[];
20
+ /**
21
+ *
22
+ * @param {number} time
23
+ */
24
+ writeAt(time: number): void;
25
+ #private;
26
+ }
27
+ //# sourceMappingURL=AnimatedValueBinding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimatedValueBinding.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/mesh-v2/aggregate/animation/AnimatedValueBinding.js"],"names":[],"mappings":"AAAA;IAoBI;;;;;OAKG;IACH,8CAHW,gBAAgB,GACd,oBAAoB,CAWhC;IArBD,2BAIC;IAjBD;;;OAGG;IACH,QAFU,mBAAiB,IAAI,CAElB;IAEb;;;OAGG;IACH,QAFU,gBAAgB,CAEf;IAkCX;;;OAGG;IACH,cAFW,MAAM,QAYhB;;CACJ"}
@@ -0,0 +1,61 @@
1
+ export class AnimatedValueBinding {
2
+ /**
3
+ *
4
+ * @type {BoundValueWriter|null}
5
+ */
6
+ writer = null
7
+
8
+ /**
9
+ *
10
+ * @type {AnimationCurve[]}
11
+ */
12
+ curves = []
13
+
14
+
15
+ constructor(itemSize) {
16
+ this.#itemSize = itemSize;
17
+
18
+ this.#sample = new Float32Array(itemSize);
19
+ }
20
+
21
+ /**
22
+ *
23
+ * @param {BoundValueWriter} writer
24
+ * @param {AnimationCurve[]} curves
25
+ * @returns {AnimatedValueBinding}
26
+ */
27
+ static from(writer, curves) {
28
+
29
+ const r = new AnimatedValueBinding(curves.length);
30
+
31
+ r.writer = writer;
32
+ r.curves = curves;
33
+
34
+ return r;
35
+
36
+ }
37
+
38
+ #itemSize = 1;
39
+
40
+ /**
41
+ *
42
+ * @type {Float32Array|null}
43
+ */
44
+ #sample = null;
45
+
46
+ /**
47
+ *
48
+ * @param {number} time
49
+ */
50
+ writeAt(time) {
51
+
52
+ for (let i = 0; i < this.#itemSize; i++) {
53
+ const curve = this.curves[i];
54
+
55
+ this.#sample[i] = curve.evaluate(time)
56
+ }
57
+
58
+
59
+ this.writer.write(this.#sample);
60
+ }
61
+ }
@@ -0,0 +1,7 @@
1
+ export class BoundQuaternionWriter extends BoundValueWriter {
2
+ constructor(quaternion: any);
3
+ write(data: any): void;
4
+ #private;
5
+ }
6
+ import { BoundValueWriter } from "./BoundValueWriter.js";
7
+ //# sourceMappingURL=BoundQuaternionWriter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BoundQuaternionWriter.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundQuaternionWriter.js"],"names":[],"mappings":"AAEA;IAOI,6BAIC;IAED,uBAGC;;CACJ;iCAnBgC,uBAAuB"}
@@ -0,0 +1,20 @@
1
+ import { BoundValueWriter } from "./BoundValueWriter.js";
2
+
3
+ export class BoundQuaternionWriter extends BoundValueWriter {
4
+ /**
5
+ *
6
+ * @type {Quaternion|null}
7
+ */
8
+ #quaternion = null
9
+
10
+ constructor(quaternion) {
11
+ super();
12
+
13
+ this.#quaternion = quaternion;
14
+ }
15
+
16
+ write(data) {
17
+ this.#quaternion.fromArray(data);
18
+ this.#quaternion.normalize();
19
+ }
20
+ }
@@ -0,0 +1,8 @@
1
+ export class BoundValueWriter {
2
+ /**
3
+ *
4
+ * @param {number[]} data
5
+ */
6
+ write(data: number[]): void;
7
+ }
8
+ //# sourceMappingURL=BoundValueWriter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BoundValueWriter.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundValueWriter.js"],"names":[],"mappings":"AAAA;IAEI;;;OAGG;IACH,YAFW,MAAM,EAAE,QAIlB;CACJ"}
@@ -0,0 +1,10 @@
1
+ export class BoundValueWriter {
2
+
3
+ /**
4
+ *
5
+ * @param {number[]} data
6
+ */
7
+ write(data) {
8
+
9
+ }
10
+ }
@@ -0,0 +1,7 @@
1
+ export class BoundVector3Writer extends BoundValueWriter {
2
+ constructor(vector: any);
3
+ write(data: any): void;
4
+ #private;
5
+ }
6
+ import { BoundValueWriter } from "./BoundValueWriter.js";
7
+ //# sourceMappingURL=BoundVector3Writer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BoundVector3Writer.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/mesh-v2/aggregate/animation/BoundVector3Writer.js"],"names":[],"mappings":"AAEA;IAOI,yBAIC;IAED,uBAEC;;CACJ;iCAlBgC,uBAAuB"}
@@ -0,0 +1,19 @@
1
+ import { BoundValueWriter } from "./BoundValueWriter.js";
2
+
3
+ export class BoundVector3Writer extends BoundValueWriter {
4
+ /**
5
+ *
6
+ * @type {Vector3|null}
7
+ */
8
+ #vector = null
9
+
10
+ constructor(vector) {
11
+ super();
12
+
13
+ this.#vector = vector;
14
+ }
15
+
16
+ write(data) {
17
+ this.#vector.fromArray(data);
18
+ }
19
+ }
@@ -10,6 +10,10 @@ export class Sampler2D {
10
10
 
11
11
  writeChannel(x: number, y: number, channel: number, value: number): void
12
12
 
13
+ sampleBilinear(x: number, y: number, result: ArrayLike<number>, result_offset?: number): void
14
+
15
+ sampleChannelBilinear(x: number, y: number, channel: number): number
16
+
13
17
  static uint8clamped(itemSize: number, width: number, height: number): Sampler2D
14
18
 
15
19
  static uint8(itemSize: number, width: number, height: number): Sampler2D
@@ -17,7 +17,6 @@ export class CellFilterCache extends CellFilterUnaryOperation {
17
17
  * @type {number}
18
18
  */
19
19
  scale: number;
20
- execute(grid: any, x: any, y: any, rotation: any): any;
21
20
  }
22
21
  import { CellFilterUnaryOperation } from "../core/CellFilterUnaryOperation.js";
23
22
  //# sourceMappingURL=CellFilterCache.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CellFilterCache.d.ts","sourceRoot":"","sources":["../../../../../src/generation/filtering/numeric/CellFilterCache.js"],"names":[],"mappings":"AAIA;IAeI;;;;;OAKG;IACH,wCAHW,MAAM,GACJ,eAAe,CAU3B;IA3BD;;;;OAIG;IACH,gBAAqC;IAErC;;;OAGG;IACH,OAFU,MAAM,CAEN;IAsDV,uDAEC;CACJ;yCA1EwC,qCAAqC"}
1
+ {"version":3,"file":"CellFilterCache.d.ts","sourceRoot":"","sources":["../../../../../src/generation/filtering/numeric/CellFilterCache.js"],"names":[],"mappings":"AAIA;IAeI;;;;;OAKG;IACH,wCAHW,MAAM,GACJ,eAAe,CAU3B;IA3BD;;;;OAIG;IACH,gBAAqC;IAErC;;;OAGG;IACH,OAFU,MAAM,CAEN;CAyDb;yCA1EwC,qCAAqC"}