@woosh/meep-engine 2.47.2 → 2.47.8
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/build/bundle-worker-image-decoder.js +1 -0
- package/build/bundle-worker-terrain.js +1 -0
- package/build/meep.cjs +659 -553
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +659 -553
- package/package.json +2 -2
- package/src/core/binary/BitSet.spec.js +3 -3
- package/src/core/bvh2/BinaryNode.js +12 -10
- package/src/core/bvh2/aabb3/AABB3.js +30 -31
- package/src/core/bvh2/binary/2/BinaryUint32BVH.js +1 -1
- package/src/core/bvh2/binary/BinaryBVH.js +1 -1
- package/src/core/bvh2/binary/RayLeafIntersectionVisitor.js +1 -1
- package/src/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +2 -2
- package/src/core/bvh2/bvh3/query/BVHQueryIntersectsFrustum.js +1 -1
- package/src/core/bvh2/bvh3/query/BVHQueryIntersectsRay.js +1 -1
- package/src/core/bvh2/bvh3/query/bvh_collect_user_data.js +10 -8
- package/src/core/bvh2/bvh3/query/bvh_query_leaves_generic.js +14 -22
- package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray.js +13 -15
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_generic.js +14 -21
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_nearest_to_point.js +16 -24
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_frustum.js +23 -26
- package/src/core/bvh2/bvh3/query/compute_tight_near_far_clipping_planes.js +10 -11
- package/src/core/bvh2/transform/BottomUpOptimizingRebuilder.js +2 -2
- package/src/core/bvh2/transform/tryRotateSingleNode.js +2 -2
- package/src/core/bvh2/traversal/aabb3_detailed_volume_intersection_callback_based.js +1 -1
- package/src/core/bvh2/traversal/queryBinaryNode_FrustumIntersections.js +1 -1
- package/src/core/collection/SCRATCH_UINT32_TRAVERSAL_STACK.js +13 -0
- package/src/core/color/Color.d.ts +2 -1
- package/src/core/color/Color.js +30 -5
- package/src/core/color/ColorUtils.js +7 -5
- package/src/core/color/parseHex.js +11 -3
- package/src/core/color/rgb2hex.js +1 -1
- package/src/core/geom/3d/SurfacePoint3.d.ts +7 -0
- package/src/core/geom/3d/SurfacePoint3.js +56 -1
- package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_array_combine.js +2 -2
- package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_array_contains_point.js +1 -1
- package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_array_intersects_frustum_degree.js +2 -2
- package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_combined_surface_area.js +2 -2
- package/src/core/geom/3d/aabb/aabb3_compute_distance_above_plane_max.js +1 -1
- package/src/core/geom/3d/aabb/aabb3_compute_distance_above_plane_max.spec.js +8 -0
- package/src/core/geom/3d/aabb/{computeAABB3PlaneSide.js → aabb3_compute_plane_side.js} +1 -1
- package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_detailed_volume_intersection.js +7 -7
- package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_from_v3_array.js +4 -4
- package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_from_v3_array_transformed.js +2 -2
- package/src/core/{bvh2/aabb3/aabb3_intersect_aabb3.js → geom/3d/aabb/aabb3_intersects_aabb3.js} +2 -2
- package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_intersects_frustum_array.js +2 -2
- package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_intersects_frustum_degree.js +4 -4
- package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_intersects_line_segment.js +1 -1
- package/src/core/geom/3d/aabb/aabb3_intersects_ray.js +87 -0
- package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_intersects_ray.spec.js +1 -1
- package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_intersects_ray_branchless.js +2 -2
- package/src/core/{bvh2/aabb3/aabb3_intersect_ray_slab.js → geom/3d/aabb/aabb3_intersects_ray_slab.js} +35 -17
- package/src/core/geom/3d/aabb/aabb3_matrix4_project_by_corners.js +5 -1
- package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_nearest_point_on_surface.js +2 -2
- package/src/core/geom/3d/aabb/aabb3_raycast.js +103 -0
- package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_signed_distance_sqr_to_point.js +1 -1
- package/src/core/geom/3d/aabb/computeBoundingBoxFromVertexData.js +4 -12
- package/src/core/geom/3d/aabb/compute_aabb_from_points.js +8 -1
- package/src/core/geom/3d/shape/UnitCubeShape3D.js +1 -1
- package/src/core/geom/3d/triangle/computeTriangleRayIntersection.js +4 -7
- package/src/core/model/node-graph/DataType.d.ts +4 -0
- package/src/core/model/node-graph/node/NodeDescription.d.ts +11 -1
- package/src/core/model/node-graph/node/NodeInstance.js +8 -1
- package/src/core/model/node-graph/node/NodeRegistry.spec.js +47 -1
- package/src/core/model/node-graph/node/Port.d.ts +3 -0
- package/src/core/model/node-graph/node/Port.js +7 -3
- package/src/core/model/node-graph/node/Port.spec.js +44 -0
- package/src/core/model/node-graph/node/PortDirection.d.ts +5 -0
- package/src/engine/asset/loaders/GLTFAssetLoader.js +1 -1
- package/src/engine/ecs/foliage/InstancedFoliage.js +1 -1
- package/src/engine/ecs/storage/BinaryBufferSerializer.js +13 -1
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +11 -4
- package/src/engine/ecs/storage/binary/object/BinaryObjectSerializationAdapter2.js +54 -0
- package/src/engine/ecs/systems/RenderSystem.js +1 -33
- package/src/engine/ecs/terrain/ecs/makeTerrainWorkerProxy.js +2 -4
- package/src/engine/ecs/terrain/tiles/TileBuildWorker.js +6 -1
- package/src/engine/graphics/GraphicsEngine.js +5 -1
- package/src/engine/graphics/ecs/decal/v2/Decal.js +44 -2
- package/src/engine/graphics/ecs/decal/v2/DecalSerializationAdapter.js +31 -0
- package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +16 -5
- package/src/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +88 -56
- package/src/engine/graphics/geometry/buffered/query/ClippingPlaneContainmentComputingVisitor.js +2 -2
- package/src/engine/graphics/geometry/buffered/query/RaycastNearestHitComputingVisitor.js +1 -1
- package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.js +3 -2
- package/src/engine/graphics/geometry/skining/computeSkinnedMeshBoundingVolumes.js +3 -2
- package/src/engine/graphics/micron/format/MicronGeometry.js +1 -1
- package/src/engine/graphics/micron/format/validate_patch_bounds.js +1 -1
- package/src/engine/graphics/micron/render/refinement/ActivePatchList.js +1 -1
- package/src/engine/graphics/micron/render/refinement/get_geometry_patch_cut.js +16 -16
- package/src/engine/graphics/render/forward_plus/LightManager.js +3 -0
- package/src/engine/graphics/render/forward_plus/LightManager.spec.js +5 -5
- package/src/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_APPLY_DECALS.js +4 -0
- package/src/engine/graphics/render/forward_plus/model/Decal.js +10 -2
- package/src/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_objects.js +2 -2
- package/src/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_texture.js +18 -16
- package/src/engine/graphics/render/gizmo/GizmoShapeRenderingInterface.js +2 -0
- package/src/engine/graphics/render/visibility/IncrementalDeltaSet.js +26 -13
- package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.js +8 -2
- package/src/engine/graphics/sh3/path_tracer/PathTracer.js +3 -3
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +18 -15
- package/src/engine/graphics/texture/sampler/sampler2d_channel_compute_max.js +1 -1
- package/src/engine/graphics/texture/sampler/sampler2d_channel_compute_min.js +1 -1
- package/src/engine/graphics/three/three_computeObjectBoundingBox.js +56 -0
- package/src/engine/input/devices/{InputDeviceButton.d.ts → InputDeviceSwitch.d.ts} +1 -1
- package/src/engine/input/devices/{InputDeviceButton.js → InputDeviceSwitch.js} +1 -1
- package/src/engine/input/devices/KeyboardDevice.d.ts +2 -2
- package/src/engine/input/devices/KeyboardDevice.js +58 -40
- package/src/engine/input/devices/PointerDevice.js +224 -179
- package/src/core/bvh2/aabb3/aabb3_intersects_ray.js +0 -97
- package/src/core/geom/3d/aabb/aabb3_computeDistanceAbovePlane_max.spec.js +0 -8
- /package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_array_intersects_frustum_array.js +0 -0
- /package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_array_intersects_ray.js +0 -0
- /package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_array_intersects_ray_array.js +0 -0
- /package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_box_surface_area_2.js +0 -0
- /package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_compute_half_surface_area.js +0 -0
- /package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_compute_surface_area.js +0 -0
- /package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_corner_edge_mapping.js +0 -0
- /package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_corner_edge_mapping.spec.js +0 -0
- /package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_edge_corner_mapping.js +0 -0
- /package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_edge_corner_mapping.spec.js +0 -0
- /package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_edge_plane_mapping.js +0 -0
- /package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_expand_array.js +0 -0
- /package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_intersects_ray_fast.js +0 -0
- /package/src/core/{bvh2/aabb3 → geom/3d/aabb}/aabb3_score_boxes_SAH.js +0 -0
- /package/src/core/{bvh2/aabb3/aabb_score_boxes_SAH_delta.js → geom/3d/aabb/aabb3_score_boxes_SAH_delta.js} +0 -0
package/build/meep.module.js
CHANGED
|
@@ -49631,7 +49631,7 @@ function arraySwapElements(array, index0, index1) {
|
|
|
49631
49631
|
array[index1] = t;
|
|
49632
49632
|
}
|
|
49633
49633
|
|
|
49634
|
-
const stack$
|
|
49634
|
+
const stack$b = [];
|
|
49635
49635
|
|
|
49636
49636
|
/**
|
|
49637
49637
|
* @template T
|
|
@@ -49652,14 +49652,14 @@ function arrayQuickSort(data, score_function, score_function_context, start, end
|
|
|
49652
49652
|
let stackPointer = 2;
|
|
49653
49653
|
let i, j;
|
|
49654
49654
|
|
|
49655
|
-
stack$
|
|
49656
|
-
stack$
|
|
49655
|
+
stack$b[0] = start;
|
|
49656
|
+
stack$b[1] = end;
|
|
49657
49657
|
|
|
49658
49658
|
while (stackPointer > 0) {
|
|
49659
49659
|
stackPointer -= 2;
|
|
49660
49660
|
|
|
49661
|
-
const right = stack$
|
|
49662
|
-
const left = stack$
|
|
49661
|
+
const right = stack$b[stackPointer + 1];
|
|
49662
|
+
const left = stack$b[stackPointer];
|
|
49663
49663
|
|
|
49664
49664
|
i = left;
|
|
49665
49665
|
j = right;
|
|
@@ -49692,12 +49692,12 @@ function arrayQuickSort(data, score_function, score_function_context, start, end
|
|
|
49692
49692
|
|
|
49693
49693
|
/* recursion */
|
|
49694
49694
|
if (left < j) {
|
|
49695
|
-
stack$
|
|
49696
|
-
stack$
|
|
49695
|
+
stack$b[stackPointer++] = left;
|
|
49696
|
+
stack$b[stackPointer++] = j;
|
|
49697
49697
|
}
|
|
49698
49698
|
if (i < right) {
|
|
49699
|
-
stack$
|
|
49700
|
-
stack$
|
|
49699
|
+
stack$b[stackPointer++] = i;
|
|
49700
|
+
stack$b[stackPointer++] = right;
|
|
49701
49701
|
}
|
|
49702
49702
|
}
|
|
49703
49703
|
}
|
|
@@ -49719,14 +49719,14 @@ function array_quick_sort_by_comparator(data, compare_function, compare_function
|
|
|
49719
49719
|
let stackPointer = 2;
|
|
49720
49720
|
let i, j;
|
|
49721
49721
|
|
|
49722
|
-
stack$
|
|
49723
|
-
stack$
|
|
49722
|
+
stack$b[0] = start;
|
|
49723
|
+
stack$b[1] = end;
|
|
49724
49724
|
|
|
49725
49725
|
while (stackPointer > 0) {
|
|
49726
49726
|
stackPointer -= 2;
|
|
49727
49727
|
|
|
49728
|
-
const right = stack$
|
|
49729
|
-
const left = stack$
|
|
49728
|
+
const right = stack$b[stackPointer + 1];
|
|
49729
|
+
const left = stack$b[stackPointer];
|
|
49730
49730
|
|
|
49731
49731
|
i = left;
|
|
49732
49732
|
j = right;
|
|
@@ -49762,12 +49762,12 @@ function array_quick_sort_by_comparator(data, compare_function, compare_function
|
|
|
49762
49762
|
|
|
49763
49763
|
/* recursion */
|
|
49764
49764
|
if (left < j) {
|
|
49765
|
-
stack$
|
|
49766
|
-
stack$
|
|
49765
|
+
stack$b[stackPointer++] = left;
|
|
49766
|
+
stack$b[stackPointer++] = j;
|
|
49767
49767
|
}
|
|
49768
49768
|
if (i < right) {
|
|
49769
|
-
stack$
|
|
49770
|
-
stack$
|
|
49769
|
+
stack$b[stackPointer++] = i;
|
|
49770
|
+
stack$b[stackPointer++] = right;
|
|
49771
49771
|
}
|
|
49772
49772
|
}
|
|
49773
49773
|
}
|
|
@@ -49872,7 +49872,7 @@ function mortonEncode_magicbits(x, y, z) {
|
|
|
49872
49872
|
* @param {number} _z1
|
|
49873
49873
|
* @returns {number}
|
|
49874
49874
|
*/
|
|
49875
|
-
function
|
|
49875
|
+
function aabb3_compute_distance_above_plane_max(
|
|
49876
49876
|
plane_normal_x, plane_normal_y, plane_normal_z, plane_constant,
|
|
49877
49877
|
_x0, _y0, _z0,
|
|
49878
49878
|
_x1, _y1, _z1
|
|
@@ -49920,7 +49920,7 @@ function v3_distance_above_plane(
|
|
|
49920
49920
|
* @param {number} _z1
|
|
49921
49921
|
* @returns {number}
|
|
49922
49922
|
*/
|
|
49923
|
-
function
|
|
49923
|
+
function aabb3_compute_plane_side(
|
|
49924
49924
|
plane_normal_x,
|
|
49925
49925
|
plane_normal_y,
|
|
49926
49926
|
plane_normal_z,
|
|
@@ -50052,16 +50052,15 @@ function aabb3_intersects_frustum_degree(
|
|
|
50052
50052
|
) {
|
|
50053
50053
|
|
|
50054
50054
|
let result = 2;
|
|
50055
|
-
let i = 0;
|
|
50056
50055
|
|
|
50057
|
-
for (; i < 24; i += 4) {
|
|
50056
|
+
for (let i = 0; i < 24; i += 4) {
|
|
50058
50057
|
|
|
50059
50058
|
const p_x = frustum[i];
|
|
50060
50059
|
const p_y = frustum[i + 1];
|
|
50061
50060
|
const p_z = frustum[i + 2];
|
|
50062
50061
|
const p_w = frustum[i + 3];
|
|
50063
50062
|
|
|
50064
|
-
const plane_side =
|
|
50063
|
+
const plane_side = aabb3_compute_plane_side(
|
|
50065
50064
|
p_x, p_y, p_z, p_w,
|
|
50066
50065
|
x0, y0, z0, x1, y1, z1
|
|
50067
50066
|
);
|
|
@@ -50070,6 +50069,7 @@ function aabb3_intersects_frustum_degree(
|
|
|
50070
50069
|
// completely outside
|
|
50071
50070
|
return 0;
|
|
50072
50071
|
} else if (plane_side === 0) {
|
|
50072
|
+
// partially inside - plane intersects AABB
|
|
50073
50073
|
result = 1;
|
|
50074
50074
|
}
|
|
50075
50075
|
}
|
|
@@ -50082,7 +50082,7 @@ function aabb3_intersects_frustum_degree(
|
|
|
50082
50082
|
* @param {Number} val
|
|
50083
50083
|
* @returns {number}
|
|
50084
50084
|
*/
|
|
50085
|
-
function fabsf(val) {
|
|
50085
|
+
function fabsf$1(val) {
|
|
50086
50086
|
return val >= 0 ? val : -val;
|
|
50087
50087
|
}
|
|
50088
50088
|
|
|
@@ -50128,22 +50128,22 @@ function aabb3_intersects_line_segment(
|
|
|
50128
50128
|
boxExtentsX = (x1 - x0) / 2;
|
|
50129
50129
|
centerX = x0 + boxExtentsX;
|
|
50130
50130
|
diffX = (0.5 * (endX + startX)) - centerX;
|
|
50131
|
-
a = fabsf(dirX);
|
|
50132
|
-
if (fabsf(diffX) > boxExtentsX + a) return false;
|
|
50131
|
+
a = fabsf$1(dirX);
|
|
50132
|
+
if (fabsf$1(diffX) > boxExtentsX + a) return false;
|
|
50133
50133
|
//
|
|
50134
50134
|
dirY = 0.5 * (endY - startY);
|
|
50135
50135
|
boxExtentsY = (y1 - y0) / 2;
|
|
50136
50136
|
centerY = y0 + boxExtentsY;
|
|
50137
50137
|
diffY = (0.5 * (endY + startY)) - centerY;
|
|
50138
|
-
b = fabsf(dirY);
|
|
50139
|
-
if (fabsf(diffY) > boxExtentsY + b) return false;
|
|
50138
|
+
b = fabsf$1(dirY);
|
|
50139
|
+
if (fabsf$1(diffY) > boxExtentsY + b) return false;
|
|
50140
50140
|
//
|
|
50141
50141
|
dirZ = 0.5 * (endZ - startZ);
|
|
50142
50142
|
boxExtentsZ = (z1 - z0) / 2;
|
|
50143
50143
|
centerZ = z0 + boxExtentsZ;
|
|
50144
50144
|
diffZ = (0.5 * (endZ + startZ)) - centerZ;
|
|
50145
|
-
c = fabsf(dirZ);
|
|
50146
|
-
if (fabsf(diffZ) > boxExtentsZ + c) return false;
|
|
50145
|
+
c = fabsf$1(dirZ);
|
|
50146
|
+
if (fabsf$1(diffZ) > boxExtentsZ + c) return false;
|
|
50147
50147
|
|
|
50148
50148
|
//Dir.y = 0.5f * (segment.mP1.y - segment.mP0.y);
|
|
50149
50149
|
//BoxExtents.y = aabb.GetExtents(1);
|
|
@@ -50153,15 +50153,17 @@ function aabb3_intersects_line_segment(
|
|
|
50153
50153
|
|
|
50154
50154
|
let f;
|
|
50155
50155
|
f = dirY * diffZ - dirZ * diffY;
|
|
50156
|
-
if (fabsf(f) > boxExtentsY * c + boxExtentsZ * b) return false;
|
|
50156
|
+
if (fabsf$1(f) > boxExtentsY * c + boxExtentsZ * b) return false;
|
|
50157
50157
|
f = dirZ * diffX - dirX * diffZ;
|
|
50158
|
-
if (fabsf(f) > boxExtentsX * c + boxExtentsZ * a) return false;
|
|
50158
|
+
if (fabsf$1(f) > boxExtentsX * c + boxExtentsZ * a) return false;
|
|
50159
50159
|
f = dirX * diffY - dirY * diffX;
|
|
50160
|
-
if (fabsf(f) > boxExtentsX * b + boxExtentsY * a) return false;
|
|
50160
|
+
if (fabsf$1(f) > boxExtentsX * b + boxExtentsY * a) return false;
|
|
50161
50161
|
|
|
50162
50162
|
return true;
|
|
50163
50163
|
}
|
|
50164
50164
|
|
|
50165
|
+
const fabsf = Math.abs;
|
|
50166
|
+
|
|
50165
50167
|
/**
|
|
50166
50168
|
* NOTES:
|
|
50167
50169
|
* https://web.archive.org/web/20090803054252/http://tog.acm.org/resources/GraphicsGems/gems/RayBox.c
|
|
@@ -50174,86 +50176,77 @@ function aabb3_intersects_line_segment(
|
|
|
50174
50176
|
* @param {number} x1
|
|
50175
50177
|
* @param {number} y1
|
|
50176
50178
|
* @param {number} z1
|
|
50177
|
-
* @param {number}
|
|
50178
|
-
* @param {number}
|
|
50179
|
-
* @param {number}
|
|
50180
|
-
* @param {number}
|
|
50181
|
-
* @param {number}
|
|
50182
|
-
* @param {number}
|
|
50179
|
+
* @param {number} origin_x
|
|
50180
|
+
* @param {number} origin_y
|
|
50181
|
+
* @param {number} origin_z
|
|
50182
|
+
* @param {number} direction_x
|
|
50183
|
+
* @param {number} direction_y
|
|
50184
|
+
* @param {number} direction_z
|
|
50183
50185
|
* @returns {boolean}
|
|
50184
50186
|
*/
|
|
50185
50187
|
function aabb3_intersects_ray(
|
|
50186
50188
|
x0, y0, z0,
|
|
50187
50189
|
x1, y1, z1,
|
|
50188
|
-
|
|
50189
|
-
|
|
50190
|
+
origin_x, origin_y, origin_z,
|
|
50191
|
+
direction_x, direction_y, direction_z
|
|
50190
50192
|
) {
|
|
50191
50193
|
|
|
50192
50194
|
// Z Projection
|
|
50193
|
-
const
|
|
50195
|
+
const extents_x = (x1 - x0) * 0.5;
|
|
50194
50196
|
|
|
50195
|
-
const
|
|
50197
|
+
const center_x = x0 + extents_x;
|
|
50196
50198
|
|
|
50197
|
-
const
|
|
50199
|
+
const diff_x = origin_x - center_x;
|
|
50198
50200
|
|
|
50199
50201
|
|
|
50200
|
-
if (
|
|
50202
|
+
if (diff_x * direction_x >= 0.0 && fabsf(diff_x) > extents_x) {
|
|
50201
50203
|
return false;
|
|
50202
50204
|
}
|
|
50203
50205
|
|
|
50204
50206
|
// Y projection
|
|
50205
|
-
const
|
|
50207
|
+
const extents_y = (y1 - y0) * 0.5;
|
|
50206
50208
|
|
|
50207
|
-
const
|
|
50209
|
+
const center_y = y0 + extents_y;
|
|
50208
50210
|
|
|
50209
|
-
const
|
|
50211
|
+
const diff_y = origin_y - center_y;
|
|
50210
50212
|
|
|
50211
50213
|
|
|
50212
|
-
if (
|
|
50214
|
+
if (diff_y * direction_y >= 0.0 && fabsf(diff_y) > extents_y) {
|
|
50213
50215
|
return false;
|
|
50214
50216
|
}
|
|
50215
50217
|
|
|
50216
50218
|
// Z projection
|
|
50217
|
-
const
|
|
50219
|
+
const extents_z = (z1 - z0) * 0.5;
|
|
50218
50220
|
|
|
50219
|
-
const
|
|
50221
|
+
const center_z = z0 + extents_z;
|
|
50220
50222
|
|
|
50221
|
-
const
|
|
50223
|
+
const diff_z = origin_z - center_z;
|
|
50222
50224
|
|
|
50223
50225
|
|
|
50224
|
-
if (
|
|
50226
|
+
if (diff_z * direction_z >= 0.0 && fabsf(diff_z) > extents_z) {
|
|
50225
50227
|
return false;
|
|
50226
50228
|
}
|
|
50227
50229
|
|
|
50228
|
-
|
|
50229
|
-
|
|
50230
|
-
//Diff.y = (0.5f * (segment.mP1.y + segment.mP0.y)) - aabb.GetCenter(1);
|
|
50231
|
-
//b = fabsf(Dir.y);
|
|
50232
|
-
//if(fabsf(Diff.y)>BoxExtents.y + b) return false;
|
|
50233
|
-
|
|
50234
|
-
const b = fabsf(dirY);
|
|
50235
|
-
const c = fabsf(dirZ);
|
|
50236
|
-
const a = fabsf(dirX);
|
|
50230
|
+
const abs_direction_y = fabsf(direction_y);
|
|
50231
|
+
const abs_direction_z = fabsf(direction_z);
|
|
50237
50232
|
|
|
50238
|
-
const f0 =
|
|
50233
|
+
const f0 = fabsf(direction_y * diff_z - direction_z * diff_y);
|
|
50239
50234
|
|
|
50240
|
-
if (
|
|
50235
|
+
if (f0 > extents_y * abs_direction_z + extents_z * abs_direction_y) {
|
|
50241
50236
|
return false;
|
|
50242
50237
|
}
|
|
50243
50238
|
|
|
50244
|
-
const
|
|
50245
|
-
|
|
50246
|
-
if (fabsf(f1) > boxExtentsX * c + boxExtentsZ * a) {
|
|
50247
|
-
return false;
|
|
50248
|
-
}
|
|
50239
|
+
const abs_direction_x = fabsf(direction_x);
|
|
50249
50240
|
|
|
50250
|
-
const
|
|
50241
|
+
const f1 = fabsf(direction_z * diff_x - direction_x * diff_z);
|
|
50251
50242
|
|
|
50252
|
-
if (
|
|
50243
|
+
if (f1 > extents_x * abs_direction_z + extents_z * abs_direction_x) {
|
|
50253
50244
|
return false;
|
|
50254
50245
|
}
|
|
50255
50246
|
|
|
50256
|
-
|
|
50247
|
+
const f2 = fabsf(direction_x * diff_y - direction_y * diff_x);
|
|
50248
|
+
|
|
50249
|
+
return f2 <= extents_x * abs_direction_y + extents_y * abs_direction_x;
|
|
50257
50250
|
}
|
|
50258
50251
|
|
|
50259
50252
|
/**
|
|
@@ -50292,7 +50285,7 @@ function aabb3_intersects_frustum_array(x0, y0, z0, x1, y1, z1, frustum) {
|
|
|
50292
50285
|
const plane_z = frustum[i + 2];
|
|
50293
50286
|
const plane_w = frustum[i + 3];
|
|
50294
50287
|
|
|
50295
|
-
const plane_distance =
|
|
50288
|
+
const plane_distance = aabb3_compute_distance_above_plane_max(
|
|
50296
50289
|
plane_x, plane_y, plane_z, plane_w,
|
|
50297
50290
|
x0, y0, z0,
|
|
50298
50291
|
x1, y1, z1
|
|
@@ -50381,6 +50374,25 @@ function aabb3_signed_distance_sqr_to_point(x0, y0, z0, x1, y1, z1, point_x, poi
|
|
|
50381
50374
|
}
|
|
50382
50375
|
}
|
|
50383
50376
|
|
|
50377
|
+
//
|
|
50378
|
+
|
|
50379
|
+
/**
|
|
50380
|
+
*
|
|
50381
|
+
* @param {ArrayLike<number>|number[]|AABB3} aabb
|
|
50382
|
+
* @param {number} x
|
|
50383
|
+
* @param {number} y
|
|
50384
|
+
* @param {number} z
|
|
50385
|
+
* @return {boolean}
|
|
50386
|
+
*/
|
|
50387
|
+
function aabb3_array_contains_point(aabb, x, y, z) {
|
|
50388
|
+
return x >= aabb[0]
|
|
50389
|
+
&& x <= aabb[3]
|
|
50390
|
+
&& y >= aabb[1]
|
|
50391
|
+
&& y <= aabb[4]
|
|
50392
|
+
&& z >= aabb[2]
|
|
50393
|
+
&& z <= aabb[5];
|
|
50394
|
+
}
|
|
50395
|
+
|
|
50384
50396
|
/**
|
|
50385
50397
|
* Created by Alex on 16/11/2014.
|
|
50386
50398
|
*/
|
|
@@ -50472,19 +50484,14 @@ class AABB3 {
|
|
|
50472
50484
|
}
|
|
50473
50485
|
|
|
50474
50486
|
/**
|
|
50475
|
-
*
|
|
50487
|
+
* @deprecated use {@link aabb3_array_contains_point} directly
|
|
50476
50488
|
* @param {number} x
|
|
50477
50489
|
* @param {number} y
|
|
50478
50490
|
* @param {number} z
|
|
50479
50491
|
* @returns {boolean}
|
|
50480
50492
|
*/
|
|
50481
50493
|
containsPoint(x, y, z) {
|
|
50482
|
-
return x
|
|
50483
|
-
&& x <= this.x1
|
|
50484
|
-
&& y >= this.y0
|
|
50485
|
-
&& y <= this.y1
|
|
50486
|
-
&& z >= this.z0
|
|
50487
|
-
&& z <= this.z1;
|
|
50494
|
+
return aabb3_array_contains_point(this, x, y, z);
|
|
50488
50495
|
}
|
|
50489
50496
|
|
|
50490
50497
|
/**
|
|
@@ -50496,15 +50503,9 @@ class AABB3 {
|
|
|
50496
50503
|
* @returns {boolean}
|
|
50497
50504
|
*/
|
|
50498
50505
|
containsPointWithTolerance(x, y, z, tolerance) {
|
|
50499
|
-
|
|
50500
|
-
(x + tolerance) < this.x0 || (x - tolerance) > this.x1
|
|
50506
|
+
return !((x + tolerance) < this.x0 || (x - tolerance) > this.x1
|
|
50501
50507
|
|| (y + tolerance) < this.y0 || (y - tolerance) > this.y1
|
|
50502
|
-
|| (z + tolerance) < this.z0 || (z - tolerance) > this.z1
|
|
50503
|
-
) {
|
|
50504
|
-
return false;
|
|
50505
|
-
}
|
|
50506
|
-
|
|
50507
|
-
return true;
|
|
50508
|
+
|| (z + tolerance) < this.z0 || (z - tolerance) > this.z1);
|
|
50508
50509
|
}
|
|
50509
50510
|
|
|
50510
50511
|
computeMortonCode() {
|
|
@@ -50556,6 +50557,13 @@ class AABB3 {
|
|
|
50556
50557
|
* @param {Number} z1
|
|
50557
50558
|
*/
|
|
50558
50559
|
setBounds(x0, y0, z0, x1, y1, z1) {
|
|
50560
|
+
assert.notNaN(x0, 'x0');
|
|
50561
|
+
assert.notNaN(y0, 'y0');
|
|
50562
|
+
assert.notNaN(z0, 'z0');
|
|
50563
|
+
assert.notNaN(x1, 'x1');
|
|
50564
|
+
assert.notNaN(y1, 'y1');
|
|
50565
|
+
assert.notNaN(z1, 'z1');
|
|
50566
|
+
|
|
50559
50567
|
/**
|
|
50560
50568
|
*
|
|
50561
50569
|
* @type {number}
|
|
@@ -51082,13 +51090,15 @@ class AABB3 {
|
|
|
51082
51090
|
readFromArray(source, offset = 0) {
|
|
51083
51091
|
assert.isNonNegativeInteger(offset, 'offset');
|
|
51084
51092
|
|
|
51085
|
-
|
|
51086
|
-
|
|
51087
|
-
|
|
51093
|
+
const _x0 = source[offset];
|
|
51094
|
+
const _y0 = source[offset + 1];
|
|
51095
|
+
const _z0 = source[offset + 2];
|
|
51088
51096
|
|
|
51089
|
-
|
|
51090
|
-
|
|
51091
|
-
|
|
51097
|
+
const _x1 = source[offset + 3];
|
|
51098
|
+
const _y1 = source[offset + 4];
|
|
51099
|
+
const _z1 = source[offset + 5];
|
|
51100
|
+
|
|
51101
|
+
this.setBounds(_x0, _y0, _z0, _x1, _y1, _z1);
|
|
51092
51102
|
}
|
|
51093
51103
|
|
|
51094
51104
|
/**
|
|
@@ -51098,7 +51108,7 @@ class AABB3 {
|
|
|
51098
51108
|
computePlaneSide(plane) {
|
|
51099
51109
|
const normal = plane.normal;
|
|
51100
51110
|
|
|
51101
|
-
return
|
|
51111
|
+
return aabb3_compute_plane_side(
|
|
51102
51112
|
normal.x, normal.y, normal.z, plane.constant,
|
|
51103
51113
|
this.x0, this.y0, this.z0,
|
|
51104
51114
|
this.x1, this.y1, this.z1
|
|
@@ -51114,7 +51124,7 @@ class AABB3 {
|
|
|
51114
51124
|
* @returns {number}
|
|
51115
51125
|
*/
|
|
51116
51126
|
computeDistanceAbovePlane(normal_x, normal_y, normal_z, offset) {
|
|
51117
|
-
return
|
|
51127
|
+
return aabb3_compute_distance_above_plane_max(
|
|
51118
51128
|
normal_x, normal_y, normal_z, offset,
|
|
51119
51129
|
this.x0, this.y0, this.z0,
|
|
51120
51130
|
this.x1, this.y1, this.z1
|
|
@@ -51599,7 +51609,7 @@ class BVHVisitor {
|
|
|
51599
51609
|
}
|
|
51600
51610
|
}
|
|
51601
51611
|
|
|
51602
|
-
const stack$
|
|
51612
|
+
const stack$a = [];
|
|
51603
51613
|
let stackPointer$3 = 0;
|
|
51604
51614
|
|
|
51605
51615
|
/**
|
|
@@ -51612,11 +51622,11 @@ function traverseBinaryNodeUsingVisitor(node, visitor) {
|
|
|
51612
51622
|
|
|
51613
51623
|
const stackOffset = stackPointer$3;
|
|
51614
51624
|
|
|
51615
|
-
stack$
|
|
51625
|
+
stack$a[stackPointer$3++] = node;
|
|
51616
51626
|
|
|
51617
51627
|
while (stackPointer$3-- > stackOffset) {
|
|
51618
51628
|
|
|
51619
|
-
n = stack$
|
|
51629
|
+
n = stack$a[stackPointer$3];
|
|
51620
51630
|
|
|
51621
51631
|
if (n.isBinaryNode) {
|
|
51622
51632
|
const traverseDeeper = visitor.visitBinary(n);
|
|
@@ -51627,7 +51637,7 @@ function traverseBinaryNodeUsingVisitor(node, visitor) {
|
|
|
51627
51637
|
|
|
51628
51638
|
// has a LEFT child
|
|
51629
51639
|
|
|
51630
|
-
stack$
|
|
51640
|
+
stack$a[stackPointer$3++] = n.left;
|
|
51631
51641
|
|
|
51632
51642
|
}
|
|
51633
51643
|
|
|
@@ -51635,7 +51645,7 @@ function traverseBinaryNodeUsingVisitor(node, visitor) {
|
|
|
51635
51645
|
|
|
51636
51646
|
// has a RIGHT child
|
|
51637
51647
|
|
|
51638
|
-
stack$
|
|
51648
|
+
stack$a[stackPointer$3++] = n.right;
|
|
51639
51649
|
|
|
51640
51650
|
}
|
|
51641
51651
|
|
|
@@ -51684,7 +51694,7 @@ function intersects1D(a0, a1, b0, b1) {
|
|
|
51684
51694
|
* @param {number} bz1
|
|
51685
51695
|
* @returns {boolean}
|
|
51686
51696
|
*/
|
|
51687
|
-
function
|
|
51697
|
+
function aabb3_intersects_aabb3(
|
|
51688
51698
|
ax0, ay0, az0,
|
|
51689
51699
|
ax1, ay1, az1,
|
|
51690
51700
|
bx0, by0, bz0,
|
|
@@ -51760,7 +51770,7 @@ let stackPointer$2 = 0;
|
|
|
51760
51770
|
*
|
|
51761
51771
|
* @type {Node[]}
|
|
51762
51772
|
*/
|
|
51763
|
-
const stack$
|
|
51773
|
+
const stack$9 = [];
|
|
51764
51774
|
|
|
51765
51775
|
class BinaryNode extends Node {
|
|
51766
51776
|
constructor() {
|
|
@@ -51810,22 +51820,22 @@ class BinaryNode extends Node {
|
|
|
51810
51820
|
|
|
51811
51821
|
const stackOffset = stackPointer$2;
|
|
51812
51822
|
|
|
51813
|
-
stack$
|
|
51823
|
+
stack$9[stackPointer$2++] = this;
|
|
51814
51824
|
let n;
|
|
51815
51825
|
while (stackPointer$2-- > stackOffset) {
|
|
51816
51826
|
|
|
51817
51827
|
visitCount++;
|
|
51818
51828
|
|
|
51819
|
-
n = stack$
|
|
51829
|
+
n = stack$9[stackPointer$2];
|
|
51820
51830
|
|
|
51821
51831
|
const traverseDeeper = visitor.call(thisArg, n);
|
|
51822
51832
|
|
|
51823
51833
|
if (traverseDeeper !== false && n.isBinaryNode) {
|
|
51824
51834
|
if (n.right !== null) {
|
|
51825
|
-
stack$
|
|
51835
|
+
stack$9[stackPointer$2++] = n.right;
|
|
51826
51836
|
}
|
|
51827
51837
|
if (n.left !== null) {
|
|
51828
|
-
stack$
|
|
51838
|
+
stack$9[stackPointer$2++] = n.left;
|
|
51829
51839
|
}
|
|
51830
51840
|
}
|
|
51831
51841
|
}
|
|
@@ -51846,7 +51856,7 @@ class BinaryNode extends Node {
|
|
|
51846
51856
|
|
|
51847
51857
|
const stackOffset = stackPointer$2;
|
|
51848
51858
|
|
|
51849
|
-
stack$
|
|
51859
|
+
stack$9[stackPointer$2++] = this;
|
|
51850
51860
|
|
|
51851
51861
|
let n;
|
|
51852
51862
|
|
|
@@ -51854,17 +51864,17 @@ class BinaryNode extends Node {
|
|
|
51854
51864
|
|
|
51855
51865
|
visitCount++;
|
|
51856
51866
|
|
|
51857
|
-
n = stack$
|
|
51867
|
+
n = stack$9[stackPointer$2];
|
|
51858
51868
|
|
|
51859
51869
|
if (n.isLeafNode) {
|
|
51860
51870
|
visitor.call(thisArg, n);
|
|
51861
51871
|
} else {
|
|
51862
51872
|
//a binary node
|
|
51863
51873
|
if (n.right !== null) {
|
|
51864
|
-
stack$
|
|
51874
|
+
stack$9[stackPointer$2++] = n.right;
|
|
51865
51875
|
}
|
|
51866
51876
|
if (n.left !== null) {
|
|
51867
|
-
stack$
|
|
51877
|
+
stack$9[stackPointer$2++] = n.left;
|
|
51868
51878
|
}
|
|
51869
51879
|
}
|
|
51870
51880
|
}
|
|
@@ -52120,13 +52130,15 @@ class BinaryNode extends Node {
|
|
|
52120
52130
|
const a = this.left;
|
|
52121
52131
|
const b = this.right;
|
|
52122
52132
|
|
|
52123
|
-
|
|
52124
|
-
|
|
52125
|
-
|
|
52133
|
+
const x0 = min2(a.x0, b.x0);
|
|
52134
|
+
const y0 = min2(a.y0, b.y0);
|
|
52135
|
+
const z0 = min2(a.z0, b.z0);
|
|
52126
52136
|
|
|
52127
|
-
|
|
52128
|
-
|
|
52129
|
-
|
|
52137
|
+
const x1 = max2(a.x1, b.x1);
|
|
52138
|
+
const y1 = max2(a.y1, b.y1);
|
|
52139
|
+
const z1 = max2(a.z1, b.z1);
|
|
52140
|
+
|
|
52141
|
+
this.setBounds(x0, y0, z0, x1, y1, z1);
|
|
52130
52142
|
}
|
|
52131
52143
|
|
|
52132
52144
|
bubbleRefit() {
|
|
@@ -52441,15 +52453,15 @@ class BinaryNode extends Node {
|
|
|
52441
52453
|
requestLeafIntersectionsAABB3(result, x0, y0, z0, x1, y1, z1) {
|
|
52442
52454
|
const startOffset = stackPointer$2;
|
|
52443
52455
|
|
|
52444
|
-
stack$
|
|
52456
|
+
stack$9[stackPointer$2++] = this;
|
|
52445
52457
|
|
|
52446
52458
|
let count = 0;
|
|
52447
52459
|
|
|
52448
52460
|
while (stackPointer$2 > startOffset) {
|
|
52449
52461
|
stackPointer$2--;
|
|
52450
|
-
const node = stack$
|
|
52462
|
+
const node = stack$9[stackPointer$2];
|
|
52451
52463
|
|
|
52452
|
-
if (!
|
|
52464
|
+
if (!aabb3_intersects_aabb3(
|
|
52453
52465
|
x0, y0, z0, x1, y1, z1,
|
|
52454
52466
|
node.x0, node.y0, node.z0, node.x1, node.y1, node.z1
|
|
52455
52467
|
)) {
|
|
@@ -52464,12 +52476,12 @@ class BinaryNode extends Node {
|
|
|
52464
52476
|
} else {
|
|
52465
52477
|
const left = node.left;
|
|
52466
52478
|
if (left !== null) {
|
|
52467
|
-
stack$
|
|
52479
|
+
stack$9[stackPointer$2++] = left;
|
|
52468
52480
|
}
|
|
52469
52481
|
|
|
52470
52482
|
const right = node.right;
|
|
52471
52483
|
if (right !== null) {
|
|
52472
|
-
stack$
|
|
52484
|
+
stack$9[stackPointer$2++] = right;
|
|
52473
52485
|
}
|
|
52474
52486
|
}
|
|
52475
52487
|
}
|
|
@@ -55936,14 +55948,14 @@ class IndexedBinaryBVH {
|
|
|
55936
55948
|
|
|
55937
55949
|
const stackOffset = stackPointer$1;
|
|
55938
55950
|
|
|
55939
|
-
stack$
|
|
55951
|
+
stack$8[stackPointer$1++] = startIndex;
|
|
55940
55952
|
|
|
55941
55953
|
const nodeThreshold = this.binaryNodeCount * 6;
|
|
55942
55954
|
const endAddress = this.boxCount * 6;
|
|
55943
55955
|
|
|
55944
55956
|
while (stackPointer$1-- > stackOffset) {
|
|
55945
55957
|
|
|
55946
|
-
const index = stack$
|
|
55958
|
+
const index = stack$8[stackPointer$1];
|
|
55947
55959
|
|
|
55948
55960
|
const address = index * 6;
|
|
55949
55961
|
|
|
@@ -55959,7 +55971,7 @@ class IndexedBinaryBVH {
|
|
|
55959
55971
|
//right
|
|
55960
55972
|
if (rightAddress < endAddress) {
|
|
55961
55973
|
if (rightAddress < nodeThreshold) {
|
|
55962
|
-
stack$
|
|
55974
|
+
stack$8[stackPointer$1++] = rightIndex;
|
|
55963
55975
|
} else {
|
|
55964
55976
|
visitor.visit(rightAddress, NodeType.LEAF);
|
|
55965
55977
|
}
|
|
@@ -55968,7 +55980,7 @@ class IndexedBinaryBVH {
|
|
|
55968
55980
|
//left
|
|
55969
55981
|
if (leftAddress < endAddress) {
|
|
55970
55982
|
if (leftAddress < nodeThreshold) {
|
|
55971
|
-
stack$
|
|
55983
|
+
stack$8[stackPointer$1++] = leftIndex;
|
|
55972
55984
|
} else {
|
|
55973
55985
|
visitor.visit(leftAddress, NodeType.LEAF);
|
|
55974
55986
|
}
|
|
@@ -56144,7 +56156,7 @@ function binaryNodeRefit(array, binaryNode, childNode0, childNode1) {
|
|
|
56144
56156
|
}
|
|
56145
56157
|
|
|
56146
56158
|
|
|
56147
|
-
const stack$
|
|
56159
|
+
const stack$8 = [];
|
|
56148
56160
|
let stackPointer$1 = 0;
|
|
56149
56161
|
|
|
56150
56162
|
const rayLeafIntersectionVisitor = new RayLeafIntersectionVisitor();
|
|
@@ -56154,7 +56166,16 @@ const rayLeafIntersectionVisitor = new RayLeafIntersectionVisitor();
|
|
|
56154
56166
|
*/
|
|
56155
56167
|
class SurfacePoint3 {
|
|
56156
56168
|
constructor() {
|
|
56169
|
+
/**
|
|
56170
|
+
* @readonly
|
|
56171
|
+
* @type {Vector3}
|
|
56172
|
+
*/
|
|
56157
56173
|
this.normal = new Vector3$1(0, 1, 0);
|
|
56174
|
+
|
|
56175
|
+
/**
|
|
56176
|
+
* @readonly
|
|
56177
|
+
* @type {Vector3}
|
|
56178
|
+
*/
|
|
56158
56179
|
this.position = new Vector3$1(0, 0, 0);
|
|
56159
56180
|
|
|
56160
56181
|
/**
|
|
@@ -56165,6 +56186,30 @@ class SurfacePoint3 {
|
|
|
56165
56186
|
this.index = -1;
|
|
56166
56187
|
}
|
|
56167
56188
|
|
|
56189
|
+
get 0() {
|
|
56190
|
+
return this.position.x;
|
|
56191
|
+
}
|
|
56192
|
+
|
|
56193
|
+
get 1() {
|
|
56194
|
+
return this.position.y;
|
|
56195
|
+
}
|
|
56196
|
+
|
|
56197
|
+
get 2() {
|
|
56198
|
+
return this.position.z;
|
|
56199
|
+
}
|
|
56200
|
+
|
|
56201
|
+
get 3() {
|
|
56202
|
+
return this.normal.x;
|
|
56203
|
+
}
|
|
56204
|
+
|
|
56205
|
+
get 4() {
|
|
56206
|
+
return this.normal.y;
|
|
56207
|
+
}
|
|
56208
|
+
|
|
56209
|
+
get 5() {
|
|
56210
|
+
return this.normal.z;
|
|
56211
|
+
}
|
|
56212
|
+
|
|
56168
56213
|
/**
|
|
56169
56214
|
*
|
|
56170
56215
|
* @param {number[]|mat4|Float32Array} m
|
|
@@ -56214,13 +56259,35 @@ class SurfacePoint3 {
|
|
|
56214
56259
|
}
|
|
56215
56260
|
|
|
56216
56261
|
/**
|
|
56217
|
-
*
|
|
56262
|
+
* @deprecated use {@link applyMatrix4} instead
|
|
56218
56263
|
* @param {THREE.Matrix4} matrix4
|
|
56219
56264
|
*/
|
|
56220
56265
|
applyMatrix4_three(matrix4) {
|
|
56266
|
+
console.warn('applyMatrix4_three is deprecated, use applyMatrix4 instead');
|
|
56267
|
+
|
|
56221
56268
|
this.applyMatrix4(matrix4.elements);
|
|
56222
56269
|
}
|
|
56223
56270
|
|
|
56271
|
+
/**
|
|
56272
|
+
*
|
|
56273
|
+
* @param {number[]|ArrayLike<number>|Float32Array} array
|
|
56274
|
+
* @param {number} [offset=0]
|
|
56275
|
+
*/
|
|
56276
|
+
fromArray(array, offset = 0) {
|
|
56277
|
+
this.position.readFromArray(array, offset);
|
|
56278
|
+
this.normal.readFromArray(array, offset + 3);
|
|
56279
|
+
}
|
|
56280
|
+
|
|
56281
|
+
/**
|
|
56282
|
+
*
|
|
56283
|
+
* @param {number[]|ArrayLike<number>|Float32Array} array
|
|
56284
|
+
* @param {number} [offset=0]
|
|
56285
|
+
*/
|
|
56286
|
+
toArray(array, offset = 0) {
|
|
56287
|
+
this.position.writeToArray(array, offset);
|
|
56288
|
+
this.normal.writeToArray(array, offset + 3);
|
|
56289
|
+
}
|
|
56290
|
+
|
|
56224
56291
|
/**
|
|
56225
56292
|
*
|
|
56226
56293
|
* @param {SurfacePoint3} other
|
|
@@ -57837,16 +57904,24 @@ function hex2dec(v) {
|
|
|
57837
57904
|
/**
|
|
57838
57905
|
*
|
|
57839
57906
|
* @param {string} hex
|
|
57840
|
-
* @returns {{r:
|
|
57907
|
+
* @returns {{r: number, g: number, b: number, a:number}} rgb
|
|
57841
57908
|
*/
|
|
57842
57909
|
function parseHex(hex) {
|
|
57843
57910
|
|
|
57844
57911
|
|
|
57845
|
-
|
|
57912
|
+
const result = {
|
|
57846
57913
|
r: hex2dec(hex.slice(1, 3)),
|
|
57847
57914
|
g: hex2dec(hex.slice(3, 5)),
|
|
57848
|
-
b: hex2dec(hex.slice(5))
|
|
57915
|
+
b: hex2dec(hex.slice(5, 7))
|
|
57849
57916
|
};
|
|
57917
|
+
|
|
57918
|
+
if (hex.length > 7) {
|
|
57919
|
+
result.a = hex2dec(hex.slice(7, 9));
|
|
57920
|
+
}else {
|
|
57921
|
+
result.a = 1;
|
|
57922
|
+
}
|
|
57923
|
+
|
|
57924
|
+
return result;
|
|
57850
57925
|
}
|
|
57851
57926
|
|
|
57852
57927
|
/**
|
|
@@ -57855,7 +57930,7 @@ function parseHex(hex) {
|
|
|
57855
57930
|
|
|
57856
57931
|
|
|
57857
57932
|
const rgbRegEx = /rgb\(\s*([0-9]+),\s*([0-9]+),\s*([0-9]+)\s*\)/;
|
|
57858
|
-
const rgbaRegEx = /rgba\(\s*([0-9]+),\s*([0-9]+),\s*([0-9]+),\s*([0-9]+(?:\.[0-9]*)?)\s*\)/;
|
|
57933
|
+
const rgbaRegEx = /rgba\(\s*([0-9]+(?:\.[0-9]*)?),\s*([0-9]+(?:\.[0-9]*)?),\s*([0-9]+(?:\.[0-9]*)?),\s*([0-9]+(?:\.[0-9]*)?)\s*\)/;
|
|
57859
57934
|
const hsvRegEx = /hsv\(([0-9]+(?:\.[0-9]*)?),\s*([0-9]+(?:\.[0-9]*)?),\s*([0-9]+(?:\.[0-9]*)?)\)/;
|
|
57860
57935
|
|
|
57861
57936
|
/**
|
|
@@ -57884,10 +57959,10 @@ function parseColor(c) {
|
|
|
57884
57959
|
|
|
57885
57960
|
} else if ((match = cL.match(rgbaRegEx)) !== null) {
|
|
57886
57961
|
|
|
57887
|
-
r =
|
|
57888
|
-
g =
|
|
57889
|
-
b =
|
|
57890
|
-
a =
|
|
57962
|
+
r = parseFloat(match[1]);
|
|
57963
|
+
g = parseFloat(match[2]);
|
|
57964
|
+
b = parseFloat(match[3]);
|
|
57965
|
+
a = parseFloat(match[4]);
|
|
57891
57966
|
|
|
57892
57967
|
} else if ((match = cL.match(hsvRegEx)) !== null) {
|
|
57893
57968
|
|
|
@@ -57908,6 +57983,8 @@ function parseColor(c) {
|
|
|
57908
57983
|
r = rgb.r;
|
|
57909
57984
|
g = rgb.g;
|
|
57910
57985
|
b = rgb.b;
|
|
57986
|
+
a = rgb.a;
|
|
57987
|
+
|
|
57911
57988
|
|
|
57912
57989
|
} else {
|
|
57913
57990
|
throw new Error(`Failed to decode color string '${c}' `);
|
|
@@ -58112,7 +58189,7 @@ class Color {
|
|
|
58112
58189
|
|
|
58113
58190
|
/**
|
|
58114
58191
|
* @readonly
|
|
58115
|
-
* @type {Signal<number,number,number,number,number,number>}
|
|
58192
|
+
* @type {Signal<number,number,number,number,number,number,number,number>}
|
|
58116
58193
|
*/
|
|
58117
58194
|
this.onChanged = new Signal();
|
|
58118
58195
|
}
|
|
@@ -58188,19 +58265,34 @@ class Color {
|
|
|
58188
58265
|
* @param {number} b
|
|
58189
58266
|
*/
|
|
58190
58267
|
setRGB(r, g, b) {
|
|
58268
|
+
|
|
58269
|
+
this.set(r, g, b, this.a);
|
|
58270
|
+
}
|
|
58271
|
+
|
|
58272
|
+
/**
|
|
58273
|
+
*
|
|
58274
|
+
* @param {number} r
|
|
58275
|
+
* @param {number} g
|
|
58276
|
+
* @param {number} b
|
|
58277
|
+
* @param {number} a
|
|
58278
|
+
*/
|
|
58279
|
+
set(r, g, b, a) {
|
|
58191
58280
|
assert.isNumber(r, 'r');
|
|
58192
58281
|
assert.isNumber(g, 'g');
|
|
58193
58282
|
assert.isNumber(b, 'b');
|
|
58283
|
+
assert.isNumber(a, 'a');
|
|
58194
58284
|
|
|
58195
58285
|
const _r = this.r;
|
|
58196
58286
|
const _g = this.g;
|
|
58197
58287
|
const _b = this.b;
|
|
58288
|
+
const _a = this.a;
|
|
58198
58289
|
|
|
58199
58290
|
this.r = r;
|
|
58200
58291
|
this.g = g;
|
|
58201
58292
|
this.b = b;
|
|
58293
|
+
this.a = a;
|
|
58202
58294
|
|
|
58203
|
-
this.onChanged.
|
|
58295
|
+
this.onChanged.send8(r, g, b, a, _r, _g, _b, _a);
|
|
58204
58296
|
}
|
|
58205
58297
|
|
|
58206
58298
|
/**
|
|
@@ -58464,7 +58556,10 @@ class Color {
|
|
|
58464
58556
|
* @param {Color} other
|
|
58465
58557
|
*/
|
|
58466
58558
|
equals(other) {
|
|
58467
|
-
return this.r === other.r
|
|
58559
|
+
return this.r === other.r
|
|
58560
|
+
&& this.g === other.g
|
|
58561
|
+
&& this.b === other.b
|
|
58562
|
+
&& this.a === other.a;
|
|
58468
58563
|
}
|
|
58469
58564
|
|
|
58470
58565
|
/**
|
|
@@ -58500,15 +58595,17 @@ class Color {
|
|
|
58500
58595
|
);
|
|
58501
58596
|
}
|
|
58502
58597
|
|
|
58503
|
-
fromJSON({ r, g, b }) {
|
|
58598
|
+
fromJSON({ r, g, b, a = 1 }) {
|
|
58504
58599
|
this.setRGB(r, g, b);
|
|
58600
|
+
this.a = a;
|
|
58505
58601
|
}
|
|
58506
58602
|
|
|
58507
58603
|
toJSON() {
|
|
58508
58604
|
return {
|
|
58509
58605
|
r: this.r,
|
|
58510
58606
|
g: this.g,
|
|
58511
|
-
b: this.b
|
|
58607
|
+
b: this.b,
|
|
58608
|
+
a: this.a
|
|
58512
58609
|
};
|
|
58513
58610
|
}
|
|
58514
58611
|
|
|
@@ -58517,6 +58614,7 @@ class Color {
|
|
|
58517
58614
|
yield this.r;
|
|
58518
58615
|
yield this.g;
|
|
58519
58616
|
yield this.b;
|
|
58617
|
+
yield this.a;
|
|
58520
58618
|
|
|
58521
58619
|
}
|
|
58522
58620
|
|
|
@@ -58529,6 +58627,7 @@ class Color {
|
|
|
58529
58627
|
destination[destination_offset] = this.r;
|
|
58530
58628
|
destination[destination_offset + 1] = this.g;
|
|
58531
58629
|
destination[destination_offset + 2] = this.b;
|
|
58630
|
+
destination[destination_offset + 3] = this.a;
|
|
58532
58631
|
}
|
|
58533
58632
|
|
|
58534
58633
|
/**
|
|
@@ -58539,6 +58638,7 @@ class Color {
|
|
|
58539
58638
|
buffer.writeFloat32(this.r);
|
|
58540
58639
|
buffer.writeFloat32(this.g);
|
|
58541
58640
|
buffer.writeFloat32(this.b);
|
|
58641
|
+
buffer.writeFloat32(this.a);
|
|
58542
58642
|
}
|
|
58543
58643
|
|
|
58544
58644
|
/**
|
|
@@ -58549,8 +58649,10 @@ class Color {
|
|
|
58549
58649
|
const r = buffer.readFloat32();
|
|
58550
58650
|
const g = buffer.readFloat32();
|
|
58551
58651
|
const b = buffer.readFloat32();
|
|
58652
|
+
const a = buffer.readFloat32();
|
|
58552
58653
|
|
|
58553
58654
|
this.setRGB(r, g, b);
|
|
58655
|
+
this.a = a;
|
|
58554
58656
|
}
|
|
58555
58657
|
|
|
58556
58658
|
/**
|
|
@@ -65390,106 +65492,6 @@ WorkerBuilder.prototype.build = function () {
|
|
|
65390
65492
|
return proxy;
|
|
65391
65493
|
};
|
|
65392
65494
|
|
|
65393
|
-
/**
|
|
65394
|
-
*
|
|
65395
|
-
* @param {Sampler2D} sampler
|
|
65396
|
-
* @param {number} [channel=0]
|
|
65397
|
-
* @returns {undefined|{x: number, index:number, y: number, value: number}}
|
|
65398
|
-
*/
|
|
65399
|
-
function sampler2d_channel_compute_max(sampler, channel=0){
|
|
65400
|
-
const itemSize = sampler.itemSize;
|
|
65401
|
-
|
|
65402
|
-
assert.isNumber(channel, "channel");
|
|
65403
|
-
assert.isNonNegativeInteger(channel , 'channel');
|
|
65404
|
-
assert.lessThan(channel, itemSize, `channel must be less than itemSize(=${itemSize}), was ${channel}`);
|
|
65405
|
-
|
|
65406
|
-
const data = sampler.data;
|
|
65407
|
-
|
|
65408
|
-
const l = data.length;
|
|
65409
|
-
|
|
65410
|
-
if (l === 0) {
|
|
65411
|
-
//no data
|
|
65412
|
-
return undefined;
|
|
65413
|
-
}
|
|
65414
|
-
|
|
65415
|
-
let bestValue = data[channel];
|
|
65416
|
-
let bestIndex = channel;
|
|
65417
|
-
|
|
65418
|
-
for (let i = channel + itemSize; i < l; i += itemSize) {
|
|
65419
|
-
const value = data[i];
|
|
65420
|
-
|
|
65421
|
-
if (bestValue < value) {
|
|
65422
|
-
bestValue = value;
|
|
65423
|
-
bestIndex = i;
|
|
65424
|
-
}
|
|
65425
|
-
|
|
65426
|
-
}
|
|
65427
|
-
|
|
65428
|
-
const width = this.width;
|
|
65429
|
-
|
|
65430
|
-
const itemIndex = (bestIndex / itemSize) | 0;
|
|
65431
|
-
|
|
65432
|
-
const x = itemIndex % width;
|
|
65433
|
-
const y = (itemIndex / width) | 0;
|
|
65434
|
-
|
|
65435
|
-
return {
|
|
65436
|
-
index: bestIndex,
|
|
65437
|
-
value: bestValue,
|
|
65438
|
-
x,
|
|
65439
|
-
y
|
|
65440
|
-
};
|
|
65441
|
-
}
|
|
65442
|
-
|
|
65443
|
-
/**
|
|
65444
|
-
*
|
|
65445
|
-
* @param {Sampler2D} sampler
|
|
65446
|
-
* @param {number} [channel=0]
|
|
65447
|
-
* @returns {undefined|{x: number, index:number, y: number, value: number}}
|
|
65448
|
-
*/
|
|
65449
|
-
function sampler2d_channel_compute_min(sampler, channel=0){
|
|
65450
|
-
const itemSize = sampler.itemSize;
|
|
65451
|
-
|
|
65452
|
-
assert.isNumber(channel, "channel");
|
|
65453
|
-
assert.isNonNegativeInteger(channel , 'channel');
|
|
65454
|
-
assert.lessThan(channel, itemSize, `channel must be less than itemSize(=${itemSize}), was ${channel}`);
|
|
65455
|
-
|
|
65456
|
-
const data = sampler.data;
|
|
65457
|
-
|
|
65458
|
-
const l = data.length;
|
|
65459
|
-
|
|
65460
|
-
if (l === 0) {
|
|
65461
|
-
//no data
|
|
65462
|
-
return undefined;
|
|
65463
|
-
}
|
|
65464
|
-
|
|
65465
|
-
let bestValue = data[channel];
|
|
65466
|
-
let bestIndex = channel;
|
|
65467
|
-
|
|
65468
|
-
for (let i = channel + itemSize; i < l; i += itemSize) {
|
|
65469
|
-
const value = data[i];
|
|
65470
|
-
|
|
65471
|
-
if (bestValue > value) {
|
|
65472
|
-
bestValue = value;
|
|
65473
|
-
bestIndex = i;
|
|
65474
|
-
}
|
|
65475
|
-
|
|
65476
|
-
}
|
|
65477
|
-
|
|
65478
|
-
const width = this.width;
|
|
65479
|
-
|
|
65480
|
-
const itemIndex = (bestIndex / itemSize) | 0;
|
|
65481
|
-
|
|
65482
|
-
const x = itemIndex % width;
|
|
65483
|
-
const y = (itemIndex / width) | 0;
|
|
65484
|
-
|
|
65485
|
-
return {
|
|
65486
|
-
index: bestIndex,
|
|
65487
|
-
value: bestValue,
|
|
65488
|
-
x,
|
|
65489
|
-
y
|
|
65490
|
-
};
|
|
65491
|
-
}
|
|
65492
|
-
|
|
65493
65495
|
/**
|
|
65494
65496
|
*
|
|
65495
65497
|
* @return {WorkerProxy}
|
|
@@ -65517,8 +65519,8 @@ function makeTerrainWorkerProxy() {
|
|
|
65517
65519
|
|
|
65518
65520
|
useSampler(function (sampler) {
|
|
65519
65521
|
|
|
65520
|
-
const min = sampler2d_channel_compute_min(sampler);
|
|
65521
|
-
const max = sampler2d_channel_compute_max(sampler);
|
|
65522
|
+
const min = Lib.sampler2d_channel_compute_min(sampler);
|
|
65523
|
+
const max = Lib.sampler2d_channel_compute_max(sampler);
|
|
65522
65524
|
|
|
65523
65525
|
resolve({
|
|
65524
65526
|
min: min.value,
|
|
@@ -69433,7 +69435,7 @@ class ClippingPlaneContainmentComputingVisitor extends GeometrySpatialAccelerato
|
|
|
69433
69435
|
const plane_normal_z = plane.normal.z;
|
|
69434
69436
|
const plane_constant = plane.constant;
|
|
69435
69437
|
|
|
69436
|
-
const side =
|
|
69438
|
+
const side = aabb3_compute_plane_side(
|
|
69437
69439
|
plane_normal_x,
|
|
69438
69440
|
plane_normal_y,
|
|
69439
69441
|
plane_normal_z,
|
|
@@ -78032,7 +78034,7 @@ class InstancedMeshGroup {
|
|
|
78032
78034
|
* @param {number[]|ArrayLike<number>|Float32Array} transform 4x4 transform matrix of the instance
|
|
78033
78035
|
*/
|
|
78034
78036
|
setTransformAt(index, transform) {
|
|
78035
|
-
this.__attributeTransformArray
|
|
78037
|
+
array_copy(transform,0,this.__attributeTransformArray,index*16,16);
|
|
78036
78038
|
}
|
|
78037
78039
|
|
|
78038
78040
|
/**
|
|
@@ -78041,7 +78043,7 @@ class InstancedMeshGroup {
|
|
|
78041
78043
|
* @param {number[]|ArrayLike<number>|Float32Array} color RGBA color in uint8 format (0...255), LDR
|
|
78042
78044
|
*/
|
|
78043
78045
|
setColorAt(index, color) {
|
|
78044
|
-
this.__attributeColorArray
|
|
78046
|
+
array_copy(color,0,this.__attributeColorArray,index*4,4);
|
|
78045
78047
|
}
|
|
78046
78048
|
|
|
78047
78049
|
/**
|
|
@@ -79654,8 +79656,8 @@ class ExplicitBinaryBoundingVolumeHierarchy {
|
|
|
79654
79656
|
|
|
79655
79657
|
/**
|
|
79656
79658
|
*
|
|
79657
|
-
* @param {number[]} aabb
|
|
79658
|
-
* @param {number[]} frustum
|
|
79659
|
+
* @param {number[]|Float32Array} aabb
|
|
79660
|
+
* @param {number[]|Float32Array} frustum
|
|
79659
79661
|
* @returns {number}
|
|
79660
79662
|
*/
|
|
79661
79663
|
function aabb3_array_intersects_frustum_degree(aabb, frustum) {
|
|
@@ -79670,9 +79672,24 @@ function aabb3_array_intersects_frustum_degree(aabb, frustum) {
|
|
|
79670
79672
|
return aabb3_intersects_frustum_degree(x0, y0, z0, x1, y1, z1, frustum);
|
|
79671
79673
|
}
|
|
79672
79674
|
|
|
79675
|
+
/**
|
|
79676
|
+
* Useful for traversals, such as tree-walking. When using - make sure you manage dependencies nad understand the call-graph to avoid overwriting data that is used else-where
|
|
79677
|
+
* Using a pre-allocated continuous chunk of memory gets us better cache coherence
|
|
79678
|
+
* @readonly
|
|
79679
|
+
* @type {Uint32Array|{pointer:number}}
|
|
79680
|
+
*/
|
|
79681
|
+
const SCRATCH_UINT32_TRAVERSAL_STACK = new Uint32Array(781250);
|
|
79682
|
+
|
|
79683
|
+
/**
|
|
79684
|
+
* Pointer used to track current top of the stack, make sure to unwind once your traversal is done
|
|
79685
|
+
* @type {number}
|
|
79686
|
+
*/
|
|
79687
|
+
SCRATCH_UINT32_TRAVERSAL_STACK.pointer = 0;
|
|
79688
|
+
|
|
79673
79689
|
//
|
|
79674
79690
|
|
|
79675
|
-
const
|
|
79691
|
+
const stack$7 = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
79692
|
+
|
|
79676
79693
|
/**
|
|
79677
79694
|
*
|
|
79678
79695
|
* @param {number[]} destination
|
|
@@ -79690,20 +79707,20 @@ function bvh_collect_user_data(destination, destination_offset, bvh, node) {
|
|
|
79690
79707
|
*
|
|
79691
79708
|
* @type {number}
|
|
79692
79709
|
*/
|
|
79693
|
-
|
|
79710
|
+
const stack_top = stack$7.pointer++;
|
|
79694
79711
|
|
|
79695
|
-
|
|
79712
|
+
stack$7[stack_top] = node;
|
|
79696
79713
|
|
|
79697
79714
|
let result_cursor = destination_offset;
|
|
79698
79715
|
|
|
79699
|
-
while (
|
|
79700
|
-
|
|
79716
|
+
while (stack$7.pointer > stack_top) {
|
|
79717
|
+
stack$7.pointer--;
|
|
79701
79718
|
|
|
79702
79719
|
/**
|
|
79703
79720
|
*
|
|
79704
79721
|
* @type {number}
|
|
79705
79722
|
*/
|
|
79706
|
-
const node =
|
|
79723
|
+
const node = stack$7[stack$7.pointer];
|
|
79707
79724
|
|
|
79708
79725
|
const node_is_leaf = bvh.node_is_leaf(node);
|
|
79709
79726
|
|
|
@@ -79714,8 +79731,8 @@ function bvh_collect_user_data(destination, destination_offset, bvh, node) {
|
|
|
79714
79731
|
const child2 = bvh.node_get_child2(node);
|
|
79715
79732
|
|
|
79716
79733
|
// write to stack in reverse order, so that fist child ends up being visited first
|
|
79717
|
-
|
|
79718
|
-
|
|
79734
|
+
stack$7[stack$7.pointer++] = child1;
|
|
79735
|
+
stack$7[stack$7.pointer++] = child2;
|
|
79719
79736
|
|
|
79720
79737
|
} else {
|
|
79721
79738
|
// leaf node
|
|
@@ -79731,9 +79748,9 @@ function bvh_collect_user_data(destination, destination_offset, bvh, node) {
|
|
|
79731
79748
|
|
|
79732
79749
|
//
|
|
79733
79750
|
|
|
79734
|
-
const
|
|
79751
|
+
const stack$6 = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
79735
79752
|
|
|
79736
|
-
const scratch_aabb$1 =
|
|
79753
|
+
const scratch_aabb$1 = new Float32Array(6);
|
|
79737
79754
|
|
|
79738
79755
|
/**
|
|
79739
79756
|
*
|
|
@@ -79758,20 +79775,20 @@ function bvh_query_user_data_overlaps_frustum(
|
|
|
79758
79775
|
*
|
|
79759
79776
|
* @type {number}
|
|
79760
79777
|
*/
|
|
79761
|
-
|
|
79778
|
+
const stack_top = stack$6.pointer++;
|
|
79762
79779
|
|
|
79763
|
-
|
|
79780
|
+
stack$6[stack_top] = root;
|
|
79764
79781
|
|
|
79765
79782
|
let result_cursor = result_offset;
|
|
79766
79783
|
|
|
79767
|
-
while (
|
|
79768
|
-
|
|
79784
|
+
while (stack$6.pointer > stack_top) {
|
|
79785
|
+
stack$6.pointer--;
|
|
79769
79786
|
|
|
79770
79787
|
/**
|
|
79771
79788
|
*
|
|
79772
79789
|
* @type {number}
|
|
79773
79790
|
*/
|
|
79774
|
-
const node =
|
|
79791
|
+
const node = stack$6[stack$6.pointer];
|
|
79775
79792
|
|
|
79776
79793
|
// test node against the ray
|
|
79777
79794
|
bvh.node_get_aabb(node, scratch_aabb$1);
|
|
@@ -79784,26 +79801,22 @@ function bvh_query_user_data_overlaps_frustum(
|
|
|
79784
79801
|
|
|
79785
79802
|
const node_is_leaf = bvh.node_is_leaf(node);
|
|
79786
79803
|
|
|
79787
|
-
if (
|
|
79788
|
-
|
|
79789
|
-
|
|
79790
|
-
// fully inside, fast collection path
|
|
79791
|
-
result_cursor += bvh_collect_user_data(result, result_cursor, bvh, node);
|
|
79792
|
-
} else {
|
|
79793
|
-
// partially inside
|
|
79794
|
-
// read in-order
|
|
79795
|
-
const child1 = bvh.node_get_child1(node);
|
|
79796
|
-
const child2 = bvh.node_get_child2(node);
|
|
79797
|
-
|
|
79798
|
-
// write to stack in reverse order, so that fist child ends up being visited first
|
|
79799
|
-
traversal_stack$1[traversal_cursor++] = child1;
|
|
79800
|
-
traversal_stack$1[traversal_cursor++] = child2;
|
|
79801
|
-
}
|
|
79804
|
+
if (node_is_leaf) {
|
|
79805
|
+
// leaf node
|
|
79806
|
+
result[result_cursor++] = bvh.node_get_user_data(node);
|
|
79802
79807
|
|
|
79808
|
+
} else if (intersection === 2) {
|
|
79809
|
+
// fully inside, fast collection path
|
|
79810
|
+
result_cursor += bvh_collect_user_data(result, result_cursor, bvh, node);
|
|
79803
79811
|
} else {
|
|
79804
|
-
//
|
|
79812
|
+
// partially inside
|
|
79813
|
+
// read in-order
|
|
79814
|
+
const child1 = bvh.node_get_child1(node);
|
|
79815
|
+
const child2 = bvh.node_get_child2(node);
|
|
79805
79816
|
|
|
79806
|
-
|
|
79817
|
+
// write to stack in reverse order, so that fist child ends up being visited first
|
|
79818
|
+
stack$6[stack$6.pointer++] = child1;
|
|
79819
|
+
stack$6[stack$6.pointer++] = child2;
|
|
79807
79820
|
}
|
|
79808
79821
|
}
|
|
79809
79822
|
|
|
@@ -79974,18 +79987,7 @@ class ShadedGeometryRendererContext {
|
|
|
79974
79987
|
}
|
|
79975
79988
|
}
|
|
79976
79989
|
|
|
79977
|
-
|
|
79978
|
-
*
|
|
79979
|
-
* @type {number[]}
|
|
79980
|
-
*/
|
|
79981
|
-
const traversal_stack = [];
|
|
79982
|
-
|
|
79983
|
-
/**
|
|
79984
|
-
*
|
|
79985
|
-
* @type {number}
|
|
79986
|
-
*/
|
|
79987
|
-
let traversal_cursor = 0;
|
|
79988
|
-
|
|
79990
|
+
const stack$5 = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
79989
79991
|
|
|
79990
79992
|
/**
|
|
79991
79993
|
*
|
|
@@ -79999,7 +80001,6 @@ function bvh_query_leaves_generic(
|
|
|
79999
80001
|
result, result_offset,
|
|
80000
80002
|
bvh, query
|
|
80001
80003
|
) {
|
|
80002
|
-
const stack_frame_address = traversal_cursor;
|
|
80003
80004
|
|
|
80004
80005
|
const root = bvh.root;
|
|
80005
80006
|
|
|
@@ -80007,18 +80008,24 @@ function bvh_query_leaves_generic(
|
|
|
80007
80008
|
return 0;
|
|
80008
80009
|
}
|
|
80009
80010
|
|
|
80010
|
-
|
|
80011
|
+
/**
|
|
80012
|
+
*
|
|
80013
|
+
* @type {number}
|
|
80014
|
+
*/
|
|
80015
|
+
const stack_top = stack$5.pointer++;
|
|
80016
|
+
|
|
80017
|
+
stack$5[stack_top] = root;
|
|
80011
80018
|
|
|
80012
80019
|
let result_cursor = result_offset;
|
|
80013
80020
|
|
|
80014
|
-
while (
|
|
80015
|
-
|
|
80021
|
+
while (stack$5.pointer > stack_top) {
|
|
80022
|
+
stack$5.pointer--;
|
|
80016
80023
|
|
|
80017
80024
|
/**
|
|
80018
80025
|
*
|
|
80019
80026
|
* @type {number}
|
|
80020
80027
|
*/
|
|
80021
|
-
const node =
|
|
80028
|
+
const node = stack$5[stack$5.pointer];
|
|
80022
80029
|
|
|
80023
80030
|
// test node against the ray
|
|
80024
80031
|
const pass = query.evaluate(node, bvh);
|
|
@@ -80036,8 +80043,8 @@ function bvh_query_leaves_generic(
|
|
|
80036
80043
|
const child2 = bvh.node_get_child2(node);
|
|
80037
80044
|
|
|
80038
80045
|
// write to stack in reverse order, so that fist child ends up being visited first
|
|
80039
|
-
|
|
80040
|
-
|
|
80046
|
+
stack$5[stack$5.pointer++] = child2;
|
|
80047
|
+
stack$5[stack$5.pointer++] = child1;
|
|
80041
80048
|
|
|
80042
80049
|
} else {
|
|
80043
80050
|
// leaf node
|
|
@@ -80046,9 +80053,6 @@ function bvh_query_leaves_generic(
|
|
|
80046
80053
|
}
|
|
80047
80054
|
}
|
|
80048
80055
|
|
|
80049
|
-
// drop stack frame
|
|
80050
|
-
traversal_cursor = stack_frame_address;
|
|
80051
|
-
|
|
80052
80056
|
return result_cursor - result_offset;
|
|
80053
80057
|
}
|
|
80054
80058
|
|
|
@@ -86414,18 +86418,31 @@ class IncrementalDeltaSet {
|
|
|
86414
86418
|
finalizeUpdate() {
|
|
86415
86419
|
assert.equal(this.state, IncrementalDeltaSetState.Building, `Expected BUILDING state, instead got '${this.state}'`);
|
|
86416
86420
|
|
|
86417
|
-
|
|
86421
|
+
const array_main_count = this.__elements_cursor;
|
|
86422
|
+
const array_previous_count = this.__swap_elements_count;
|
|
86423
|
+
|
|
86424
|
+
this.size = array_main_count;
|
|
86418
86425
|
|
|
86419
86426
|
// sort newly populated elements array
|
|
86420
|
-
|
|
86421
|
-
this.
|
|
86427
|
+
const array_main = this.__elements;
|
|
86428
|
+
const array_previous = this.__swap_elements;
|
|
86429
|
+
|
|
86430
|
+
const compare = this.__compare;
|
|
86431
|
+
|
|
86432
|
+
const onAdded = this.onAdded;
|
|
86433
|
+
const onRemoved = this.onRemoved;
|
|
86434
|
+
|
|
86435
|
+
array_shrink_to_size(array_main, array_main_count);
|
|
86436
|
+
array_main.sort(compare);
|
|
86437
|
+
|
|
86422
86438
|
|
|
86423
86439
|
let i0 = 0, i1 = 0;
|
|
86424
|
-
while (i0 < this.size && i1 < this.__swap_elements_count) {
|
|
86425
|
-
const el_0 = this.__elements[i0];
|
|
86426
|
-
const el_1 = this.__swap_elements[i1];
|
|
86427
86440
|
|
|
86428
|
-
|
|
86441
|
+
while (i0 < array_main_count && i1 < array_previous_count) {
|
|
86442
|
+
const el_0 = array_main[i0];
|
|
86443
|
+
const el_1 = array_previous[i1];
|
|
86444
|
+
|
|
86445
|
+
const diff = compare(el_0, el_1);
|
|
86429
86446
|
|
|
86430
86447
|
if (diff === 0) {
|
|
86431
86448
|
i0++;
|
|
@@ -86434,20 +86451,20 @@ class IncrementalDeltaSet {
|
|
|
86434
86451
|
} else if (diff < 0) {
|
|
86435
86452
|
i0++;
|
|
86436
86453
|
// addition
|
|
86437
|
-
|
|
86454
|
+
onAdded.send1(el_0);
|
|
86438
86455
|
} else {
|
|
86439
86456
|
i1++;
|
|
86440
86457
|
// removal
|
|
86441
|
-
|
|
86458
|
+
onRemoved.send1(el_1);
|
|
86442
86459
|
}
|
|
86443
86460
|
}
|
|
86444
86461
|
|
|
86445
86462
|
// process remainders
|
|
86446
|
-
for (; i0 <
|
|
86447
|
-
|
|
86463
|
+
for (; i0 < array_main_count; i0++) {
|
|
86464
|
+
onAdded.send1(array_main[i0]);
|
|
86448
86465
|
}
|
|
86449
|
-
for (; i1 <
|
|
86450
|
-
|
|
86466
|
+
for (; i1 < array_previous_count; i1++) {
|
|
86467
|
+
onRemoved.send1(array_previous[i1]);
|
|
86451
86468
|
}
|
|
86452
86469
|
|
|
86453
86470
|
this.state = IncrementalDeltaSetState.Ready;
|
|
@@ -95839,7 +95856,11 @@ GraphicsEngine.prototype.start = function () {
|
|
|
95839
95856
|
antialias: true,
|
|
95840
95857
|
logarithmicDepthBuffer: false,
|
|
95841
95858
|
canvas,
|
|
95842
|
-
context
|
|
95859
|
+
context,
|
|
95860
|
+
/**
|
|
95861
|
+
* @see https://registry.khronos.org/webgl/specs/latest/1.0/#5.2
|
|
95862
|
+
*/
|
|
95863
|
+
powerPreference:"high-performance"
|
|
95843
95864
|
};
|
|
95844
95865
|
|
|
95845
95866
|
const webGLRenderer = this.renderer = new WebGLRenderer(rendererParameters);
|
|
@@ -96609,117 +96630,166 @@ function readPositionFromMouseEvent(result, event, source = event.target) {
|
|
|
96609
96630
|
result.set(x, y);
|
|
96610
96631
|
}
|
|
96611
96632
|
|
|
96612
|
-
|
|
96613
|
-
*
|
|
96614
|
-
* @param {EventTarget} domElement html element
|
|
96615
|
-
* @constructor
|
|
96616
|
-
*/
|
|
96617
|
-
function PointerDevice(domElement) {
|
|
96618
|
-
assert.notEqual(domElement, undefined, "domElement is undefined");
|
|
96633
|
+
class PointerDevice {
|
|
96619
96634
|
|
|
96620
96635
|
/**
|
|
96621
|
-
* @
|
|
96622
|
-
* @type {
|
|
96636
|
+
* @readonly
|
|
96637
|
+
* @type {Vector2}
|
|
96623
96638
|
*/
|
|
96624
|
-
|
|
96639
|
+
position = new Vector2();
|
|
96625
96640
|
|
|
96626
96641
|
/**
|
|
96627
|
-
*
|
|
96628
|
-
* @type {
|
|
96629
|
-
|
|
96642
|
+
* @readonly
|
|
96643
|
+
* @type {Vector2}
|
|
96644
|
+
*/
|
|
96645
|
+
#anchor_touch_last = new Vector2();
|
|
96646
|
+
|
|
96647
|
+
#globalUp = new Signal();
|
|
96648
|
+
|
|
96649
|
+
#touchStart = new Signal();
|
|
96650
|
+
#touchEnd = new Signal();
|
|
96651
|
+
#touchMove = new Signal();
|
|
96652
|
+
|
|
96653
|
+
/**
|
|
96654
|
+
* @readonly
|
|
96630
96655
|
*/
|
|
96631
|
-
|
|
96656
|
+
on = {
|
|
96657
|
+
down: new Signal(),
|
|
96658
|
+
up: new Signal(),
|
|
96659
|
+
move: new Signal(),
|
|
96660
|
+
tap: new Signal(),
|
|
96661
|
+
drag: new Signal(),
|
|
96662
|
+
dragStart: new Signal(),
|
|
96663
|
+
dragEnd: new Signal(),
|
|
96664
|
+
wheel: new Signal(),
|
|
96665
|
+
pinch: new Signal(),
|
|
96666
|
+
pinchStart: new Signal(),
|
|
96667
|
+
pinchEnd: new Signal(),
|
|
96668
|
+
};
|
|
96632
96669
|
|
|
96633
96670
|
/**
|
|
96634
96671
|
*
|
|
96635
|
-
* @type {
|
|
96672
|
+
* @type {Element|null}
|
|
96673
|
+
* @private
|
|
96636
96674
|
*/
|
|
96637
|
-
|
|
96675
|
+
#target = null;
|
|
96638
96676
|
|
|
96639
|
-
|
|
96677
|
+
/**
|
|
96678
|
+
* @private
|
|
96679
|
+
* @type {boolean}
|
|
96680
|
+
*/
|
|
96681
|
+
isRunning = false;
|
|
96640
96682
|
|
|
96641
96683
|
/**
|
|
96642
96684
|
*
|
|
96643
|
-
* @param {
|
|
96685
|
+
* @param {EventTarget} domElement html element
|
|
96686
|
+
* @constructor
|
|
96644
96687
|
*/
|
|
96645
|
-
|
|
96646
|
-
|
|
96688
|
+
constructor(domElement) {
|
|
96689
|
+
assert.defined(domElement, "domElement");
|
|
96647
96690
|
|
|
96648
|
-
this.__target = event.target;
|
|
96649
96691
|
|
|
96650
|
-
|
|
96692
|
+
/**
|
|
96693
|
+
*
|
|
96694
|
+
* @type {EventTarget}
|
|
96695
|
+
*/
|
|
96696
|
+
this.domElement = domElement;
|
|
96651
96697
|
|
|
96652
|
-
this.on.move.send3(position, event, new Vector2(event.movementX, event.movementY));
|
|
96653
|
-
};
|
|
96654
|
-
this.eventHandlerMouseUp = (event) => {
|
|
96655
|
-
this.readPointerPositionFromEvent(position, event);
|
|
96656
|
-
this.on.up.send2(position, event);
|
|
96657
|
-
};
|
|
96658
|
-
this.eventHandlerMouseDown = (event) => {
|
|
96659
|
-
this.readPointerPositionFromEvent(position, event);
|
|
96660
|
-
this.on.down.send2(position, event);
|
|
96661
|
-
};
|
|
96662
96698
|
|
|
96663
|
-
|
|
96664
|
-
|
|
96665
|
-
|
|
96699
|
+
this.#touchStart.add((param0, param1, param2) => {
|
|
96700
|
+
this.on.down.send3(param0, param1, param2);
|
|
96701
|
+
});
|
|
96666
96702
|
|
|
96667
|
-
|
|
96668
|
-
|
|
96669
|
-
|
|
96703
|
+
this.#touchEnd.add((param0, param1, param2) => {
|
|
96704
|
+
this.on.up.send3(param0, param1, param2);
|
|
96705
|
+
});
|
|
96706
|
+
this.#touchMove.add((param0, param1, param2) => {
|
|
96707
|
+
this.on.move.send3(param0, param1, param2);
|
|
96708
|
+
});
|
|
96670
96709
|
|
|
96671
|
-
touchEnd.add((param0, param1, param2) => {
|
|
96672
|
-
this.on.up.send3(param0, param1, param2);
|
|
96673
|
-
});
|
|
96674
|
-
touchMove.add((param0, param1, param2) => {
|
|
96675
|
-
this.on.move.send3(param0, param1, param2);
|
|
96676
|
-
});
|
|
96677
96710
|
|
|
96678
|
-
|
|
96711
|
+
//constructed events
|
|
96712
|
+
observeTap(this.on.up, this.on.down, this.on.move, 10, this.on.tap);
|
|
96713
|
+
observeDrag(this.#globalUp, this.on.down, this.on.move, this.on.dragStart, this.on.dragEnd, this.on.drag);
|
|
96714
|
+
observePinch({
|
|
96715
|
+
touchStart: this.#touchStart,
|
|
96716
|
+
touchEnd: this.#touchEnd,
|
|
96717
|
+
touchMove: this.#touchMove,
|
|
96718
|
+
pinch: this.on.pinch,
|
|
96719
|
+
pinchStart: this.on.pinchStart,
|
|
96720
|
+
pinchEnd: this.on.pinchEnd,
|
|
96721
|
+
device: this
|
|
96722
|
+
});
|
|
96723
|
+
}
|
|
96679
96724
|
|
|
96680
|
-
|
|
96681
|
-
|
|
96682
|
-
|
|
96725
|
+
/**
|
|
96726
|
+
*
|
|
96727
|
+
* @param {MouseEvent} event
|
|
96728
|
+
*/
|
|
96729
|
+
#eventHandlerMouseDown = (event) => {
|
|
96730
|
+
this.readPointerPositionFromEvent(this.position, event);
|
|
96731
|
+
this.on.down.send2(this.position, event);
|
|
96732
|
+
}
|
|
96683
96733
|
|
|
96684
|
-
|
|
96685
|
-
|
|
96734
|
+
/**
|
|
96735
|
+
*
|
|
96736
|
+
* @param {TouchEvent} event
|
|
96737
|
+
*/
|
|
96738
|
+
#eventHandlerGlobalTouchEnd = (event) => {
|
|
96739
|
+
getTouchCenter(event.touches, this.position);
|
|
96740
|
+
this.#globalUp.send2(this.position, event);
|
|
96741
|
+
}
|
|
96686
96742
|
|
|
96687
|
-
|
|
96688
|
-
|
|
96689
|
-
|
|
96690
|
-
|
|
96743
|
+
/**
|
|
96744
|
+
*
|
|
96745
|
+
* @param {MouseEvent} event
|
|
96746
|
+
*/
|
|
96747
|
+
#eventHandlerMouseUp = (event) => {
|
|
96748
|
+
this.readPointerPositionFromEvent(this.position, event);
|
|
96749
|
+
this.on.up.send2(this.position, event);
|
|
96750
|
+
}
|
|
96751
|
+
|
|
96752
|
+
/**
|
|
96753
|
+
*
|
|
96754
|
+
* @param {MouseEvent} event
|
|
96755
|
+
*/
|
|
96756
|
+
#eventHandlerGlobalMouseUp = (event) => {
|
|
96757
|
+
this.readPointerPositionFromEvent(this.position, event);
|
|
96758
|
+
this.#globalUp.send2(this.position, event);
|
|
96759
|
+
}
|
|
96691
96760
|
|
|
96692
|
-
|
|
96761
|
+
/**
|
|
96762
|
+
*
|
|
96763
|
+
* @param {TouchEvent} event
|
|
96764
|
+
*/
|
|
96765
|
+
#eventHandlerTouchEnd = (event) => {
|
|
96766
|
+
getTouchCenter(event.touches, this.position);
|
|
96767
|
+
this.#touchEnd.send2(this.position, event);
|
|
96768
|
+
}
|
|
96769
|
+
|
|
96770
|
+
/**
|
|
96771
|
+
*
|
|
96772
|
+
* @param {TouchEvent} event
|
|
96773
|
+
*/
|
|
96774
|
+
#eventHandlerTouchMove = (event) => {
|
|
96693
96775
|
event.preventDefault();
|
|
96694
96776
|
|
|
96695
96777
|
getTouchCenter(event.touches, position);
|
|
96696
96778
|
|
|
96697
96779
|
const delta = new Vector2();
|
|
96698
96780
|
|
|
96699
|
-
delta.subVectors(position, anchor_touch_last);
|
|
96700
|
-
|
|
96701
|
-
touchMove.send3(position, event, delta);
|
|
96702
|
-
|
|
96703
|
-
anchor_touch_last.copy(position);
|
|
96704
|
-
};
|
|
96705
|
-
|
|
96706
|
-
const globalUp = new Signal();
|
|
96781
|
+
delta.subVectors(this.position, this.#anchor_touch_last);
|
|
96707
96782
|
|
|
96708
|
-
|
|
96709
|
-
getTouchCenter(event.touches, position);
|
|
96710
|
-
globalUp.send2(position, event);
|
|
96711
|
-
};
|
|
96783
|
+
this.#touchMove.send3(this.position, event, delta);
|
|
96712
96784
|
|
|
96713
|
-
|
|
96714
|
-
|
|
96715
|
-
globalUp.send2(position, event);
|
|
96716
|
-
};
|
|
96785
|
+
this.#anchor_touch_last.copy(this.position);
|
|
96786
|
+
}
|
|
96717
96787
|
|
|
96718
96788
|
/**
|
|
96719
96789
|
*
|
|
96720
96790
|
* @param {WheelEvent} event
|
|
96721
96791
|
*/
|
|
96722
|
-
|
|
96792
|
+
#eventHandlerWheel = (event) => {
|
|
96723
96793
|
event.preventDefault();
|
|
96724
96794
|
|
|
96725
96795
|
//deltas have inconsistent values across browsers, so we will normalize them
|
|
@@ -96730,148 +96800,146 @@ function PointerDevice(domElement) {
|
|
|
96730
96800
|
|
|
96731
96801
|
const delta = new Vector3$1(x, y, z);
|
|
96732
96802
|
|
|
96733
|
-
this.readPointerPositionFromEvent(position, event);
|
|
96803
|
+
this.readPointerPositionFromEvent(this.position, event);
|
|
96734
96804
|
|
|
96735
|
-
this.on.wheel.send3(delta, position, event);
|
|
96736
|
-
}
|
|
96805
|
+
this.on.wheel.send3(delta, this.position, event);
|
|
96806
|
+
}
|
|
96737
96807
|
|
|
96808
|
+
/**
|
|
96809
|
+
*
|
|
96810
|
+
* @param {TouchEvent} event
|
|
96811
|
+
*/
|
|
96812
|
+
#eventHandlerTouchStart = (event) => {
|
|
96813
|
+
getTouchCenter(event.touches, this.position);
|
|
96814
|
+
this.#touchStart.send2(this.position, event);
|
|
96738
96815
|
|
|
96739
|
-
|
|
96740
|
-
|
|
96741
|
-
up: new Signal(),
|
|
96742
|
-
move: new Signal(),
|
|
96743
|
-
tap: new Signal(),
|
|
96744
|
-
drag: new Signal(),
|
|
96745
|
-
dragStart: new Signal(),
|
|
96746
|
-
dragEnd: new Signal(),
|
|
96747
|
-
wheel: new Signal(),
|
|
96748
|
-
pinch: new Signal(),
|
|
96749
|
-
pinchStart: new Signal(),
|
|
96750
|
-
pinchEnd: new Signal(),
|
|
96751
|
-
};
|
|
96816
|
+
this.#anchor_touch_last.copy(this.position);
|
|
96817
|
+
}
|
|
96752
96818
|
|
|
96753
|
-
|
|
96754
|
-
|
|
96755
|
-
|
|
96756
|
-
|
|
96757
|
-
|
|
96758
|
-
|
|
96759
|
-
touchMove: touchMove,
|
|
96760
|
-
pinch: this.on.pinch,
|
|
96761
|
-
pinchStart: this.on.pinchStart,
|
|
96762
|
-
pinchEnd: this.on.pinchEnd
|
|
96763
|
-
});
|
|
96764
|
-
}
|
|
96819
|
+
/**
|
|
96820
|
+
*
|
|
96821
|
+
* @param {MouseEvent} event
|
|
96822
|
+
*/
|
|
96823
|
+
#eventHandlerMouseMove = (event) => {
|
|
96824
|
+
event.preventDefault();
|
|
96765
96825
|
|
|
96766
|
-
|
|
96767
|
-
*
|
|
96768
|
-
* @return {Element}
|
|
96769
|
-
*/
|
|
96770
|
-
PointerDevice.prototype.getTargetElement = function () {
|
|
96771
|
-
return this.__target;
|
|
96772
|
-
};
|
|
96826
|
+
this.#target = event.target;
|
|
96773
96827
|
|
|
96774
|
-
|
|
96775
|
-
*
|
|
96776
|
-
* @param {Element} el
|
|
96777
|
-
*/
|
|
96778
|
-
PointerDevice.prototype.setTargetElement = function (el) {
|
|
96779
|
-
assert.defined(el, 'el');
|
|
96780
|
-
assert.notNull(el, 'el');
|
|
96828
|
+
this.readPointerPositionFromEvent(this.position, event);
|
|
96781
96829
|
|
|
96782
|
-
|
|
96783
|
-
// no change
|
|
96784
|
-
return;
|
|
96830
|
+
this.on.move.send3(this.position, event, new Vector2(event.movementX, event.movementY));
|
|
96785
96831
|
}
|
|
96786
96832
|
|
|
96787
|
-
|
|
96788
|
-
|
|
96789
|
-
|
|
96790
|
-
|
|
96791
|
-
|
|
96833
|
+
/**
|
|
96834
|
+
*
|
|
96835
|
+
* @return {Element}
|
|
96836
|
+
*/
|
|
96837
|
+
getTargetElement() {
|
|
96838
|
+
return this.#target;
|
|
96792
96839
|
}
|
|
96793
96840
|
|
|
96794
|
-
|
|
96841
|
+
/**
|
|
96842
|
+
*
|
|
96843
|
+
* @param {Element} el
|
|
96844
|
+
*/
|
|
96845
|
+
setTargetElement(el) {
|
|
96846
|
+
assert.defined(el, 'el');
|
|
96847
|
+
assert.notNull(el, 'el');
|
|
96795
96848
|
|
|
96796
|
-
|
|
96797
|
-
|
|
96798
|
-
|
|
96799
|
-
|
|
96800
|
-
};
|
|
96849
|
+
if (this.#target === el) {
|
|
96850
|
+
// no change
|
|
96851
|
+
return;
|
|
96852
|
+
}
|
|
96801
96853
|
|
|
96802
|
-
|
|
96803
|
-
*
|
|
96804
|
-
* @param {Vector2} result
|
|
96805
|
-
* @param {MouseEvent|TouchEvent} event
|
|
96806
|
-
*/
|
|
96807
|
-
PointerDevice.prototype.readPointerPositionFromEvent = function (result, event) {
|
|
96808
|
-
readPositionFromMouseEvent(result, event, this.domElement);
|
|
96809
|
-
};
|
|
96854
|
+
let was_running = this.isRunning;
|
|
96810
96855
|
|
|
96811
|
-
|
|
96812
|
-
|
|
96813
|
-
|
|
96814
|
-
|
|
96856
|
+
if (was_running) {
|
|
96857
|
+
// disconnect from previous target
|
|
96858
|
+
this.stop();
|
|
96859
|
+
}
|
|
96860
|
+
|
|
96861
|
+
this.#target = el;
|
|
96862
|
+
|
|
96863
|
+
if (was_running) {
|
|
96864
|
+
// restart to maintain original state
|
|
96865
|
+
this.start();
|
|
96866
|
+
}
|
|
96815
96867
|
}
|
|
96816
96868
|
|
|
96817
|
-
|
|
96869
|
+
/**
|
|
96870
|
+
*
|
|
96871
|
+
* @param {Vector2} result
|
|
96872
|
+
* @param {MouseEvent|TouchEvent} event
|
|
96873
|
+
*/
|
|
96874
|
+
readPointerPositionFromEvent(result, event) {
|
|
96875
|
+
readPositionFromMouseEvent(result, event, this.domElement);
|
|
96876
|
+
}
|
|
96818
96877
|
|
|
96819
|
-
|
|
96878
|
+
start() {
|
|
96879
|
+
if (this.isRunning) {
|
|
96880
|
+
//already running
|
|
96881
|
+
return;
|
|
96882
|
+
}
|
|
96820
96883
|
|
|
96821
|
-
|
|
96884
|
+
this.isRunning = true;
|
|
96822
96885
|
|
|
96823
|
-
|
|
96824
|
-
assert.notEqual(domElement, undefined, "domElement is undefined");
|
|
96886
|
+
// console.warn("PointerDevice.start");
|
|
96825
96887
|
|
|
96826
|
-
|
|
96827
|
-
domElement.addEventListener(MouseEvents.Up, this.eventHandlerMouseUp);
|
|
96828
|
-
domElement.addEventListener(MouseEvents.Down, this.eventHandlerMouseDown);
|
|
96888
|
+
const domElement = this.domElement;
|
|
96829
96889
|
|
|
96830
|
-
|
|
96831
|
-
|
|
96832
|
-
domElement.addEventListener(TouchEvents.Move, this.eventHandlerTouchMove);
|
|
96890
|
+
assert.notEqual(domElement, null, "domElement is null");
|
|
96891
|
+
assert.notEqual(domElement, undefined, "domElement is undefined");
|
|
96833
96892
|
|
|
96834
|
-
|
|
96835
|
-
|
|
96893
|
+
domElement.addEventListener(MouseEvents.Move, this.#eventHandlerMouseMove);
|
|
96894
|
+
domElement.addEventListener(MouseEvents.Up, this.#eventHandlerMouseUp);
|
|
96895
|
+
domElement.addEventListener(MouseEvents.Down, this.#eventHandlerMouseDown);
|
|
96836
96896
|
|
|
96837
|
-
|
|
96838
|
-
|
|
96839
|
-
|
|
96840
|
-
*/
|
|
96841
|
-
domElement.addEventListener(MouseEvents.Wheel, this.eventHandlerWheel, { passive: false });
|
|
96897
|
+
domElement.addEventListener(TouchEvents.Start, this.#eventHandlerTouchStart);
|
|
96898
|
+
domElement.addEventListener(TouchEvents.End, this.#eventHandlerTouchEnd);
|
|
96899
|
+
domElement.addEventListener(TouchEvents.Move, this.#eventHandlerTouchMove);
|
|
96842
96900
|
|
|
96901
|
+
window.addEventListener(MouseEvents.Up, this.#eventHandlerGlobalMouseUp);
|
|
96902
|
+
window.addEventListener(TouchEvents.End, this.#eventHandlerGlobalTouchEnd);
|
|
96843
96903
|
|
|
96844
|
-
|
|
96845
|
-
|
|
96904
|
+
/*
|
|
96905
|
+
In some cases wheel event gets registered as "passive" by default. This interferes with "preventDefault()"
|
|
96906
|
+
see https://www.chromestatus.com/features/6662647093133312
|
|
96907
|
+
*/
|
|
96908
|
+
domElement.addEventListener(MouseEvents.Wheel, this.#eventHandlerWheel, { passive: false });
|
|
96846
96909
|
|
|
96847
|
-
|
|
96848
|
-
|
|
96849
|
-
//not running
|
|
96850
|
-
return;
|
|
96910
|
+
|
|
96911
|
+
domElement.addEventListener("contextmenu", supressContextMenu);
|
|
96851
96912
|
}
|
|
96852
96913
|
|
|
96853
|
-
|
|
96914
|
+
stop() {
|
|
96915
|
+
if (!this.isRunning) {
|
|
96916
|
+
//not running
|
|
96917
|
+
return;
|
|
96918
|
+
}
|
|
96854
96919
|
|
|
96855
|
-
|
|
96920
|
+
this.isRunning = false;
|
|
96856
96921
|
|
|
96857
|
-
|
|
96922
|
+
// console.warn("PointerDevice.stop");
|
|
96858
96923
|
|
|
96859
|
-
|
|
96860
|
-
domElement.removeEventListener(MouseEvents.Up, this.eventHandlerMouseUp);
|
|
96861
|
-
domElement.removeEventListener(MouseEvents.Down, this.eventHandlerMouseDown);
|
|
96924
|
+
const domElement = this.domElement;
|
|
96862
96925
|
|
|
96863
|
-
|
|
96864
|
-
|
|
96865
|
-
|
|
96926
|
+
domElement.removeEventListener(MouseEvents.Move, this.#eventHandlerMouseMove);
|
|
96927
|
+
domElement.removeEventListener(MouseEvents.Up, this.#eventHandlerMouseUp);
|
|
96928
|
+
domElement.removeEventListener(MouseEvents.Down, this.#eventHandlerMouseDown);
|
|
96866
96929
|
|
|
96867
|
-
|
|
96868
|
-
|
|
96930
|
+
domElement.removeEventListener(TouchEvents.Start, this.#eventHandlerTouchStart);
|
|
96931
|
+
domElement.removeEventListener(TouchEvents.End, this.#eventHandlerTouchEnd);
|
|
96932
|
+
domElement.removeEventListener(TouchEvents.Move, this.#eventHandlerTouchMove);
|
|
96869
96933
|
|
|
96870
|
-
|
|
96934
|
+
window.removeEventListener(MouseEvents.Up, this.#eventHandlerGlobalMouseUp);
|
|
96935
|
+
window.removeEventListener(TouchEvents.End, this.#eventHandlerGlobalTouchEnd);
|
|
96871
96936
|
|
|
96937
|
+
domElement.removeEventListener(MouseEvents.Wheel, this.#eventHandlerWheel);
|
|
96872
96938
|
|
|
96873
|
-
|
|
96874
|
-
|
|
96939
|
+
|
|
96940
|
+
domElement.removeEventListener("contextmenu", supressContextMenu);
|
|
96941
|
+
}
|
|
96942
|
+
}
|
|
96875
96943
|
|
|
96876
96944
|
const KeyboardEvents = {
|
|
96877
96945
|
KeyUp: 'keyup',
|
|
@@ -96881,7 +96949,7 @@ const KeyboardEvents = {
|
|
|
96881
96949
|
/**
|
|
96882
96950
|
* Representation of an input device key
|
|
96883
96951
|
*/
|
|
96884
|
-
class
|
|
96952
|
+
class InputDeviceSwitch {
|
|
96885
96953
|
/**
|
|
96886
96954
|
* Button press
|
|
96887
96955
|
* @type {Signal}
|
|
@@ -96938,7 +97006,28 @@ function isFocusable(el) {
|
|
|
96938
97006
|
|| isInstanceOf(el, HTMLAreaElement)
|
|
96939
97007
|
}
|
|
96940
97008
|
|
|
97009
|
+
/**
|
|
97010
|
+
* @readonly
|
|
97011
|
+
* @type {string[]}
|
|
97012
|
+
*/
|
|
97013
|
+
const codeToKeyNameMap = [];
|
|
97014
|
+
|
|
96941
97015
|
class KeyboardDevice {
|
|
97016
|
+
|
|
97017
|
+
/**
|
|
97018
|
+
* @readonly
|
|
97019
|
+
*/
|
|
97020
|
+
on = {
|
|
97021
|
+
down: new Signal(),
|
|
97022
|
+
up: new Signal()
|
|
97023
|
+
};
|
|
97024
|
+
|
|
97025
|
+
/**
|
|
97026
|
+
* @readonly
|
|
97027
|
+
* @type {Object<InputDeviceSwitch>}
|
|
97028
|
+
*/
|
|
97029
|
+
keys = {};
|
|
97030
|
+
|
|
96942
97031
|
/**
|
|
96943
97032
|
*
|
|
96944
97033
|
* @param {EventTarget|Element} domElement
|
|
@@ -96958,19 +97047,6 @@ class KeyboardDevice {
|
|
|
96958
97047
|
*/
|
|
96959
97048
|
this.domElement = domElement;
|
|
96960
97049
|
|
|
96961
|
-
this.on = {
|
|
96962
|
-
down: new Signal(),
|
|
96963
|
-
up: new Signal()
|
|
96964
|
-
};
|
|
96965
|
-
|
|
96966
|
-
|
|
96967
|
-
/**
|
|
96968
|
-
*
|
|
96969
|
-
* @type {Object<InputDeviceButton>}
|
|
96970
|
-
*/
|
|
96971
|
-
const keys = this.keys = {};
|
|
96972
|
-
|
|
96973
|
-
const codeToKeyNameMap = [];
|
|
96974
97050
|
|
|
96975
97051
|
//initialize separate events for each key
|
|
96976
97052
|
for (let keyName in KeyCodes) {
|
|
@@ -96979,51 +97055,61 @@ class KeyboardDevice {
|
|
|
96979
97055
|
|
|
96980
97056
|
codeToKeyNameMap[keyCode] = keyName;
|
|
96981
97057
|
|
|
96982
|
-
keys[keyName] = new
|
|
97058
|
+
this.keys[keyName] = new InputDeviceSwitch();
|
|
96983
97059
|
}
|
|
96984
97060
|
|
|
96985
|
-
|
|
96986
|
-
|
|
97061
|
+
}
|
|
97062
|
+
|
|
97063
|
+
/**
|
|
97064
|
+
*
|
|
97065
|
+
* @param {KeyboardEvent} event
|
|
97066
|
+
* @private
|
|
97067
|
+
*/
|
|
97068
|
+
#handlerKeyDown = (event) => {
|
|
97069
|
+
this.on.down.send1(event);
|
|
96987
97070
|
|
|
96988
|
-
|
|
96989
|
-
|
|
96990
|
-
|
|
97071
|
+
//hook up dispatch handler for individual keys
|
|
97072
|
+
const keyCode = event.keyCode;
|
|
97073
|
+
const keyName = codeToKeyNameMap[keyCode];
|
|
96991
97074
|
|
|
96992
|
-
|
|
96993
|
-
|
|
97075
|
+
if (keyName !== undefined) {
|
|
97076
|
+
const button = this.keys[keyName];
|
|
96994
97077
|
|
|
96995
|
-
|
|
96996
|
-
|
|
97078
|
+
button.is_down = true;
|
|
97079
|
+
button.down.send1(event);
|
|
96997
97080
|
|
|
96998
|
-
|
|
96999
|
-
|
|
97081
|
+
}
|
|
97082
|
+
}
|
|
97000
97083
|
|
|
97001
|
-
|
|
97002
|
-
|
|
97084
|
+
/**
|
|
97085
|
+
*
|
|
97086
|
+
* @param {KeyboardEvent} event
|
|
97087
|
+
* @private
|
|
97088
|
+
*/
|
|
97089
|
+
#handlerKeyUp = (event) => {
|
|
97090
|
+
this.on.up.send1(event);
|
|
97003
97091
|
|
|
97004
|
-
|
|
97005
|
-
|
|
97092
|
+
//hook up dispatch handler for individual keys
|
|
97093
|
+
const keyCode = event.keyCode;
|
|
97006
97094
|
|
|
97007
|
-
|
|
97095
|
+
const keyName = codeToKeyNameMap[keyCode];
|
|
97008
97096
|
|
|
97009
|
-
|
|
97010
|
-
|
|
97097
|
+
if (keyName !== undefined) {
|
|
97098
|
+
const button = this.keys[keyName];
|
|
97011
97099
|
|
|
97012
|
-
|
|
97013
|
-
|
|
97014
|
-
|
|
97015
|
-
};
|
|
97100
|
+
button.is_down = false;
|
|
97101
|
+
button.up.send1(event);
|
|
97102
|
+
}
|
|
97016
97103
|
}
|
|
97017
97104
|
|
|
97018
|
-
|
|
97019
97105
|
start() {
|
|
97020
|
-
this.domElement.addEventListener(KeyboardEvents.KeyDown, this
|
|
97021
|
-
this.domElement.addEventListener(KeyboardEvents.KeyUp, this
|
|
97106
|
+
this.domElement.addEventListener(KeyboardEvents.KeyDown, this.#handlerKeyDown);
|
|
97107
|
+
this.domElement.addEventListener(KeyboardEvents.KeyUp, this.#handlerKeyUp);
|
|
97022
97108
|
}
|
|
97023
97109
|
|
|
97024
97110
|
stop() {
|
|
97025
|
-
this.domElement.removeEventListener(KeyboardEvents.KeyDown, this
|
|
97026
|
-
this.domElement.removeEventListener(KeyboardEvents.KeyUp, this
|
|
97111
|
+
this.domElement.removeEventListener(KeyboardEvents.KeyDown, this.#handlerKeyDown);
|
|
97112
|
+
this.domElement.removeEventListener(KeyboardEvents.KeyUp, this.#handlerKeyUp);
|
|
97027
97113
|
}
|
|
97028
97114
|
}
|
|
97029
97115
|
|
|
@@ -118741,7 +118827,11 @@ AbstractLight.prototype.type = 'Abstract';
|
|
|
118741
118827
|
* @param {number[]|Float32Array|Float64Array} aabb_corners
|
|
118742
118828
|
* @param {number[]|Float32Array|mat4} projection_matrix
|
|
118743
118829
|
*/
|
|
118744
|
-
function aabb3_matrix4_project_by_corners(
|
|
118830
|
+
function aabb3_matrix4_project_by_corners(
|
|
118831
|
+
result,
|
|
118832
|
+
aabb_corners,
|
|
118833
|
+
projection_matrix
|
|
118834
|
+
) {
|
|
118745
118835
|
assert.greaterThanOrEqual(result.length, 6, 'result.length must >= 6');
|
|
118746
118836
|
assert.greaterThanOrEqual(aabb_corners.length, 24, 'aabb_corners.length must >= 24');
|
|
118747
118837
|
assert.greaterThanOrEqual(projection_matrix.length, 16, 'projection_matrix.length must >= 16');
|
|
@@ -118844,6 +118934,11 @@ class Decal extends AbstractLight {
|
|
|
118844
118934
|
this.transform_inverse = new Float32Array(16);
|
|
118845
118935
|
this.uv = new Float32Array(4);
|
|
118846
118936
|
|
|
118937
|
+
this.color = new Float32Array(4);
|
|
118938
|
+
// initialize color to full white
|
|
118939
|
+
this.color.fill(1);
|
|
118940
|
+
|
|
118941
|
+
|
|
118847
118942
|
/**
|
|
118848
118943
|
*
|
|
118849
118944
|
* @type {Sampler2D}
|
|
@@ -118923,8 +119018,11 @@ class Decal extends AbstractLight {
|
|
|
118923
119018
|
array_copy(this.uv, 0, destination, address + 16, 4);
|
|
118924
119019
|
|
|
118925
119020
|
// required for sorting
|
|
118926
|
-
destination[address + 20] = this.draw_priority;
|
|
118927
|
-
destination[address + 21] = this.id;
|
|
119021
|
+
// destination[address + 20] = this.draw_priority;
|
|
119022
|
+
// destination[address + 21] = this.id;
|
|
119023
|
+
|
|
119024
|
+
// color
|
|
119025
|
+
array_copy(this.color, 0, destination, address + 20, 4);
|
|
118928
119026
|
|
|
118929
119027
|
return 24;
|
|
118930
119028
|
}
|
|
@@ -119456,11 +119554,7 @@ function point_light_inside_volume(
|
|
|
119456
119554
|
}
|
|
119457
119555
|
}
|
|
119458
119556
|
|
|
119459
|
-
|
|
119460
|
-
*
|
|
119461
|
-
* @type {number[]}
|
|
119462
|
-
*/
|
|
119463
|
-
const stack = [];
|
|
119557
|
+
const stack = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
119464
119558
|
|
|
119465
119559
|
/**
|
|
119466
119560
|
*
|
|
@@ -119485,7 +119579,7 @@ function frustum_check(data_view, address, planes) {
|
|
|
119485
119579
|
const plane_normal_z = planes[plane_address + 2];
|
|
119486
119580
|
const plane_constant = planes[plane_address + 3];
|
|
119487
119581
|
|
|
119488
|
-
const distanceAbovePlane =
|
|
119582
|
+
const distanceAbovePlane = aabb3_compute_distance_above_plane_max(
|
|
119489
119583
|
plane_normal_x, plane_normal_y, plane_normal_z, plane_constant,
|
|
119490
119584
|
n_x0, n_y0, n_z0,
|
|
119491
119585
|
n_x1, n_y1, n_z1
|
|
@@ -119522,8 +119616,6 @@ function query_bvh_frustum_from_texture(
|
|
|
119522
119616
|
source_data,
|
|
119523
119617
|
planes, points
|
|
119524
119618
|
) {
|
|
119525
|
-
|
|
119526
|
-
let stackPointer = 1;
|
|
119527
119619
|
let result = 0;
|
|
119528
119620
|
|
|
119529
119621
|
const binary_node_count = root.getBinaryNodeCount();
|
|
@@ -119533,19 +119625,26 @@ function query_bvh_frustum_from_texture(
|
|
|
119533
119625
|
return 0;
|
|
119534
119626
|
}
|
|
119535
119627
|
|
|
119628
|
+
/**
|
|
119629
|
+
*
|
|
119630
|
+
* @type {number}
|
|
119631
|
+
*/
|
|
119632
|
+
const stack_top = stack.pointer++;
|
|
119633
|
+
|
|
119536
119634
|
/**
|
|
119537
119635
|
* After performing empirical tests, stack-based depth-first traversal turns out faster than using a queue
|
|
119538
119636
|
* @type {number}
|
|
119539
119637
|
*/
|
|
119540
|
-
stack[
|
|
119638
|
+
stack[stack_top] = 0;
|
|
119541
119639
|
|
|
119542
119640
|
const last_valid_index = binary_node_count + root.getLeafNodeCount();
|
|
119543
119641
|
const data_view = root.getDataView();
|
|
119544
119642
|
|
|
119545
|
-
|
|
119643
|
+
do {
|
|
119644
|
+
stack.pointer--;
|
|
119546
119645
|
|
|
119547
119646
|
// query_bvh_frustum_from_objects.iteration_count++;
|
|
119548
|
-
const node_index = stack[
|
|
119647
|
+
const node_index = stack[stack.pointer];
|
|
119549
119648
|
|
|
119550
119649
|
if (node_index < binary_node_count) {
|
|
119551
119650
|
// is intermediate node
|
|
@@ -119560,11 +119659,11 @@ function query_bvh_frustum_from_texture(
|
|
|
119560
119659
|
|
|
119561
119660
|
// left node ends up on top of the stack, which aligns with the desired access sequence
|
|
119562
119661
|
if (right_index < last_valid_index) {
|
|
119563
|
-
stack[
|
|
119662
|
+
stack[stack.pointer++] = right_index;
|
|
119564
119663
|
// micro-optimization, since we know that right node is valid and left appears before that, left is valid too
|
|
119565
|
-
stack[
|
|
119664
|
+
stack[stack.pointer++] = left_index;
|
|
119566
119665
|
} else if (left_index < last_valid_index) {
|
|
119567
|
-
stack[
|
|
119666
|
+
stack[stack.pointer++] = left_index;
|
|
119568
119667
|
}
|
|
119569
119668
|
|
|
119570
119669
|
|
|
@@ -119612,7 +119711,7 @@ function query_bvh_frustum_from_texture(
|
|
|
119612
119711
|
result++;
|
|
119613
119712
|
}
|
|
119614
119713
|
|
|
119615
|
-
}
|
|
119714
|
+
}while (stack.pointer > stack_top)
|
|
119616
119715
|
|
|
119617
119716
|
return result;
|
|
119618
119717
|
}
|
|
@@ -120861,14 +120960,17 @@ class LightManager {
|
|
|
120861
120960
|
assert.isNumber(x, 'x');
|
|
120862
120961
|
assert.isNonNegativeInteger(x, 'x');
|
|
120863
120962
|
assert.isFiniteNumber(x, 'x');
|
|
120963
|
+
assert.greaterThan(x,0,'x must be > 0');
|
|
120864
120964
|
|
|
120865
120965
|
assert.isNumber(y, 'y');
|
|
120866
120966
|
assert.isNonNegativeInteger(y, 'y');
|
|
120867
120967
|
assert.isFiniteNumber(y, 'y');
|
|
120968
|
+
assert.greaterThan(y,0,'y must be > 0');
|
|
120868
120969
|
|
|
120869
120970
|
assert.isNumber(z, 'z');
|
|
120870
120971
|
assert.isNonNegativeInteger(z, 'z');
|
|
120871
120972
|
assert.isFiniteNumber(z, 'z');
|
|
120973
|
+
assert.greaterThan(z,0,'z must be > 0');
|
|
120872
120974
|
|
|
120873
120975
|
const r = this.__tiles_resolution;
|
|
120874
120976
|
|
|
@@ -121210,6 +121312,10 @@ const FP_SHADER_CHUNK_APPLY_DECALS = `
|
|
|
121210
121312
|
|
|
121211
121313
|
vec4 decal_color = texture2D(fp_t_decal_atlas,decal_uv, -0.2);
|
|
121212
121314
|
|
|
121315
|
+
vec4 decal_color_tint = texelFetch(fp_t_light_data, address_to_data_texture_coordinates(light_address+5u), 0);
|
|
121316
|
+
|
|
121317
|
+
decal_color*= decal_color_tint;
|
|
121318
|
+
|
|
121213
121319
|
// compute decal alpha
|
|
121214
121320
|
float decal_alpha = decal_color.a * decal_surface_angle_fade;
|
|
121215
121321
|
|