@woosh/meep-engine 2.118.9 → 2.118.12

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 (104) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/build/meep.cjs +209 -266
  3. package/build/meep.min.js +1 -1
  4. package/build/meep.module.js +209 -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 +13 -11
  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/array/typed/array_buffer_copy.js +2 -2
  19. package/src/core/collection/array/typed/typed_array_copy.d.ts.map +1 -1
  20. package/src/core/collection/array/typed/typed_array_copy.js +16 -0
  21. package/src/core/collection/queue/Deque.d.ts.map +1 -1
  22. package/src/core/collection/queue/Deque.js +1 -1
  23. package/src/core/geom/3d/aabb/AABB3.d.ts.map +1 -1
  24. package/src/core/geom/3d/aabb/AABB3.js +0 -8
  25. package/src/core/geom/3d/aabb/aabb3_compute_surface_area.js +1 -3
  26. package/src/core/geom/3d/morton/{Morton.d.ts → v3_morton_encode.d.ts} +1 -1
  27. package/src/core/geom/3d/morton/v3_morton_encode.d.ts.map +1 -0
  28. package/src/core/geom/3d/morton/v3_morton_encode_bounded.js +2 -2
  29. package/src/core/geom/3d/morton/v3_morton_encode_transformed.js +2 -2
  30. package/src/core/geom/Quaternion.d.ts.map +1 -1
  31. package/src/core/geom/Quaternion.js +7 -10
  32. package/src/core/geom/Vector3.d.ts.map +1 -1
  33. package/src/core/geom/Vector3.js +4 -49
  34. package/src/core/math/sinc.d.ts +8 -0
  35. package/src/core/math/sinc.d.ts.map +1 -0
  36. package/src/core/math/sinc.js +13 -0
  37. package/src/core/process/worker/WorkerProxy.d.ts +12 -3
  38. package/src/core/process/worker/WorkerProxy.d.ts.map +1 -1
  39. package/src/core/process/worker/WorkerProxy.js +10 -1
  40. package/src/engine/ecs/terrain/BufferedGeometryArraysBuilder.d.ts +2 -17
  41. package/src/engine/ecs/terrain/BufferedGeometryArraysBuilder.d.ts.map +1 -1
  42. package/src/engine/ecs/terrain/BufferedGeometryArraysBuilder.js +2 -118
  43. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrain.d.ts +0 -1
  44. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrain.d.ts.map +1 -1
  45. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrain.js +1 -6
  46. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.d.ts +5 -5
  47. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.d.ts.map +1 -1
  48. package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.js +20 -28
  49. package/src/engine/ecs/terrain/ecs/layers/TerrainLayer.d.ts.map +1 -1
  50. package/src/engine/ecs/terrain/ecs/layers/TerrainLayer.js +2 -2
  51. package/src/engine/ecs/terrain/tiles/TerrainTile.d.ts.map +1 -1
  52. package/src/engine/ecs/terrain/tiles/TerrainTile.js +3 -1
  53. package/src/engine/graphics/geometry/MikkT/MikkTSpace.d.ts +1 -1
  54. package/src/engine/graphics/geometry/MikkT/MikkTSpace.js +12 -12
  55. package/src/engine/graphics/geometry/MikkT/STSpace.d.ts.map +1 -1
  56. package/src/engine/graphics/geometry/MikkT/STSpace.js +14 -16
  57. package/src/engine/graphics/geometry/buffered/build_height_field_geometry.d.ts +17 -0
  58. package/src/engine/graphics/geometry/buffered/build_height_field_geometry.d.ts.map +1 -0
  59. package/src/engine/graphics/geometry/buffered/build_height_field_geometry.js +118 -0
  60. package/src/engine/graphics/geometry/buffered/geometry_compute_vertex_normals_indexed.d.ts +2 -2
  61. package/src/engine/graphics/geometry/buffered/geometry_compute_vertex_normals_indexed.d.ts.map +1 -1
  62. package/src/engine/graphics/geometry/buffered/geometry_compute_vertex_normals_indexed.js +1 -1
  63. package/src/engine/graphics/geometry/optimization/VertexCacheOptimizer.d.ts.map +1 -1
  64. package/src/engine/graphics/geometry/optimization/VertexCacheOptimizer.js +36 -22
  65. package/src/engine/graphics/material/optimization/MaterialOptimizationContext.d.ts.map +1 -1
  66. package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +2 -2
  67. package/src/engine/graphics/render/forward_plus/materials/FPlusDebugMaterial.js +3 -3
  68. package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
  69. package/src/engine/graphics/texture/sampler/Sampler2D.js +31 -52
  70. package/src/engine/graphics/texture/sampler/sampler2d_to_texture.d.ts +10 -0
  71. package/src/engine/graphics/texture/sampler/sampler2d_to_texture.d.ts.map +1 -0
  72. package/src/engine/graphics/texture/sampler/{Sampler2D2Texture.js → sampler2d_to_texture.js} +5 -5
  73. package/src/engine/graphics/texture/sampler/{copy_Sampler2D_channel_data.d.ts → sampler2d_transfer_data.d.ts} +2 -2
  74. package/src/engine/graphics/texture/sampler/sampler2d_transfer_data.d.ts.map +1 -0
  75. package/src/engine/graphics/texture/sampler/{copy_Sampler2D_channel_data.js → sampler2d_transfer_data.js} +1 -1
  76. package/src/engine/graphics/texture/sampler/writeSampler2DDataToDataTexture.js +2 -2
  77. package/src/engine/graphics/trail/x/simulator/RibbonXFixedPhysicsSimulator.d.ts.map +1 -1
  78. package/src/engine/graphics/trail/x/simulator/RibbonXFixedPhysicsSimulator.js +0 -3
  79. package/src/engine/intelligence/behavior/selector/WeightedElement.d.ts +6 -3
  80. package/src/engine/intelligence/behavior/selector/WeightedElement.d.ts.map +1 -1
  81. package/src/engine/intelligence/behavior/selector/WeightedElement.js +9 -12
  82. package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.d.ts +1 -1
  83. package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.d.ts.map +1 -1
  84. package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.js +20 -23
  85. package/src/engine/intelligence/mcts/StateNode.d.ts.map +1 -1
  86. package/src/engine/intelligence/mcts/StateNode.js +76 -102
  87. package/src/engine/logging/Logger.d.ts.map +1 -1
  88. package/src/engine/logging/Logger.js +7 -9
  89. package/src/engine/logging/LoggerBackend.d.ts.map +1 -1
  90. package/src/engine/logging/LoggerBackend.js +7 -7
  91. package/src/core/geom/3d/morton/Morton.d.ts.map +0 -1
  92. package/src/engine/graphics/geometry/MikkT/m_getNumVerticesOfFace.d.ts +0 -9
  93. package/src/engine/graphics/geometry/MikkT/m_getNumVerticesOfFace.d.ts.map +0 -1
  94. package/src/engine/graphics/geometry/MikkT/m_getNumVerticesOfFace.js +0 -11
  95. package/src/engine/graphics/geometry/MikkT/m_getPosition.d.ts +0 -14
  96. package/src/engine/graphics/geometry/MikkT/m_getPosition.d.ts.map +0 -1
  97. package/src/engine/graphics/geometry/MikkT/m_getPosition.js +0 -20
  98. package/src/engine/graphics/geometry/MikkT/m_setTSpaceBasic.d.ts +0 -21
  99. package/src/engine/graphics/geometry/MikkT/m_setTSpaceBasic.d.ts.map +0 -1
  100. package/src/engine/graphics/geometry/MikkT/m_setTSpaceBasic.js +0 -22
  101. package/src/engine/graphics/texture/sampler/Sampler2D2Texture.d.ts +0 -10
  102. package/src/engine/graphics/texture/sampler/Sampler2D2Texture.d.ts.map +0 -1
  103. package/src/engine/graphics/texture/sampler/copy_Sampler2D_channel_data.d.ts.map +0 -1
  104. /package/src/core/geom/3d/morton/{Morton.js → v3_morton_encode.js} +0 -0
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"geometry_compute_vertex_normals_indexed.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/buffered/geometry_compute_vertex_normals_indexed.js"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,mEAJW,MAAO,MAAM,CAAC,GAAC,YAAY,WAC3B,MAAO,MAAM,CAAC,GAAC,YAAY,WAC3B,MAAO,MAAM,CAAC,GAAC,WAAW,QAgCpC"}
1
+ {"version":3,"file":"geometry_compute_vertex_normals_indexed.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/buffered/geometry_compute_vertex_normals_indexed.js"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,mEAJW,MAAO,MAAM,CAAC,GAAC,YAAY,WAC3B,MAAO,MAAM,CAAC,GAAC,YAAY,WAC3B,MAAO,MAAM,CAAC,GAAC,WAAW,GAAC,WAAW,GAAC,UAAU,QAgC3D"}
@@ -9,7 +9,7 @@ const scratch_v3 = new Float64Array(3);
9
9
  * Prior to calling this function, normals need to be set to 0
10
10
  * @param {Array.<number>|Float32Array} positions
11
11
  * @param {Array.<number>|Float32Array} normals
12
- * @param {Array.<number>|Uint32Array} indices
12
+ * @param {Array.<number>|Uint32Array|Uint16Array|Uint8Array} indices
13
13
  */
14
14
  export function geometry_compute_vertex_normals_indexed(
15
15
  positions,
@@ -1 +1 @@
1
- {"version":3,"file":"VertexCacheOptimizer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/optimization/VertexCacheOptimizer.js"],"names":[],"mappings":"AAgaA;;;;;;GAMG;AACH,yDALW,MAAM,EAAE,GAAC,WAAW,WACpB,MAAM,EAAE,GAAC,WAAW,eACpB,MAAM,gBACN,MAAM,QAIhB;AAED;;;;;;GAMG;AACH,8DALW,MAAM,EAAE,GAAC,WAAW,WACpB,MAAM,EAAE,GAAC,WAAW,eACpB,MAAM,gBACN,MAAM,QAIhB"}
1
+ {"version":3,"file":"VertexCacheOptimizer.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/optimization/VertexCacheOptimizer.js"],"names":[],"mappings":"AA8aA;;;;;;GAMG;AACH,yDALW,MAAM,EAAE,GAAC,WAAW,WACpB,MAAM,EAAE,GAAC,WAAW,eACpB,MAAM,gBACN,MAAM,QAIhB;AAED;;;;;;GAMG;AACH,8DALW,MAAM,EAAE,GAAC,WAAW,WACpB,MAAM,EAAE,GAAC,WAAW,eACpB,MAAM,gBACN,MAAM,QAIhB"}
@@ -8,10 +8,9 @@ const kCacheSizeMax = 16;
8
8
  const kValenceMax = 8;
