@woosh/meep-engine 2.118.9 → 2.118.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 (98) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/build/meep.cjs +192 -266
  3. package/build/meep.min.js +1 -1
  4. package/build/meep.module.js +192 -266
  5. package/editor/ecs/component/editors/Sampler2DEditor.js +2 -4
  6. package/package.json +1 -1
  7. package/samples/terrain/editor.js +3 -3
  8. package/src/core/bvh2/binary/2/BinaryUint32BVH.d.ts +1 -19
  9. package/src/core/bvh2/binary/2/BinaryUint32BVH.d.ts.map +1 -1
  10. package/src/core/bvh2/binary/2/BinaryUint32BVH.js +10 -78
  11. package/src/core/bvh2/bvh3/build_triangle_morton_codes.js +1 -1
  12. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts.map +1 -1
  13. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +9 -7
  14. package/src/core/collection/array/isArrayEqualStrict.d.ts.map +1 -1
  15. package/src/core/collection/array/isArrayEqualStrict.js +2 -2
  16. package/src/core/collection/array/iterator/ArrayIteratorSequential.d.ts.map +1 -1
  17. package/src/core/collection/array/iterator/ArrayIteratorSequential.js +3 -4
  18. package/src/core/collection/queue/Deque.d.ts.map +1 -1
  19. package/src/core/collection/queue/Deque.js +1 -1
  20. package/src/core/geom/3d/aabb/AABB3.d.ts.map +1 -1
  21. package/src/core/geom/3d/aabb/AABB3.js +0 -8
  22. package/src/core/geom/3d/morton/{Morton.d.ts → v3_morton_encode.d.ts} +1 -1
  23. package/src/core/geom/3d/morton/v3_morton_encode.d.ts.map +1 -0
  24. package/src/core/geom/3d/morton/v3_morton_encode_bounded.js +2 -2
  25. package/src/core/geom/3d/morton/v3_morton_encode_transformed.js +2 -2
  26. package/src/core/geom/Quaternion.d.ts.map +1 -1
  27. package/src/core/geom/Quaternion.js +7 -10
  28. package/src/core/geom/Vector3.d.ts.map +1 -1
  29. package/src/core/geom/Vector3.js +4 -49
  30. package/src/core/math/sinc.d.ts +8 -0
  31. package/src/core/math/sinc.d.ts.map +1 -0
  32. package/src/core/math/sinc.js +13 -0
  33. package/src/core/process/worker/WorkerProxy.d.ts +12 -3
  34. package/src/core/process/worker/WorkerProxy.d.ts.map +1 -1
  35. package/src/core/process/worker/WorkerProxy.js +10 -1
  36. package/src/engine/ecs/terrain/BufferedGeometryArraysBuilder.d.ts +2 -17
  37. package/src/engine/ecs/terrain/BufferedGeometryArraysBuilder.d.ts.map +1 -1
  38. package/src/engine/ecs/terrain/BufferedGeometryArraysBuilder.js +2 -118
  39. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrain.d.ts +0 -1
  40. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrain.d.ts.map +1 -1
  41. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrain.js +1 -6
  42. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.d.ts +5 -5
  43. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.d.ts.map +1 -1
  44. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.js +20 -28
  45. package/src/engine/ecs/terrain/ecs/layers/TerrainLayer.d.ts.map +1 -1
  46. package/src/engine/ecs/terrain/ecs/layers/TerrainLayer.js +2 -2
  47. package/src/engine/ecs/terrain/tiles/TerrainTile.d.ts.map +1 -1
  48. package/src/engine/ecs/terrain/tiles/TerrainTile.js +3 -1
  49. package/src/engine/graphics/geometry/MikkT/MikkTSpace.d.ts +1 -1
  50. package/src/engine/graphics/geometry/MikkT/MikkTSpace.js +12 -12
  51. package/src/engine/graphics/geometry/MikkT/STSpace.d.ts.map +1 -1
  52. package/src/engine/graphics/geometry/MikkT/STSpace.js +14 -16
  53. package/src/engine/graphics/geometry/buffered/build_height_field_geometry.d.ts +17 -0
  54. package/src/engine/graphics/geometry/buffered/build_height_field_geometry.d.ts.map +1 -0
  55. package/src/engine/graphics/geometry/buffered/build_height_field_geometry.js +118 -0
  56. package/src/engine/graphics/geometry/buffered/geometry_compute_vertex_normals_indexed.d.ts +2 -2
  57. package/src/engine/graphics/geometry/buffered/geometry_compute_vertex_normals_indexed.d.ts.map +1 -1
  58. package/src/engine/graphics/geometry/buffered/geometry_compute_vertex_normals_indexed.js +1 -1
  59. package/src/engine/graphics/material/optimization/MaterialOptimizationContext.d.ts.map +1 -1
  60. package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +2 -2
  61. package/src/engine/graphics/render/forward_plus/materials/FPlusDebugMaterial.js +3 -3
  62. package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
  63. package/src/engine/graphics/texture/sampler/Sampler2D.js +31 -52
  64. package/src/engine/graphics/texture/sampler/sampler2d_to_texture.d.ts +10 -0
  65. package/src/engine/graphics/texture/sampler/sampler2d_to_texture.d.ts.map +1 -0
  66. package/src/engine/graphics/texture/sampler/{Sampler2D2Texture.js → sampler2d_to_texture.js} +5 -5
  67. package/src/engine/graphics/texture/sampler/{copy_Sampler2D_channel_data.d.ts → sampler2d_transfer_data.d.ts} +2 -2
  68. package/src/engine/graphics/texture/sampler/sampler2d_transfer_data.d.ts.map +1 -0
  69. package/src/engine/graphics/texture/sampler/{copy_Sampler2D_channel_data.js → sampler2d_transfer_data.js} +1 -1
  70. package/src/engine/graphics/texture/sampler/writeSampler2DDataToDataTexture.js +2 -2
  71. package/src/engine/graphics/trail/x/simulator/RibbonXFixedPhysicsSimulator.d.ts.map +1 -1
  72. package/src/engine/graphics/trail/x/simulator/RibbonXFixedPhysicsSimulator.js +0 -3
  73. package/src/engine/intelligence/behavior/selector/WeightedElement.d.ts +6 -3
  74. package/src/engine/intelligence/behavior/selector/WeightedElement.d.ts.map +1 -1
  75. package/src/engine/intelligence/behavior/selector/WeightedElement.js +9 -12
  76. package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.d.ts +1 -1
  77. package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.d.ts.map +1 -1
  78. package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.js +20 -23
  79. package/src/engine/intelligence/mcts/StateNode.d.ts.map +1 -1
  80. package/src/engine/intelligence/mcts/StateNode.js +76 -102
  81. package/src/engine/logging/Logger.d.ts.map +1 -1
  82. package/src/engine/logging/Logger.js +7 -9
  83. package/src/engine/logging/LoggerBackend.d.ts.map +1 -1
  84. package/src/engine/logging/LoggerBackend.js +7 -7
  85. package/src/core/geom/3d/morton/Morton.d.ts.map +0 -1
  86. package/src/engine/graphics/geometry/MikkT/m_getNumVerticesOfFace.d.ts +0 -9
  87. package/src/engine/graphics/geometry/MikkT/m_getNumVerticesOfFace.d.ts.map +0 -1
  88. package/src/engine/graphics/geometry/MikkT/m_getNumVerticesOfFace.js +0 -11
  89. package/src/engine/graphics/geometry/MikkT/m_getPosition.d.ts +0 -14
  90. package/src/engine/graphics/geometry/MikkT/m_getPosition.d.ts.map +0 -1
  91. package/src/engine/graphics/geometry/MikkT/m_getPosition.js +0 -20
  92. package/src/engine/graphics/geometry/MikkT/m_setTSpaceBasic.d.ts +0 -21
  93. package/src/engine/graphics/geometry/MikkT/m_setTSpaceBasic.d.ts.map +0 -1
  94. package/src/engine/graphics/geometry/MikkT/m_setTSpaceBasic.js +0 -22
  95. package/src/engine/graphics/texture/sampler/Sampler2D2Texture.d.ts +0 -10
  96. package/src/engine/graphics/texture/sampler/Sampler2D2Texture.d.ts.map +0 -1
  97. package/src/engine/graphics/texture/sampler/copy_Sampler2D_channel_data.d.ts.map +0 -1
  98. /package/src/core/geom/3d/morton/{Morton.js → v3_morton_encode.js} +0 -0
