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