9
9
 
10
10
  class VertexScoreTable {
11
- constructor() {
12
- this.cache = new Float32Array(1 + kCacheSizeMax);
13
- this.live = new Float32Array(1 + kValenceMax);
14
- }
11
+
12
+ cache = new Float32Array(1 + kCacheSizeMax);
13
+ live = new Float32Array(1 + kValenceMax);
15
14
 
16
15
  /**
17
16
  *
@@ -42,11 +41,10 @@ const kVertexScoreTableStrip = VertexScoreTable.from(
42
41
  );
43
42
 
44
43
  class TriangleAdjacency {
45
- constructor() {
46
- this.counts = new Uint32Array(1);
47
- this.offsets = new Uint32Array(1);
48
- this.data = new Uint32Array(1);
49
- }
44
+
45
+ counts = new Uint32Array(1);
46
+ offsets = new Uint32Array(1);
47
+ data = new Uint32Array(1);
50
48
 
51
49
  /**
52
50
  *
@@ -76,42 +74,48 @@ function buildTriangleAdjacency(adjacency, indices, index_count, vertex_count) {
76
74
  // fill triangle counts
77
75
  // adjacency.counts.fill(0);// unnecessary, new arrays are already zero-filled
78
76
 
77
+ const adjacency_counts = adjacency.counts;
78
+
79
79
  for (let i = 0; i < index_count; ++i) {
80
80
  const index = indices[i];
81
81
 
82
82
  assert.lessThan(index, vertex_count);
83
83
 
84
- adjacency.counts[index]++;
84
+ adjacency_counts[index]++;
85
85
  }
86
86
 
87
87
  // fill offset table
88
88
  let offset = 0;
89
89
 
90
+ const adjacency_offsets = adjacency.offsets;
91
+
90
92
  for (let i = 0; i < vertex_count; ++i) {
91
- adjacency.offsets[i] = offset;
92
- offset += adjacency.counts[i];
93
+ adjacency_offsets[i] = offset;
94
+ offset += adjacency_counts[i];
93
95
  }
94
96
 
95
97
  assert.equal(offset, index_count);
96
98
 
99
+ const adjacency_data = adjacency.data;
100
+
97
101
  // fill triangle data
98
102
  for (let i = 0; i < face_count; ++i) {
99
103
  const i3 = i * 3;
100
104
 
101
- const a = indices[i3 + 0];
105
+ const a = indices[i3];
102
106
  const b = indices[i3 + 1];
103
107
  const c = indices[i3 + 2];
104
108
 
105
- adjacency.data[adjacency.offsets[a]++] = i;
106
- adjacency.data[adjacency.offsets[b]++] = i;
107
- adjacency.data[adjacency.offsets[c]++] = i;
109
+ adjacency_data[adjacency_offsets[a]++] = i;
110
+ adjacency_data[adjacency_offsets[b]++] = i;
111
+ adjacency_data[adjacency_offsets[c]++] = i;
108
112
  }
109
113
 
110
114
  // fix offsets that have been disturbed by the previous pass
111
115
  for (let i = 0; i < vertex_count; ++i) {
112
116
  // assert(adjacency.offsets[i] >= adjacency.counts[i]);
113
117
 
114
- adjacency.offsets[i] -= adjacency.counts[i];
118
+ adjacency_offsets[i] -= adjacency_counts[i];
115
119
  }
116
120
  }
117
121
 
@@ -236,8 +240,9 @@ function meshopt_optimizeVertexCacheTable(destination, indices, index_count, ver
236
240
  assert.equal(index_count % 3, 0);
237
241
 
238
242
  // guard for empty meshes
239
- if (index_count === 0 || vertex_count === 0)
243
+ if (index_count === 0 || vertex_count === 0) {
240
244
  return;
245
+ }
241
246
 
242
247
  // support in-place optimization
243
248
  if (destination === indices) {
@@ -273,9 +278,10 @@ function meshopt_optimizeVertexCacheTable(destination, indices, index_count, ver
273
278
  const triangle_scores = new Float32Array(face_count);
274
279
 
275
280
  for (let i = 0; i < face_count; ++i) {
281
+
276
282
  const i3 = i * 3;
277
283
 
278
- const a = indices[i3 + 0];
284
+ const a = indices[i3];
279
285
  const b = indices[i3 + 1];
280
286
  const c = indices[i3 + 2];
281
287
 
@@ -296,16 +302,17 @@ function meshopt_optimizeVertexCacheTable(destination, indices, index_count, ver
296
302
 
297
303
  const in_tri_3 = current_triangle * 3;
298
304
 
299
- const a = indices[in_tri_3 + 0];
305
+ const a = indices[in_tri_3];
300
306
  const b = indices[in_tri_3 + 1];
301
307
  const c = indices[in_tri_3 + 2];
302
308
 
303
309
  // output indices
304
310
  const out_tri_3 = output_triangle * 3;
305
311
 
306
- destination[out_tri_3 + 0] = a;
312
+ destination[out_tri_3] = a;
307
313
  destination[out_tri_3 + 1] = b;
308
314
  destination[out_tri_3 + 2] = c;
315
+
309
316
  output_triangle++;
310
317
 
311
318
  // update emitted flags
@@ -327,8 +334,11 @@ function meshopt_optimizeVertexCacheTable(destination, indices, index_count, ver
327
334
  }
328
335
  }
329
336
 
337
+ // swap caches
330
338
  const cache_temp = cache;
331
- cache = cache_new, cache_new = cache_temp;
339
+ cache = cache_new;
340
+ cache_new = cache_temp;
341
+
332
342
  cache_count = cache_write > cache_size ? cache_size : cache_write;
333
343
 
334
344
  // update live triangle counts
@@ -346,13 +356,17 @@ function meshopt_optimizeVertexCacheTable(destination, indices, index_count, ver
346
356
  const neighbours_size = adjacency.counts[index];
347
357
 
348
358
  for (let i = 0; i < neighbours_size; ++i) {
359
+
349
360
  const tri = neighbours[i + neighbour_offset];
350
361
 
351
362
  if (tri === current_triangle) {
363
+
352
364
  neighbours[neighbour_offset + i] = neighbours[neighbour_offset + neighbours_size - 1];
353
365
  adjacency.counts[index]--;
354
366
  break;
367
+
355
368
  }
369
+
356
370
  }
357
371
  }
358
372
 
@@ -1 +1 @@
1
- {"version":3,"file":"MaterialOptimizationContext.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/material/optimization/MaterialOptimizationContext.js"],"names":[],"mappings":"AAkXA;IAEQ;;;OAGG;IACH,UAFU,MAAM,OAAO,EAAE,CAEP;IAElB;;;OAGG;IACH,QAFU,MAAM,IAAI,EAAE,CAEN;IAGhB;;;OAGG;IACH,SAFU,IAAI,MAAM,EAAC,SAAS,CAAC,CAEP;IAExB;;;OAGG;IACH,YAFU,SAAS,CAEC;IAGxB;;;OAGG;IACH,sBAFW,kBAAkB,EAAE,QAkE9B;IAED;;;OAGG;IACH,gCAFW,kBAAkB,EAAE,QAmE9B;IAED;;;OAGG;IACH,kCAFW,kBAAkB,QA4E5B;IAED;;;OAGG;IACH,cAFW,MAAM,IAAI,QAUpB;IAED;;;OAGG;IACH,iCAMC;IAED;;OAEG;IACH,eAwIC;IAED;;;OAGG;IACH,6BAFY,IAAI,MAAM,EAAE,iBAAiB,CAAC,CAyBzC;IAED;;;;OAIG;IACH,0CAHW,MAAM,cAAc,OACpB,kBAAkB,QA+C5B;CACJ;;0BAIS,MAAM;;0BAx0BU,oCAAoC;mCAK3B,yBAAyB;4BA3BrD,OAAO"}
1
+ {"version":3,"file":"MaterialOptimizationContext.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/material/optimization/MaterialOptimizationContext.js"],"names":[],"mappings":"AAkXA;IAEQ;;;OAGG;IACH,UAFU,MAAM,OAAO,EAAE,CAEP;IAElB;;;OAGG;IACH,QAFU,MAAM,IAAI,EAAE,CAEN;IAGhB;;;OAGG;IACH,SAFU,IAAI,MAAM,EAAC,SAAS,CAAC,CAEP;IAExB;;;OAGG;IACH,YAFU,SAAS,CAEC;IAGxB;;;OAGG;IACH,sBAFW,kBAAkB,EAAE,QAkE9B;IAED;;;OAGG;IACH,gCAFW,kBAAkB,EAAE,QAmE9B;IAED;;;OAGG;IACH,kCAFW,kBAAkB,QA4E5B;IAED;;;OAGG;IACH,cAFW,MAAM,IAAI,QAUpB;IAED;;;OAGG;IACH,iCAMC;IAED;;OAEG;IACH,eAwIC;IAED;;;OAGG;IACH,6BAFY,IAAI,MAAM,EAAE,iBAAiB,CAAC,CAyBzC;IAED;;;;OAIG;IACH,0CAHW,MAAM,cAAc,OACpB,kBAAkB,QA+C5B;CACJ;;0BAIS,MAAM;;0BAz0BU,oCAAoC;mCAM3B,yBAAyB;4BA3BrD,OAAO"}
@@ -27,10 +27,10 @@ import { channelCountToThreeTextureFormat } from "../../texture/channelCountToTh
27
27
  import { computeThreeTextureTypeFromDataType } from "../../texture/computeThreeTextureTypeFromDataType.js";
28
28
  import { normalized_internal_format } from "../../texture/normalized_internal_format.js";
29
29
  import { convertTexture2Sampler2D } from "../../texture/sampler/convertTexture2Sampler2D.js";
30
- import { copy_Sampler2D_channel_data } from "../../texture/sampler/copy_Sampler2D_channel_data.js";
31
30
  import { Sampler2D } from "../../texture/sampler/Sampler2D.js";
32
31
  import { sampler2d_copy_channel_data } from "../../texture/sampler/sampler2d_copy_channel_data.js";
33
32
  import { sampler2d_sub_copy_same_item_size } from "../../texture/sampler/sampler2d_sub_copy_same_item_size.js";
33
+ import { sampler2d_transfer_data } from "../../texture/sampler/sampler2d_transfer_data.js";
34
34
  import { BUFFER_GEOMETRY_UVS } from "./BUFFER_GEOMETRY_UVS.js";
35
35
  import { is_compliant_mesh } from "./is_compliant_mesh.js";
36
36
  import { MaterialDescriptor } from "./MaterialDescriptor.js";
@@ -198,7 +198,7 @@ function extract_texture_data(destination, source, texture_name) {
198
198
  sampler2d_copy_channel_data(source, 2, destination, 0);
199
199
  break;
200
200
  default:
201
- copy_Sampler2D_channel_data(source, destination);
201
+ sampler2d_transfer_data(source, destination);
202
202
  }
203
203
  }
204
204
 
@@ -1,7 +1,7 @@
1
1
  import { GLSL3, ShaderMaterial, Vector2, Vector3 } from "three";
2
- import { Sampler2D } from "../../../texture/sampler/Sampler2D.js";
3
- import sampler2D2Texture from "../../../texture/sampler/Sampler2D2Texture.js";
4
2
  import { ParameterLookupTable } from "../../../particles/particular/engine/parameter/ParameterLookupTable.js";
3
+ import { Sampler2D } from "../../../texture/sampler/Sampler2D.js";
4
+ import sampler2d_to_texture from "../../../texture/sampler/sampler2d_to_texture.js";
5
5
 
6
6
 
7
7
  const v_shader = `
@@ -155,7 +155,7 @@ export class FPlusDebugMaterial extends ShaderMaterial {
155
155
  heatmap_sampler.set(i, 0, r);
156
156
  }
157
157
 
158
- const heatmap_texture = sampler2D2Texture(heatmap_sampler);
158
+ const heatmap_texture = sampler2d_to_texture(heatmap_sampler);
159
159
 
160
160
  this.uniforms.t_heatmap_lookup.value = heatmap_texture;
161
161
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Sampler2D.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/Sampler2D.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH;IAk8BI;;;;;;OAMG;IACH,6DAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,sDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,uDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,uDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,qDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,sDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,sDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,wDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,wDAFY,SAAS,CAKpB;IA3iCD;;;;;;;OAOG;IACH,mBANW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,iBAAiB,GAAC,UAAU,GAAC,WAAW,GAAC,WAAW,GAAC,SAAS,GAAC,UAAU,GAAC,UAAU,GAAC,YAAY,GAAC,YAAY,aACzI,MAAM,UACN,MAAM,WACN,MAAM,EAmDhB;IA7BG;;;OAGG;IACH,cAAkB;IAElB;;;OAGG;IACH,eAAoB;IAEpB;;;OAGG;IACH,iBAAwB;IAExB;;;OAGG;IACH,MAFU,MAAM,EAAE,GAAC,iBAAiB,GAAC,UAAU,GAAC,WAAW,GAAC,WAAW,GAAC,SAAS,GAAC,UAAU,GAAC,UAAU,GAAC,YAAY,GAAC,YAAY,CAEjH;IAEhB;;;OAGG;IACH,SAFU,MAAM,CA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AJW,MAAM,KACN,MAAM,QACN,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,QAapC;IAED;;;;;;OAMG;IACH,UALW,MAAM,KACN,MAAM,WACN,2BAAuB,OAajC;IAED;;;;;OAKG;IACH,eAJW,MAAM,KACN,MAAM,GACJ,MAAM,CAIlB;IAED;;;;OAIG;IACH,mBAHW,MAAM,yBAUhB;IAED;;;;;;;;;OASG;IACH,aARW,SAAS,qHAoDnB;IAGD;;;;;;;OAOG;IACH,oEA8BC;IAED;;;;OAIG;IACH,2BAHW,MAAM,SACN,MAAM,QAYhB;IAED;;;;;;;OAOG;IACH,iEAFW,aAAc,QAqCxB;IAED;;;;;;OAMG;IACH,gBALW,MAAM,KACN,MAAM,WACN,MAAM,SACN,MAAM,QAqBhB;IAED;;;;;OAKG;IACH,OAJW,MAAM,KACN,MAAM,SACN,MAAM,EAAE,GAAC,YAAY,QAe/B;IAED;;;;;;;OAOG;IACH,wBALW,MAAM,WACN,MAAM,UACN,MAAM,sBAyBhB;IAED;;;;;OAKG;IACH,UAJW,MAAM,KACN,MAAM,iBACN,OAAO,QAyDjB;IAED;;;OAGG;IACH,mBAFY,MAAM,CAYjB;IAED;;;;OAIG;IACH,cAHW,SAAS,GACR,OAAO,CAYlB;IAED;;;OAGG;IACH,QAFY,MAAM,CAYjB;IAGD;;OAEG;IACH,SAFa,SAAS,CAerB;IAED;;;;;;MAUC;IAED;;;;;;aAwBC;IAgHL;;;OAGG;IACH,sBAFU,OAAO,CAEc;CAN9B;;kBAUS,MAAM"}
1
+ {"version":3,"file":"Sampler2D.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/Sampler2D.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH;IA66BI;;;;;;OAMG;IACH,6DAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,sDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,uDAFY,SAAS,CAKpB;IAED;;;;;;OAMG;IACH,uDAFY,SAA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AOG;IACH,wBALW,MAAM,WACN,MAAM,UACN,MAAM,sBAyBhB;IAED;;;;;OAKG;IACH,UAJW,MAAM,KACN,MAAM,iBACN,OAAO,QAyDjB;IAED;;;OAGG;IACH,mBAFY,MAAM,CAejB;IAED;;;;OAIG;IACH,cAHW,SAAS,GACR,OAAO,CAiBlB;IAED;;;OAGG;IACH,QAFY,MAAM,CAUjB;IAGD;;OAEG;IACH,SAFa,SAAS,CAerB;IAED;;;;;;MAUC;IAED;;;;;;aAwBC;IAgHL;;;OAGG;IACH,sBAFU,OAAO,CAEc;CAN9B;;kBAUS,MAAM"}
@@ -3,11 +3,11 @@ import { Base64 } from "../../../../core/binary/base64/Base64.js";
3
3
  import {
4
4
  compute_typed_array_constructor_from_data_type
5
5
  } from "../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
6
- import { computeStridedIntegerArrayHash } from "../../../../core/collection/array/computeStridedIntegerArrayHash.js";
7
6
  import {
8
7
  compute_binary_data_type_from_typed_array
9
8
  } from "../../../../core/collection/array/typed/compute_binary_data_type_from_typed_array.js";
10
9
  import { is_typed_array_equals } from "../../../../core/collection/array/typed/is_typed_array_equals.js";
10
+ import { sparse_typed_array_hash } from "../../../../core/collection/array/typed/sparse_typed_array_hash.js";
11
11
  import {
12
12
  typedArrayConstructorByInstance
13
13
  } from "../../../../core/collection/array/typed/typedArrayConstructorByInstance.js";
@@ -52,19 +52,19 @@ export class Sampler2D {
52
52
 
53
53
  /**
54
54
  *
55
- * @type {Number}
55
+ * @type {number}
56
56
  */
57
57
  this.width = width;
58
58
 
59
59
  /**
60
60
  *
61
- * @type {Number}
61
+ * @type {number}
62
62
  */
63
63
  this.height = height;
64
64
 
65
65
  /**
66
66
  * Number of channels
67
- * @type {Number}
67
+ * @type {number}
68
68
  */
69
69
  this.itemSize = itemSize;
70
70
 
@@ -81,18 +81,6 @@ export class Sampler2D {
81
81
  this.version = 0;
82
82
  }
83
83
 
84
- /**
85
- *
86
- * @deprecated
87
- * @param {number} x
88
- * @param {number}y
89
- * @param {Vector1|Vector2|Vector3|Vector4} result
90
- * @returns {number}
91
- */
92
- get(x, y, result) {
93
- throw new Error("Deprecated method, use sampleBilinear instead");
94
- }
95
-
96
84
  /**
97
85
  *
98
86
  * @param {number} u
@@ -115,8 +103,8 @@ export class Sampler2D {
115
103
  * @returns {number}
116
104
  */
117
105
  sampleChannelCatmullRomUV(u, v, channel) {
118
- const x = u * (this.width) - 0.5;
119
- const y = v * (this.height) - 0.5;
106
+ const x = u * this.width - 0.5;
107
+ const y = v * this.height - 0.5;
120
108
 
121
109
  return this.sampleChannelCatmullRom(x, y, channel);
122
110
  }
@@ -171,8 +159,8 @@ export class Sampler2D {
171
159
  const texPos12_x = texPos1_x + offset12_x;
172
160
  const texPos12_y = texPos1_y + offset12_y;
173
161
 
174
-
175
162
  let result = 0.0;
163
+
176
164
  result += this.sampleChannelBilinear(texPos0_x, texPos0_y, channel) * w0_x * w0_y;
177
165
  result += this.sampleChannelBilinear(texPos12_x, texPos0_y, channel) * w12_x * w0_y;
178
166
  result += this.sampleChannelBilinear(texPos3_x, texPos0_y, channel) * w3_x * w0_y;
@@ -234,8 +222,8 @@ export class Sampler2D {
234
222
  }
235
223
 
236
224
  /**
237
- * TODO there is an oversaturation bug in here somewhere, prefer to use linear sampling for now instead
238
- * Bicubic-filtered sampling
225
+ *
226
+ * Bicubic-filtered sampling, note values can be negative due to the nature of the cubic curve
239
227
  * @param {number} x
240
228
  * @param {number} y
241
229
  * @param {number} channel
@@ -471,7 +459,11 @@ export class Sampler2D {
471
459
  const x = Math.round(u * w - 0.5);
472
460
  const y = Math.round(v * h - 0.5);
473
461
 
474
- this.read(clamp(x, 0, w - 1), clamp(y, 0, h - 1), result);
462
+ this.read(
463
+ clamp(x, 0, w - 1),
464
+ clamp(y, 0, h - 1),
465
+ result
466
+ );
475
467
  }
476
468
 
477
469
  /**
@@ -532,25 +524,6 @@ export class Sampler2D {
532
524
  }
533
525
  }
534
526
 
535
- /**
536
- *
537
- * @param {number} u
538
- * @param {number} v
539
- * @param {Vector4|Vector3|Vector2} [result]
540
- * @deprecated
541
- */
542
- sample(u, v, result) {
543
- console.warn("Deprecated method, use sampleBilinear instead");
544
-
545
- const temp = [];
546
-
547
- this.sampleBilinear(u * (this.width - 1), v * (this.height - 1), temp, 0);
548
-
549
- result.readFromArray(temp);
550
-
551
- return temp[0];
552
- }
553
-
554
527
  /**
555
528
  *
556
529
  * @param {number} x
@@ -691,11 +664,11 @@ export class Sampler2D {
691
664
 
692
665
  /**
693
666
  *
694
- * @param {Number} x
695
- * @param {Number} y
696
- * @param {Number} width
697
- * @param {Number} height
698
- * @param {Array.<Number>} value
667
+ * @param {number} x
668
+ * @param {number} y
669
+ * @param {number} width
670
+ * @param {number} height
671
+ * @param {Array.<number>} value
699
672
  */
700
673
  fill(x, y, width, height, value) {
701
674
 
@@ -885,10 +858,13 @@ export class Sampler2D {
885
858
  computeByteSize() {
886
859
  let dataSize;
887
860
 
888
- if (Array.isArray(this.data)) {
889
- dataSize = 8 * this.data.length;
861
+ const data = this.data;
862
+
863
+ if (Array.isArray(data)) {
864
+ // Assume IEEE float 64
865
+ dataSize = 8 * data.length;
890
866
  } else {
891
- dataSize = this.data.buffer.byteLength;
867
+ dataSize = data.buffer.byteLength;
892
868
  }
893
869
 
894
870
  return dataSize + 280;
@@ -900,6 +876,11 @@ export class Sampler2D {
900
876
  * @return {boolean}
901
877
  */
902
878
  equals(other) {
879
+ if(this === other){
880
+ // special case
881
+ return true;
882
+ }
883
+
903
884
  if (
904
885
  this.width !== other.width
905
886
  || this.height !== other.height
@@ -920,9 +901,7 @@ export class Sampler2D {
920
901
 
921
902
  const length = this.data.length;
922
903
 
923
- const stride = Math.max(1, Math.ceil(length / 509));
924
-
925
- hash ^= computeStridedIntegerArrayHash(this.data, 0, length, stride);
904
+ hash ^= sparse_typed_array_hash(this.data, 0, length, 509);
926
905
 
927
906
  return hash;
928
907
  }
@@ -0,0 +1,10 @@
1
+ export default sampler2d_to_texture;
2
+ /**
3
+ *
4
+ * @param {Sampler2D} sampler
5
+ * @return {DataTexture}
6
+ */
7
+ declare function sampler2d_to_texture(sampler: Sampler2D): DataTexture;
8
+ import { Sampler2D } from "./Sampler2D.js";
9
+ import { DataTexture } from 'three';
10
+ //# sourceMappingURL=sampler2d_to_texture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sampler2d_to_texture.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/sampler2d_to_texture.js"],"names":[],"mappings":";AAMA;;;;GAIG;AACH,+CAHW,SAAS,GACR,WAAW,CAsCtB;0BA7CyB,gBAAgB;4BAFqC,OAAO"}
@@ -1,7 +1,7 @@
1
1
  import { ClampToEdgeWrapping, DataTexture, RGBAFormat, UnsignedByteType } from 'three';
2
2
  import { assert } from "../../../../core/assert.js";
3
- import { copy_Sampler2D_channel_data } from "./copy_Sampler2D_channel_data.js";
4
3
  import { Sampler2D } from "./Sampler2D.js";
4
+ import { sampler2d_transfer_data } from "./sampler2d_transfer_data.js";
5
5
 
6
6
 
7
7
  /**
@@ -9,8 +9,8 @@ import { Sampler2D } from "./Sampler2D.js";
9
9
  * @param {Sampler2D} sampler
10
10
  * @return {DataTexture}
11
11
  */
12
- function sampler2D2Texture(sampler) {
13
- assert.notEqual(sampler, undefined, 'sampler is undefined');
12
+ function sampler2d_to_texture(sampler) {
13
+ assert.defined(sampler, 'sampler');
14
14
 
15
15
  const result = new DataTexture();
16
16
  result.format = RGBAFormat;
@@ -23,7 +23,7 @@ function sampler2D2Texture(sampler) {
23
23
 
24
24
  } else {
25
25
  const dest = Sampler2D.uint8(4, sampler.width, sampler.height);
26
- copy_Sampler2D_channel_data(sampler, dest);
26
+ sampler2d_transfer_data(sampler, dest);
27
27
 
28
28
  data = dest.data;
29
29
  }
@@ -47,4 +47,4 @@ function sampler2D2Texture(sampler) {
47
47
 
48
48
  }
49
49
 
50
- export default sampler2D2Texture;
50
+ export default sampler2d_to_texture;
@@ -4,5 +4,5 @@
4
4
  * @param {Sampler2D} source
5
5
  * @param {Sampler2D} destination
6
6
  */
7
- export function copy_Sampler2D_channel_data(source: Sampler2D, destination: Sampler2D): void;
8
- //# sourceMappingURL=copy_Sampler2D_channel_data.d.ts.map
7
+ export function sampler2d_transfer_data(source: Sampler2D, destination: Sampler2D): void;
8
+ //# sourceMappingURL=sampler2d_transfer_data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sampler2d_transfer_data.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/texture/sampler/sampler2d_transfer_data.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,yFAiEC"}
@@ -6,7 +6,7 @@ import { saturated_value_by_constructor } from "./saturated_value_by_constructor
6
6
  * @param {Sampler2D} source
7
7
  * @param {Sampler2D} destination
8
8
  */
9
- export function copy_Sampler2D_channel_data(source, destination) {
9
+ export function sampler2d_transfer_data(source, destination) {
10
10
  if (source.width !== destination.width || source.height !== destination.height) {
11
11
  throw new Error('Source and destination dimensions do not match');
12
12
  }
@@ -16,11 +16,11 @@ export function writeSample2DDataToDataTexture(sampler, texture) {
16
16
  }
17
17
  } else if (sampler.itemSize === 3) {
18
18
  if (texture.format !== RGBFormat) {
19
- throw new Error('itemSize is 2 and texture.format is not RGBFormat');
19
+ throw new Error('itemSize is 3 and texture.format is not RGBFormat');
20
20
  }
21
21
  } else if (sampler.itemSize === 4) {
22
22
  if (texture.format !== RGBAFormat) {
23
- throw new Error('itemSize is 2 and texture.format is not RGBAFormat');
23
+ throw new Error('itemSize is 4 and texture.format is not RGBAFormat');
24
24
  }
25
25
  } else {
26
26
  throw new Error('Unsupported itemSize');
@@ -1 +1 @@
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
+ {"version":3,"file":"RibbonXFixedPhysicsSimulator.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/trail/x/simulator/RibbonXFixedPhysicsSimulator.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IAEI;;;;;OAKG;IACH,iCAHW,MAAM,aACN,MAAM,QAkBhB;CACJ"}
@@ -6,9 +6,6 @@ import { RIBBON_ATTRIBUTE_ADDRESS_AGE, RIBBON_ATTRIBUTE_ADDRESS_UV_OFFSET } from
6
6
  * Fixed function simulation engine for ribbons
7
7
  */
8
8
  export class RibbonXFixedPhysicsSimulator {
9
- constructor() {
10
-
11
- }
12
9
 
13
10
  /**
14
11
  *