@woosh/meep-engine 2.48.20 → 2.48.21

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 (94) hide show
  1. package/package.json +1 -1
  2. package/src/engine/graphics/micron/MICRON_GEOMETRY_FIELD.js +0 -1
  3. package/src/engine/graphics/micron/MICRON_URI_FIELD.js +0 -1
  4. package/src/engine/graphics/micron/build/MICRON_PATCH_SIZE_MAX.js +0 -5
  5. package/src/engine/graphics/micron/build/PatchRepresentation.js +0 -424
  6. package/src/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +0 -311
  7. package/src/engine/graphics/micron/build/build_geometry_info.js +0 -21
  8. package/src/engine/graphics/micron/build/clustering/assignInitialPatchNeighbours.js +0 -63
  9. package/src/engine/graphics/micron/build/clustering/assign_patch_neighbours_from_topology.js +0 -46
  10. package/src/engine/graphics/micron/build/clustering/build_clustering_2.js +0 -37
  11. package/src/engine/graphics/micron/build/clustering/build_leaf_patches.js +0 -326
  12. package/src/engine/graphics/micron/build/clustering/build_leaf_patches_metis.js +0 -76
  13. package/src/engine/graphics/micron/build/clustering/computeBorderLengthChange.js +0 -59
  14. package/src/engine/graphics/micron/build/clustering/computeFaceCurvatureScore.js +0 -57
  15. package/src/engine/graphics/micron/build/clustering/computeOpenFaceFreedom.js +0 -35
  16. package/src/engine/graphics/micron/build/clustering/compute_face_connection_weight.js +0 -35
  17. package/src/engine/graphics/micron/build/clustering/populateOpenFaceNeighboursForPatch.js +0 -56
  18. package/src/engine/graphics/micron/build/clustering/validate_leaf_patch_connectivity.js +0 -44
  19. package/src/engine/graphics/micron/build/compute_micron_buffer_array_constructor.js +0 -24
  20. package/src/engine/graphics/micron/build/compute_vertex_remap_cost.js +0 -29
  21. package/src/engine/graphics/micron/build/debug/build_clustering_info.js +0 -58
  22. package/src/engine/graphics/micron/build/debug/build_graph_info.js +0 -59
  23. package/src/engine/graphics/micron/build/fill_patch_geometry_data.js +0 -270
  24. package/src/engine/graphics/micron/build/hierarchy/buildAbstractPatchHierarchy.js +0 -196
  25. package/src/engine/graphics/micron/build/hierarchy/build_intermediate_patch_topology.js +0 -162
  26. package/src/engine/graphics/micron/build/hierarchy/build_merge_graph.js +0 -89
  27. package/src/engine/graphics/micron/build/hierarchy/computePatchMergeScore.js +0 -146
  28. package/src/engine/graphics/micron/build/hierarchy/compute_patches_shared_vertex_count.js +0 -32
  29. package/src/engine/graphics/micron/build/hierarchy/compute_patches_shared_vertices.js +0 -34
  30. package/src/engine/graphics/micron/build/hierarchy/merge_patches.js +0 -581
  31. package/src/engine/graphics/micron/build/hierarchy/metis_cluster_clusters.js +0 -53
  32. package/src/engine/graphics/micron/build/hierarchy/optimize_graph_partitioning_balance.js +0 -515
  33. package/src/engine/graphics/micron/build/hierarchy/patch_combine.js +0 -180
  34. package/src/engine/graphics/micron/build/hierarchy/patch_fill_holes_by_uncollapse.js +0 -60
  35. package/src/engine/graphics/micron/build/hierarchy/patch_stitch_parent_border.js +0 -320
  36. package/src/engine/graphics/micron/build/hierarchy/qvdr_build_simplified_clusters.js +0 -547
  37. package/src/engine/graphics/micron/build/hierarchy/qvdr_build_tree.js +0 -140
  38. package/src/engine/graphics/micron/buildPatchwork.js +0 -68
  39. package/src/engine/graphics/micron/convert_three_object_to_micron.js +0 -179
  40. package/src/engine/graphics/micron/debug/VirtualGeometryStats.js +0 -42
  41. package/src/engine/graphics/micron/format/MICRON_GEOMETRY_PROPERTY_NAME.js +0 -1
  42. package/src/engine/graphics/micron/format/MicronGeometry.d.ts +0 -21
  43. package/src/engine/graphics/micron/format/MicronGeometry.js +0 -334
  44. package/src/engine/graphics/micron/format/MicronGeometryPatch.d.ts +0 -3
  45. package/src/engine/graphics/micron/format/MicronGeometryPatch.js +0 -205
  46. package/src/engine/graphics/micron/format/MicronGeometryPatchOccurance.js +0 -50
  47. package/src/engine/graphics/micron/format/ThreeMicronMesh.d.ts +0 -10
  48. package/src/engine/graphics/micron/format/ThreeMicronMesh.js +0 -45
  49. package/src/engine/graphics/micron/format/VirtualGeometry.js +0 -158
  50. package/src/engine/graphics/micron/format/micron_build_proxy_geometry.js +0 -205
  51. package/src/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.js +0 -123
  52. package/src/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.spec.js +0 -63
  53. package/src/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.js +0 -83
  54. package/src/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.spec.js +0 -51
  55. package/src/engine/graphics/micron/format/serialization/deserialize_attribute_spec.js +0 -25
  56. package/src/engine/graphics/micron/format/serialization/deserialize_patch.js +0 -106
  57. package/src/engine/graphics/micron/format/serialization/serialize_attribute_spec.js +0 -18
  58. package/src/engine/graphics/micron/format/serialization/serialize_patch.js +0 -84
  59. package/src/engine/graphics/micron/format/validate_patch_bounds.js +0 -69
  60. package/src/engine/graphics/micron/plugin/GLTFAssetTransformer.js +0 -265
  61. package/src/engine/graphics/micron/plugin/GLTF_MICRON_ID_FIELD.js +0 -5
  62. package/src/engine/graphics/micron/plugin/MicronRenderPlugin.d.ts +0 -8
  63. package/src/engine/graphics/micron/plugin/MicronRenderPlugin.js +0 -150
  64. package/src/engine/graphics/micron/plugin/serialization/BufferGeometrySerializationAdapter.js +0 -176
  65. package/src/engine/graphics/micron/plugin/shaded_geometry/MicronShadedGeometryRenderAdapter.js +0 -216
  66. package/src/engine/graphics/micron/prototypeMicronProxyBuild.js +0 -227
  67. package/src/engine/graphics/micron/prototypeVirtualGeometry.js +0 -911
  68. package/src/engine/graphics/micron/render/PatchCacheKey.js +0 -79
  69. package/src/engine/graphics/micron/render/VIRTUAL_MESH_FLAG.d.ts +0 -1
  70. package/src/engine/graphics/micron/render/VIRTUAL_MESH_FLAG.js +0 -1
  71. package/src/engine/graphics/micron/render/VirtualGeometryBuilder.js +0 -207
  72. package/src/engine/graphics/micron/render/approximateTriangleArea.js +0 -25
  73. package/src/engine/graphics/micron/render/culling/PatchCullingSystem.js +0 -129
  74. package/src/engine/graphics/micron/render/instanced/PatchDataTextures.js +0 -329
  75. package/src/engine/graphics/micron/render/instanced/ThreeInstancedAdapter.js +0 -175
  76. package/src/engine/graphics/micron/render/instanced/shader/constants.js +0 -3
  77. package/src/engine/graphics/micron/render/instanced/shader/gen_micron_vertex_attribute_texture_name.js +0 -8
  78. package/src/engine/graphics/micron/render/instanced/shader/shader_rewrite_standard.js +0 -250
  79. package/src/engine/graphics/micron/render/makeThreeMeshFromVirtualGeometry.js +0 -37
  80. package/src/engine/graphics/micron/render/refinement/ActivePatchFlags.js +0 -8
  81. package/src/engine/graphics/micron/render/refinement/ActivePatchList.js +0 -241
  82. package/src/engine/graphics/micron/render/refinement/ActivePatchRecord.js +0 -154
  83. package/src/engine/graphics/micron/render/refinement/RefinementSpec.js +0 -84
  84. package/src/engine/graphics/micron/render/refinement/get_geometry_patch_cut.js +0 -133
  85. package/src/engine/graphics/micron/render/refinement/is_patch_facing_back.js +0 -43
  86. package/src/engine/graphics/micron/render/refinement/is_patch_visible.js +0 -37
  87. package/src/engine/graphics/micron/render/v1/MaterialContext.js +0 -150
  88. package/src/engine/graphics/micron/render/v1/MaterialVertexSpec.js +0 -115
  89. package/src/engine/graphics/micron/render/v1/MicronRenderContext.js +0 -145
  90. package/src/engine/graphics/micron/render/v1/ThreeVirtualGeometryAdapter.js +0 -255
  91. package/src/engine/graphics/micron/render/v1/VGThreeRenderer.js +0 -142
  92. package/src/engine/graphics/micron/render/v1/getTransformedPositionsCached.js +0 -54
  93. package/src/engine/graphics/micron/simplifyGeometry.js +0 -26
  94. package/src/engine/graphics/micron/util/patchToBufferGeometry.js +0 -19
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.48.20",
8
+ "version": "2.48.21",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1 +0,0 @@
1
- export const MICRON_GEOMETRY_FIELD = '@micron_geometry';
@@ -1 +0,0 @@
1
- export const MICRON_URI_FIELD = '@micron_path';
@@ -1,5 +0,0 @@
1
- /**
2
- * Maximum number of triangles per patch
3
- * @type {number}
4
- */
5
- export const MICRON_PATCH_SIZE_MAX = 128;
@@ -1,424 +0,0 @@
1
- import { TopoMesh } from "../../../../core/geom/3d/topology/struct/TopoMesh.js";
2
- import { MicronGeometryPatch } from "../format/MicronGeometryPatch.js";
3
- import { fill_patch_geometry_data } from "./fill_patch_geometry_data.js";
4
- import { AABB3 } from "../../../../core/bvh2/aabb3/AABB3.js";
5
- import { assert } from "../../../../core/assert.js";
6
- import {
7
- computeTriangleClusterNormalBoundingCone
8
- } from "../../../../core/geom/3d/topology/bounds/computeTriangleClusterNormalBoundingCone.js";
9
- import { noop } from "../../../../core/function/Functions.js";
10
- import { ConicRay } from "../../../../core/geom/ConicRay.js";
11
- import { vec4 } from "gl-matrix";
12
- import { computeTopoMeshBoundiningBox } from "../../../../core/geom/3d/topology/bounds/computeTopoMeshBoundiningBox.js";
13
- import {
14
- computeTopoMeshBoundingSphere
15
- } from "../../../../core/geom/3d/topology/bounds/computeTopoMeshBoundingSphere.js";
16
- import { meshopt_optimizeVertexCache } from "../../geometry/optimization/VertexCacheOptimizer.js";
17
- import { array_copy } from "../../../../core/collection/array/copyArray.js";
18
-
19
- /**
20
- *
21
- * @type {PatchRepresentation[]}
22
- */
23
- const parent_stack = [];
24
-
25
- export class PatchRepresentation {
26
- constructor() {
27
- /**
28
- *
29
- * @type {number}
30
- */
31
- this.id = 0;
32
-
33
- this.bounding_box = new AABB3(
34
- Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY,
35
- Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY
36
- );
37
-
38
- /**
39
- *
40
- * @type {AABB3}
41
- */
42
- this.group_aabb = new AABB3(0, 0, 0, 0, 0, 0);
43
-
44
- /**
45
- *
46
- * @type {vec4|Float32Array}
47
- */
48
- this.group_bounding_sphere = new Float32Array(4);
49
-
50
- /**
51
- *
52
- * @type {number}
53
- */
54
- this.group_error = 0;
55
-
56
- /**
57
- *
58
- * @type {vec4}
59
- */
60
- this.bounding_sphere = vec4.create()
61
-
62
- /**
63
- * Bounding cone of face normals
64
- * @type {ConicRay}
65
- */
66
- this.normal_cone = new ConicRay();
67
-
68
- /**
69
- *
70
- * @type {TopoMesh|null}
71
- */
72
- this.topology_snapshot = null;
73
-
74
- /**
75
- * @deprecated
76
- * Vertices that are shared with neighbours
77
- * @type {Set<number>}
78
- */
79
- this.vertices_shared = new Set();
80
-
81
- /**
82
- *
83
- * @type {Set<number>}
84
- */
85
- this.vertices_included = new Set();
86
-
87
- /**
88
- * Runtime dependency patches, if this patch is refined at runtime - dependencies must be refined as well
89
- * These dependencies allow for more aggressive simplification of topology
90
- * @type {PatchRepresentation[]}
91
- */
92
- this.dependencies = [];
93
-
94
- /**
95
- * Patches that share 1 or more edges with this one
96
- * This includes patches at all LOD levels
97
- * @type {PatchRepresentation[]}
98
- */
99
- this.neighbours = [];
100
-
101
- /**
102
- *
103
- * @type {PatchRepresentation[]}
104
- */
105
- this.children = [];
106
-
107
- /**
108
- *
109
- * @type {PatchRepresentation[]}
110
- */
111
- this.parents = [];
112
-
113
- this.lod = 0;
114
- }
115
-
116
-
117
- /**
118
- * @deprecated
119
- */
120
- set topology_mask(v) {
121
- throw new Error('E');
122
- }
123
-
124
-
125
- /**
126
- * @deprecated
127
- */
128
- get topology_mask() {
129
- throw new Error('E');
130
- }
131
-
132
- /**
133
- * @deprecated
134
- */
135
- get parent() {
136
- throw new Error('Single parent is no longer supported, use .parents instead');
137
- }
138
-
139
- /**
140
- * @deprecated
141
- */
142
- set parent(v) {
143
- throw new Error('Single parent is no longer supported, use .parents instead');
144
- }
145
-
146
- snapshotTopology() {
147
- const mesh = new TopoMesh();
148
-
149
- mesh.add(this.topology_mask);
150
-
151
- this.topology_snapshot = mesh;
152
- }
153
-
154
- /**
155
- *
156
- * @param {function(string)} error_consumer
157
- * @param {*} thisArg
158
- * @returns {boolean}
159
- */
160
- validate(error_consumer = noop, thisArg) {
161
- let result = true;
162
- // check neighbours
163
- const neighbours = this.neighbours;
164
- const neighbour_count = neighbours.length;
165
-
166
- for (let i = 0; i < neighbour_count; i++) {
167
- const neighbour = neighbours[i];
168
-
169
- if (!neighbour.hasNeighbour(this)) {
170
- result = false;
171
- error_consumer.call(thisArg, `Neighbour[${i}] missing back link`);
172
- }
173
- }
174
-
175
- // check that parent contains all of the children's neighbours except for descendants
176
- const children = this.children;
177
- const child_count = children.length;
178
- for (let i = 0; i < child_count; i++) {
179
- const child = children[i];
180
-
181
- const child_neighbours = child.neighbours;
182
- const child_neighbour_count = child_neighbours.length;
183
-
184
- for (let j = 0; j < child_neighbour_count; j++) {
185
- const child_neighbour = child_neighbours[j];
186
-
187
- if (child_neighbour.isDescendantOf(this)) {
188
- // skip descendants
189
- continue;
190
- }
191
-
192
- if (!this.hasNeighbour(child_neighbour)) {
193
- result = false;
194
- error_consumer.call(thisArg, `Missing inherited neighbour[${j}] of child[${i}]`);
195
- }
196
- }
197
- }
198
-
199
- return result;
200
- }
201
-
202
- computeBounds() {
203
- computeTopoMeshBoundiningBox(this.bounding_box, this.topology_snapshot);
204
- computeTopoMeshBoundingSphere(this.bounding_sphere, this.topology_snapshot);
205
- }
206
-
207
- /**
208
- * @returns {number}
209
- */
210
- computePerimeterLength() {
211
- let result = 0;
212
- const edges = this.topology_snapshot.getEdges();
213
- for (const edge of edges) {
214
- if (edge.isTopologyBorder()) {
215
- result += edge.length;
216
- }
217
- }
218
-
219
- return result;
220
- }
221
-
222
- /**
223
- *
224
- * @param {function(PatchRepresentation):boolean} filter
225
- * @returns {PatchRepresentation[]}
226
- */
227
- collectNodes(filter) {
228
- const result = [];
229
- this.traverse(p => {
230
- if (filter(p)) {
231
- result.push(p);
232
- }
233
- });
234
-
235
- return result;
236
- }
237
-
238
- /**
239
- *
240
- * @param {function(path:PatchRepresentation):boolean?} callback
241
- * @param {*} [thisArg]
242
- */
243
- traverse(callback, thisArg) {
244
- const stack = [this];
245
- let stack_cursor = 1;
246
- const seen_nodes = new Set();
247
- seen_nodes.add(this);
248
-
249
-
250
- while (stack_cursor > 0) {
251
- stack_cursor--;
252
-
253
- const patch = stack[stack_cursor];
254
-
255
-
256
- const traverse_deeper = callback.call(thisArg, patch);
257
-
258
- if (traverse_deeper === false) {
259
- continue;
260
- }
261
-
262
- const children = patch.children;
263
- const child_count = children.length;
264
-
265
- for (let i = 0; i < child_count; i++) {
266
- const child = children[i];
267
-
268
- if (seen_nodes.has(child)) {
269
- continue;
270
- }
271
-
272
- seen_nodes.add(child);
273
-
274
- stack[stack_cursor++] = child;
275
- }
276
- }
277
- }
278
-
279
- /**
280
- *
281
- * @returns {number}
282
- */
283
- countDescendants() {
284
- let result = 0;
285
-
286
- const children = this.children;
287
- const child_count = children.length;
288
- for (let i = 0; i < child_count; i++) {
289
- result++;
290
-
291
- const child = children[i];
292
-
293
- result += child.countDescendants();
294
- }
295
-
296
- return result;
297
- }
298
-
299
- /**
300
- *
301
- * @param {PatchRepresentation} p
302
- * @returns {boolean}
303
- */
304
- isDescendantOf(p) {
305
-
306
- let cursor = 1;
307
- parent_stack[0] = this;
308
-
309
- do {
310
- cursor--;
311
-
312
- const x = parent_stack[cursor];
313
-
314
- if (x === p) {
315
- return true;
316
- }
317
-
318
- const parents = x.parents;
319
- const parent_count = parents.length;
320
- for (let i = 0; i < parent_count; i++) {
321
- parent_stack[cursor++] = parents[i];
322
- }
323
-
324
- } while (cursor > 0);
325
-
326
- return false;
327
- }
328
-
329
- /**
330
- *
331
- * @param {PatchRepresentation} p
332
- * @returns {boolean}
333
- */
334
- hasDescendant(p) {
335
- const children = this.children;
336
- const child_count = children.length;
337
- for (let i = 0; i < child_count; i++) {
338
- const child = children[i];
339
-
340
- if (child === p) {
341
- return true;
342
- }
343
-
344
- if (child.hasDescendant(p)) {
345
- return true;
346
- }
347
- }
348
-
349
- return false;
350
- }
351
-
352
- /**
353
- *
354
- * @param {PatchRepresentation} p
355
- * @returns {boolean}
356
- */
357
- hasChild(p) {
358
- return this.children.indexOf(p) !== -1;
359
- }
360
-
361
- /**
362
- *
363
- * @param {PatchRepresentation} p
364
- * @returns {boolean}
365
- */
366
- hasNeighbour(p) {
367
- return this.neighbours.indexOf(p) !== -1;
368
- }
369
-
370
- /**
371
- *
372
- * @param {PatchRepresentation} p
373
- */
374
- addNeighbour(p) {
375
- assert.notEqual(this, p, 'cannot add self as a neighbour');
376
- assert.arrayHasNo(this.neighbours, p, 'already contained');
377
-
378
- this.neighbours.push(p);
379
- }
380
-
381
- computeNormalBoundingCone() {
382
- computeTriangleClusterNormalBoundingCone(this.normal_cone, this.topology_snapshot.getFaces());
383
- }
384
-
385
- /**
386
- *
387
- * @param {MicronGeometryPatch} result
388
- * @param {THREE.BufferGeometry} source_geometry
389
- * @param {VertexDataSpec} vertex_data_spec
390
- */
391
- buildMicronGeometryPatch(result, source_geometry, vertex_data_spec) {
392
-
393
- assert.defined(source_geometry, 'source_geometry');
394
- assert.equal(source_geometry.isBufferGeometry, true, 'source_geometry.isBufferGeometry !== true');
395
- assert.defined(vertex_data_spec, 'vertex_data_spec');
396
-
397
- result.id = this.id;
398
- result.lod = this.lod;
399
-
400
- const topology = this.topology_snapshot;
401
-
402
- result.polygon_count = topology.getFaces().size;
403
-
404
- // copy bounding_box
405
- this.bounding_box.writeToArray(result.bounding_box, 0);
406
-
407
- this.group_aabb.writeToArray(result.group_bounding_box, 0);
408
-
409
- this.group_aabb.getCorners(result.group_bounding_box_corners);
410
-
411
- array_copy(this.group_bounding_sphere, 0, result.group_bounding_sphere, 0, 4);
412
-
413
- result.group_error = this.group_error;
414
-
415
- array_copy(this.bounding_sphere, 0, result.bounding_sphere, 0, 4);
416
-
417
- result.normal_cone.copy(this.normal_cone);
418
-
419
- fill_patch_geometry_data(result, source_geometry, this.topology_snapshot, vertex_data_spec);
420
-
421
- // optimize index buffer for better caching
422
- meshopt_optimizeVertexCache(result.face_indices, result.face_indices, result.face_indices.length, result.vertex_count);
423
- }
424
- }