@woosh/meep-engine 2.36.10 → 2.36.13
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/binary/BitSet.js +32 -8
- package/core/binary/BitSet.spec.js +12 -0
- package/core/bvh2/aabb3/AABB3.js +1 -1
- package/core/bvh2/aabb3/aabb3_array_intersects_frustum_degree.js +20 -0
- package/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js +290 -240
- package/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.spec.js +3 -0
- package/core/bvh2/bvh3/bvh_collect_user_data.js +60 -0
- package/core/bvh2/bvh3/bvh_query_user_data_by_frustum.js +85 -0
- package/core/bvh2/bvh3/bvh_query_user_data_generic.js +79 -0
- package/engine/graphics/ecs/mesh/Mesh.js +15 -0
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +3 -1
- package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +1 -1
- package/engine/graphics/ecs/mesh-v2/aggregate/prototypeSGMesh.js +22 -6
- package/engine/graphics/ecs/mesh-v2/render/ShadedGeometryRendererContext.js +9 -11
- package/engine/graphics/ecs/mesh-v2/three_object_to_entity_composition.js +6 -1
- package/engine/graphics/micron/plugin/MicronRenderPlugin.js +73 -1
- package/engine/graphics/render/visibility/IncrementalDeltaSet.js +1 -1
- package/package.json +1 -1
package/core/binary/BitSet.js
CHANGED
|
@@ -510,6 +510,36 @@ BitSet.prototype.getAndClear = function (index) {
|
|
|
510
510
|
return v;
|
|
511
511
|
};
|
|
512
512
|
|
|
513
|
+
/**
|
|
514
|
+
*
|
|
515
|
+
* @param {number} distance
|
|
516
|
+
* @param {number} start_index
|
|
517
|
+
* @param {number} end_index
|
|
518
|
+
*/
|
|
519
|
+
BitSet.prototype.shift_right = function (distance, start_index, end_index) {
|
|
520
|
+
assert.isNonNegativeInteger(distance, 'distance');
|
|
521
|
+
|
|
522
|
+
for (let i = end_index; i >= start_index; i--) {
|
|
523
|
+
const v = this.get(i);
|
|
524
|
+
this.set(i + distance, v);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
*
|
|
530
|
+
* @param {number} distance
|
|
531
|
+
* @param {number} start_index
|
|
532
|
+
* @param {number} end_index
|
|
533
|
+
*/
|
|
534
|
+
BitSet.prototype.shift_left = function (distance, start_index, end_index) {
|
|
535
|
+
assert.isNonNegativeInteger(distance, 'distance');
|
|
536
|
+
|
|
537
|
+
for (let i = start_index; i <= end_index; i++) {
|
|
538
|
+
const v = this.get(i);
|
|
539
|
+
this.set(i - distance, v);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
513
543
|
/**
|
|
514
544
|
*
|
|
515
545
|
* @param {number} distance
|
|
@@ -518,15 +548,9 @@ BitSet.prototype.getAndClear = function (index) {
|
|
|
518
548
|
*/
|
|
519
549
|
BitSet.prototype.shift = function (distance, start_index, end_index) {
|
|
520
550
|
if (distance > 0) {
|
|
521
|
-
|
|
522
|
-
const v = this.get(i);
|
|
523
|
-
this.set(i + distance, v);
|
|
524
|
-
}
|
|
551
|
+
this.shift_right(distance, start_index, end_index);
|
|
525
552
|
} else {
|
|
526
|
-
|
|
527
|
-
const v = this.get(i);
|
|
528
|
-
this.set(i + distance, v);
|
|
529
|
-
}
|
|
553
|
+
this.shift_right(-distance, start_index, end_index);
|
|
530
554
|
}
|
|
531
555
|
};
|
|
532
556
|
|
|
@@ -452,3 +452,15 @@ test('performance, next clear from 0', () => {
|
|
|
452
452
|
const v = s.nextClearBit(0);
|
|
453
453
|
}
|
|
454
454
|
});
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
test('shift right by 1', () => {
|
|
458
|
+
const s = new BitSet();
|
|
459
|
+
|
|
460
|
+
s.set(0, true);
|
|
461
|
+
|
|
462
|
+
s.shift_right(1, 0, 1);
|
|
463
|
+
|
|
464
|
+
expect(s.get(0)).toBe(true);
|
|
465
|
+
expect(s.get(1)).toBe(true);
|
|
466
|
+
});
|
package/core/bvh2/aabb3/AABB3.js
CHANGED
|
@@ -753,7 +753,7 @@ export class AABB3 {
|
|
|
753
753
|
* @param {number[]|Float32Array|Float64Array} source
|
|
754
754
|
* @param {number} offset
|
|
755
755
|
*/
|
|
756
|
-
readFromArray(source, offset) {
|
|
756
|
+
readFromArray(source, offset = 0) {
|
|
757
757
|
assert.isNonNegativeInteger(offset, 'offset');
|
|
758
758
|
|
|
759
759
|
this.x0 = source[offset];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { aabb3_intersects_frustum_degree } from "./aabb3_intersects_frustum_degree.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {number[]} aabb
|
|
7
|
+
* @param {number[]} frustum
|
|
8
|
+
* @returns {number}
|
|
9
|
+
*/
|
|
10
|
+
export function aabb3_array_intersects_frustum_degree(aabb, frustum) {
|
|
11
|
+
|
|
12
|
+
const x0 = aabb[0];
|
|
13
|
+
const y0 = aabb[1];
|
|
14
|
+
const z0 = aabb[2];
|
|
15
|
+
const x1 = aabb[3];
|
|
16
|
+
const y1 = aabb[4];
|
|
17
|
+
const z1 = aabb[5];
|
|
18
|
+
|
|
19
|
+
return aabb3_intersects_frustum_degree(x0, y0, z0, x1, y1, z1, frustum);
|
|
20
|
+
}
|