@@ -1,6 +1,11 @@
1
1
  export default WorkerProxy;
2
2
  declare class WorkerProxy {
3
- constructor(url: any, methods: any);
3
+ /**
4
+ *
5
+ * @param {string} url
6
+ * @param {Object} methods
7
+ */
8
+ constructor(url: string, methods: any);
4
9
  /**
5
10
  *
6
11
  * @type {{}}
@@ -20,7 +25,7 @@ declare class WorkerProxy {
20
25
  * @private
21
26
  */
22
27
  private __id_counter;
23
- url: any;
28
+ url: string;
24
29
  methods: any;
25
30
  /**
26
31
  * Invoke a given method on the worker, as defined by the `WorkerBuilder`
@@ -36,7 +41,11 @@ declare class WorkerProxy {
36
41
  * @private
37
42
  */
38
43
  private __makeMethod;
39
- __generateAPI(): void;
44
+ /**
45
+ *
46
+ * @private
47
+ */
48
+ private __generateAPI;
40
49
  /**
41
50
  *
42
51
  * @param {Event} event
@@ -1 +1 @@
1
- {"version":3,"file":"WorkerProxy.d.ts","sourceRoot":"","sources":["../../../../../src/core/process/worker/WorkerProxy.js"],"names":[],"mappings":";AAqCA;IA0BI,oCAKC;IA7BD;;;;OAIG;IACH,kBAAe;IAEf,qBAAoB;IAEpB;;;;OAIG;IACH,iBAAgB;IAEhB;;;;OAIG;IACH,qBAAiB;IAIb,SAAc;IACd,aAAsB;IAK1B;;;;;;OAMG;IACH,wBAJW,MAAM,2BAmDhB;IAED;;;;OAIG;IACH,qBAeC;IAED,sBAQC;IAED;;;;OAIG;IACH,wBAqCC;IAED,qBAEC;IAED,aAOC;IAED;;;;;OAKG;IACH,kBAJW,MAAM,eACN,MAAM,GACJ,OAAO,CAkCnB;IAED,4BAmBC;IAED,cAiBC;CACJ"}
1
+ {"version":3,"file":"WorkerProxy.d.ts","sourceRoot":"","sources":["../../../../../src/core/process/worker/WorkerProxy.js"],"names":[],"mappings":";AAqCA;IA0BI;;;;OAIG;IACH,iBAHW,MAAM,gBAQhB;IAlCD;;;;OAIG;IACH,kBAAe;IAEf,qBAAoB;IAEpB;;;;OAIG;IACH,iBAAgB;IAEhB;;;;OAIG;IACH,qBAAiB;IASb,YAAc;IACd,aAAsB;IAK1B;;;;;;OAMG;IACH,wBAJW,MAAM,2BAmDhB;IAED;;;;OAIG;IACH,qBAeC;IAED;;;OAGG;IACH,sBAQC;IAED;;;;OAIG;IACH,wBAqCC;IAED,qBAEC;IAED,aAOC;IAED;;;;;OAKG;IACH,kBAJW,MAAM,eACN,MAAM,GACJ,OAAO,CAkCnB;IAED,4BAmBC;IAED,cAiBC;CACJ"}
@@ -61,11 +61,16 @@ class WorkerProxy {
61
61
  __id_counter = 0;
62
62
 
63
63
 
64
+ /**
65
+ *
66
+ * @param {string} url
67
+ * @param {Object} methods
68
+ */
64
69
  constructor(url, methods) {
65
70
  this.url = url;
66
71
  this.methods = methods;
67
72
 
68
- this.__generateAPI(this, methods);
73
+ this.__generateAPI();
69
74
  }
70
75
 
71
76
  /**
@@ -146,6 +151,10 @@ class WorkerProxy {
146
151
 
147
152
  }
148
153
 
154
+ /**
155
+ *
156
+ * @private
157
+ */
149
158
  __generateAPI() {
150
159
 
151
160
 
@@ -1,21 +1,6 @@
1
1
  export default Builder;
2
2
  declare namespace Builder {
3
- export { buildBufferGeometry as build };
3
+ export { build_height_field_geometry as build };
4
4
  }
5
- /**
6
- *
7
- * @param {Sampler2D} samplerHeight
8
- * @param {Vector2} position
9
- * @param {Vector2} size
10
- * @param {Vector2} scale
11
- * @param {Vector2} totalSize
12
- * @param {number} resolution
13
- * @returns {{indices, vertices: Float32Array, normals: Float32Array, uvs: Float32Array}}
14
- */
15
- declare function buildBufferGeometry(samplerHeight: Sampler2D, position: Vector2, size: Vector2, scale: Vector2, totalSize: Vector2, resolution: number): {
16
- indices: any;
17
- vertices: Float32Array;
18
- normals: Float32Array;
19
- uvs: Float32Array;
20
- };
5
+ import { build_height_field_geometry } from "../../graphics/geometry/buffered/build_height_field_geometry.js";
21
6
  //# sourceMappingURL=BufferedGeometryArraysBuilder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BufferedGeometryArraysBuilder.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/terrain/BufferedGeometryArraysBuilder.js"],"names":[],"mappings":";;;;AAIA;;;;;;;;;GASG;AACH,iJAHW,MAAM;;cACgB,YAAY;aAAW,YAAY;SAAO,YAAY;EAwGtF"}
1
+ {"version":3,"file":"BufferedGeometryArraysBuilder.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/terrain/BufferedGeometryArraysBuilder.js"],"names":[],"mappings":";;;;4CAA4C,iEAAiE"}
@@ -1,123 +1,7 @@
1
- import {
2
- geometry_compute_vertex_normals_indexed
3
- } from '../../graphics/geometry/buffered/geometry_compute_vertex_normals_indexed.js';
4
-
5
- /**
6
- *
7
- * @param {Sampler2D} samplerHeight
8
- * @param {Vector2} position
9
- * @param {Vector2} size
10
- * @param {Vector2} scale
11
- * @param {Vector2} totalSize
12
- * @param {number} resolution
13
- * @returns {{indices, vertices: Float32Array, normals: Float32Array, uvs: Float32Array}}
14
- */
15
- function buildBufferGeometry(samplerHeight, position, size, scale, totalSize, resolution) {
16
-
17
- const width = size.x;
18
- const height = size.y;
19
-
20
-
21
- const gridX1 = width * resolution;
22
- const gridY1 = height * resolution;
23
-
24
- const gridX2 = gridX1 - 1;
25
- const gridY2 = gridY1 - 1;
26
-
27
- let offset = 0, offset2 = 0;
28
-
29
- const vertexCount = gridX1 * gridY1;
30
-
31
-
32
- const vertices = new Float32Array(vertexCount * 3);
33
-
34
- const normals = new Float32Array(vertexCount * 3);
35
-
36
- const uvs = new Float32Array(vertexCount * 2);
37
-
38
- let y, x;
39
-
40
- const vMultiplier = (size.y / totalSize.y) / gridY2;
41
- const uMultiplier = (size.x / totalSize.x) / gridX2;
42
-
43
- const vConst = position.y / totalSize.y;
44
- const uConst = position.x / totalSize.x;
45
-
46
- const totalScaledSizeX = totalSize.x * scale.x;
47
- const totalScaledSizeY = totalSize.y * scale.y;
48
-
49
- //fill vertices
50
- let px, py, pz;
51
- for (y = 0; y < gridY1; y++) {
52
-
53
- const v = y * vMultiplier + vConst;
54
-
55
- pz = v * totalScaledSizeY;
56
-
57
- for (x = 0; x < gridX1; x++) {
58
-
59
- const u = x * uMultiplier + uConst;
60
-
61
- //get height sample
62
- const val = samplerHeight.sampleChannelBicubicUV(u, v, 0);
63
-
64
- px = u * totalScaledSizeX;
65
- py = val;
66
-
67
- vertices[offset] = px;
68
- vertices[offset + 1] = py;
69
- vertices[offset + 2] = pz;
70
-
71
- uvs[offset2] = u;
72
- uvs[offset2 + 1] = v;
73
-
74
- offset += 3;
75
- offset2 += 2;
76
- }
77
- }
78
-
79
- offset = 0;
80
-
81
- /**
82
- * @type {Uint16Array|Uint32Array}
83
- */
84
- const indices = new ((vertices.length / 3) > 65535 ? Uint32Array : Uint16Array)(gridX2 * gridY2 * 6);
85
-
86
- //add faces
87
- //TODO TraingleStip mode is more efficient in terms of memory usage and probably GPU-time
88
- for (y = 0; y < gridY2; y++) {
89
-
90
- for (x = 0; x < gridX2; x++) {
91
- const a = x + gridX1 * y;
92
- const b = x + gridX1 * (y + 1);
93
- const c = (x + 1) + gridX1 * (y + 1);
94
- const d = (x + 1) + gridX1 * y;
95
-
96
- indices[offset] = a;
97
- indices[offset + 1] = b;
98
- indices[offset + 2] = d;
99
-
100
- indices[offset + 3] = b;
101
- indices[offset + 4] = c;
102
- indices[offset + 5] = d;
103
-
104
- offset += 6;
105
- }
106
- }
107
-
108
- geometry_compute_vertex_normals_indexed(vertices, normals, indices);
109
-
110
- //CleanupGeometry(geometry);
111
- return {
112
- indices: indices,
113
- vertices: vertices,
114
- normals: normals,
115
- uvs: uvs
116
- };
117
- }
1
+ import { build_height_field_geometry } from "../../graphics/geometry/buffered/build_height_field_geometry.js";
118
2
 
119
3
  const Builder = {
120
- build: buildBufferGeometry
4
+ build: build_height_field_geometry
121
5
  };
122
6
 
123
7
  export default Builder;
@@ -6,7 +6,6 @@ declare class ClingToTerrain {
6
6
  * @returns {ClingToTerrain}
7
7
  */
8
8
  static fromJSON(json: any): ClingToTerrain;
9
- constructor(opt: any);
10
9
  /**
11
10
  * @type {boolean}
12
11
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ClingToTerrain.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/terrain/ecs/cling/ClingToTerrain.js"],"names":[],"mappings":";AAGA;IA8DI;;;;OAIG;IACH,4BAFa,cAAc,CAQ1B;IApDD,sBAIC;IAxBD;;OAEG;IACH,aAFU,OAAO,CAEG;IACpB;;;OAGG;IACH,gBAFU,OAAO,CAEqB;IACtC;;;OAGG;IACH,gBAFU,UAAU,CAEwB;IAC5C;;;OAGG;IACH,eAFU,MAAM,CAEE;IAQlB;;;;OAIG;IACH,cAHW,cAAc,GACZ,OAAO,CAKnB;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;;MAKC;IAED;;;aAQC;CAcJ;;;;oBA5EmB,qCAAqC;uBADlC,wCAAwC"}
1
+ {"version":3,"file":"ClingToTerrain.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/terrain/ecs/cling/ClingToTerrain.js"],"names":[],"mappings":";AAGA;IAyDI;;;;OAIG;IACH,4BAFa,cAAc,CAQ1B;IAnED;;OAEG;IACH,aAFU,OAAO,CAEG;IACpB;;;OAGG;IACH,gBAFU,OAAO,CAEqB;IACtC;;;OAGG;IACH,gBAFU,UAAU,CAEwB;IAE5C;;;OAGG;IACH,eAFU,MAAM,CAEE;IAElB;;;;OAIG;IACH,cAHW,cAAc,GACZ,OAAO,CAKnB;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;;MAKC;IAED;;;aAQC;CAcJ;;;;oBAvEmB,qCAAqC;uBADlC,wCAAwC"}
@@ -16,18 +16,13 @@ class ClingToTerrain {
16
16
  * @type {Quaternion}
17
17
  */
18
18
  __lastRotation = new Quaternion(0, 0, 0, 1);
19
+
19
20
  /**
20
21
  * Speed in Rad/s (Radians/second) by which rotation can change
21
22
  * @type {number}
22
23
  */
23
24
  rotationSpeed = 3;
24
25
 
25
- constructor(opt) {
26
- if (opt !== undefined) {
27
- throw new Error("constructor options deprecated");
28
- }
29
- }
30
-
31
26
  /**
32
27
  *
33
28
  * @param {ClingToTerrain} other
@@ -11,10 +11,6 @@ export default ClingToTerrainSystem;
11
11
  import Quaternion from "../../../../../core/geom/Quaternion.js";
12
12
  import Vector3 from '../../../../../core/geom/Vector3.js';
13
13
  declare class ClingToTerrainSystem extends System<any, any, any, any, any> {
14
- /**
15
- *
16
- * @constructor
17
- */
18
14
  constructor();
19
15
  dependencies: (typeof Transform | typeof ClingToTerrain)[];
20
16
  components_used: (ResourceAccessSpecification<typeof Transform> | ResourceAccessSpecification<typeof Terrain>)[];
@@ -29,7 +25,11 @@ declare class ClingToTerrainSystem extends System<any, any, any, any, any> {
29
25
  * @type {number}
30
26
  */
31
27
  updateBatchLimit: number;
32
- requestUpdate(entity: any): void;
28
+ /**
29
+ *
30
+ * @param {number} entity
31
+ */
32
+ requestUpdate(entity: number): void;
33
33
  /**
34
34
  *
35
35
  * @param {Transform} transform
@@ -1 +1 @@
1
- {"version":3,"file":"ClingToTerrainSystem.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.js"],"names":[],"mappings":"AAmMA;;;;;;;GAOG;AACH,wCANW,UAAU,aACV,OAAO,gBACP,MAAM,yCAgDhB;;uBAnPsB,wCAAwC;oBAE3C,qCAAqC;AAyCzD;IACI;;;OAGG;IACH,cA8BC;IA3BG,2DAA+C;IAG/C,iHAGC;IAQD;;;OAGG;IACH,aAFU,MAAM,MAAM,CAAC,CAEO;IAE9B,YAAc;IAEd;;;OAGG;IACH,kBAFU,MAAM,CAE4B;IAGhD,iCAKC;IAED;;;;;OAKG;IACH,YAHW,cAAc,aADd,SAAS,uBAkBnB;IAED;;;;;OAKG;IACH,cAHW,cAAc,aADd,SAAS,uBAkBnB;IAED,6BAiDC;CACJ;uBA7KsB,oBAAoB;0BACjB,iCAAiC;2BAIhC,qBAAqB;4CANJ,0DAA0D;oBAIlF,eAAe;sBAbb,+CAA+C"}
1
+ {"version":3,"file":"ClingToTerrainSystem.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.js"],"names":[],"mappings":"AA2LA;;;;;;;GAOG;AACH,wCANW,UAAU,aACV,OAAO,gBACP,MAAM,yCAgDhB;;uBA3OsB,wCAAwC;oBAE3C,qCAAqC;AAyCzD;IA5CmB,cAAmB;IA+ClC,2DAA2C;IAG3C,iHAGE;IAEF;;;OAGG;IACH,aAFU,MAAM,MAAM,CAAC,CAEG;IAE1B,YAAU;IAEV;;;OAGG;IACH,kBAFU,MAAM,CAEwB;IAExC;;;OAGG;IACH,sBAFW,MAAM,QAOhB;IAED;;;;;OAKG;IACH,YAHW,cAAc,aADd,SAAS,uBAkBnB;IAED;;;;;OAKG;IACH,cAHW,cAAc,aADd,SAAS,uBAkBnB;IAED,6BAiDC;CACJ;uBArKsB,oBAAoB;0BACjB,iCAAiC;2BAIhC,qBAAqB;4CANJ,0DAA0D;oBAIlF,eAAe;sBAbb,+CAA+C"}
@@ -46,42 +46,34 @@ function deregister(datum) {
46
46
  const DEFAULT_UPDATE_LIMIT = 1024;
47
47
 
48
48
  class ClingToTerrainSystem extends System {
49
- /**
50
- *
51
- * @constructor
52
- */
53
- constructor() {
54
- super();
55
49
 
56
- this.dependencies = [ClingToTerrain, Transform];
57
50
 
51
+ dependencies = [ClingToTerrain, Transform];
58
52
 
59
- this.components_used = [
60
- ResourceAccessSpecification.from(Transform, ResourceAccessKind.Read | ResourceAccessKind.Write),
61
- ResourceAccessSpecification.from(Terrain, ResourceAccessKind.Read)
62
- ];
63
53
 
64
- /**
65
- *
66
- * @type {EntityManager|null}
67
- */
68
- this.entityManager = null;
54
+ components_used = [
55
+ ResourceAccessSpecification.from(Transform, ResourceAccessKind.Read | ResourceAccessKind.Write),
56
+ ResourceAccessSpecification.from(Terrain, ResourceAccessKind.Read)
57
+ ];
69
58
 
70
- /**
71
- *
72
- * @type {Deque<number>}
73
- */
74
- this.updateQueue = new Deque();
59
+ /**
60
+ *
61
+ * @type {Deque<number>}
62
+ */
63
+ updateQueue = new Deque();
75
64
 
76
- this.data = [];
65
+ data = [];
77
66
 
78
- /**
79
- * How many entities can be updated in a single tick, this is useful for performance optimization, if you have a large number of entities that need to be updated, updates can be executed over several ticks
80
- * @type {number}
81
- */
82
- this.updateBatchLimit = DEFAULT_UPDATE_LIMIT;
83
- }
67
+ /**
68
+ * How many entities can be updated in a single tick, this is useful for performance optimization, if you have a large number of entities that need to be updated, updates can be executed over several ticks
69
+ * @type {number}
70
+ */
71
+ updateBatchLimit = DEFAULT_UPDATE_LIMIT;
84
72
 
73
+ /**
74
+ *
75
+ * @param {number} entity
76
+ */
85
77
  requestUpdate(entity) {
86
78
  if (!this.updateQueue.has(entity)) {
87
79
  //queue up update
@@ -1 +1 @@
1
- {"version":3,"file":"TerrainLayer.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/terrain/ecs/layers/TerrainLayer.js"],"names":[],"mappings":"AA2BA;IA+CI;;;;;OAKG;IACH,iBAJW,MAAM,SACN,MAAM,UACN,MAAM,gBAShB;IAED;;;;OAIG;IACH,oDAFa,YAAY,CAQxB;IAvED;;;OAGG;IACH,0BAAuB;IAEvB;;;OAGG;IACH,SAFU,SAAS,CAEgB;IAEnC;;;OAGG;IACH,MAFU,OAAO,CAEQ;IAEzB;;;OAGG;IACH,WAAW;IAEX;;;OAGG;IACH,WAFU,MAAM,CAES;IAGzB;;;;MAMC;IAED;;;;aAIC;IA8BD;;;;OAIG;IACH,0DAwDC;IAGL;;;OAGG;IACH,yBAFU,OAAO,CAEoB;CANpC;0BA7JyB,mDAAmD;oBALzD,qCAAqC;mBADtC,6CAA6C"}
1
+ {"version":3,"file":"TerrainLayer.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/terrain/ecs/layers/TerrainLayer.js"],"names":[],"mappings":"AA2BA;IA+CI;;;;;OAKG;IACH,iBAJW,MAAM,SACN,MAAM,UACN,MAAM,gBAShB;IAED;;;;OAIG;IACH,oDAFa,YAAY,CAQxB;IAvED;;;OAGG;IACH,0BAAuB;IAEvB;;;OAGG;IACH,SAFU,SAAS,CAEgB;IAEnC;;;OAGG;IACH,MAFU,OAAO,CAEQ;IAEzB;;;OAGG;IACH,WAAW;IAEX;;;OAGG;IACH,WAFU,MAAM,CAES;IAGzB;;;;MAMC;IAED;;;;aAIC;IA8BD;;;;OAIG;IACH,0DAwDC;IAGL;;;OAGG;IACH,yBAFU,OAAO,CAEoB;CANpC;0BA9JyB,mDAAmD;oBAJzD,qCAAqC;mBADtC,6CAA6C"}
@@ -4,8 +4,8 @@ import Vector2 from "../../../../../core/geom/Vector2.js";
4
4
  import { computeStringHash } from "../../../../../core/primitives/strings/computeStringHash.js";
5
5
  import { string_compute_byte_size } from "../../../../../core/primitives/strings/string_compute_byte_size.js";
6
6
  import { GameAssetType } from "../../../../asset/GameAssetType.js";
7
- import { copy_Sampler2D_channel_data } from "../../../../graphics/texture/sampler/copy_Sampler2D_channel_data.js";
8
7
  import { Sampler2D } from "../../../../graphics/texture/sampler/Sampler2D.js";
8
+ import { sampler2d_transfer_data } from "../../../../graphics/texture/sampler/sampler2d_transfer_data.js";
9
9
 
10
10
  /**
11
11
  *
@@ -149,7 +149,7 @@ export class TerrainLayer {
149
149
 
150
150
  const source = new Sampler2D(source_data, source_item_size, image.width, image.height);
151
151
 
152
- copy_Sampler2D_channel_data(source, this.diffuse);
152
+ sampler2d_transfer_data(source, this.diffuse);
153
153
 
154
154
  this.onChanged.send0();
155
155
 
@@ -1 +1 @@
1
- {"version":3,"file":"TerrainTile.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/terrain/tiles/TerrainTile.js"],"names":[],"mappings":";AAgCA;;GAEG;AACH;IACI,sBAA6B;IAC7B,eAA0B;IAC1B,cAAqB;IACrB,kBAAyB;IACzB,4BAAoC;IAEpC;;;OAGG;IACH,mBAAgB;IAChB,uGAAiE;IAGjE;;;OAGG;IACH,UAFU,MAAM,cAAc,CAEd;IAEhB;;;OAGG;IACH,WAFU,OAAO,CAEA;IAEjB;;;OAGG;IACH,cAFU,SAAS,CAEY;IAE/B;;;OAGG;IACH,KAFU,eAAe,CAEd;IAEX;;;OAGG;IACH,SAFU,OAAO,CAED;IAChB;;;OAGG;IACH,mBAFU,OAAO,CAES;IAC1B,uBAAmB;IAEnB;;;OAGG;IACH,SAFU,OAAO,WAAW,CAAC,CAEN;IACvB,4DAA2B;IAE3B;;;;OAIG;IACH,kBAWE;IAEF;;;;;OAKG;IACH,+BAAiG;IAEjG;;;OAGG;IACH,SAFU,MAAM,CAEJ;IAqBZ;;;OAGG;IACH,6BAGC;IAfD;;;OAGG;IACH,0BAEC;IAWD;;;;;;;;;;OAUG;IACH,yBATW,aAAa,WACb,MAAM,WACN,MAAM,WACN,MAAM,cACN,MAAM,cACN,MAAM,cACN,MAAM,GACL,OAAO,CAkDlB;IAED,+CAKC;IAED,8CAOC;IAED;;;;;;;;;;OAUG;IACH,mBATW,WAAW,GAAC,SAAS,UACrB,WAAW,GAAC,SAAS,QACrB,WAAW,GAAC,SAAS,SACrB,WAAW,GAAC,SAAS,WACrB,WAAW,GAAC,SAAS,YACrB,WAAW,GAAC,SAAS,cACrB,WAAW,GAAC,SAAS,eACrB,WAAW,GAAC,SAAS,QAsN/B;IAED,2BAiFC;IAED;;;;OAIG;IACH,mCAHW,MAAM,cACN,MAAM,QAIhB;IAED,gBAYC;IAED;;;;OAIG;IACH,gBAHW;QAAC,QAAQ,CAAC;QAAC,GAAG,CAAC,EAAC;YAAC,UAAU,EAAC,MAAM,CAAC;YAAC,IAAI,EAAC,WAAW,CAAA;SAAC,CAAA;KAAC,QAoDhE;CACJ;oBAvlBmB,kCAAkC;4BAG1B,2CAA2C;sDAZhE,OAAO;0BAEY,yCAAyC;gCADnC,mDAAmD;mBAGhE,0CAA0C;8BAI/B,2CAA2C"}
1
+ {"version":3,"file":"TerrainTile.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/terrain/tiles/TerrainTile.js"],"names":[],"mappings":";AAgCA;;GAEG;AACH;IACI,sBAA6B;IAC7B,eAA0B;IAC1B,cAAyB;IACzB,kBAAyB;IACzB,4BAAoC;IAEpC;;;OAGG;IACH,mBAAgB;IAChB,uGAAiE;IAGjE;;;OAGG;IACH,UAFU,MAAM,cAAc,CAEd;IAEhB;;;OAGG;IACH,WAFU,OAAO,CAEA;IAEjB;;;OAGG;IACH,cAFU,SAAS,CAEY;IAE/B;;;OAGG;IACH,KAFU,eAAe,CAEd;IAEX;;;OAGG;IACH,SAFU,OAAO,CAED;IAChB;;;OAGG;IACH,mBAFU,OAAO,CAES;IAC1B,uBAAmB;IAEnB;;;OAGG;IACH,SAFU,OAAO,WAAW,CAAC,CAEN;IACvB,4DAA2B;IAE3B;;;;OAIG;IACH,kBAWE;IAEF;;;;;OAKG;IACH,+BAAiG;IAEjG;;;OAGG;IACH,SAFU,MAAM,CAEJ;IAqBZ;;;OAGG;IACH,6BAGC;IAfD;;;OAGG;IACH,0BAEC;IAWD;;;;;;;;;;OAUG;IACH,yBATW,aAAa,WACb,MAAM,WACN,MAAM,WACN,MAAM,cACN,MAAM,cACN,MAAM,cACN,MAAM,GACL,OAAO,CAkDlB;IAED,+CAKC;IAED,8CAOC;IAED;;;;;;;;;;OAUG;IACH,mBATW,WAAW,GAAC,SAAS,UACrB,WAAW,GAAC,SAAS,QACrB,WAAW,GAAC,SAAS,SACrB,WAAW,GAAC,SAAS,WACrB,WAAW,GAAC,SAAS,YACrB,WAAW,GAAC,SAAS,cACrB,WAAW,GAAC,SAAS,eACrB,WAAW,GAAC,SAAS,QAsN/B;IAED,2BAmFC;IAED;;;;OAIG;IACH,mCAHW,MAAM,cACN,MAAM,QAIhB;IAED,gBAYC;IAED;;;;OAIG;IACH,gBAHW;QAAC,QAAQ,CAAC;QAAC,GAAG,CAAC,EAAC;YAAC,UAAU,EAAC,MAAM,CAAC;YAAC,IAAI,EAAC,WAAW,CAAA;SAAC,CAAA;KAAC,QAoDhE;CACJ;oBAzlBmB,kCAAkC;4BAG1B,2CAA2C;sDAZhE,OAAO;0BAEY,yCAAyC;gCADnC,mDAAmD;mBAGhE,0CAA0C;8BAI/B,2CAA2C"}
@@ -36,7 +36,7 @@ const m4_tmp = [];
36
36
  class TerrainTile {
37
37
  gridPosition = new Vector2();
38
38
  scale = new Vector2(1, 1);
39
- size = new Vector2();
39
+ size = new Vector2(1, 1);
40
40
  position = new Vector2();
41
41
  resolution = new ObservedInteger(1);
42
42
 
@@ -506,6 +506,7 @@ class TerrainTile {
506
506
 
507
507
  geometry.boundingSphere = new ThreeSphere(center, radius);
508
508
  }
509
+
509
510
  //pull bounding box from geometry
510
511
 
511
512
  bb = geometry.boundingBox;
@@ -513,6 +514,7 @@ class TerrainTile {
513
514
  geometry.computeBoundingBox();
514
515
  bb = geometry.boundingBox;
515
516
  }
517
+
516
518
  }
517
519
 
518
520
  const x0 = bb.min.x;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  *
3
3
  * @param {SMikkTSpaceContext} pContext
4
- * @param {number} fAngularThreshold
4
+ * @param {number} [fAngularThreshold]
5
5
  * @return {boolean}
6
6
  */
7
7
  export function genTangSpace(pContext: SMikkTSpaceContext, fAngularThreshold?: number): boolean;
@@ -1,19 +1,19 @@
1
1
  import { vec3 } from "gl-matrix";
2
- import { m_setTSpace } from "./m_setTSpace.js";
3
- import { GetPosition } from "./GetPosition.js";
4
- import { malloc } from "./malloc.js";
5
- import { STSpace } from "./STSpace.js";
2
+ import { v3_allocate } from "../../../../core/geom/vec3/v3_allocate.js";
3
+ import { DEG_TO_RAD } from "../../../../core/math/DEG_TO_RAD.js";
4
+ import { Build4RuleGroups } from "./Build4RuleGroups.js";
6
5
  import { MARK_DEGENERATE } from "./constants/MARK_DEGENERATE.js";
7
- import { InitTriInfo } from "./InitTriInfo.js";
8
- import { GenerateTSpaces } from "./GenerateTSpaces.js";
9
6
  import { DegenEpilogue } from "./DegenEpilogue.js";
10
- import { Build4RuleGroups } from "./Build4RuleGroups.js";
11
- import { v3_allocate } from "../../../../core/geom/vec3/v3_allocate.js";
12
- import { m_getNumFaces } from "./m_getNumFaces.js";
13
- import { GenerateInitialVerticesIndexList } from "./GenerateInitialVerticesIndexList.js";
14
7
  import { DegenPrologue } from "./DegenPrologue.js";
8
+ import { GenerateInitialVerticesIndexList } from "./GenerateInitialVerticesIndexList.js";
15
9
  import { GenerateSharedVerticesIndexList } from "./GenerateSharedVerticesIndexList.js";
16
- import { DEG_TO_RAD } from "../../../../core/math/DEG_TO_RAD.js";
10
+ import { GenerateTSpaces } from "./GenerateTSpaces.js";
11
+ import { GetPosition } from "./GetPosition.js";
12
+ import { InitTriInfo } from "./InitTriInfo.js";
13
+ import { m_getNumFaces } from "./m_getNumFaces.js";
14
+ import { m_setTSpace } from "./m_setTSpace.js";
15
+ import { malloc } from "./malloc.js";
16
+ import { STSpace } from "./STSpace.js";
17
17
 
18
18
 
19
19
  /*
@@ -158,7 +158,7 @@ export class SMikkTSpaceContext {
158
158
  /**
159
159
  *
160
160
  * @param {SMikkTSpaceContext} pContext
161
- * @param {number} fAngularThreshold
161
+ * @param {number} [fAngularThreshold]
162
162
  * @return {boolean}
163
163
  */
164
164
  export function genTangSpace(pContext, fAngularThreshold = 180) {
@@ -1 +1 @@
1
- {"version":3,"file":"STSpace.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/MikkT/STSpace.js"],"names":[],"mappings":";AAGA;IAEQ;;;OAGG;IACH,KAFU,IAAI,GAAC,YAAY,CAEH;IACxB;;;OAGG;IACH,KAFU,IAAI,GAAC,YAAY,CAEH;IAExB,cAAc;IACd,cAAc;IAEd,iBAAiB;IACjB,iBAAoB;IAGxB;;;OAGG;IACH,YAFW,OAAO,QASjB;CACJ;qBAnCoB,WAAW"}
1
+ {"version":3,"file":"STSpace.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/MikkT/STSpace.js"],"names":[],"mappings":";AAGA;IACI;;;OAGG;IACH,KAFU,IAAI,GAAC,YAAY,CAEP;IACpB;;;OAGG;IACH,KAFU,IAAI,GAAC,YAAY,CAEP;IAEpB,cAAU;IACV,cAAU;IAEV,iBAAa;IACb,iBAAgB;IAEhB;;;OAGG;IACH,YAFW,OAAO,QASjB;CACJ;qBAjCoB,WAAW"}
@@ -2,24 +2,22 @@ import { vec3 } from "gl-matrix";
2
2
  import { v3_allocate } from "../../../../core/geom/vec3/v3_allocate.js";
3
3
 
4
4
  export class STSpace {
5
- constructor() {
6
- /**
7
- *
8
- * @type {vec3|Float32Array}
9
- */
10
- this.vOs = v3_allocate();
11
- /**
12
- *
13
- * @type {vec3|Float32Array}
14
- */
15
- this.vOt = v3_allocate();
5
+ /**
6
+ *
7
+ * @type {vec3|Float32Array}
8
+ */
9
+ vOs = v3_allocate();
10
+ /**
11
+ *
12
+ * @type {vec3|Float32Array}
13
+ */
14
+ vOt = v3_allocate();
16
15
 
17
- this.fMagS = 0;
18
- this.fMagT = 0;
16
+ fMagS = 0;
17
+ fMagT = 0;
19
18
 
20
- this.iCounter = 0; // this is to average back into quads.
21
- this.bOrient = false;
22
- }
19
+ iCounter = 0; // this is to average back into quads.
20
+ bOrient = false;
23
21
 
24
22
  /**
25
23
  *
@@ -0,0 +1,17 @@
1
+ /**
2
+ *
3
+ * @param {Sampler2D} samplerHeight
4
+ * @param {Vector2} position
5
+ * @param {Vector2} size
6
+ * @param {Vector2} scale
7
+ * @param {Vector2} totalSize
8
+ * @param {number} resolution
9
+ * @returns {{indices, vertices: Float32Array, normals: Float32Array, uvs: Float32Array}}
10
+ */
11
+ export function build_height_field_geometry(samplerHeight: Sampler2D, position: Vector2, size: Vector2, scale: Vector2, totalSize: Vector2, resolution: number): {
12
+ indices: any;
13
+ vertices: Float32Array;
14
+ normals: Float32Array;
15
+ uvs: Float32Array;
16
+ };
17
+ //# sourceMappingURL=build_height_field_geometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build_height_field_geometry.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/buffered/build_height_field_geometry.js"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,wJAHW,MAAM;;cACgB,YAAY;aAAW,YAAY;SAAO,YAAY;EA0GtF"}
@@ -0,0 +1,118 @@
1
+ import { UintArrayForCount } from "../../../../core/collection/array/typed/uint_array_for_count.js";
2
+ import { geometry_compute_vertex_normals_indexed } from "./geometry_compute_vertex_normals_indexed.js";
3
+
4
+ /**
5
+ *
6
+ * @param {Sampler2D} samplerHeight
7
+ * @param {Vector2} position
8
+ * @param {Vector2} size
9
+ * @param {Vector2} scale
10
+ * @param {Vector2} totalSize
11
+ * @param {number} resolution
12
+ * @returns {{indices, vertices: Float32Array, normals: Float32Array, uvs: Float32Array}}
13
+ */
14
+ export function build_height_field_geometry(samplerHeight, position, size, scale, totalSize, resolution) {
15
+
16
+ const width = size.x;
17
+ const height = size.y;
18
+
19
+
20
+ const gridX1 = width * resolution;
21
+ const gridY1 = height * resolution;
22
+
23
+ const gridX2 = gridX1 - 1;
24
+ const gridY2 = gridY1 - 1;
25
+
26
+ let offset = 0, offset2 = 0;
27
+
28
+ const vertexCount = gridX1 * gridY1;
29
+
30
+
31
+ const vertices = new Float32Array(vertexCount * 3);
32
+
33
+ const normals = new Float32Array(vertexCount * 3);
34
+
35
+ const uvs = new Float32Array(vertexCount * 2);
36
+
37
+ let y, x;
38
+
39
+ const vMultiplier = (size.y / totalSize.y) / gridY2;
40
+ const uMultiplier = (size.x / totalSize.x) / gridX2;
41
+
42
+ const vConst = position.y / totalSize.y;
43
+ const uConst = position.x / totalSize.x;
44
+
45
+ const totalScaledSizeX = totalSize.x * scale.x;
46
+ const totalScaledSizeY = totalSize.y * scale.y;
47
+
48
+ //fill vertices
49
+ let px, py, pz;
50
+ for (y = 0; y < gridY1; y++) {
51
+
52
+ const v = y * vMultiplier + vConst;
53
+
54
+ pz = v * totalScaledSizeY;
55
+
56
+ for (x = 0; x < gridX1; x++) {
57
+
58
+ const u = x * uMultiplier + uConst;
59
+
60
+ //get height sample
61
+ const val = samplerHeight.sampleChannelBicubicUV(u, v, 0);
62
+
63
+ px = u * totalScaledSizeX;
64
+ py = val;
65
+
66
+ vertices[offset] = px;
67
+ vertices[offset + 1] = py;
68
+ vertices[offset + 2] = pz;
69
+
70
+ uvs[offset2] = u;
71
+ uvs[offset2 + 1] = v;
72
+
73
+ offset += 3;
74
+ offset2 += 2;
75
+ }
76
+ }
77
+
78
+ offset = 0;
79
+
80
+ const IndexArray = UintArrayForCount(vertices.length / 3);
81
+
82
+ /**
83
+ * @type {Uint8Array|Uint16Array|Uint32Array}
84
+ */
85
+ const indices = new IndexArray(gridX2 * gridY2 * 6);
86
+
87
+ //add faces
88
+ //TODO TraingleStip mode is more efficient in terms of memory usage and probably GPU-time
89
+ for (y = 0; y < gridY2; y++) {
90
+
91
+ for (x = 0; x < gridX2; x++) {
92
+ const a = x + gridX1 * y;
93
+ const b = x + gridX1 * (y + 1);
94
+ const c = (x + 1) + gridX1 * (y + 1);
95
+ const d = (x + 1) + gridX1 * y;
96
+
97
+ indices[offset] = a;
98
+ indices[offset + 1] = b;
99
+ indices[offset + 2] = d;
100
+
101
+ indices[offset + 3] = b;
102
+ indices[offset + 4] = c;
103
+ indices[offset + 5] = d;
104
+
105
+ offset += 6;
106
+ }
107
+ }
108
+
109
+ geometry_compute_vertex_normals_indexed(vertices, normals, indices);
110
+
111
+ //CleanupGeometry(geometry);
112
+ return {
113
+ indices: indices,
114
+ vertices: vertices,
115
+ normals: normals,
116
+ uvs: uvs
117
+ };
118
+ }
@@ -3,7 +3,7 @@
3
3
  * Prior to calling this function, normals need to be set to 0
4
4
  * @param {Array.<number>|Float32Array} positions
5
5
  * @param {Array.<number>|Float32Array} normals
6
- * @param {Array.<number>|Uint32Array} indices
6
+ * @param {Array.<number>|Uint32Array|Uint16Array|Uint8Array} indices
7
7
  */
8
- export function geometry_compute_vertex_normals_indexed(positions: Array<number> | Float32Array, normals: Array<number> | Float32Array, indices: Array<number> | Uint32Array): void;
8
+ export function geometry_compute_vertex_normals_indexed(positions: Array<number> | Float32Array, normals: Array<number> | Float32Array, indices: Array<number> | Uint32Array | Uint16Array | Uint8Array): void;
9
9
  //# sourceMappingURL=geometry_compute_vertex_normals_indexed.d.ts.map