@woosh/meep-engine 2.49.8 → 2.50.0
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/editor/actions/concrete/ArrayCopyAction.js +1 -1
- package/package.json +1 -1
- package/src/core/binary/BinaryBuffer.js +1 -1
- package/src/core/binary/BinaryBuffer.spec.js +128 -0
- package/src/core/binary/int32_to_binary_string.js +4 -1
- package/src/core/binary/int32_to_binary_string.spec.js +9 -0
- package/src/core/bvh2/BinaryNode.js +0 -30
- package/src/core/bvh2/binary/2/BinaryUint32BVH.js +1 -1
- package/src/core/bvh2/binary/IndexedBinaryBVH.js +1 -1
- package/src/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js +1 -1
- package/src/core/bvh2/bvh3/query/compute_tight_near_far_clipping_planes.js +1 -1
- package/src/core/cache/Cache.js +31 -29
- package/src/core/cache/Cache.spec.js +4 -1
- package/src/core/collection/HashMap.js +1 -1
- package/src/core/collection/array/{copyArray.js → array_copy.js} +1 -24
- package/src/core/collection/array/array_copy_entire.js +21 -0
- package/src/core/collection/array/typed/typed_array_copy.js +1 -1
- package/src/core/collection/queue/Deque.d.ts +4 -0
- package/src/core/collection/queue/Deque.js +5 -7
- package/src/core/collection/queue/Deque.spec.js +107 -0
- package/src/core/collection/table/RowFirstTable.js +1 -1
- package/src/core/geom/2d/aabb/AABB2.d.ts +14 -0
- package/src/core/geom/2d/aabb/AABB2.js +9 -7
- package/src/core/geom/2d/aabb/AABB2.spec.js +100 -0
- package/src/core/geom/2d/aabb/aabb2_compute_center_from_multiple.spec.js +11 -0
- package/src/core/geom/2d/aabb/aabb2_compute_overlap.spec.js +56 -0
- package/src/core/geom/2d/aabb/aabb2_contains.spec.js +40 -0
- package/src/core/geom/2d/bvh/Node2.js +1 -1
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.js +1 -1
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js +1 -1
- package/src/core/geom/2d/line/line_segment_compute_line_segment_intersection_2d.js +35 -0
- package/src/core/geom/2d/line/line_segment_compute_line_segment_intersection_array_2d.js +51 -0
- package/src/core/geom/2d/line/line_segment_compute_line_segment_intersection_vectors_2d.js +15 -0
- package/src/core/geom/2d/line/line_segment_compute_line_segment_intersection_vectors_array_2d.js +30 -0
- package/src/core/geom/2d/line/line_segment_line_segment_intersection_exists_2d.js +29 -0
- package/src/core/geom/3d/aabb/AABB3.d.ts +4 -0
- package/src/core/geom/3d/aabb/AABB3.spec.js +30 -0
- package/src/core/geom/3d/matrix/m4_make_translation.js +1 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +1 -1
- package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +1 -1
- package/src/core/geom/3d/tetrahedra/compute_circumsphere.js +1 -1
- package/src/core/geom/3d/tetrahedra/delaunay/fill_in_a_cavity.js +1 -1
- package/src/core/geom/3d/topology/bounds/computeTriangleClusterNormalBoundingCone.js +1 -1
- package/src/core/geom/3d/topology/expandConnectivityByLocality.js +1 -1
- package/src/core/geom/3d/topology/struct/binary/BinaryTopology.js +1 -1
- package/src/core/geom/Quaternion.d.ts +11 -0
- package/src/core/geom/Quaternion.js +36 -27
- package/src/core/geom/Quaternion.spec.js +141 -0
- package/src/core/geom/Vector2.d.ts +5 -1
- package/src/core/geom/Vector2.js +24 -0
- package/src/core/geom/Vector3.d.ts +4 -0
- package/src/core/geom/Vector3.spec.js +60 -0
- package/src/core/graph/GraphUtils.js +4 -2
- package/src/core/graph/layout/CircleLayout.js +4 -2
- package/src/core/math/bessel_i0.spec.js +43 -0
- package/src/core/math/bessel_j0.js +30 -0
- package/src/core/math/hash/murmur3_32.spec.js +8 -0
- package/src/core/math/hash/squirrel3.spec.js +16 -0
- package/src/core/math/interval/NumericInterval.js +1 -0
- package/src/core/math/{bessel_i0.js → modified_bessel_i0.js} +5 -2
- package/src/core/math/noise/{create_noise_2d.js → create_simplex_noise_2d.js} +2 -2
- package/src/core/math/noise/create_simplex_noise_2d.spec.js +21 -0
- package/src/core/math/physics/irradiance/interpolate_irradiance_linear.spec.js +20 -0
- package/src/core/math/physics/irradiance/interpolate_irradiance_lograrithmic.js +4 -4
- package/src/core/math/physics/irradiance/interpolate_irradiance_lograrithmic.spec.js +18 -0
- package/src/core/math/physics/irradiance/interpolate_irradiance_smith.js +1 -1
- package/src/core/math/physics/irradiance/interpolate_irradiance_smith.spec.js +20 -0
- package/src/core/math/random/seededRandomMersenneTwister.spec.js +10 -0
- package/src/core/math/spline/spline_bezier3.js +1 -1
- package/src/core/math/spline/spline_bezier3_bounds.js +2 -1
- package/src/core/math/spline/spline_bezier3_bounds.spec.js +37 -0
- package/src/core/math/statistics/computeSampleSize_Cochran.spec.js +12 -0
- package/src/core/math/statistics/computeStatisticalPartialMedian.js +4 -0
- package/src/core/math/statistics/computeStatisticalPartialMedian.spec.js +13 -0
- package/src/core/math/vector_nd_dot.js +16 -0
- package/src/core/math/{normalizeArrayVector.js → vector_nd_normalize.js} +3 -3
- package/src/core/math/vector_nd_normalize.spec.js +15 -0
- package/src/core/process/PromiseWatcher.spec.js +1 -1
- package/src/engine/achievements/Achievement.spec.js +21 -0
- package/src/engine/animation/curve/compression/downsample_float_array_curve_by_error.js +1 -1
- package/src/engine/animation/curve/compression/prototypeCurveCompression.js +2 -2
- package/src/engine/animation/curve/compression/{animation_curve_to_float_array.js → sample_animation_curve_to_float_array.js} +10 -3
- package/src/engine/animation/curve/compression/sample_animation_curve_to_float_array.spec.js +29 -0
- package/src/engine/animation/curve/draw/build_curve_editor.js +3 -3
- package/src/engine/development/performance/RingBufferMetric.js +1 -1
- package/src/engine/ecs/EntityManager.js +1 -205
- package/src/engine/ecs/animation/Animation.js +2 -180
- package/src/engine/ecs/animation/AnimationClip.js +132 -0
- package/src/engine/ecs/animation/AnimationClip.spec.js +5 -0
- package/src/engine/ecs/animation/AnimationClipFlag.js +7 -0
- package/src/engine/ecs/animation/AnimationFlags.js +8 -0
- package/src/engine/ecs/animation/AnimationSerializationAdapter.js +32 -0
- package/src/engine/ecs/fow/FogOfWar.js +1 -1
- package/src/engine/ecs/guid/GUID.js +1 -1
- package/src/engine/ecs/systems/AnimationSystem.js +3 -1
- package/src/engine/ecs/terrain/ecs/splat/SplatMapping.js +1 -1
- package/src/engine/ecs/terrain/overlay/TerrainOverlay.js +1 -1
- package/src/engine/ecs/terrain/tiles/TerrainTile.js +1 -1
- package/src/engine/ecs/transform/Transform.d.ts +2 -0
- package/src/engine/ecs/transform/Transform.spec.js +63 -0
- package/src/engine/ecs/transform-attachment/TransformAttachment.d.ts +17 -1
- package/src/engine/ecs/transform-attachment/TransformAttachment.js +12 -2
- package/src/engine/ecs/transform-attachment/TransformAttachment.spec.js +103 -0
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +1 -1
- package/src/engine/graphics/ecs/animation/AnimationControllerSystem.js +2 -1
- package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +1 -1
- package/src/engine/graphics/ecs/path/tube/build/computeFrenetFrames.js +1 -1
- package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +1 -1
- package/src/engine/graphics/geometry/MikkT/GenerateTSpaces.js +1 -1
- package/src/engine/graphics/geometry/MikkT/m_getNormal.js +1 -1
- package/src/engine/graphics/geometry/MikkT/m_getTexCoord.js +1 -1
- package/src/engine/graphics/geometry/bvh/buffered/BVHGeometryRaycaster.js +1 -1
- package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.js +1 -1
- package/src/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.js +1 -1
- package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.js +1 -1
- package/src/engine/graphics/load_and_set_cubemap_v0.js +1 -1
- package/src/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.js +1 -1
- package/src/engine/graphics/render/Lines.js +1 -1
- package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +1 -1
- package/src/engine/graphics/render/buffer/simple-fx/taa/TemporalSupersamplingRenderPlugin.js +1 -1
- package/src/engine/graphics/render/forward_plus/LightManager.js +1 -1
- package/src/engine/graphics/render/forward_plus/model/Decal.js +1 -1
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +1 -1
- package/src/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +1 -1
- package/src/engine/graphics/render/gizmo/GizmoShapeRenderingInterface.js +1 -1
- package/src/engine/graphics/render/view/CameraView.js +1 -1
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +1 -1
- package/src/engine/graphics/render/visibility/hiz/query/BatchOcclusionQuery.js +1 -1
- package/src/engine/graphics/render/webgpu/sample/MeshInstance.js +1 -1
- package/src/engine/graphics/sh3/LightProbeVolume.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracer.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.js +1 -1
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +1 -1
- package/src/engine/graphics/texture/3d/scs3d_read_2d_slice.js +1 -1
- package/src/engine/graphics/texture/CanvasClone.js +5 -1
- package/src/engine/graphics/texture/sampler/Sampler2D.js +14 -75
- package/src/engine/graphics/texture/sampler/bicubic.js +19 -19
- package/src/engine/graphics/texture/sampler/convertSampler2D2DataURL.spec.js +10 -0
- package/src/engine/graphics/texture/sampler/copy_Sampler2D_channel_data.spec.js +90 -0
- package/src/engine/graphics/texture/sampler/differenceSampler.js +13 -8
- package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_Chamfer.js +140 -0
- package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_NaiveFlood.js +130 -0
- package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.js +10 -0
- package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.spec.js +183 -0
- package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField_Chamfer.js +133 -0
- package/src/engine/graphics/texture/sampler/filter/kaiser_1.js +8 -4
- package/src/engine/graphics/texture/sampler/filter/kaiser_bessel_window.js +2 -0
- package/src/engine/graphics/texture/sampler/filter/mitchell.js +4 -0
- package/src/engine/graphics/texture/sampler/loadSampler2D.js +5 -2
- package/src/engine/graphics/texture/sampler/resize/sampler2d_downsample_mipmap.js +8 -3
- package/src/engine/graphics/texture/sampler/resize/sampler2d_downsample_mipmap.spec.js +13 -0
- package/src/engine/graphics/texture/sampler/sampler2d_channel_compute_min_indices.js +58 -0
- package/src/engine/graphics/trail/TemporalPath.js +0 -36
- package/src/engine/intelligence/behavior/composite/ParallelBehavior.spec.js +12 -12
- package/src/engine/intelligence/behavior/composite/SequenceBehavior.spec.js +17 -0
- package/src/engine/intelligence/behavior/primitive/SucceedingBehavior.js +2 -0
- package/src/engine/knowledge/database/StaticKnowledgeDataTable.d.ts +7 -1
- package/src/engine/knowledge/database/StaticKnowledgeDataTable.spec.js +21 -0
- package/src/engine/knowledge/database/StaticKnowledgeDataTableDescriptor.d.ts +2 -2
- package/src/engine/logging/ConsoleLoggerBackend.js +4 -0
- package/src/engine/logging/VoidLoggerBackend.js +12 -0
- package/src/engine/navigation/ecs/components/computeCatmullRomSpline.js +1 -1
- package/src/engine/navigation/ecs/components/computeCatmullRomSplineUniformDistance.js +1 -1
- package/src/engine/physics/cannon/CannonJSPhysicsSystem.js +1 -1
- package/src/engine/save/GameStateLoader.js +1 -1
- package/src/engine/scene/Scene.d.ts +2 -0
- package/src/engine/scene/Scene.js +2 -2
- package/src/engine/scene/Scene.spec.js +20 -0
- package/src/engine/scene/SceneManager.d.ts +4 -0
- package/src/engine/scene/SceneManager.js +46 -23
- package/src/engine/scene/SceneManager.spec.js +107 -0
- package/src/engine/sound/material/detector/terrain/TerrainSoundMaterialSurfaceDetector.js +2 -2
- package/src/engine/ui/GUIEngine.js +1 -1
- package/src/generation/filtering/numeric/complex/CellFilterAngleToNormal.js +11 -4
- package/src/generation/filtering/numeric/complex/CellFilterAngleToNormal.spec.js +30 -0
- package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.js +18 -2
- package/src/generation/filtering/numeric/complex/CellFilterGaussianBlur.spec.js +17 -0
- package/src/generation/filtering/numeric/complex/CellFilterSimplexNoise.js +2 -2
- package/src/generation/grid/GridData.js +0 -60
- package/src/generation/grid/generation/util/buildUnsignedDistanceField.js +3 -1
- package/src/generation/markers/MarkerNode.js +2 -2
- package/src/generation/theme/AreaMask.js +3 -1
- package/src/view/elements/progress/RectangularPieProgressView.js +8 -6
- package/src/core/geom/2d/LineSegment2.js +0 -175
- package/src/core/geom/Matrix4.js +0 -275
- package/src/engine/graphics/texture/sampler/distanceField.js +0 -411
- package/src/engine/graphics/texture/sampler/distanceField.spec.js +0 -184
- package/src/engine/physics/cannon/cannon.min.js +0 -27
- /package/src/engine/ecs/{animation → ik}/IKMath.js +0 -0
- /package/src/engine/ecs/{animation → ik}/IKProblem.js +0 -0
- /package/src/engine/ecs/{animation → ik}/IKSolver.js +0 -0
- /package/src/engine/ecs/{animation → ik}/InverseKinematics.js +0 -0
- /package/src/engine/ecs/{animation → ik}/InverseKinematicsSystem.js +0 -0
- /package/src/engine/ecs/{animation → ik}/OneBoneSurfaceAlignmentSolver.js +0 -0
- /package/src/engine/ecs/{animation → ik}/TwoBoneInverseKinematicsSolver.js +0 -0
- /package/src/engine/physics/spring/{Spring.js → computeHookeForce.js} +0 -0
|
@@ -38,7 +38,7 @@ import { FogOfWarSystem } from "../../ecs/fow/FogOfWarSystem.js";
|
|
|
38
38
|
import { FogOfWarRevealerSystem } from "../../ecs/fow/FogOfWarRevealerSystem.js";
|
|
39
39
|
import { BehaviorSystem } from "../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
40
40
|
import { SerializationMetadataSystem } from "../../ecs/systems/SerializationMetadataSystem.js";
|
|
41
|
-
import { InverseKinematicsSystem } from "../../ecs/
|
|
41
|
+
import { InverseKinematicsSystem } from "../../ecs/ik/InverseKinematicsSystem.js";
|
|
42
42
|
import { PathDisplaySystem } from "../ecs/path/PathDisplaySystem.js";
|
|
43
43
|
import RenderSystem from "../../ecs/systems/RenderSystem.js";
|
|
44
44
|
import { makeEngineOptionsModel } from "../../../../../model/game/options/makeEngineOptionsModel.js";
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { System } from '../../../ecs/System.js';
|
|
7
7
|
import AnimationController from './AnimationController.js';
|
|
8
8
|
import { Animation } from '../../../ecs/animation/Animation.js';
|
|
9
|
+
import { AnimationClip } from "../../../ecs/animation/AnimationClip.js";
|
|
9
10
|
|
|
10
11
|
class AnimationControllerSystem extends System {
|
|
11
12
|
constructor() {
|
|
@@ -33,7 +34,7 @@ class AnimationControllerSystem extends System {
|
|
|
33
34
|
removeAnimation(animation);
|
|
34
35
|
|
|
35
36
|
//create a new animation according to the rule
|
|
36
|
-
const clip = new
|
|
37
|
+
const clip = new AnimationClip();
|
|
37
38
|
clip.fromJSON({
|
|
38
39
|
name: r.animation,
|
|
39
40
|
timeScale: r.speed,
|
|
@@ -39,7 +39,7 @@ import AnimationControllerSystem from "../animation/AnimationControllerSystem.js
|
|
|
39
39
|
import { AnimationGraphSystem } from "../animation/animator/AnimationGraphSystem.js";
|
|
40
40
|
import { BehaviorSystem } from "../../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
41
41
|
import { SerializationMetadataSystem } from "../../../ecs/systems/SerializationMetadataSystem.js";
|
|
42
|
-
import { InverseKinematicsSystem } from "../../../ecs/
|
|
42
|
+
import { InverseKinematicsSystem } from "../../../ecs/ik/InverseKinematicsSystem.js";
|
|
43
43
|
import { PathDisplaySystem } from "./PathDisplaySystem.js";
|
|
44
44
|
import { PathDisplay } from "./PathDisplay.js";
|
|
45
45
|
import { PathDisplayType } from "./PathDisplayType.js";
|
|
@@ -3,7 +3,7 @@ import { max2 } from "../../../../../../core/math/max2.js";
|
|
|
3
3
|
import { min2 } from "../../../../../../core/math/min2.js";
|
|
4
4
|
import { clamp } from "../../../../../../core/math/clamp.js";
|
|
5
5
|
import { vec3 } from "gl-matrix";
|
|
6
|
-
import { array_copy } from "../../../../../../core/collection/array/
|
|
6
|
+
import { array_copy } from "../../../../../../core/collection/array/array_copy.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Compute a normal vector for Frenet frame based on a tangent (direction in which vertex points)
|
|
@@ -37,7 +37,7 @@ import AnimationControllerSystem from "../../animation/AnimationControllerSystem
|
|
|
37
37
|
import { AnimationGraphSystem } from "../../animation/animator/AnimationGraphSystem.js";
|
|
38
38
|
import { BehaviorSystem } from "../../../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
39
39
|
import { SerializationMetadataSystem } from "../../../../ecs/systems/SerializationMetadataSystem.js";
|
|
40
|
-
import { InverseKinematicsSystem } from "../../../../ecs/
|
|
40
|
+
import { InverseKinematicsSystem } from "../../../../ecs/ik/InverseKinematicsSystem.js";
|
|
41
41
|
import { PathDisplaySystem } from "../PathDisplaySystem.js";
|
|
42
42
|
import {
|
|
43
43
|
AmbientOcclusionPostProcessEffect
|
|
@@ -8,7 +8,7 @@ import { GROUP_WITH_ANY } from "./constants/GROUP_WITH_ANY.js";
|
|
|
8
8
|
import { INTERNAL_RND_SORT_SEED } from "./constants/INTERNAL_RND_SORT_SEED.js";
|
|
9
9
|
import { QuickSort } from "./QuickSort.js";
|
|
10
10
|
import { CompareSubGroups } from "./CompareSubGroups.js";
|
|
11
|
-
import { array_copy } from "../../../../core/collection/array/
|
|
11
|
+
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
12
12
|
import { EvalTspace } from "./EvalTspace.js";
|
|
13
13
|
import { ORIENT_PRESERVING } from "./constants/ORIENT_PRESERVING.js";
|
|
14
14
|
import { AvgTSpace } from "./AvgTSpace.js";
|
|
@@ -8,7 +8,7 @@ import { v3_length } from "../../../../../core/geom/v3_length.js";
|
|
|
8
8
|
import { ray3_array_apply_matrix4 } from "../../../../../core/geom/3d/ray/ray3_array_apply_matrix4.js";
|
|
9
9
|
import { mat4 } from "gl-matrix";
|
|
10
10
|
import { ray3_array_compose } from "../../../../../core/geom/3d/ray/ray3_array_compose.js";
|
|
11
|
-
import { array_copy } from "../../../../../core/collection/array/
|
|
11
|
+
import { array_copy } from "../../../../../core/collection/array/array_copy.js";
|
|
12
12
|
import { MATRIX_4_IDENTITY } from "../../../../../core/geom/3d/matrix/MATRIX_4_IDENTITY.js";
|
|
13
13
|
|
|
14
14
|
const hit = new ThreeVector3();
|
|
@@ -17,7 +17,7 @@ import { rewriteMaterial } from "./rewriteMaterial.js";
|
|
|
17
17
|
import { max3 } from "../../../../core/math/max3.js";
|
|
18
18
|
import { min2 } from "../../../../core/math/min2.js";
|
|
19
19
|
import { DrawMode } from "../../ecs/mesh-v2/DrawMode.js";
|
|
20
|
-
import { array_copy } from "../../../../core/collection/array/
|
|
20
|
+
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
21
21
|
import { Cache } from "../../../../core/cache/Cache.js";
|
|
22
22
|
import { computeMaterialHash } from "../../../asset/loaders/material/computeMaterialHash.js";
|
|
23
23
|
|
|
@@ -2,7 +2,7 @@ import { StaticMaterialCache } from "../../../../asset/loaders/material/StaticMa
|
|
|
2
2
|
import { HashMap } from "../../../../../core/collection/HashMap.js";
|
|
3
3
|
import { computeGeometryEquality } from "../../buffered/computeGeometryEquality.js";
|
|
4
4
|
import { computeGeometryHash } from "../../buffered/computeGeometryHash.js";
|
|
5
|
-
import { array_copy } from "../../../../../core/collection/array/
|
|
5
|
+
import { array_copy } from "../../../../../core/collection/array/array_copy.js";
|
|
6
6
|
import { mat4 } from "gl-matrix";
|
|
7
7
|
import { Group, Matrix4, Mesh } from "three";
|
|
8
8
|
import { mergeBufferGeometries } from "three/examples/jsm/utils/BufferGeometryUtils.js";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { renderSamplerFromTexture } from "../../../render/visibility/hiz/buildCanvasViewFromTexture.js";
|
|
4
4
|
import { convex_hull_jarvis_2d } from "../../../../../core/geom/2d/convex-hull/convex_hull_jarvis_2d.js";
|
|
5
5
|
import { fixed_convex_hull_relaxation } from "../../../../../core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js";
|
|
6
|
-
import { array_copy } from "../../../../../core/collection/array/
|
|
6
|
+
import { array_copy } from "../../../../../core/collection/array/array_copy.js";
|
|
7
7
|
import { Sampler2D } from "../../../texture/sampler/Sampler2D.js";
|
|
8
8
|
import { max2 } from "../../../../../core/math/max2.js";
|
|
9
9
|
import { sampler2d_find_pixels } from "../../../texture/sampler/search/sampler2d_find_pixels.js";
|
|
@@ -2,7 +2,7 @@ import Signal from "../../../../../../../core/events/signal/Signal.js";
|
|
|
2
2
|
import {
|
|
3
3
|
DataType2TypedArrayConstructorMapping
|
|
4
4
|
} from "../../../../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
5
|
-
import { array_copy } from "../../../../../../../core/collection/array/
|
|
5
|
+
import { array_copy } from "../../../../../../../core/collection/array/array_copy.js";
|
|
6
6
|
import { min2 } from "../../../../../../../core/math/min2.js";
|
|
7
7
|
import { assert } from "../../../../../../../core/assert.js";
|
|
8
8
|
import { ParameterLookupTable } from "../../parameter/ParameterLookupTable.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DynamicDrawUsage, LineBasicMaterial, LineSegments } from "three";
|
|
2
|
-
import { array_copy } from "../../../core/collection/array/
|
|
2
|
+
import { array_copy } from "../../../core/collection/array/array_copy.js";
|
|
3
3
|
import { BufferGeometry } from "three/src/core/BufferGeometry.js";
|
|
4
4
|
import { Float32BufferAttribute } from "three/src/core/BufferAttribute.js";
|
|
5
5
|
|
|
@@ -39,7 +39,7 @@ import { FogOfWarSystem } from "../../../../ecs/fow/FogOfWarSystem.js";
|
|
|
39
39
|
import { FogOfWarRevealerSystem } from "../../../../ecs/fow/FogOfWarRevealerSystem.js";
|
|
40
40
|
import { BehaviorSystem } from "../../../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
41
41
|
import { SerializationMetadataSystem } from "../../../../ecs/systems/SerializationMetadataSystem.js";
|
|
42
|
-
import { InverseKinematicsSystem } from "../../../../ecs/
|
|
42
|
+
import { InverseKinematicsSystem } from "../../../../ecs/ik/InverseKinematicsSystem.js";
|
|
43
43
|
import { CanvasView } from "../../../../../view/elements/CanvasView.js";
|
|
44
44
|
import Vector3 from "../../../../../core/geom/Vector3.js";
|
|
45
45
|
import Vector2 from "../../../../../core/geom/Vector2.js";
|
package/src/engine/graphics/render/buffer/simple-fx/taa/TemporalSupersamplingRenderPlugin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EnginePlugin } from "../../../../../plugin/EnginePlugin.js";
|
|
2
2
|
import { halton_sequence } from "../../../../../../core/math/statistics/halton_sequence.js";
|
|
3
|
-
import { array_copy } from "../../../../../../core/collection/array/
|
|
3
|
+
import { array_copy } from "../../../../../../core/collection/array/array_copy.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Generates a number of 2d jitter offsets in range -1...1
|
|
@@ -38,7 +38,7 @@ import { Decal } from "./model/Decal.js";
|
|
|
38
38
|
import { ReferencedTextureAtlas } from "../../texture/atlas/ReferencedTextureAtlas.js";
|
|
39
39
|
import { v3_morton_encode_transformed } from "../../../../core/geom/3d/morton/v3_morton_encode_transformed.js";
|
|
40
40
|
import { v3_distance } from "../../../../core/geom/v3_distance.js";
|
|
41
|
-
import { array_copy } from "../../../../core/collection/array/
|
|
41
|
+
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
42
42
|
import { arrayQuickSort } from "../../../../core/collection/array/arrayQuickSort.js";
|
|
43
43
|
import { frustum_from_camera } from "../../ecs/camera/frustum_from_camera.js";
|
|
44
44
|
import { arraySwapElements } from "../../../../core/collection/array/arraySwapElements.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AbstractLight } from "./AbstractLight.js";
|
|
2
2
|
import { aabb3_matrix4_project_by_corners } from "../../../../../core/geom/3d/aabb/aabb3_matrix4_project_by_corners.js";
|
|
3
3
|
import { aabb3_build_corners } from "../../../../../core/geom/3d/aabb/aabb3_build_corners.js";
|
|
4
|
-
import { array_copy } from "../../../../../core/collection/array/
|
|
4
|
+
import { array_copy } from "../../../../../core/collection/array/array_copy.js";
|
|
5
5
|
import { mat4 } from "gl-matrix";
|
|
6
6
|
import Signal from "../../../../../core/events/signal/Signal.js";
|
|
7
7
|
|
|
@@ -40,7 +40,7 @@ import { FogOfWarSystem } from "../../../../ecs/fow/FogOfWarSystem.js";
|
|
|
40
40
|
import { FogOfWarRevealerSystem } from "../../../../ecs/fow/FogOfWarRevealerSystem.js";
|
|
41
41
|
import { BehaviorSystem } from "../../../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
42
42
|
import { SerializationMetadataSystem } from "../../../../ecs/systems/SerializationMetadataSystem.js";
|
|
43
|
-
import { InverseKinematicsSystem } from "../../../../ecs/
|
|
43
|
+
import { InverseKinematicsSystem } from "../../../../ecs/ik/InverseKinematicsSystem.js";
|
|
44
44
|
import { PathDisplaySystem } from "../../../ecs/path/PathDisplaySystem.js";
|
|
45
45
|
import {
|
|
46
46
|
BoxBufferGeometry,
|
|
@@ -49,7 +49,7 @@ import { Decal } from "../model/Decal.js";
|
|
|
49
49
|
import { mat4 } from "gl-matrix";
|
|
50
50
|
import { Sampler2D } from "../../../texture/sampler/Sampler2D.js";
|
|
51
51
|
import { makeHelperBoxGeometry } from "../../../../../../editor/process/symbolic/makeHelperBoxGeometry.js";
|
|
52
|
-
import { array_copy } from "../../../../../core/collection/array/
|
|
52
|
+
import { array_copy } from "../../../../../core/collection/array/array_copy.js";
|
|
53
53
|
import { BufferGeometry } from "three/src/core/BufferGeometry.js";
|
|
54
54
|
import { Float32BufferAttribute } from "three/src/core/BufferAttribute.js";
|
|
55
55
|
import Quaternion from "../../../../../core/geom/Quaternion.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { array_copy } from "../../../../core/collection/array/
|
|
1
|
+
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
2
2
|
import { assert } from "../../../../core/assert.js";
|
|
3
3
|
import { InstancedMeshGroup } from "../../geometry/instancing/InstancedMeshGroup.js";
|
|
4
4
|
import { BoxBufferGeometry, LineBasicMaterial, MeshBasicMaterial, OctahedronBufferGeometry } from "three";
|
|
@@ -6,7 +6,7 @@ import { read_frustum_planes_to_array } from "../../../../core/geom/3d/frustum/r
|
|
|
6
6
|
import Signal from "../../../../core/events/signal/Signal.js";
|
|
7
7
|
import { compare_three_objects } from "../../three/compare_three_objects.js";
|
|
8
8
|
import { frustum_from_camera } from "../../ecs/camera/frustum_from_camera.js";
|
|
9
|
-
import { array_copy } from "../../../../core/collection/array/
|
|
9
|
+
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
10
10
|
import { array_remove_first } from "../../../../core/collection/array/array_remove_first.js";
|
|
11
11
|
|
|
12
12
|
const DEFAULT_FLAGS = CameraViewFlags.Active
|
|
@@ -39,7 +39,7 @@ import { FogOfWarSystem } from "../../../../ecs/fow/FogOfWarSystem.js";
|
|
|
39
39
|
import { FogOfWarRevealerSystem } from "../../../../ecs/fow/FogOfWarRevealerSystem.js";
|
|
40
40
|
import { BehaviorSystem } from "../../../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
41
41
|
import { SerializationMetadataSystem } from "../../../../ecs/systems/SerializationMetadataSystem.js";
|
|
42
|
-
import { InverseKinematicsSystem } from "../../../../ecs/
|
|
42
|
+
import { InverseKinematicsSystem } from "../../../../ecs/ik/InverseKinematicsSystem.js";
|
|
43
43
|
import Vector3 from "../../../../../core/geom/Vector3.js";
|
|
44
44
|
import Vector2 from "../../../../../core/geom/Vector2.js";
|
|
45
45
|
import RenderSystem from "../../../../ecs/systems/RenderSystem.js";
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
UnsignedByteType,
|
|
9
9
|
WebGLRenderTarget
|
|
10
10
|
} from "three";
|
|
11
|
-
import { array_copy } from "../../../../../../core/collection/array/
|
|
11
|
+
import { array_copy } from "../../../../../../core/collection/array/array_copy.js";
|
|
12
12
|
import { makeQueryShader } from "./QueryShader.js";
|
|
13
13
|
import { renderScreenSpace } from "../../../utils/renderScreenSpace.js";
|
|
14
14
|
import { assert } from "../../../../../../core/assert.js";
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
} from "three";
|
|
20
20
|
import { DrawMode } from "../ecs/mesh-v2/DrawMode.js";
|
|
21
21
|
import { Transform } from "../../ecs/transform/Transform.js";
|
|
22
|
-
import { array_copy } from "../../../core/collection/array/
|
|
22
|
+
import { array_copy } from "../../../core/collection/array/array_copy.js";
|
|
23
23
|
import { SurfacePoint3 } from "../../../core/geom/3d/SurfacePoint3.js";
|
|
24
24
|
import { Light } from "../ecs/light/Light.js";
|
|
25
25
|
import { threeMakeLight } from "../ecs/light/binding/three/threeMakeLight.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { array_copy } from "../../../../core/collection/array/
|
|
1
|
+
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
2
2
|
import { mat4 } from "gl-matrix";
|
|
3
3
|
import { ray3_array_apply_matrix4 } from "../../../../core/geom/3d/ray/ray3_array_apply_matrix4.js";
|
|
4
4
|
import { ray_hit_apply_transform } from "./ray_hit_apply_transform.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "../../../../core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js";
|
|
4
4
|
import { bvh_query_leaves_ray } from "../../../../core/bvh2/bvh3/query/bvh_query_leaves_ray.js";
|
|
5
5
|
import { aabb3_matrix4_project } from "../../../../core/geom/3d/aabb/aabb3_matrix4_project.js";
|
|
6
|
-
import { array_copy } from "../../../../core/collection/array/
|
|
6
|
+
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
7
7
|
import { mat4, vec3 } from "gl-matrix";
|
|
8
8
|
import { ensureGeometryBoundingBox } from "../../util/ensureGeometryBoundingBox.js";
|
|
9
9
|
import { GeometryBVHBatched } from "./GeometryBVHBatched.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
sky_hosek_precompute
|
|
4
4
|
} from "../sky/hosek/sky_hosek_compute_irradiance_by_direction.js";
|
|
5
5
|
import { vec3 } from "gl-matrix";
|
|
6
|
-
import { array_copy } from "../../../../core/collection/array/
|
|
6
|
+
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
7
7
|
import { max2 } from "../../../../core/math/max2.js";
|
|
8
8
|
|
|
9
9
|
export function make_sky_hosek(sun = [0, 1, 0], turbidity = 1, overcast = 0, albedo = [0, 0, 0]) {
|
|
@@ -19,7 +19,7 @@ import { Transform } from "../../ecs/transform/Transform.js";
|
|
|
19
19
|
import Vector3 from "../../../core/geom/Vector3.js";
|
|
20
20
|
import { BinaryBuffer } from "../../../core/binary/BinaryBuffer.js";
|
|
21
21
|
import { is_typed_array_equals } from "../../../core/collection/array/typed/is_typed_array_equals.js";
|
|
22
|
-
import { array_copy } from "../../../core/collection/array/
|
|
22
|
+
import { array_copy } from "../../../core/collection/array/array_copy.js";
|
|
23
23
|
import { randomFloatBetween } from "../../../core/math/random/randomFloatBetween.js";
|
|
24
24
|
import { GLTFAssetLoader } from "../../asset/loaders/GLTFAssetLoader.js";
|
|
25
25
|
import { three_object_to_entity_composition } from "../ecs/mesh-v2/three_object_to_entity_composition.js";
|
|
@@ -92,50 +92,14 @@ export class Sampler2D {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
|
+
* @deprecated
|
|
95
96
|
* @param {number[]} result
|
|
97
|
+
* @param {number} result_offset
|
|
96
98
|
* @param {number} [channel=0]
|
|
99
|
+
* @returns {number} number of matches written to result array
|
|
97
100
|
*/
|
|
98
|
-
computeMinIndices(result, channel = 0) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
assert.typeOf(channel, "number", "channel");
|
|
102
|
-
assert.ok(channel >= 0, `channel must be >= 0, was ${channel}`);
|
|
103
|
-
assert.ok(channel < itemSize, `channel must be less than itemSize(=${itemSize}), was ${channel}`);
|
|
104
|
-
|
|
105
|
-
assert.ok(Array.isArray(result), "result is not an array");
|
|
106
|
-
|
|
107
|
-
const data = this.data;
|
|
108
|
-
|
|
109
|
-
const l = data.length;
|
|
110
|
-
|
|
111
|
-
if (l === 0) {
|
|
112
|
-
//no data
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
let bestValue = data[channel];
|
|
117
|
-
|
|
118
|
-
let resultCount = 0;
|
|
119
|
-
|
|
120
|
-
for (let i = channel + itemSize; i < l; i += itemSize) {
|
|
121
|
-
const value = data[i];
|
|
122
|
-
|
|
123
|
-
if (bestValue > value) {
|
|
124
|
-
bestValue = value;
|
|
125
|
-
//drop result
|
|
126
|
-
resultCount = 1;
|
|
127
|
-
|
|
128
|
-
result[0] = i;
|
|
129
|
-
} else if (value === bestValue) {
|
|
130
|
-
result[resultCount++] = i;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
//crop results
|
|
136
|
-
if (resultCount < result.length) {
|
|
137
|
-
result.splice(resultCount, result.length - resultCount);
|
|
138
|
-
}
|
|
101
|
+
computeMinIndices(result, result_offset = 0, channel = 0) {
|
|
102
|
+
throw new Error("deprecated, use sampler2d_channel_compute_min_indices")
|
|
139
103
|
}
|
|
140
104
|
|
|
141
105
|
/**
|
|
@@ -410,7 +374,7 @@ export class Sampler2D {
|
|
|
410
374
|
*
|
|
411
375
|
* @param {number} x
|
|
412
376
|
* @param {number} y
|
|
413
|
-
* @param {number[]} result
|
|
377
|
+
* @param {number[]|Float32Array|Float64Array} result
|
|
414
378
|
* @param {number} result_offset
|
|
415
379
|
*/
|
|
416
380
|
sampleBilinear(x, y, result, result_offset = 0) {
|
|
@@ -446,6 +410,12 @@ export class Sampler2D {
|
|
|
446
410
|
* @returns {number}
|
|
447
411
|
*/
|
|
448
412
|
sampleChannelBilinear(x, y, channel) {
|
|
413
|
+
assert.isNumber(x, 'x');
|
|
414
|
+
assert.notNaN(x, 'x');
|
|
415
|
+
|
|
416
|
+
assert.isNumber(y, 'y');
|
|
417
|
+
assert.notNaN(y, 'y');
|
|
418
|
+
|
|
449
419
|
assert.isNonNegativeInteger(channel, 'channel');
|
|
450
420
|
|
|
451
421
|
const itemSize = this.itemSize;
|
|
@@ -548,6 +518,7 @@ export class Sampler2D {
|
|
|
548
518
|
assert.isNumber(channel, "channel");
|
|
549
519
|
|
|
550
520
|
assert.isNonNegativeInteger(channel, 'channel');
|
|
521
|
+
assert.lessThanOrEqual(channel, this.itemSize);
|
|
551
522
|
|
|
552
523
|
const index = (y * this.width + x) * this.itemSize + channel;
|
|
553
524
|
|
|
@@ -933,6 +904,7 @@ export class Sampler2D {
|
|
|
933
904
|
|
|
934
905
|
/**
|
|
935
906
|
* Fill data values with zeros for a given area
|
|
907
|
+
* Specialized version of `fill` method, optimized for speed
|
|
936
908
|
* @param {Number} x
|
|
937
909
|
* @param {Number} y
|
|
938
910
|
* @param {Number} width
|
|
@@ -1205,39 +1177,6 @@ export class Sampler2D {
|
|
|
1205
1177
|
throw new Error('Deprecated, use Sampler2DSerializationAdapter instead');
|
|
1206
1178
|
}
|
|
1207
1179
|
|
|
1208
|
-
/**
|
|
1209
|
-
*
|
|
1210
|
-
* @param {number} x
|
|
1211
|
-
* @param {number} y
|
|
1212
|
-
* @param {function(x:number, y:number, value:number, index:number):boolean?} visitor
|
|
1213
|
-
* @param {*} [thisArg]
|
|
1214
|
-
*/
|
|
1215
|
-
traverseOrthogonalNeighbours(x, y, visitor, thisArg) {
|
|
1216
|
-
const width = this.width;
|
|
1217
|
-
const height = this.height;
|
|
1218
|
-
|
|
1219
|
-
const index = this.point2index(x, y);
|
|
1220
|
-
|
|
1221
|
-
let i = 0;
|
|
1222
|
-
const data = this.data;
|
|
1223
|
-
if (x > 0) {
|
|
1224
|
-
i = index - 1;
|
|
1225
|
-
visitor.call(thisArg, x - 1, y, data[i], i);
|
|
1226
|
-
}
|
|
1227
|
-
if (x < width - 1) {
|
|
1228
|
-
i = index + 1;
|
|
1229
|
-
visitor.call(thisArg, x + 1, y, data[i], i);
|
|
1230
|
-
}
|
|
1231
|
-
if (y > 0) {
|
|
1232
|
-
i = index - width;
|
|
1233
|
-
visitor.call(thisArg, x, y - 1, data[i], i);
|
|
1234
|
-
}
|
|
1235
|
-
if (y < height - 1) {
|
|
1236
|
-
i = index + width;
|
|
1237
|
-
visitor.call(thisArg, x, y + 1, data[i], i);
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
1180
|
/**
|
|
1242
1181
|
*
|
|
1243
1182
|
* @param {Sampler2D} other
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @see https://github.com/hughsk/bicubic/blob/master/index.js
|
|
3
|
-
* @param xf
|
|
4
|
-
* @param yf
|
|
5
|
-
* @param p00
|
|
6
|
-
* @param p01
|
|
7
|
-
* @param p02
|
|
8
|
-
* @param p03
|
|
9
|
-
* @param p10
|
|
10
|
-
* @param p11
|
|
11
|
-
* @param p12
|
|
12
|
-
* @param p13
|
|
13
|
-
* @param p20
|
|
14
|
-
* @param p21
|
|
15
|
-
* @param p22
|
|
16
|
-
* @param p23
|
|
17
|
-
* @param p30
|
|
18
|
-
* @param p31
|
|
19
|
-
* @param p32
|
|
20
|
-
* @param p33
|
|
21
|
-
* @returns {
|
|
3
|
+
* @param {number} xf
|
|
4
|
+
* @param {number} yf
|
|
5
|
+
* @param {number} p00
|
|
6
|
+
* @param {number} p01
|
|
7
|
+
* @param {number} p02
|
|
8
|
+
* @param {number} p03
|
|
9
|
+
* @param {number} p10
|
|
10
|
+
* @param {number} p11
|
|
11
|
+
* @param {number} p12
|
|
12
|
+
* @param {number} p13
|
|
13
|
+
* @param {number} p20
|
|
14
|
+
* @param {number} p21
|
|
15
|
+
* @param {number} p22
|
|
16
|
+
* @param {number} p23
|
|
17
|
+
* @param {number} p30
|
|
18
|
+
* @param {number} p31
|
|
19
|
+
* @param {number} p32
|
|
20
|
+
* @param {number} p33
|
|
21
|
+
* @returns {number}
|
|
22
22
|
*/
|
|
23
23
|
export function bicubic(
|
|
24
24
|
xf, yf
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { convertSampler2D2DataURL } from "./convertSampler2D2DataURL.js";
|
|
2
|
+
import { Sampler2D } from "./Sampler2D.js";
|
|
3
|
+
|
|
4
|
+
// currently does not run in Node.js context due to reliance on HTMLCanvasElement that is absent in Node.js
|
|
5
|
+
test.skip("result is a data URL", () => {
|
|
6
|
+
const result = convertSampler2D2DataURL(Sampler2D.uint8(4, 1, 1));
|
|
7
|
+
|
|
8
|
+
expect(typeof result).toBe('string');
|
|
9
|
+
expect(result.startsWith("data://")).toBe(true);
|
|
10
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { copy_Sampler2D_channel_data } from "./copy_Sampler2D_channel_data.js";
|
|
2
|
+
import { Sampler2D } from "./Sampler2D.js";
|
|
3
|
+
|
|
4
|
+
test("should throw when dimensions do not match", () => {
|
|
5
|
+
expect(() => copy_Sampler2D_channel_data(
|
|
6
|
+
Sampler2D.uint8(1, 1, 1),
|
|
7
|
+
Sampler2D.uint8(1, 2, 1),
|
|
8
|
+
)).toThrow();
|
|
9
|
+
|
|
10
|
+
expect(() => copy_Sampler2D_channel_data(
|
|
11
|
+
Sampler2D.uint8(1, 2, 1),
|
|
12
|
+
Sampler2D.uint8(1, 1, 1),
|
|
13
|
+
)).toThrow();
|
|
14
|
+
|
|
15
|
+
expect(() => copy_Sampler2D_channel_data(
|
|
16
|
+
Sampler2D.uint8(1, 1, 2),
|
|
17
|
+
Sampler2D.uint8(1, 1, 1),
|
|
18
|
+
)).toThrow();
|
|
19
|
+
|
|
20
|
+
expect(() => copy_Sampler2D_channel_data(
|
|
21
|
+
Sampler2D.uint8(1, 1, 1),
|
|
22
|
+
Sampler2D.uint8(1, 1, 2),
|
|
23
|
+
)).toThrow();
|
|
24
|
+
|
|
25
|
+
expect(() => copy_Sampler2D_channel_data(
|
|
26
|
+
Sampler2D.uint8(1, 2, 2),
|
|
27
|
+
Sampler2D.uint8(1, 1, 1),
|
|
28
|
+
)).toThrow();
|
|
29
|
+
|
|
30
|
+
expect(() => copy_Sampler2D_channel_data(
|
|
31
|
+
Sampler2D.uint8(1, 1, 1),
|
|
32
|
+
Sampler2D.uint8(1, 2, 2),
|
|
33
|
+
)).toThrow();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test("channel counts match", () => {
|
|
37
|
+
const source = Sampler2D.uint8(1, 1, 1);
|
|
38
|
+
source.writeChannel(0, 0, 0, 7);
|
|
39
|
+
|
|
40
|
+
const target = Sampler2D.uint8(1, 1, 1);
|
|
41
|
+
|
|
42
|
+
copy_Sampler2D_channel_data(source, target);
|
|
43
|
+
|
|
44
|
+
expect(target.readChannel(0, 0, 0)).toEqual(7);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("from 2 channels to 1", () => {
|
|
48
|
+
|
|
49
|
+
const source = Sampler2D.uint8(2, 1, 1);
|
|
50
|
+
source.writeChannel(0, 0, 0, 7);
|
|
51
|
+
source.writeChannel(0, 0, 1, 13);
|
|
52
|
+
|
|
53
|
+
const target = Sampler2D.uint8(1, 1, 1);
|
|
54
|
+
|
|
55
|
+
copy_Sampler2D_channel_data(source, target);
|
|
56
|
+
|
|
57
|
+
expect(target.readChannel(0, 0, 0)).toEqual(7);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test("from 3 channels to 4", () => {
|
|
61
|
+
|
|
62
|
+
const source = Sampler2D.uint8(3, 1, 1);
|
|
63
|
+
source.set(0, 0, [3, 7, 13]);
|
|
64
|
+
|
|
65
|
+
const target = Sampler2D.uint8(4, 1, 1);
|
|
66
|
+
|
|
67
|
+
copy_Sampler2D_channel_data(source, target);
|
|
68
|
+
|
|
69
|
+
const sample = [];
|
|
70
|
+
|
|
71
|
+
target.read(0, 0, sample);
|
|
72
|
+
|
|
73
|
+
expect(sample).toEqual([3, 7, 13, 255]);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test("from 2 channels to 4", () => {
|
|
77
|
+
|
|
78
|
+
const source = Sampler2D.uint8(2, 1, 1);
|
|
79
|
+
source.set(0, 0, [3, 7]);
|
|
80
|
+
|
|
81
|
+
const target = Sampler2D.uint8(4, 1, 1);
|
|
82
|
+
|
|
83
|
+
copy_Sampler2D_channel_data(source, target);
|
|
84
|
+
|
|
85
|
+
const sample = [];
|
|
86
|
+
|
|
87
|
+
target.read(0, 0, sample);
|
|
88
|
+
|
|
89
|
+
expect(sample).toEqual([3, 3, 3, 7]);
|
|
90
|
+
});
|