@woosh/meep-engine 2.34.42 → 2.34.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/bvh2/BinaryNode.js +60 -32
- package/core/bvh2/LeafNode.js +2 -1
- package/core/bvh2/aabb3/AABB3.js +879 -1059
- package/core/bvh2/aabb3/AABB3.spec.js +5 -7
- package/core/bvh2/aabb3/aabb3_array_intersects_ray.js +2 -2
- package/core/bvh2/aabb3/aabb3_box_surface_area_2.js +10 -0
- package/core/bvh2/aabb3/aabb3_compute_half_surface_area.js +16 -0
- package/core/bvh2/aabb3/aabb3_compute_surface_area.js +18 -0
- package/core/bvh2/aabb3/aabb3_expand_array.js +15 -0
- package/core/bvh2/aabb3/aabb3_intersect_aabb3.js +28 -0
- package/core/bvh2/aabb3/aabb3_intersect_ray_slab.js +73 -0
- package/core/bvh2/aabb3/{aabb3_intersects_frustum.js → aabb3_intersects_frustum_array.js} +16 -1
- package/core/bvh2/aabb3/aabb3_intersects_line_segment.js +79 -0
- package/core/bvh2/aabb3/aabb3_intersects_ray.js +92 -0
- package/core/bvh2/aabb3/{AABB3Math.spec.js → aabb3_intersects_ray.spec.js} +3 -3
- package/core/bvh2/aabb3/aabb3_intersects_ray_fast.js +176 -0
- package/core/bvh2/aabb3/aabb3_score_boxes_SAH.js +43 -0
- package/core/bvh2/aabb3/aabb_score_boxes_SAH_delta.js +37 -0
- package/core/bvh2/aabb3/deserializeAABB3.js +17 -0
- package/core/bvh2/aabb3/deserializeAABB3Encoded_v0.js +73 -0
- package/core/bvh2/aabb3/deserializeAABB3Quantized16Uint.js +36 -0
- package/core/bvh2/aabb3/serializeAABB3.js +13 -0
- package/core/bvh2/aabb3/serializeAABB3Quantized16Uint.js +33 -0
- package/core/bvh2/binary/2/BinaryUint32BVH.js +3 -3
- package/core/bvh2/binary/BinaryBVH.js +2 -2
- package/core/bvh2/binary/RayLeafIntersectionVisitor.js +2 -2
- package/core/bvh2/serialization/deserializeBinaryNode.js +1 -1
- package/core/bvh2/serialization/deserializeBinaryNodeFromBinaryBuffer.js +2 -1
- package/core/bvh2/serialization/serializeBinaryNode.js +1 -1
- package/core/bvh2/serialization/serializeBinaryNodeToBinaryBuffer.js +2 -1
- package/core/bvh2/transform/BottomUpOptimizingRebuilder.js +6 -5
- package/core/bvh2/transform/tryRotateSingleNode.js +2 -1
- package/core/bvh2/traversal/bvh_traverse_pre_order_using_stack.js +43 -0
- package/core/bvh2/visual/convert_bvh_to_dot_format_string.js +50 -0
- package/core/geom/3d/frustum/{array_setFromProjectionMatrix.js → frustum_from_projection_matrix_array.js} +1 -1
- package/core/geom/3d/topology/TopoMesh.js +0 -8
- package/core/geom/3d/topology/TopoVertex.js +7 -6
- package/core/geom/3d/topology/simplify/quadratic/Quadratic3.js +93 -5
- package/core/geom/3d/topology/simplify/quadratic/build_vertex_quadratics.js +7 -4
- package/core/geom/3d/topology/simplify/quadratic/compute_edge_collapse_cost_quadratic.js +7 -1
- package/core/geom/3d/topology/simplify/simplifyTopoMesh.js +1 -14
- package/core/graph/convertGraphToDotString.js +4 -4
- package/core/graph/v2/Graph.js +4 -0
- package/core/math/fabsf.js +8 -0
- package/engine/development/performance/MetricCollection.js +6 -0
- package/engine/ecs/foliage/ecs/Foliage2System.js +6 -2
- package/engine/graphics/compute_geometry_polycount.js +21 -0
- package/engine/graphics/ecs/light/binding/three/ThreeLightBinding.js +1 -1
- package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +2 -2
- package/engine/graphics/ecs/mesh-v2/sample/prototypeShadedGeometry.js +77 -7
- package/engine/graphics/geometry/buffered/query/RaycastNearestHitComputingVisitor.js +2 -2
- package/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +4 -0
- package/engine/graphics/micron/build/hierarchy/merge_patches.js +1 -1
- package/engine/graphics/micron/convert_three_object_to_micron.js +2 -0
- package/engine/graphics/micron/format/MicronGeometryPatchOccurance.js +3 -2
- package/engine/graphics/micron/plugin/GLTFAssetTransformer.js +176 -0
- package/engine/graphics/micron/plugin/MicronRenderPlugin.js +1 -135
- package/engine/graphics/micron/prototypeVirtualGeometry.js +12 -7
- package/engine/graphics/micron/render/PatchCacheKey.js +1 -1
- package/engine/graphics/micron/render/VirtualGeometryBuilder.js +16 -43
- package/engine/graphics/micron/render/instanced/ThreeInstancedAdapter.js +5 -1
- package/engine/graphics/micron/render/refinement/ActivePatchList.js +4 -10
- package/engine/graphics/micron/render/refinement/RefinementSpec.js +16 -20
- package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +316 -11
- package/engine/graphics/render/layers/RenderLayer.js +22 -14
- package/engine/graphics/render/visibility/IncrementalDeltaSet.js +18 -5
- package/engine/graphics/render/visibility/VisibilityComputer.js +11 -15
- package/package.json +1 -1
- package/core/bvh2/aabb3/AABB3Math.js +0 -579
package/core/bvh2/BinaryNode.js
CHANGED
|
@@ -8,12 +8,14 @@ import { arrayQuickSort } from "../collection/array/arrayQuickSort.js";
|
|
|
8
8
|
import { max2 } from "../math/max2.js";
|
|
9
9
|
import { min2 } from "../math/min2.js";
|
|
10
10
|
import { computeSampleStandardDeviation } from "../math/statistics/computeSampleStandardDeviation.js";
|
|
11
|
-
import { _boxSurfaceArea2, aabb3_intersect_aabb3, boxSurfaceArea2 } from "./aabb3/AABB3Math.js";
|
|
12
11
|
import { isLeaf, LeafNode } from "./LeafNode.js";
|
|
13
12
|
import { Node } from "./Node.js";
|
|
14
13
|
import { surfaceAreaHeuristic } from "./sah/surfaceAreaHeuristic.js";
|
|
15
14
|
import { BVHVisitor } from "./traversal/BVHVisitor.js";
|
|
16
15
|
import { traverseBinaryNodeUsingVisitor } from "./traversal/traverseBinaryNodeUsingVisitor.js";
|
|
16
|
+
import { aabb3_intersect_aabb3 } from "./aabb3/aabb3_intersect_aabb3.js";
|
|
17
|
+
import { aabb3_box_surface_area_2 } from "./aabb3/aabb3_box_surface_area_2.js";
|
|
18
|
+
import { aabb3_compute_half_surface_area } from "./aabb3/aabb3_compute_half_surface_area.js";
|
|
17
19
|
|
|
18
20
|
|
|
19
21
|
/**
|
|
@@ -209,44 +211,60 @@ export class BinaryNode extends Node {
|
|
|
209
211
|
*/
|
|
210
212
|
__insertion_findSiblingFor(box) {
|
|
211
213
|
|
|
212
|
-
|
|
213
|
-
let
|
|
214
|
+
let node = this;
|
|
215
|
+
let cost_left = 0;
|
|
216
|
+
let cost_right = 0;
|
|
214
217
|
|
|
215
|
-
|
|
216
|
-
|
|
218
|
+
while (node.isBinaryNode) {
|
|
219
|
+
const left = node.left;
|
|
220
|
+
const right = node.right;
|
|
217
221
|
|
|
218
|
-
|
|
219
|
-
const node = open_set[--cursor];
|
|
222
|
+
const area = aabb3_box_surface_area_2(node);
|
|
220
223
|
|
|
221
|
-
const
|
|
224
|
+
const combined_area = combined_surface_area(node, box);
|
|
222
225
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
best_node = node;
|
|
226
|
-
}
|
|
226
|
+
//cost of creating a new parent for this node and the new leaf
|
|
227
|
+
const cost = combined_area;
|
|
227
228
|
|
|
228
|
-
|
|
229
|
+
// minimum cost of pushing the leaf further down the tree
|
|
230
|
+
const inheritance_cost = combined_area - area;
|
|
229
231
|
|
|
230
|
-
|
|
232
|
+
// cost of descending left
|
|
233
|
+
if (left !== null) {
|
|
234
|
+
if (left.isLeafNode) {
|
|
235
|
+
cost_left = combined_surface_area(left, box) + inheritance_cost;
|
|
236
|
+
} else {
|
|
237
|
+
cost_left = combined_surface_area(left, box) - aabb3_box_surface_area_2(left) + inheritance_cost;
|
|
238
|
+
}
|
|
239
|
+
} else {
|
|
240
|
+
cost_left = Infinity;
|
|
241
|
+
}
|
|
231
242
|
|
|
232
|
-
|
|
233
|
-
|
|
243
|
+
// cost of descending right
|
|
244
|
+
if (right !== null) {
|
|
234
245
|
|
|
235
|
-
if (
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
if (node.right !== null) {
|
|
241
|
-
open_set[cursor++] = node.right
|
|
242
|
-
}
|
|
246
|
+
if (right.isLeafNode) {
|
|
247
|
+
cost_right = combined_surface_area(right, box) + inheritance_cost;
|
|
248
|
+
} else {
|
|
249
|
+
cost_right = combined_surface_area(right, box) - aabb3_box_surface_area_2(right) + inheritance_cost;
|
|
243
250
|
}
|
|
251
|
+
} else {
|
|
252
|
+
cost_right = Infinity;
|
|
244
253
|
}
|
|
245
254
|
|
|
255
|
+
if (cost < cost_left && cost < cost_right) {
|
|
256
|
+
// descending either branch is too expensive
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
246
259
|
|
|
260
|
+
if (cost_left < cost_right) {
|
|
261
|
+
node = left;
|
|
262
|
+
} else {
|
|
263
|
+
node = right;
|
|
264
|
+
}
|
|
247
265
|
}
|
|
248
266
|
|
|
249
|
-
return
|
|
267
|
+
return node;
|
|
250
268
|
}
|
|
251
269
|
|
|
252
270
|
/**
|
|
@@ -288,8 +306,8 @@ export class BinaryNode extends Node {
|
|
|
288
306
|
}
|
|
289
307
|
|
|
290
308
|
//change costs to be based on balance
|
|
291
|
-
aCost = a.leafNodeCount /
|
|
292
|
-
bCost = b.leafNodeCount /
|
|
309
|
+
aCost = a.leafNodeCount / aabb3_box_surface_area_2(a);
|
|
310
|
+
bCost = b.leafNodeCount / aabb3_box_surface_area_2(b);
|
|
293
311
|
}
|
|
294
312
|
|
|
295
313
|
if (aCost === bCost) {
|
|
@@ -480,7 +498,7 @@ export class BinaryNode extends Node {
|
|
|
480
498
|
leftArea = 0;
|
|
481
499
|
leftLeaves = 0;
|
|
482
500
|
} else {
|
|
483
|
-
leftArea =
|
|
501
|
+
leftArea = aabb3_box_surface_area_2(left);
|
|
484
502
|
leftLeaves = left.leafNodeCount;
|
|
485
503
|
}
|
|
486
504
|
|
|
@@ -489,11 +507,11 @@ export class BinaryNode extends Node {
|
|
|
489
507
|
rightArea = 0;
|
|
490
508
|
rightLeaves = 0;
|
|
491
509
|
} else {
|
|
492
|
-
rightArea =
|
|
510
|
+
rightArea = aabb3_box_surface_area_2(right);
|
|
493
511
|
rightLeaves = right.leafNodeCount;
|
|
494
512
|
}
|
|
495
513
|
|
|
496
|
-
const thisArea =
|
|
514
|
+
const thisArea = aabb3_box_surface_area_2(this);
|
|
497
515
|
|
|
498
516
|
return surfaceAreaHeuristic(thisArea, leftArea, rightArea, leftLeaves, rightLeaves);
|
|
499
517
|
}
|
|
@@ -1132,6 +1150,16 @@ BinaryNode.prototype.isBinaryNode = true;
|
|
|
1132
1150
|
* @returns {number}
|
|
1133
1151
|
*/
|
|
1134
1152
|
function inclusion_surface_area_heuristic(node, addition) {
|
|
1153
|
+
return combined_surface_area(node, addition) - aabb3_box_surface_area_2(node);
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
/**
|
|
1157
|
+
*
|
|
1158
|
+
* @param {AABB3} node
|
|
1159
|
+
* @param {AABB3} addition
|
|
1160
|
+
* @returns {number}
|
|
1161
|
+
*/
|
|
1162
|
+
function combined_surface_area(node, addition) {
|
|
1135
1163
|
const x0 = min2(node.x0, addition.x0);
|
|
1136
1164
|
const y0 = min2(node.y0, addition.y0);
|
|
1137
1165
|
const z0 = min2(node.z0, addition.z0);
|
|
@@ -1140,7 +1168,7 @@ function inclusion_surface_area_heuristic(node, addition) {
|
|
|
1140
1168
|
const y1 = max2(node.y1, addition.y1);
|
|
1141
1169
|
const z1 = max2(node.z1, addition.z1);
|
|
1142
1170
|
|
|
1143
|
-
return
|
|
1171
|
+
return aabb3_compute_half_surface_area(x0, y0, z0, x1, y1, z1);
|
|
1144
1172
|
}
|
|
1145
1173
|
|
|
1146
1174
|
/**
|
|
@@ -1150,7 +1178,7 @@ function inclusion_surface_area_heuristic(node, addition) {
|
|
|
1150
1178
|
*/
|
|
1151
1179
|
function inclusion_cost_lower_bound(node, addition) {
|
|
1152
1180
|
let n = node;
|
|
1153
|
-
let r =
|
|
1181
|
+
let r = aabb3_box_surface_area_2(addition);
|
|
1154
1182
|
|
|
1155
1183
|
while (n !== null) {
|
|
1156
1184
|
|
package/core/bvh2/LeafNode.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Created by Alex on 17/11/2014.
|
|
3
3
|
*/
|
|
4
|
-
import { deserializeAABB3, serializeAABB3 } from "./aabb3/AABB3.js";
|
|
5
4
|
import { Node } from "./Node.js";
|
|
5
|
+
import { serializeAABB3 } from "./aabb3/serializeAABB3.js";
|
|
6
|
+
import { deserializeAABB3 } from "./aabb3/deserializeAABB3.js";
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
/**
|