@woosh/meep-engine 2.75.8 → 2.76.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/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +784 -982
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +784 -982
- package/editor/actions/concrete/ModifyPatchSampler2DAction.js +6 -3
- package/editor/actions/concrete/PatchTerrainTextureAction.js +6 -3
- package/editor/process/EditorProcess.js +12 -16
- package/editor/process/ProcessEngine.js +9 -10
- package/package.json +1 -1
- package/src/core/binary/dec2hex.js +1 -1
- package/src/{engine/ecs/ik/IKMath.js → core/geom/vec3/v3_computeOffsetVector.js} +1 -1
- package/src/core/math/newton_solver_1d.js +13 -4
- package/src/{engine/graphics → core/math/random}/generate_halton_jitter.js +2 -2
- package/src/core/math/solveQuadratic.js +5 -3
- package/src/core/math/spline/catmull_rom_compute_T.js +19 -0
- package/src/{engine/navigation/ecs/components → core/math/spline}/computeCatmullRomSpline.js +3 -3
- package/src/{engine/navigation/ecs/components → core/math/spline}/computeCatmullRomSplineUniformDistance.js +3 -3
- package/src/core/math/spline/computeNonuniformCatmullRomSplineSample.js +109 -0
- package/src/core/math/spline/interpolate_bicubic.js +12 -0
- package/src/core/math/spline/spline_catmullrom_1d.js +120 -0
- package/src/engine/control/ControlContext.js +25 -27
- package/src/engine/ecs/EntityManager.js +12 -9
- package/src/engine/ecs/EntityObserver.js +26 -22
- package/src/engine/ecs/binding/ComponentPropertyPath.js +12 -12
- package/src/engine/ecs/components/Motion.js +5 -7
- package/src/engine/ecs/components/SerializationMetadata.js +5 -3
- package/src/engine/ecs/dynamic_actions/actions/definition/AbstractActionDescription.js +0 -2
- package/src/engine/ecs/dynamic_actions/actions/definition/ActionSequenceDescription.js +7 -9
- package/src/engine/ecs/dynamic_actions/actions/definition/DelayActionDescription.js +3 -5
- package/src/engine/ecs/dynamic_actions/actions/definition/SendRequestActionDescription.js +6 -8
- package/src/engine/ecs/dynamic_actions/actions/definition/SpeakLineActionDescription.js +14 -17
- package/src/engine/ecs/dynamic_actions/actions/definition/WeightedRandomActionDescription.js +8 -11
- package/src/engine/ecs/dynamic_actions/actions/definition/WriteToBlackboardActionDescription.js +15 -18
- package/src/engine/ecs/ik/OneBoneSurfaceAlignmentSolver.js +7 -7
- package/src/engine/ecs/ik/TwoBoneInverseKinematicsSolver.js +6 -6
- package/src/engine/ecs/parent/EntityNode.js +39 -37
- package/src/engine/ecs/speaker/VoiceSystem.js +36 -39
- package/src/engine/ecs/system/SystemEntityContext.js +25 -23
- package/src/engine/ecs/tag/find_entities_with_tag.js +18 -0
- package/src/engine/ecs/terrain/TerrainClouds.js +23 -24
- package/src/engine/ecs/terrain/ecs/splat/SplatMapMaterialPatch.js +5 -2
- package/src/engine/ecs/terrain/overlay/TerrainOverlay.js +15 -14
- package/src/engine/ecs/tooltip/TooltipComponent.js +6 -7
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +0 -4
- package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +1 -5
- package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +2 -6
- package/src/engine/graphics/ecs/water2/shader/testWaterShader.js +12 -14
- package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +22 -20
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +3 -4
- package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +0 -4
- package/src/engine/graphics/render/buffer/simple-fx/taa/TemporalSupersamplingRenderPlugin.js +1 -1
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +0 -4
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +0 -4
- package/src/engine/graphics/shadows/testShadowMapRendering.js +0 -2
- package/src/engine/graphics/texture/atlas/TextureAtlas.js +13 -11
- package/src/engine/graphics/texture/sampler/Sampler2D.js +15 -366
- package/src/engine/graphics/texture/sampler/Sampler2D.spec.js +0 -31
- package/src/engine/graphics/texture/sampler/sampler2d_copy_with_margins.js +166 -0
- package/src/engine/graphics/texture/sampler/sampler2d_copy_with_margins.spec.js +31 -0
- package/src/engine/graphics/texture/sampler/sampler2d_paint.js +81 -0
- package/src/engine/graphics/texture/sampler/sampler2d_sub_copy_same_item_size.js +50 -0
- package/src/engine/graphics/texture/virtual/VirtualTextureUsageUpdater.js +1 -1
- package/src/engine/navigation/ecs/components/Path.js +10 -9
- package/src/engine/physics/computeInterceptPoint.js +44 -0
- package/src/engine/plugin/EnginePlugin.js +1 -2
- package/src/engine/ecs/components/AlignToVelocity.js +0 -9
- package/src/engine/ecs/components/CharacterController.js +0 -31
- package/src/engine/ecs/components/PhysicalBody.js +0 -51
- package/src/engine/ecs/components/Steering.js +0 -111
- package/src/engine/ecs/components/SteeringSerializationAdapter.js +0 -34
- package/src/engine/ecs/systems/AlignToVelocitySystem.js +0 -51
- package/src/engine/ecs/systems/CharacterControlSystem.js +0 -134
- package/src/engine/ecs/systems/PhysicsSystem.js +0 -89
- package/src/engine/ecs/systems/PropertySetSystem.js +0 -18
- package/src/engine/ecs/systems/SteeringSystem.js +0 -171
- package/src/engine/ecs/systems/TagSystem.d.ts +0 -5
- package/src/engine/ecs/systems/TagSystem.js +0 -31
- package/src/engine/graphics/CanvasBlur.js +0 -599
- package/src/engine/graphics/material/LoadMaterial.js +0 -199
- package/src/engine/graphics/material/getTextureImmediate.js +0 -21
- package/src/engine/graphics/render/buffer/RenderGraph.js +0 -177
- package/src/engine/graphics/render/buffer/RenderGraphUtils.js +0 -32
- package/src/engine/graphics/render/buffer/buffers/DepthFrameBuffer.js +0 -101
- package/src/engine/graphics/render/buffer/conection/ProgramValueSlotConnection.js +0 -43
- package/src/engine/graphics/render/buffer/conection/ProgramValueSlotConnectionEndpoint.js +0 -39
- package/src/engine/graphics/render/buffer/conection/ProgramValueSlotConnectionValidator.js +0 -30
- package/src/engine/graphics/render/buffer/executor/FrameBufferPool.js +0 -127
- package/src/engine/graphics/render/buffer/executor/RenderGraphExecutor.js +0 -261
- package/src/engine/graphics/render/buffer/executor/RenderProgramCommandType.js +0 -5
- package/src/engine/graphics/render/buffer/node/DeferredRenderProgramDefinition.js +0 -142
- package/src/engine/graphics/render/buffer/node/RenderProgramDefinition.js +0 -21
- package/src/engine/graphics/render/buffer/node/RenderProgramInstance.js +0 -30
- package/src/engine/graphics/render/buffer/node/ScreenSpaceRenderProgramDefinition.js +0 -118
- package/src/engine/graphics/render/staged/PostProcessingEffect.js +0 -32
- package/src/engine/graphics/render/staged/PostProcessingEffectInputCoupling.js +0 -41
- package/src/engine/graphics/render/staged/PostProcessingStack.js +0 -29
- package/src/engine/graphics/render/staged/StagedRenderer.js +0 -161
- package/src/engine/graphics/render/staged/StandardRenderOutputs.js +0 -20
- package/src/engine/graphics/texture/CanvasClone.js +0 -28
- package/src/engine/graphics/texture/sampler/bicubic.js +0 -59
- package/src/engine/graphics/texture/sampler/bicubic.spec.js +0 -13
- package/src/engine/graphics/texture/sampler/differenceSampler.js +0 -36
- package/src/engine/graphics/texture/sampler/loadSampler2D.js +0 -41
- package/src/engine/graphics/texture/sampler/mergeSampler2D.js +0 -96
- package/src/engine/graphics/texture/sampler/rgbaData2valueSampler2D.js +0 -38
- package/src/engine/navigation/ecs/components/computeNonuniformCatmullRomSplineSample.js +0 -242
- /package/src/{engine/graphics/texture → core/math/noise}/noise_octaves.js +0 -0
package/build/meep.cjs
CHANGED
|
@@ -49637,137 +49637,6 @@ const TerrainShader = {
|
|
|
49637
49637
|
fragmentShader: fragment$2()
|
|
49638
49638
|
};
|
|
49639
49639
|
|
|
49640
|
-
/**
|
|
49641
|
-
*
|
|
49642
|
-
* Produces a proportional mix of 2 values, a*(1-portion) + b*portion
|
|
49643
|
-
* Same as lerp
|
|
49644
|
-
*/
|
|
49645
|
-
const mix = lerp$1;
|
|
49646
|
-
|
|
49647
|
-
/**
|
|
49648
|
-
* Color blending modes
|
|
49649
|
-
* @enum {number}
|
|
49650
|
-
*/
|
|
49651
|
-
const BlendingType = {
|
|
49652
|
-
NoBlending: 5,
|
|
49653
|
-
Normal: 0,
|
|
49654
|
-
Add: 1,
|
|
49655
|
-
Subtract: 2,
|
|
49656
|
-
Multiply: 3,
|
|
49657
|
-
MultiplyAdd: 4
|
|
49658
|
-
};
|
|
49659
|
-
|
|
49660
|
-
function typedArrayConstructorByInstance(a) {
|
|
49661
|
-
if (a instanceof Int8Array) {
|
|
49662
|
-
return Int8Array;
|
|
49663
|
-
} else if (a instanceof Int16Array) {
|
|
49664
|
-
return Int16Array;
|
|
49665
|
-
} else if (a instanceof Int32Array) {
|
|
49666
|
-
return Int32Array;
|
|
49667
|
-
} else if (a instanceof Uint8Array) {
|
|
49668
|
-
return Uint8Array;
|
|
49669
|
-
} else if (a instanceof Uint8ClampedArray) {
|
|
49670
|
-
return Uint8ClampedArray;
|
|
49671
|
-
} else if (a instanceof Uint16Array) {
|
|
49672
|
-
return Uint16Array;
|
|
49673
|
-
} else if (a instanceof Uint32Array) {
|
|
49674
|
-
return Uint32Array;
|
|
49675
|
-
} else if (a instanceof Float32Array) {
|
|
49676
|
-
return Float32Array;
|
|
49677
|
-
} else if (a instanceof Float64Array) {
|
|
49678
|
-
return Float64Array;
|
|
49679
|
-
} else if (Array.isArray(a)) {
|
|
49680
|
-
return Array;
|
|
49681
|
-
} else {
|
|
49682
|
-
throw new TypeError(`Unsupported array type`);
|
|
49683
|
-
}
|
|
49684
|
-
}
|
|
49685
|
-
|
|
49686
|
-
/**
|
|
49687
|
-
* @readonly
|
|
49688
|
-
* @enum {string}
|
|
49689
|
-
*/
|
|
49690
|
-
const BinaryDataType = {
|
|
49691
|
-
Uint8: "uint8",
|
|
49692
|
-
Uint16: "uint16",
|
|
49693
|
-
Uint32: "uint32",
|
|
49694
|
-
Uint64: "uint64",
|
|
49695
|
-
|
|
49696
|
-
Int8: "int8",
|
|
49697
|
-
Int16: "int16",
|
|
49698
|
-
Int32: "int32",
|
|
49699
|
-
Int64: "int64",
|
|
49700
|
-
|
|
49701
|
-
Float16: 'float16',
|
|
49702
|
-
Float32: "float32",
|
|
49703
|
-
Float64: "float64"
|
|
49704
|
-
};
|
|
49705
|
-
|
|
49706
|
-
/**
|
|
49707
|
-
*
|
|
49708
|
-
* @param {*} v
|
|
49709
|
-
* @returns {BinaryDataType}
|
|
49710
|
-
*/
|
|
49711
|
-
function typedArrayToDataType(v) {
|
|
49712
|
-
const ctor = Object.getPrototypeOf(v).constructor;
|
|
49713
|
-
|
|
49714
|
-
switch (ctor) {
|
|
49715
|
-
case Uint8Array:
|
|
49716
|
-
case Uint8ClampedArray:
|
|
49717
|
-
return BinaryDataType.Uint8;
|
|
49718
|
-
case Uint16Array:
|
|
49719
|
-
return BinaryDataType.Uint16;
|
|
49720
|
-
case Uint32Array:
|
|
49721
|
-
return BinaryDataType.Uint32;
|
|
49722
|
-
|
|
49723
|
-
case Int8Array:
|
|
49724
|
-
return BinaryDataType.Int8;
|
|
49725
|
-
case Int16Array:
|
|
49726
|
-
return BinaryDataType.Int16;
|
|
49727
|
-
case Int32Array:
|
|
49728
|
-
return BinaryDataType.Int32;
|
|
49729
|
-
|
|
49730
|
-
case Float32Array:
|
|
49731
|
-
return BinaryDataType.Float32;
|
|
49732
|
-
case Float64Array:
|
|
49733
|
-
return BinaryDataType.Float64;
|
|
49734
|
-
default:
|
|
49735
|
-
throw new Error('unsupported constructor type');
|
|
49736
|
-
}
|
|
49737
|
-
}
|
|
49738
|
-
|
|
49739
|
-
/**
|
|
49740
|
-
* Mapping from {@DataType} to TypedArray constructors
|
|
49741
|
-
* @enum {function}
|
|
49742
|
-
*/
|
|
49743
|
-
const DataType2TypedArrayConstructorMapping = {
|
|
49744
|
-
[BinaryDataType.Uint8]: Uint8Array,
|
|
49745
|
-
[BinaryDataType.Uint16]: Uint16Array,
|
|
49746
|
-
[BinaryDataType.Uint32]: Uint32Array,
|
|
49747
|
-
[BinaryDataType.Int8]: Int8Array,
|
|
49748
|
-
[BinaryDataType.Int16]: Int16Array,
|
|
49749
|
-
[BinaryDataType.Int32]: Int32Array,
|
|
49750
|
-
// No float16 array type, using uint16 as a backing instead
|
|
49751
|
-
[BinaryDataType.Float16]: Uint16Array,
|
|
49752
|
-
[BinaryDataType.Float32]: Float32Array,
|
|
49753
|
-
[BinaryDataType.Float64]: Float64Array,
|
|
49754
|
-
};
|
|
49755
|
-
|
|
49756
|
-
/**
|
|
49757
|
-
*
|
|
49758
|
-
* @param {BinaryDataType} dt
|
|
49759
|
-
* @returns {constructor|function}
|
|
49760
|
-
*/
|
|
49761
|
-
function compute_typed_array_constructor_from_data_type(dt) {
|
|
49762
|
-
const r = DataType2TypedArrayConstructorMapping[dt];
|
|
49763
|
-
|
|
49764
|
-
if (r === undefined) {
|
|
49765
|
-
throw new Error(`Unsupported data type '${dt}'`);
|
|
49766
|
-
}
|
|
49767
|
-
|
|
49768
|
-
return r;
|
|
49769
|
-
}
|
|
49770
|
-
|
|
49771
49640
|
/**
|
|
49772
49641
|
* Adapted from https://github.com/beatgammit/base64-js
|
|
49773
49642
|
* @author Jameson Little
|
|
@@ -49980,25 +49849,55 @@ class Base64 {
|
|
|
49980
49849
|
}
|
|
49981
49850
|
|
|
49982
49851
|
/**
|
|
49983
|
-
*
|
|
49984
|
-
* @
|
|
49985
|
-
* @param {number} offset
|
|
49986
|
-
* @param {number} length
|
|
49987
|
-
* @param {number} stride
|
|
49988
|
-
* @return {number}
|
|
49852
|
+
* @readonly
|
|
49853
|
+
* @enum {string}
|
|
49989
49854
|
*/
|
|
49990
|
-
|
|
49991
|
-
|
|
49992
|
-
|
|
49993
|
-
|
|
49855
|
+
const BinaryDataType = {
|
|
49856
|
+
Uint8: "uint8",
|
|
49857
|
+
Uint16: "uint16",
|
|
49858
|
+
Uint32: "uint32",
|
|
49859
|
+
Uint64: "uint64",
|
|
49994
49860
|
|
|
49995
|
-
|
|
49996
|
-
|
|
49861
|
+
Int8: "int8",
|
|
49862
|
+
Int16: "int16",
|
|
49863
|
+
Int32: "int32",
|
|
49864
|
+
Int64: "int64",
|
|
49997
49865
|
|
|
49998
|
-
|
|
49866
|
+
Float16: 'float16',
|
|
49867
|
+
Float32: "float32",
|
|
49868
|
+
Float64: "float64"
|
|
49869
|
+
};
|
|
49870
|
+
|
|
49871
|
+
/**
|
|
49872
|
+
* Mapping from {@DataType} to TypedArray constructors
|
|
49873
|
+
* @enum {function}
|
|
49874
|
+
*/
|
|
49875
|
+
const DataType2TypedArrayConstructorMapping = {
|
|
49876
|
+
[BinaryDataType.Uint8]: Uint8Array,
|
|
49877
|
+
[BinaryDataType.Uint16]: Uint16Array,
|
|
49878
|
+
[BinaryDataType.Uint32]: Uint32Array,
|
|
49879
|
+
[BinaryDataType.Int8]: Int8Array,
|
|
49880
|
+
[BinaryDataType.Int16]: Int16Array,
|
|
49881
|
+
[BinaryDataType.Int32]: Int32Array,
|
|
49882
|
+
// No float16 array type, using uint16 as a backing instead
|
|
49883
|
+
[BinaryDataType.Float16]: Uint16Array,
|
|
49884
|
+
[BinaryDataType.Float32]: Float32Array,
|
|
49885
|
+
[BinaryDataType.Float64]: Float64Array,
|
|
49886
|
+
};
|
|
49887
|
+
|
|
49888
|
+
/**
|
|
49889
|
+
*
|
|
49890
|
+
* @param {BinaryDataType} dt
|
|
49891
|
+
* @returns {constructor|function}
|
|
49892
|
+
*/
|
|
49893
|
+
function compute_typed_array_constructor_from_data_type(dt) {
|
|
49894
|
+
const r = DataType2TypedArrayConstructorMapping[dt];
|
|
49895
|
+
|
|
49896
|
+
if (r === undefined) {
|
|
49897
|
+
throw new Error(`Unsupported data type '${dt}'`);
|
|
49999
49898
|
}
|
|
50000
49899
|
|
|
50001
|
-
return
|
|
49900
|
+
return r;
|
|
50002
49901
|
}
|
|
50003
49902
|
|
|
50004
49903
|
//
|
|
@@ -50068,6 +49967,107 @@ function is_typed_array_equals(a, b) {
|
|
|
50068
49967
|
return isArrayEqualStrict(a_proxy, b_proxy);
|
|
50069
49968
|
}
|
|
50070
49969
|
|
|
49970
|
+
/**
|
|
49971
|
+
*
|
|
49972
|
+
* @param {*} v
|
|
49973
|
+
* @returns {BinaryDataType}
|
|
49974
|
+
*/
|
|
49975
|
+
function typedArrayToDataType(v) {
|
|
49976
|
+
const ctor = Object.getPrototypeOf(v).constructor;
|
|
49977
|
+
|
|
49978
|
+
switch (ctor) {
|
|
49979
|
+
case Uint8Array:
|
|
49980
|
+
case Uint8ClampedArray:
|
|
49981
|
+
return BinaryDataType.Uint8;
|
|
49982
|
+
case Uint16Array:
|
|
49983
|
+
return BinaryDataType.Uint16;
|
|
49984
|
+
case Uint32Array:
|
|
49985
|
+
return BinaryDataType.Uint32;
|
|
49986
|
+
|
|
49987
|
+
case Int8Array:
|
|
49988
|
+
return BinaryDataType.Int8;
|
|
49989
|
+
case Int16Array:
|
|
49990
|
+
return BinaryDataType.Int16;
|
|
49991
|
+
case Int32Array:
|
|
49992
|
+
return BinaryDataType.Int32;
|
|
49993
|
+
|
|
49994
|
+
case Float32Array:
|
|
49995
|
+
return BinaryDataType.Float32;
|
|
49996
|
+
case Float64Array:
|
|
49997
|
+
return BinaryDataType.Float64;
|
|
49998
|
+
default:
|
|
49999
|
+
throw new Error('unsupported constructor type');
|
|
50000
|
+
}
|
|
50001
|
+
}
|
|
50002
|
+
|
|
50003
|
+
/**
|
|
50004
|
+
*
|
|
50005
|
+
* Produces a proportional mix of 2 values, a*(1-portion) + b*portion
|
|
50006
|
+
* Same as lerp
|
|
50007
|
+
*/
|
|
50008
|
+
const mix = lerp$1;
|
|
50009
|
+
|
|
50010
|
+
/**
|
|
50011
|
+
* Based on code from reddit https://www.reddit.com/r/javascript/comments/jxa8x/bicubic_interpolation/
|
|
50012
|
+
* @param {number} t ratio
|
|
50013
|
+
* @param {number} a position -2
|
|
50014
|
+
* @param {number} b position -1
|
|
50015
|
+
* @param {number} c position +1
|
|
50016
|
+
* @param {number} d position +2
|
|
50017
|
+
* @returns {number}
|
|
50018
|
+
*/
|
|
50019
|
+
function interpolate_bicubic(t, a, b, c, d) {
|
|
50020
|
+
return 0.5 * (c - a + (2.0 * a - 5.0 * b + 4.0 * c - d + (3.0 * (b - c) + d - a) * t) * t) * t + b;
|
|
50021
|
+
}
|
|
50022
|
+
|
|
50023
|
+
/**
|
|
50024
|
+
* Useful for computing hashes of large arrays, can pick a relevant stride and skip large chunks of memory while still capturing good amount of unique information from evenly-spaced areas of the array
|
|
50025
|
+
* @param {number[]|Uint32Array|Uint16Array|Uint8Array} array
|
|
50026
|
+
* @param {number} offset
|
|
50027
|
+
* @param {number} length
|
|
50028
|
+
* @param {number} stride
|
|
50029
|
+
* @return {number}
|
|
50030
|
+
*/
|
|
50031
|
+
function computeStridedIntegerArrayHash(
|
|
50032
|
+
array, offset, length, stride
|
|
50033
|
+
) {
|
|
50034
|
+
let result = length;
|
|
50035
|
+
|
|
50036
|
+
for (let i = offset; i < length; i += stride) {
|
|
50037
|
+
const value = array[i];
|
|
50038
|
+
|
|
50039
|
+
result = ((result * 31) + value) | 0;
|
|
50040
|
+
}
|
|
50041
|
+
|
|
50042
|
+
return result;
|
|
50043
|
+
}
|
|
50044
|
+
|
|
50045
|
+
function typedArrayConstructorByInstance(a) {
|
|
50046
|
+
if (a instanceof Int8Array) {
|
|
50047
|
+
return Int8Array;
|
|
50048
|
+
} else if (a instanceof Int16Array) {
|
|
50049
|
+
return Int16Array;
|
|
50050
|
+
} else if (a instanceof Int32Array) {
|
|
50051
|
+
return Int32Array;
|
|
50052
|
+
} else if (a instanceof Uint8Array) {
|
|
50053
|
+
return Uint8Array;
|
|
50054
|
+
} else if (a instanceof Uint8ClampedArray) {
|
|
50055
|
+
return Uint8ClampedArray;
|
|
50056
|
+
} else if (a instanceof Uint16Array) {
|
|
50057
|
+
return Uint16Array;
|
|
50058
|
+
} else if (a instanceof Uint32Array) {
|
|
50059
|
+
return Uint32Array;
|
|
50060
|
+
} else if (a instanceof Float32Array) {
|
|
50061
|
+
return Float32Array;
|
|
50062
|
+
} else if (a instanceof Float64Array) {
|
|
50063
|
+
return Float64Array;
|
|
50064
|
+
} else if (Array.isArray(a)) {
|
|
50065
|
+
return Array;
|
|
50066
|
+
} else {
|
|
50067
|
+
throw new TypeError(`Unsupported array type`);
|
|
50068
|
+
}
|
|
50069
|
+
}
|
|
50070
|
+
|
|
50071
50071
|
/**
|
|
50072
50072
|
* Created by Alex on 11/11/2014.
|
|
50073
50073
|
*/
|
|
@@ -50136,35 +50136,6 @@ class Sampler2D {
|
|
|
50136
50136
|
this.version = 0;
|
|
50137
50137
|
}
|
|
50138
50138
|
|
|
50139
|
-
/**
|
|
50140
|
-
* @deprecated
|
|
50141
|
-
* @param {number} [channel=0]
|
|
50142
|
-
* @returns {{x: number, index: number, y: number, value: number}}
|
|
50143
|
-
*/
|
|
50144
|
-
computeMax(channel = 0) {
|
|
50145
|
-
throw new Error("deprecated, use sampler2d_channel_compute_max");
|
|
50146
|
-
}
|
|
50147
|
-
|
|
50148
|
-
/**
|
|
50149
|
-
* @deprecated
|
|
50150
|
-
* @param {number[]} result
|
|
50151
|
-
* @param {number} result_offset
|
|
50152
|
-
* @param {number} [channel=0]
|
|
50153
|
-
* @returns {number} number of matches written to result array
|
|
50154
|
-
*/
|
|
50155
|
-
computeMinIndices(result, result_offset = 0, channel = 0) {
|
|
50156
|
-
throw new Error("deprecated, use sampler2d_channel_compute_min_indices")
|
|
50157
|
-
}
|
|
50158
|
-
|
|
50159
|
-
/**
|
|
50160
|
-
* @deprecated
|
|
50161
|
-
* @param {number} [channel=0]
|
|
50162
|
-
* @returns {{x: number, index: number, y: number, value: number}}
|
|
50163
|
-
*/
|
|
50164
|
-
computeMin(channel = 0) {
|
|
50165
|
-
throw new Error("deprecated, use sampler2d_channel_compute_min");
|
|
50166
|
-
}
|
|
50167
|
-
|
|
50168
50139
|
/**
|
|
50169
50140
|
*
|
|
50170
50141
|
* @deprecated
|
|
@@ -50174,18 +50145,7 @@ class Sampler2D {
|
|
|
50174
50145
|
* @returns {number}
|
|
50175
50146
|
*/
|
|
50176
50147
|
get(x, y, result) {
|
|
50177
|
-
|
|
50178
|
-
|
|
50179
|
-
const t = [];
|
|
50180
|
-
|
|
50181
|
-
this.sampleBilinear(x, y, t, 0);
|
|
50182
|
-
|
|
50183
|
-
if (result !== undefined) {
|
|
50184
|
-
result.readFromArray(t, 0);
|
|
50185
|
-
return result;
|
|
50186
|
-
} else {
|
|
50187
|
-
return t[0];
|
|
50188
|
-
}
|
|
50148
|
+
throw new Error("Deprecated method, use sampleBilinear instead");
|
|
50189
50149
|
}
|
|
50190
50150
|
|
|
50191
50151
|
/**
|
|
@@ -50388,23 +50348,14 @@ class Sampler2D {
|
|
|
50388
50348
|
const vl2 = data[row3_address + col2_offset];
|
|
50389
50349
|
const vl3 = data[row3_address + col3_offset];
|
|
50390
50350
|
|
|
50391
|
-
|
|
50392
|
-
// return bicubic(xd, yd,
|
|
50393
|
-
// vi0, vi1, vi2, vi3,
|
|
50394
|
-
// vj0, vj1, vj2, vj3,
|
|
50395
|
-
// vk0, vk1, vk2, vk3,
|
|
50396
|
-
// vl0, vl1, vl2, vl3,
|
|
50397
|
-
// );
|
|
50398
|
-
|
|
50399
|
-
|
|
50400
50351
|
// perform filtering in X (rows)
|
|
50401
|
-
const s0 =
|
|
50402
|
-
const s1 =
|
|
50403
|
-
const s2 =
|
|
50404
|
-
const s3 =
|
|
50352
|
+
const s0 = interpolate_bicubic(xd, vi0, vi1, vi2, vi3);
|
|
50353
|
+
const s1 = interpolate_bicubic(xd, vj0, vj1, vj2, vj3);
|
|
50354
|
+
const s2 = interpolate_bicubic(xd, vk0, vk1, vk2, vk3);
|
|
50355
|
+
const s3 = interpolate_bicubic(xd, vl0, vl1, vl2, vl3);
|
|
50405
50356
|
|
|
50406
50357
|
// filter in Y (columns)
|
|
50407
|
-
return
|
|
50358
|
+
return interpolate_bicubic(yd, s0, s1, s2, s3);
|
|
50408
50359
|
}
|
|
50409
50360
|
|
|
50410
50361
|
/**
|
|
@@ -50643,162 +50594,6 @@ class Sampler2D {
|
|
|
50643
50594
|
result.set(x, y);
|
|
50644
50595
|
}
|
|
50645
50596
|
|
|
50646
|
-
/**
|
|
50647
|
-
* Copy a patch from another sampler with a margin.
|
|
50648
|
-
* This is useful for texture rendering where filtering can cause bleeding along the edges of the patch.
|
|
50649
|
-
* @param {Sampler2D} source where to copy from
|
|
50650
|
-
* @param {Number} sourceX where to start reading from, X coordinate
|
|
50651
|
-
* @param {Number} sourceY where to start reading from, X coordinate
|
|
50652
|
-
* @param {Number} destinationX where to start writing to, X coordinate
|
|
50653
|
-
* @param {Number} destinationY where to start writing to, X coordinate
|
|
50654
|
-
* @param {Number} width size of the patch that is to be copied
|
|
50655
|
-
* @param {Number} height size of the patch that is to be copied
|
|
50656
|
-
* @param {Number} marginLeft
|
|
50657
|
-
* @param {Number} marginRight
|
|
50658
|
-
* @param {Number} marginTop
|
|
50659
|
-
* @param {Number} marginBottom
|
|
50660
|
-
*/
|
|
50661
|
-
copyWithMargin(source, sourceX, sourceY, destinationX, destinationY, width, height, marginLeft, marginRight, marginTop, marginBottom) {
|
|
50662
|
-
const dItemSize = this.itemSize;
|
|
50663
|
-
const sItemSize = source.itemSize;
|
|
50664
|
-
const _itemSize = Math.min(dItemSize, sItemSize);
|
|
50665
|
-
|
|
50666
|
-
|
|
50667
|
-
const dRowSize = dItemSize * this.width;
|
|
50668
|
-
const sRowSize = sItemSize * source.width;
|
|
50669
|
-
|
|
50670
|
-
const sData = source.data;
|
|
50671
|
-
const dData = this.data;
|
|
50672
|
-
|
|
50673
|
-
let x, y, i;
|
|
50674
|
-
|
|
50675
|
-
let xMax, yMax;
|
|
50676
|
-
|
|
50677
|
-
let dA, sA, dOffset, sOffset;
|
|
50678
|
-
//Write top-left corner
|
|
50679
|
-
sOffset = sourceY * sRowSize + sourceX * dItemSize;
|
|
50680
|
-
for (y = Math.max(0, destinationY - marginTop), yMax = destinationY; y < yMax; y++) {
|
|
50681
|
-
dA = y * dRowSize;
|
|
50682
|
-
|
|
50683
|
-
for (x = Math.max(0, destinationX - marginLeft), xMax = destinationX; x < xMax; x++) {
|
|
50684
|
-
|
|
50685
|
-
dOffset = dA + x * dItemSize;
|
|
50686
|
-
|
|
50687
|
-
for (i = 0; i < _itemSize; i++) {
|
|
50688
|
-
dData[dOffset + i] = sData[sOffset + i];
|
|
50689
|
-
}
|
|
50690
|
-
}
|
|
50691
|
-
}
|
|
50692
|
-
//Write top margin
|
|
50693
|
-
sA = sourceY * sRowSize;
|
|
50694
|
-
for (y = Math.max(0, destinationY - marginTop), yMax = destinationY; y < yMax; y++) {
|
|
50695
|
-
dA = y * dRowSize;
|
|
50696
|
-
|
|
50697
|
-
for (x = 0; x < width; x++) {
|
|
50698
|
-
|
|
50699
|
-
dOffset = dA + (x + destinationX) * dItemSize;
|
|
50700
|
-
sOffset = sA + (x + sourceX) * dItemSize;
|
|
50701
|
-
for (i = 0; i < _itemSize; i++) {
|
|
50702
|
-
dData[dOffset + i] = sData[sOffset + i];
|
|
50703
|
-
}
|
|
50704
|
-
}
|
|
50705
|
-
}
|
|
50706
|
-
//Write top-right corner
|
|
50707
|
-
sOffset = sourceY * sRowSize + (sourceX + width - 1) * dItemSize;
|
|
50708
|
-
for (y = Math.max(0, destinationY - marginTop), yMax = destinationY; y < yMax; y++) {
|
|
50709
|
-
dA = y * dRowSize;
|
|
50710
|
-
|
|
50711
|
-
for (x = destinationX + width, xMax = Math.min(this.width, x + marginRight); x < xMax; x++) {
|
|
50712
|
-
|
|
50713
|
-
dOffset = dA + x * dItemSize;
|
|
50714
|
-
|
|
50715
|
-
for (i = 0; i < _itemSize; i++) {
|
|
50716
|
-
dData[dOffset + i] = sData[sOffset + i];
|
|
50717
|
-
}
|
|
50718
|
-
}
|
|
50719
|
-
}
|
|
50720
|
-
//Write left margin
|
|
50721
|
-
for (y = 0; y < height; y++) {
|
|
50722
|
-
dA = (y + destinationY) * dRowSize;
|
|
50723
|
-
sA = (y + sourceY) * sRowSize;
|
|
50724
|
-
|
|
50725
|
-
sOffset = sA + (sourceX) * dItemSize;
|
|
50726
|
-
|
|
50727
|
-
for (x = Math.max(0, destinationX - marginLeft), xMax = destinationX; x < xMax; x++) {
|
|
50728
|
-
|
|
50729
|
-
dOffset = dA + x * dItemSize;
|
|
50730
|
-
|
|
50731
|
-
for (i = 0; i < _itemSize; i++) {
|
|
50732
|
-
dData[dOffset + i] = sData[sOffset + i];
|
|
50733
|
-
}
|
|
50734
|
-
}
|
|
50735
|
-
}
|
|
50736
|
-
//write actual patch
|
|
50737
|
-
this.copy(source, sourceX, sourceY, destinationX, destinationY, width, height);
|
|
50738
|
-
|
|
50739
|
-
//Write right margin
|
|
50740
|
-
for (y = 0; y < height; y++) {
|
|
50741
|
-
dA = (y + destinationY) * dRowSize;
|
|
50742
|
-
sA = (y + sourceY) * sRowSize;
|
|
50743
|
-
|
|
50744
|
-
sOffset = sA + (sourceX + width - 1) * dItemSize;
|
|
50745
|
-
|
|
50746
|
-
for (x = destinationX + width, xMax = Math.min(this.width, x + marginRight); x < xMax; x++) {
|
|
50747
|
-
|
|
50748
|
-
dOffset = dA + x * dItemSize;
|
|
50749
|
-
|
|
50750
|
-
for (i = 0; i < _itemSize; i++) {
|
|
50751
|
-
dData[dOffset + i] = sData[sOffset + i];
|
|
50752
|
-
}
|
|
50753
|
-
}
|
|
50754
|
-
}
|
|
50755
|
-
|
|
50756
|
-
//Write Bottom-left margin
|
|
50757
|
-
sOffset = (sourceY + height - 1) * sRowSize + sourceX * dItemSize;
|
|
50758
|
-
for (y = destinationY + width, yMax = Math.min(this.height, y + marginBottom); y < yMax; y++) {
|
|
50759
|
-
dA = y * dRowSize;
|
|
50760
|
-
|
|
50761
|
-
for (x = Math.max(0, destinationX - marginLeft), xMax = destinationX; x < xMax; x++) {
|
|
50762
|
-
|
|
50763
|
-
dOffset = dA + x * dItemSize;
|
|
50764
|
-
|
|
50765
|
-
for (i = 0; i < _itemSize; i++) {
|
|
50766
|
-
dData[dOffset + i] = sData[sOffset + i];
|
|
50767
|
-
}
|
|
50768
|
-
}
|
|
50769
|
-
}
|
|
50770
|
-
//Write Bottom margin
|
|
50771
|
-
sA = (sourceY + height - 1) * sRowSize;
|
|
50772
|
-
for (y = destinationY + width, yMax = Math.min(this.height, y + marginBottom); y < yMax; y++) {
|
|
50773
|
-
dA = y * dRowSize;
|
|
50774
|
-
|
|
50775
|
-
for (x = 0; x < width; x++) {
|
|
50776
|
-
|
|
50777
|
-
dOffset = dA + (x + destinationX) * dItemSize;
|
|
50778
|
-
sOffset = sA + (x + sourceX) * dItemSize;
|
|
50779
|
-
for (i = 0; i < _itemSize; i++) {
|
|
50780
|
-
dData[dOffset + i] = sData[sOffset + i];
|
|
50781
|
-
}
|
|
50782
|
-
}
|
|
50783
|
-
}
|
|
50784
|
-
//Write Bottom-right margin
|
|
50785
|
-
sOffset = (sourceY + height - 1) * sRowSize + (sourceX + width - 1) * dItemSize;
|
|
50786
|
-
for (y = destinationY + width, yMax = Math.min(this.height, y + marginBottom); y < yMax; y++) {
|
|
50787
|
-
dA = y * dRowSize;
|
|
50788
|
-
|
|
50789
|
-
for (x = destinationX + width, xMax = Math.min(this.width, x + marginRight); x < xMax; x++) {
|
|
50790
|
-
|
|
50791
|
-
dOffset = dA + x * dItemSize;
|
|
50792
|
-
|
|
50793
|
-
for (i = 0; i < _itemSize; i++) {
|
|
50794
|
-
dData[dOffset + i] = sData[sOffset + i];
|
|
50795
|
-
}
|
|
50796
|
-
}
|
|
50797
|
-
}
|
|
50798
|
-
|
|
50799
|
-
this.version++;
|
|
50800
|
-
}
|
|
50801
|
-
|
|
50802
50597
|
/**
|
|
50803
50598
|
* Copy a patch from another sampler
|
|
50804
50599
|
* @param {Sampler2D} source where to copy from
|
|
@@ -50855,106 +50650,6 @@ class Sampler2D {
|
|
|
50855
50650
|
this.version++;
|
|
50856
50651
|
}
|
|
50857
50652
|
|
|
50858
|
-
/**
|
|
50859
|
-
* Copy a patch from another sampler with the same itemSize
|
|
50860
|
-
* @param {Sampler2D} source where to copy from
|
|
50861
|
-
* @param {Number} sourceX where to start reading from, X coordinate
|
|
50862
|
-
* @param {Number} sourceY where to start reading from, X coordinate
|
|
50863
|
-
* @param {Number} destinationX where to start writing to, X coordinate
|
|
50864
|
-
* @param {Number} destinationY where to start writing to, X coordinate
|
|
50865
|
-
* @param {Number} width size of the patch that is to be copied
|
|
50866
|
-
* @param {Number} height size of the patch that is to be copied
|
|
50867
|
-
*/
|
|
50868
|
-
copy_sameItemSize(source, sourceX, sourceY, destinationX, destinationY, width, height) {
|
|
50869
|
-
const itemSize = this.itemSize;
|
|
50870
|
-
const sItemSize = source.itemSize;
|
|
50871
|
-
|
|
50872
|
-
assert.equal(sItemSize, sItemSize, `source.itemSize(=${sItemSize}) != this.itemSize(=${itemSize})`);
|
|
50873
|
-
|
|
50874
|
-
const _w = Math.min(width, source.width - sourceX, this.width - destinationX);
|
|
50875
|
-
const _h = Math.min(height, source.height - sourceY, this.height - destinationY);
|
|
50876
|
-
|
|
50877
|
-
|
|
50878
|
-
const dRowSize = itemSize * this.width;
|
|
50879
|
-
const sRowSize = itemSize * source.width;
|
|
50880
|
-
|
|
50881
|
-
const sData = source.data;
|
|
50882
|
-
const dData = this.data;
|
|
50883
|
-
|
|
50884
|
-
const patchRowSize = _w * itemSize;
|
|
50885
|
-
|
|
50886
|
-
let y, i;
|
|
50887
|
-
|
|
50888
|
-
for (y = 0; y < _h; y++) {
|
|
50889
|
-
const dA = (y + destinationY) * dRowSize;
|
|
50890
|
-
const sA = (y + sourceY) * sRowSize;
|
|
50891
|
-
|
|
50892
|
-
const dOffset = dA + destinationX * itemSize;
|
|
50893
|
-
const sOffset = sA + sourceX * itemSize;
|
|
50894
|
-
|
|
50895
|
-
for (i = 0; i < patchRowSize; i++) {
|
|
50896
|
-
|
|
50897
|
-
dData[dOffset + i] = sData[sOffset + i];
|
|
50898
|
-
|
|
50899
|
-
}
|
|
50900
|
-
}
|
|
50901
|
-
|
|
50902
|
-
this.version++;
|
|
50903
|
-
}
|
|
50904
|
-
|
|
50905
|
-
/**
|
|
50906
|
-
* Assumes both samplers are uint8 with values 0-255
|
|
50907
|
-
* @param {Sampler2D} source
|
|
50908
|
-
* @param sourceX
|
|
50909
|
-
* @param sourceY
|
|
50910
|
-
* @param destinationX
|
|
50911
|
-
* @param destinationY
|
|
50912
|
-
* @param width
|
|
50913
|
-
* @param height
|
|
50914
|
-
* @param {BlendingType} [blendMode]
|
|
50915
|
-
*/
|
|
50916
|
-
paint(source, sourceX, sourceY, destinationX, destinationY, width, height, blendMode = BlendingType.Normal) {
|
|
50917
|
-
let blendFunction;
|
|
50918
|
-
if (blendMode === BlendingType.Normal) {
|
|
50919
|
-
blendFunction = blendFunctionNormal;
|
|
50920
|
-
} else {
|
|
50921
|
-
throw new Error(`Unsupported blendType(=${blendMode})`);
|
|
50922
|
-
}
|
|
50923
|
-
|
|
50924
|
-
const _w = Math.min(width, source.width - sourceX, this.width - destinationX);
|
|
50925
|
-
const _h = Math.min(height, source.height - sourceY, this.height - destinationY);
|
|
50926
|
-
|
|
50927
|
-
const _x0 = Math.max(0, -destinationX);
|
|
50928
|
-
const _y0 = Math.max(0, -destinationY);
|
|
50929
|
-
|
|
50930
|
-
const c0 = [0, 0, 0, 255];
|
|
50931
|
-
const c1 = [0, 0, 0, 255];
|
|
50932
|
-
|
|
50933
|
-
const c3 = [];
|
|
50934
|
-
|
|
50935
|
-
let x, y;
|
|
50936
|
-
|
|
50937
|
-
for (y = _y0; y < _h; y++) {
|
|
50938
|
-
for (x = _x0; x < _w; x++) {
|
|
50939
|
-
const d_x = Math.round(x + destinationX);
|
|
50940
|
-
const d_y = Math.round(y + destinationY);
|
|
50941
|
-
|
|
50942
|
-
this.read(d_x, d_y, c0);
|
|
50943
|
-
|
|
50944
|
-
const s_x = Math.round(x + sourceY);
|
|
50945
|
-
const s_y = Math.round(y + sourceY);
|
|
50946
|
-
|
|
50947
|
-
source.read(s_x, s_y, c1);
|
|
50948
|
-
|
|
50949
|
-
blendFunction(c1, c0, c3);
|
|
50950
|
-
|
|
50951
|
-
this.set(d_x, d_y, c3);
|
|
50952
|
-
|
|
50953
|
-
}
|
|
50954
|
-
}
|
|
50955
|
-
|
|
50956
|
-
|
|
50957
|
-
}
|
|
50958
50653
|
|
|
50959
50654
|
/**
|
|
50960
50655
|
* Fill data values with zeros for a given area
|
|
@@ -51215,22 +50910,6 @@ class Sampler2D {
|
|
|
51215
50910
|
return dataSize + 280;
|
|
51216
50911
|
}
|
|
51217
50912
|
|
|
51218
|
-
/**
|
|
51219
|
-
* @deprecated Use {@link Sampler2DSerializationAdapter} adapter instead
|
|
51220
|
-
* @param {BinaryBuffer} buffer
|
|
51221
|
-
*/
|
|
51222
|
-
toBinaryBuffer(buffer) {
|
|
51223
|
-
throw new Error('Deprecated, use Sampler2DSerializationAdapter instead');
|
|
51224
|
-
}
|
|
51225
|
-
|
|
51226
|
-
/**
|
|
51227
|
-
* @deprecated Use {@link Sampler2DSerializationAdapter} adapter instead
|
|
51228
|
-
* @param {BinaryBuffer} buffer
|
|
51229
|
-
*/
|
|
51230
|
-
fromBinaryBuffer(buffer) {
|
|
51231
|
-
throw new Error('Deprecated, use Sampler2DSerializationAdapter instead');
|
|
51232
|
-
}
|
|
51233
|
-
|
|
51234
50913
|
/**
|
|
51235
50914
|
*
|
|
51236
50915
|
* @param {Sampler2D} other
|
|
@@ -51441,38 +51120,7 @@ Sampler2D.prototype.isSampler2D = true;
|
|
|
51441
51120
|
* @readonly
|
|
51442
51121
|
* @type {string}
|
|
51443
51122
|
*/
|
|
51444
|
-
Sampler2D.typeName = "Sampler2D";
|
|
51445
|
-
|
|
51446
|
-
/**
|
|
51447
|
-
* Based on code from reddit https://www.reddit.com/r/javascript/comments/jxa8x/bicubic_interpolation/
|
|
51448
|
-
* @param {number} t
|
|
51449
|
-
* @param {number} a
|
|
51450
|
-
* @param {number} b
|
|
51451
|
-
* @param {number} c
|
|
51452
|
-
* @param {number} d
|
|
51453
|
-
* @returns {number}
|
|
51454
|
-
*/
|
|
51455
|
-
function bicubic_terp(t, a, b, c, d) {
|
|
51456
|
-
return 0.5 * (c - a + (2.0 * a - 5.0 * b + 4.0 * c - d + (3.0 * (b - c) + d - a) * t) * t) * t + b;
|
|
51457
|
-
}
|
|
51458
|
-
|
|
51459
|
-
|
|
51460
|
-
/**
|
|
51461
|
-
*
|
|
51462
|
-
* @param {number[]} source
|
|
51463
|
-
* @param {number[]} destination
|
|
51464
|
-
* @param {Array} result
|
|
51465
|
-
*/
|
|
51466
|
-
function blendFunctionNormal(source, destination, result) {
|
|
51467
|
-
|
|
51468
|
-
const a1 = source[3] / 255;
|
|
51469
|
-
const a0 = destination[3] / 255;
|
|
51470
|
-
|
|
51471
|
-
result[0] = source[0] * a1 + destination[0] * (1 - a1);
|
|
51472
|
-
result[1] = source[1] * a1 + destination[1] * (1 - a1);
|
|
51473
|
-
result[2] = source[2] * a1 + destination[2] * (1 - a1);
|
|
51474
|
-
result[3] = (a1 + a0 * (1 - a1)) * 255;
|
|
51475
|
-
}
|
|
51123
|
+
Sampler2D.typeName = "Sampler2D";
|
|
51476
51124
|
|
|
51477
51125
|
/**
|
|
51478
51126
|
*
|
|
@@ -51781,6 +51429,354 @@ function SplatMaterial(
|
|
|
51781
51429
|
|
|
51782
51430
|
const WHITE_PIXEL_DATA_URL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P///38ACfsD/QVDRcoAAAAASUVORK5CYII=";
|
|
51783
51431
|
|
|
51432
|
+
/**
|
|
51433
|
+
*
|
|
51434
|
+
* @param {number} v
|
|
51435
|
+
* @returns {number}
|
|
51436
|
+
*/
|
|
51437
|
+
function float2uint8(v) {
|
|
51438
|
+
return Math.round(v * 255);
|
|
51439
|
+
}
|
|
51440
|
+
|
|
51441
|
+
/**
|
|
51442
|
+
*
|
|
51443
|
+
* @param {number} v
|
|
51444
|
+
* @returns {number}
|
|
51445
|
+
*/
|
|
51446
|
+
function uint82float(v) {
|
|
51447
|
+
return v / 255;
|
|
51448
|
+
}
|
|
51449
|
+
|
|
51450
|
+
/**
|
|
51451
|
+
* Copy data from one array to another
|
|
51452
|
+
* Follows Java System.arraycopy interface
|
|
51453
|
+
* @template T
|
|
51454
|
+
* @param {T[]|ArrayLike<T>|TypedArray|Uint8ClampedArray|Uint8Array|Uint32Array|Int32Array|Float32Array|Float64Array} source The source array
|
|
51455
|
+
* @param {number} source_position Starting position where to copy from inside the source array
|
|
51456
|
+
* @param {T[]|ArrayLike<T>|TypedArray|Uint8ClampedArray|Uint8Array|Uint32Array|Int32Array|Float32Array|Float64Array} destination The destination array
|
|
51457
|
+
* @param {number} destination_position Starting position where to copy to inside the destination array
|
|
51458
|
+
* @param {number} length How many elements should be copied
|
|
51459
|
+
*/
|
|
51460
|
+
function array_copy(
|
|
51461
|
+
source,
|
|
51462
|
+
source_position,
|
|
51463
|
+
destination,
|
|
51464
|
+
destination_position,
|
|
51465
|
+
length
|
|
51466
|
+
) {
|
|
51467
|
+
assert.isNonNegativeInteger(source_position, 'source_position');
|
|
51468
|
+
assert.isNonNegativeInteger(destination_position, 'destination_position');
|
|
51469
|
+
assert.isNonNegativeInteger(length, 'length');
|
|
51470
|
+
|
|
51471
|
+
let i, j, k;
|
|
51472
|
+
|
|
51473
|
+
for (k = 0; k < length; k++) {
|
|
51474
|
+
i = source_position + k;
|
|
51475
|
+
j = destination_position + k;
|
|
51476
|
+
|
|
51477
|
+
destination[j] = source[i];
|
|
51478
|
+
}
|
|
51479
|
+
}
|
|
51480
|
+
|
|
51481
|
+
/**
|
|
51482
|
+
* @author Alex Goldring
|
|
51483
|
+
* @copyright Alex Goldring 2018
|
|
51484
|
+
*/
|
|
51485
|
+
|
|
51486
|
+
|
|
51487
|
+
class Vector1 extends Number {
|
|
51488
|
+
/**
|
|
51489
|
+
*
|
|
51490
|
+
* @param {number} [x=0]
|
|
51491
|
+
* @constructor
|
|
51492
|
+
* @class
|
|
51493
|
+
* @property {number} x
|
|
51494
|
+
*/
|
|
51495
|
+
constructor(x = 0) {
|
|
51496
|
+
super();
|
|
51497
|
+
|
|
51498
|
+
assert.isNumber( x, 'x');
|
|
51499
|
+
assert.notNaN(x, 'x');
|
|
51500
|
+
|
|
51501
|
+
this.x = x;
|
|
51502
|
+
|
|
51503
|
+
this.onChanged = new Signal();
|
|
51504
|
+
}
|
|
51505
|
+
|
|
51506
|
+
/**
|
|
51507
|
+
* Inherited from Number class
|
|
51508
|
+
* @returns {number}
|
|
51509
|
+
*/
|
|
51510
|
+
valueOf() {
|
|
51511
|
+
return this.x;
|
|
51512
|
+
}
|
|
51513
|
+
|
|
51514
|
+
/**
|
|
51515
|
+
*
|
|
51516
|
+
* @returns {string}
|
|
51517
|
+
*/
|
|
51518
|
+
toString() {
|
|
51519
|
+
return String(this.x);
|
|
51520
|
+
}
|
|
51521
|
+
|
|
51522
|
+
/**
|
|
51523
|
+
*
|
|
51524
|
+
* @returns {number}
|
|
51525
|
+
*/
|
|
51526
|
+
getValue() {
|
|
51527
|
+
return this.x;
|
|
51528
|
+
}
|
|
51529
|
+
|
|
51530
|
+
/**
|
|
51531
|
+
*
|
|
51532
|
+
* @param {Vector1} other
|
|
51533
|
+
* @returns {number}
|
|
51534
|
+
*/
|
|
51535
|
+
compareTo(other) {
|
|
51536
|
+
return this.x - other.x;
|
|
51537
|
+
}
|
|
51538
|
+
|
|
51539
|
+
/**
|
|
51540
|
+
*
|
|
51541
|
+
* @param {number} x
|
|
51542
|
+
* @returns {Vector1}
|
|
51543
|
+
*/
|
|
51544
|
+
set(x) {
|
|
51545
|
+
assert.isNumber( x,'x');
|
|
51546
|
+
assert.notNaN(x, 'x');
|
|
51547
|
+
|
|
51548
|
+
const oldValue = this.x;
|
|
51549
|
+
if (oldValue !== x) {
|
|
51550
|
+
this.x = x;
|
|
51551
|
+
|
|
51552
|
+
if (this.onChanged.hasHandlers()) {
|
|
51553
|
+
this.onChanged.send2(x, oldValue);
|
|
51554
|
+
}
|
|
51555
|
+
}
|
|
51556
|
+
|
|
51557
|
+
return this;
|
|
51558
|
+
}
|
|
51559
|
+
|
|
51560
|
+
/**
|
|
51561
|
+
* Set value without triggering {@link #onChanged} signal
|
|
51562
|
+
* @param {number} x
|
|
51563
|
+
*/
|
|
51564
|
+
setSilent(x) {
|
|
51565
|
+
this.x = x;
|
|
51566
|
+
}
|
|
51567
|
+
|
|
51568
|
+
/**
|
|
51569
|
+
*
|
|
51570
|
+
* @return {boolean}
|
|
51571
|
+
*/
|
|
51572
|
+
isZero() {
|
|
51573
|
+
return this.x === 0;
|
|
51574
|
+
}
|
|
51575
|
+
|
|
51576
|
+
increment() {
|
|
51577
|
+
this._add(1);
|
|
51578
|
+
}
|
|
51579
|
+
|
|
51580
|
+
decrement() {
|
|
51581
|
+
this._add(-1);
|
|
51582
|
+
}
|
|
51583
|
+
|
|
51584
|
+
/**
|
|
51585
|
+
*
|
|
51586
|
+
* @param {Number} v
|
|
51587
|
+
* @return {Vector1}
|
|
51588
|
+
*/
|
|
51589
|
+
_add(v) {
|
|
51590
|
+
return this.set(this.x + v);
|
|
51591
|
+
}
|
|
51592
|
+
|
|
51593
|
+
/**
|
|
51594
|
+
*
|
|
51595
|
+
* @param {Vector1|Vector2|Vector3|Vector4} other
|
|
51596
|
+
*/
|
|
51597
|
+
add(other) {
|
|
51598
|
+
return this._add(other.x);
|
|
51599
|
+
}
|
|
51600
|
+
|
|
51601
|
+
/**
|
|
51602
|
+
*
|
|
51603
|
+
* @param {Number} v
|
|
51604
|
+
* @return {Vector1}
|
|
51605
|
+
*/
|
|
51606
|
+
_sub(v) {
|
|
51607
|
+
return this._add(-v);
|
|
51608
|
+
}
|
|
51609
|
+
|
|
51610
|
+
/**
|
|
51611
|
+
*
|
|
51612
|
+
* @param {Vector1} other
|
|
51613
|
+
* @returns {Vector1}
|
|
51614
|
+
*/
|
|
51615
|
+
sub(other) {
|
|
51616
|
+
return this._sub(other.x);
|
|
51617
|
+
}
|
|
51618
|
+
|
|
51619
|
+
/**
|
|
51620
|
+
*
|
|
51621
|
+
* @param {Vector1} other
|
|
51622
|
+
* @returns {Vector1}
|
|
51623
|
+
*/
|
|
51624
|
+
multiply(other) {
|
|
51625
|
+
return this.set(this.x * other.x);
|
|
51626
|
+
}
|
|
51627
|
+
|
|
51628
|
+
/**
|
|
51629
|
+
*
|
|
51630
|
+
* @param {number} v
|
|
51631
|
+
*/
|
|
51632
|
+
multiplyScalar(v) {
|
|
51633
|
+
this.set(this.x * v);
|
|
51634
|
+
}
|
|
51635
|
+
|
|
51636
|
+
/**
|
|
51637
|
+
*
|
|
51638
|
+
* @param {number} low
|
|
51639
|
+
* @param {number} high
|
|
51640
|
+
* @returns {Vector1}
|
|
51641
|
+
*/
|
|
51642
|
+
clamp(low, high) {
|
|
51643
|
+
return this.set(clamp$1(this.x, low, high));
|
|
51644
|
+
}
|
|
51645
|
+
|
|
51646
|
+
/**
|
|
51647
|
+
*
|
|
51648
|
+
* @param {Vector1|Vector2|Vector3|Vector4} other
|
|
51649
|
+
*/
|
|
51650
|
+
copy(other) {
|
|
51651
|
+
this.set(other.x);
|
|
51652
|
+
}
|
|
51653
|
+
|
|
51654
|
+
/**
|
|
51655
|
+
*
|
|
51656
|
+
* @returns {Vector1}
|
|
51657
|
+
*/
|
|
51658
|
+
clone() {
|
|
51659
|
+
return new Vector1(this.x);
|
|
51660
|
+
}
|
|
51661
|
+
|
|
51662
|
+
/**
|
|
51663
|
+
*
|
|
51664
|
+
* @param {Vector1} other
|
|
51665
|
+
* @returns {boolean}
|
|
51666
|
+
*/
|
|
51667
|
+
equals(other) {
|
|
51668
|
+
return this.x === other.x;
|
|
51669
|
+
}
|
|
51670
|
+
|
|
51671
|
+
/**
|
|
51672
|
+
* @returns {number}
|
|
51673
|
+
*/
|
|
51674
|
+
hash() {
|
|
51675
|
+
return computeHashFloat(this.x);
|
|
51676
|
+
}
|
|
51677
|
+
|
|
51678
|
+
/**
|
|
51679
|
+
*
|
|
51680
|
+
* @param {function(newValue:number, oldValue:number)} handler
|
|
51681
|
+
*/
|
|
51682
|
+
process(handler) {
|
|
51683
|
+
handler(this.x, this.x);
|
|
51684
|
+
this.onChanged.add(handler);
|
|
51685
|
+
}
|
|
51686
|
+
|
|
51687
|
+
toJSON() {
|
|
51688
|
+
return this.x;
|
|
51689
|
+
}
|
|
51690
|
+
|
|
51691
|
+
fromJSON(val) {
|
|
51692
|
+
this.set(val);
|
|
51693
|
+
}
|
|
51694
|
+
|
|
51695
|
+
/**
|
|
51696
|
+
*
|
|
51697
|
+
* @param {number[]} array
|
|
51698
|
+
* @param {number} offset
|
|
51699
|
+
*/
|
|
51700
|
+
readFromArray(array, offset=0) {
|
|
51701
|
+
this.set(array[offset]);
|
|
51702
|
+
}
|
|
51703
|
+
|
|
51704
|
+
/**
|
|
51705
|
+
*
|
|
51706
|
+
* @param {number[]} array
|
|
51707
|
+
* @param {number} offset
|
|
51708
|
+
*/
|
|
51709
|
+
writeToArray(array, offset=0) {
|
|
51710
|
+
array[offset] = this.x;
|
|
51711
|
+
}
|
|
51712
|
+
|
|
51713
|
+
asArray(){
|
|
51714
|
+
return [this.x];
|
|
51715
|
+
}
|
|
51716
|
+
|
|
51717
|
+
/**
|
|
51718
|
+
*
|
|
51719
|
+
* @param {BinaryBuffer} buffer
|
|
51720
|
+
*/
|
|
51721
|
+
toBinaryBuffer(buffer) {
|
|
51722
|
+
buffer.writeFloat64(this.x);
|
|
51723
|
+
}
|
|
51724
|
+
|
|
51725
|
+
/**
|
|
51726
|
+
*
|
|
51727
|
+
* @param {BinaryBuffer} buffer
|
|
51728
|
+
*/
|
|
51729
|
+
fromBinaryBuffer(buffer) {
|
|
51730
|
+
const x = buffer.readFloat64();
|
|
51731
|
+
|
|
51732
|
+
this.set(x);
|
|
51733
|
+
}
|
|
51734
|
+
|
|
51735
|
+
/**
|
|
51736
|
+
*
|
|
51737
|
+
* @param {Vector1} a
|
|
51738
|
+
* @param {Vector1} b
|
|
51739
|
+
* @return {number}
|
|
51740
|
+
*/
|
|
51741
|
+
static compare(a, b) {
|
|
51742
|
+
return a.x - b.x;
|
|
51743
|
+
}
|
|
51744
|
+
|
|
51745
|
+
get 0() {
|
|
51746
|
+
return this.x;
|
|
51747
|
+
}
|
|
51748
|
+
|
|
51749
|
+
set 0(v) {
|
|
51750
|
+
this.x = v;
|
|
51751
|
+
}
|
|
51752
|
+
|
|
51753
|
+
* [Symbol.iterator]() {
|
|
51754
|
+
|
|
51755
|
+
yield this.x;
|
|
51756
|
+
|
|
51757
|
+
}
|
|
51758
|
+
}
|
|
51759
|
+
|
|
51760
|
+
/**
|
|
51761
|
+
* @readonly
|
|
51762
|
+
* @type {boolean}
|
|
51763
|
+
*/
|
|
51764
|
+
Vector1.prototype.isVector1 = true;
|
|
51765
|
+
|
|
51766
|
+
Vector1.typeName = "Vector1";
|
|
51767
|
+
|
|
51768
|
+
/**
|
|
51769
|
+
* @readonly
|
|
51770
|
+
* @type {Vector1}
|
|
51771
|
+
*/
|
|
51772
|
+
Vector1.zero = Object.freeze(new Vector1(0));
|
|
51773
|
+
|
|
51774
|
+
/**
|
|
51775
|
+
* @readonly
|
|
51776
|
+
* @type {Vector1}
|
|
51777
|
+
*/
|
|
51778
|
+
Vector1.one = Object.freeze(new Vector1(1));
|
|
51779
|
+
|
|
51784
51780
|
/**
|
|
51785
51781
|
*
|
|
51786
51782
|
* @param {Uint8Array|number[]|ArrayLike<number>|IArguments} data
|
|
@@ -52278,342 +52274,6 @@ class Vector4 {
|
|
|
52278
52274
|
}
|
|
52279
52275
|
}
|
|
52280
52276
|
|
|
52281
|
-
/**
|
|
52282
|
-
* Created by Alex on 11/11/2014.
|
|
52283
|
-
*/
|
|
52284
|
-
|
|
52285
|
-
|
|
52286
|
-
function canvas2Sampler2D(canvas) {
|
|
52287
|
-
const width = canvas.width;
|
|
52288
|
-
const height = canvas.height;
|
|
52289
|
-
|
|
52290
|
-
const context = canvas.getContext("2d");
|
|
52291
|
-
|
|
52292
|
-
const result = new Sampler2D(null, 4, width, height);
|
|
52293
|
-
|
|
52294
|
-
canvasDataToSampler(result, context);
|
|
52295
|
-
|
|
52296
|
-
return result;
|
|
52297
|
-
|
|
52298
|
-
}
|
|
52299
|
-
|
|
52300
|
-
/**
|
|
52301
|
-
*
|
|
52302
|
-
* @param {Sampler2D} target
|
|
52303
|
-
* @param {CanvasRenderingContext2D} ctx
|
|
52304
|
-
*/
|
|
52305
|
-
function canvasDataToSampler(target, ctx) {
|
|
52306
|
-
const width = target.width;
|
|
52307
|
-
const height = target.height;
|
|
52308
|
-
|
|
52309
|
-
const imageData = ctx.getImageData(0, 0, width, height);
|
|
52310
|
-
|
|
52311
|
-
const data = imageData.data;
|
|
52312
|
-
|
|
52313
|
-
assert.equal(data.length, target.height * target.width * target.itemSize);
|
|
52314
|
-
|
|
52315
|
-
target.data = data;
|
|
52316
|
-
}
|
|
52317
|
-
|
|
52318
|
-
/**
|
|
52319
|
-
* @author Alex Goldring
|
|
52320
|
-
* @copyright Alex Goldring 2018
|
|
52321
|
-
*/
|
|
52322
|
-
|
|
52323
|
-
|
|
52324
|
-
class Vector1 extends Number {
|
|
52325
|
-
/**
|
|
52326
|
-
*
|
|
52327
|
-
* @param {number} [x=0]
|
|
52328
|
-
* @constructor
|
|
52329
|
-
* @class
|
|
52330
|
-
* @property {number} x
|
|
52331
|
-
*/
|
|
52332
|
-
constructor(x = 0) {
|
|
52333
|
-
super();
|
|
52334
|
-
|
|
52335
|
-
assert.isNumber( x, 'x');
|
|
52336
|
-
assert.notNaN(x, 'x');
|
|
52337
|
-
|
|
52338
|
-
this.x = x;
|
|
52339
|
-
|
|
52340
|
-
this.onChanged = new Signal();
|
|
52341
|
-
}
|
|
52342
|
-
|
|
52343
|
-
/**
|
|
52344
|
-
* Inherited from Number class
|
|
52345
|
-
* @returns {number}
|
|
52346
|
-
*/
|
|
52347
|
-
valueOf() {
|
|
52348
|
-
return this.x;
|
|
52349
|
-
}
|
|
52350
|
-
|
|
52351
|
-
/**
|
|
52352
|
-
*
|
|
52353
|
-
* @returns {string}
|
|
52354
|
-
*/
|
|
52355
|
-
toString() {
|
|
52356
|
-
return String(this.x);
|
|
52357
|
-
}
|
|
52358
|
-
|
|
52359
|
-
/**
|
|
52360
|
-
*
|
|
52361
|
-
* @returns {number}
|
|
52362
|
-
*/
|
|
52363
|
-
getValue() {
|
|
52364
|
-
return this.x;
|
|
52365
|
-
}
|
|
52366
|
-
|
|
52367
|
-
/**
|
|
52368
|
-
*
|
|
52369
|
-
* @param {Vector1} other
|
|
52370
|
-
* @returns {number}
|
|
52371
|
-
*/
|
|
52372
|
-
compareTo(other) {
|
|
52373
|
-
return this.x - other.x;
|
|
52374
|
-
}
|
|
52375
|
-
|
|
52376
|
-
/**
|
|
52377
|
-
*
|
|
52378
|
-
* @param {number} x
|
|
52379
|
-
* @returns {Vector1}
|
|
52380
|
-
*/
|
|
52381
|
-
set(x) {
|
|
52382
|
-
assert.isNumber( x,'x');
|
|
52383
|
-
assert.notNaN(x, 'x');
|
|
52384
|
-
|
|
52385
|
-
const oldValue = this.x;
|
|
52386
|
-
if (oldValue !== x) {
|
|
52387
|
-
this.x = x;
|
|
52388
|
-
|
|
52389
|
-
if (this.onChanged.hasHandlers()) {
|
|
52390
|
-
this.onChanged.send2(x, oldValue);
|
|
52391
|
-
}
|
|
52392
|
-
}
|
|
52393
|
-
|
|
52394
|
-
return this;
|
|
52395
|
-
}
|
|
52396
|
-
|
|
52397
|
-
/**
|
|
52398
|
-
* Set value without triggering {@link #onChanged} signal
|
|
52399
|
-
* @param {number} x
|
|
52400
|
-
*/
|
|
52401
|
-
setSilent(x) {
|
|
52402
|
-
this.x = x;
|
|
52403
|
-
}
|
|
52404
|
-
|
|
52405
|
-
/**
|
|
52406
|
-
*
|
|
52407
|
-
* @return {boolean}
|
|
52408
|
-
*/
|
|
52409
|
-
isZero() {
|
|
52410
|
-
return this.x === 0;
|
|
52411
|
-
}
|
|
52412
|
-
|
|
52413
|
-
increment() {
|
|
52414
|
-
this._add(1);
|
|
52415
|
-
}
|
|
52416
|
-
|
|
52417
|
-
decrement() {
|
|
52418
|
-
this._add(-1);
|
|
52419
|
-
}
|
|
52420
|
-
|
|
52421
|
-
/**
|
|
52422
|
-
*
|
|
52423
|
-
* @param {Number} v
|
|
52424
|
-
* @return {Vector1}
|
|
52425
|
-
*/
|
|
52426
|
-
_add(v) {
|
|
52427
|
-
return this.set(this.x + v);
|
|
52428
|
-
}
|
|
52429
|
-
|
|
52430
|
-
/**
|
|
52431
|
-
*
|
|
52432
|
-
* @param {Vector1|Vector2|Vector3|Vector4} other
|
|
52433
|
-
*/
|
|
52434
|
-
add(other) {
|
|
52435
|
-
return this._add(other.x);
|
|
52436
|
-
}
|
|
52437
|
-
|
|
52438
|
-
/**
|
|
52439
|
-
*
|
|
52440
|
-
* @param {Number} v
|
|
52441
|
-
* @return {Vector1}
|
|
52442
|
-
*/
|
|
52443
|
-
_sub(v) {
|
|
52444
|
-
return this._add(-v);
|
|
52445
|
-
}
|
|
52446
|
-
|
|
52447
|
-
/**
|
|
52448
|
-
*
|
|
52449
|
-
* @param {Vector1} other
|
|
52450
|
-
* @returns {Vector1}
|
|
52451
|
-
*/
|
|
52452
|
-
sub(other) {
|
|
52453
|
-
return this._sub(other.x);
|
|
52454
|
-
}
|
|
52455
|
-
|
|
52456
|
-
/**
|
|
52457
|
-
*
|
|
52458
|
-
* @param {Vector1} other
|
|
52459
|
-
* @returns {Vector1}
|
|
52460
|
-
*/
|
|
52461
|
-
multiply(other) {
|
|
52462
|
-
return this.set(this.x * other.x);
|
|
52463
|
-
}
|
|
52464
|
-
|
|
52465
|
-
/**
|
|
52466
|
-
*
|
|
52467
|
-
* @param {number} v
|
|
52468
|
-
*/
|
|
52469
|
-
multiplyScalar(v) {
|
|
52470
|
-
this.set(this.x * v);
|
|
52471
|
-
}
|
|
52472
|
-
|
|
52473
|
-
/**
|
|
52474
|
-
*
|
|
52475
|
-
* @param {number} low
|
|
52476
|
-
* @param {number} high
|
|
52477
|
-
* @returns {Vector1}
|
|
52478
|
-
*/
|
|
52479
|
-
clamp(low, high) {
|
|
52480
|
-
return this.set(clamp$1(this.x, low, high));
|
|
52481
|
-
}
|
|
52482
|
-
|
|
52483
|
-
/**
|
|
52484
|
-
*
|
|
52485
|
-
* @param {Vector1|Vector2|Vector3|Vector4} other
|
|
52486
|
-
*/
|
|
52487
|
-
copy(other) {
|
|
52488
|
-
this.set(other.x);
|
|
52489
|
-
}
|
|
52490
|
-
|
|
52491
|
-
/**
|
|
52492
|
-
*
|
|
52493
|
-
* @returns {Vector1}
|
|
52494
|
-
*/
|
|
52495
|
-
clone() {
|
|
52496
|
-
return new Vector1(this.x);
|
|
52497
|
-
}
|
|
52498
|
-
|
|
52499
|
-
/**
|
|
52500
|
-
*
|
|
52501
|
-
* @param {Vector1} other
|
|
52502
|
-
* @returns {boolean}
|
|
52503
|
-
*/
|
|
52504
|
-
equals(other) {
|
|
52505
|
-
return this.x === other.x;
|
|
52506
|
-
}
|
|
52507
|
-
|
|
52508
|
-
/**
|
|
52509
|
-
* @returns {number}
|
|
52510
|
-
*/
|
|
52511
|
-
hash() {
|
|
52512
|
-
return computeHashFloat(this.x);
|
|
52513
|
-
}
|
|
52514
|
-
|
|
52515
|
-
/**
|
|
52516
|
-
*
|
|
52517
|
-
* @param {function(newValue:number, oldValue:number)} handler
|
|
52518
|
-
*/
|
|
52519
|
-
process(handler) {
|
|
52520
|
-
handler(this.x, this.x);
|
|
52521
|
-
this.onChanged.add(handler);
|
|
52522
|
-
}
|
|
52523
|
-
|
|
52524
|
-
toJSON() {
|
|
52525
|
-
return this.x;
|
|
52526
|
-
}
|
|
52527
|
-
|
|
52528
|
-
fromJSON(val) {
|
|
52529
|
-
this.set(val);
|
|
52530
|
-
}
|
|
52531
|
-
|
|
52532
|
-
/**
|
|
52533
|
-
*
|
|
52534
|
-
* @param {number[]} array
|
|
52535
|
-
* @param {number} offset
|
|
52536
|
-
*/
|
|
52537
|
-
readFromArray(array, offset=0) {
|
|
52538
|
-
this.set(array[offset]);
|
|
52539
|
-
}
|
|
52540
|
-
|
|
52541
|
-
/**
|
|
52542
|
-
*
|
|
52543
|
-
* @param {number[]} array
|
|
52544
|
-
* @param {number} offset
|
|
52545
|
-
*/
|
|
52546
|
-
writeToArray(array, offset=0) {
|
|
52547
|
-
array[offset] = this.x;
|
|
52548
|
-
}
|
|
52549
|
-
|
|
52550
|
-
asArray(){
|
|
52551
|
-
return [this.x];
|
|
52552
|
-
}
|
|
52553
|
-
|
|
52554
|
-
/**
|
|
52555
|
-
*
|
|
52556
|
-
* @param {BinaryBuffer} buffer
|
|
52557
|
-
*/
|
|
52558
|
-
toBinaryBuffer(buffer) {
|
|
52559
|
-
buffer.writeFloat64(this.x);
|
|
52560
|
-
}
|
|
52561
|
-
|
|
52562
|
-
/**
|
|
52563
|
-
*
|
|
52564
|
-
* @param {BinaryBuffer} buffer
|
|
52565
|
-
*/
|
|
52566
|
-
fromBinaryBuffer(buffer) {
|
|
52567
|
-
const x = buffer.readFloat64();
|
|
52568
|
-
|
|
52569
|
-
this.set(x);
|
|
52570
|
-
}
|
|
52571
|
-
|
|
52572
|
-
/**
|
|
52573
|
-
*
|
|
52574
|
-
* @param {Vector1} a
|
|
52575
|
-
* @param {Vector1} b
|
|
52576
|
-
* @return {number}
|
|
52577
|
-
*/
|
|
52578
|
-
static compare(a, b) {
|
|
52579
|
-
return a.x - b.x;
|
|
52580
|
-
}
|
|
52581
|
-
|
|
52582
|
-
get 0() {
|
|
52583
|
-
return this.x;
|
|
52584
|
-
}
|
|
52585
|
-
|
|
52586
|
-
set 0(v) {
|
|
52587
|
-
this.x = v;
|
|
52588
|
-
}
|
|
52589
|
-
|
|
52590
|
-
* [Symbol.iterator]() {
|
|
52591
|
-
|
|
52592
|
-
yield this.x;
|
|
52593
|
-
|
|
52594
|
-
}
|
|
52595
|
-
}
|
|
52596
|
-
|
|
52597
|
-
/**
|
|
52598
|
-
* @readonly
|
|
52599
|
-
* @type {boolean}
|
|
52600
|
-
*/
|
|
52601
|
-
Vector1.prototype.isVector1 = true;
|
|
52602
|
-
|
|
52603
|
-
Vector1.typeName = "Vector1";
|
|
52604
|
-
|
|
52605
|
-
/**
|
|
52606
|
-
* @readonly
|
|
52607
|
-
* @type {Vector1}
|
|
52608
|
-
*/
|
|
52609
|
-
Vector1.zero = Object.freeze(new Vector1(0));
|
|
52610
|
-
|
|
52611
|
-
/**
|
|
52612
|
-
* @readonly
|
|
52613
|
-
* @type {Vector1}
|
|
52614
|
-
*/
|
|
52615
|
-
Vector1.one = Object.freeze(new Vector1(1));
|
|
52616
|
-
|
|
52617
52277
|
/**
|
|
52618
52278
|
*
|
|
52619
52279
|
* @param {string|null|undefined} string
|
|
@@ -52775,6 +52435,43 @@ class ObservedString extends String {
|
|
|
52775
52435
|
*/
|
|
52776
52436
|
ObservedString.prototype.isObservedString = true;
|
|
52777
52437
|
|
|
52438
|
+
/**
|
|
52439
|
+
* Created by Alex on 11/11/2014.
|
|
52440
|
+
*/
|
|
52441
|
+
|
|
52442
|
+
|
|
52443
|
+
function canvas2Sampler2D(canvas) {
|
|
52444
|
+
const width = canvas.width;
|
|
52445
|
+
const height = canvas.height;
|
|
52446
|
+
|
|
52447
|
+
const context = canvas.getContext("2d");
|
|
52448
|
+
|
|
52449
|
+
const result = new Sampler2D(null, 4, width, height);
|
|
52450
|
+
|
|
52451
|
+
canvasDataToSampler(result, context);
|
|
52452
|
+
|
|
52453
|
+
return result;
|
|
52454
|
+
|
|
52455
|
+
}
|
|
52456
|
+
|
|
52457
|
+
/**
|
|
52458
|
+
*
|
|
52459
|
+
* @param {Sampler2D} target
|
|
52460
|
+
* @param {CanvasRenderingContext2D} ctx
|
|
52461
|
+
*/
|
|
52462
|
+
function canvasDataToSampler(target, ctx) {
|
|
52463
|
+
const width = target.width;
|
|
52464
|
+
const height = target.height;
|
|
52465
|
+
|
|
52466
|
+
const imageData = ctx.getImageData(0, 0, width, height);
|
|
52467
|
+
|
|
52468
|
+
const data = imageData.data;
|
|
52469
|
+
|
|
52470
|
+
assert.equal(data.length, target.height * target.width * target.itemSize);
|
|
52471
|
+
|
|
52472
|
+
target.data = data;
|
|
52473
|
+
}
|
|
52474
|
+
|
|
52778
52475
|
/**
|
|
52779
52476
|
*
|
|
52780
52477
|
* @param {Sampler2D} input
|
|
@@ -53009,52 +52706,96 @@ function sampler2d_scale(input, output) {
|
|
|
53009
52706
|
}
|
|
53010
52707
|
|
|
53011
52708
|
/**
|
|
53012
|
-
*
|
|
53013
|
-
* @
|
|
53014
|
-
* @returns {number}
|
|
52709
|
+
* Color blending modes
|
|
52710
|
+
* @enum {number}
|
|
53015
52711
|
*/
|
|
53016
|
-
|
|
53017
|
-
|
|
53018
|
-
|
|
52712
|
+
const BlendingType = {
|
|
52713
|
+
NoBlending: 5,
|
|
52714
|
+
Normal: 0,
|
|
52715
|
+
Add: 1,
|
|
52716
|
+
Subtract: 2,
|
|
52717
|
+
Multiply: 3,
|
|
52718
|
+
MultiplyAdd: 4
|
|
52719
|
+
};
|
|
53019
52720
|
|
|
53020
52721
|
/**
|
|
53021
52722
|
*
|
|
53022
|
-
* @param {number}
|
|
53023
|
-
* @
|
|
52723
|
+
* @param {number[]} source
|
|
52724
|
+
* @param {number[]} destination
|
|
52725
|
+
* @param {Array} result
|
|
53024
52726
|
*/
|
|
53025
|
-
function
|
|
53026
|
-
|
|
53027
|
-
|
|
53028
|
-
|
|
52727
|
+
function blendFunctionNormal(source, destination, result) {
|
|
52728
|
+
|
|
52729
|
+
const a1 = source[3] / 255;
|
|
52730
|
+
const a0 = destination[3] / 255;
|
|
52731
|
+
|
|
52732
|
+
result[0] = source[0] * a1 + destination[0] * (1 - a1);
|
|
52733
|
+
result[1] = source[1] * a1 + destination[1] * (1 - a1);
|
|
52734
|
+
result[2] = source[2] * a1 + destination[2] * (1 - a1);
|
|
52735
|
+
result[3] = (a1 + a0 * (1 - a1)) * 255;
|
|
52736
|
+
}
|
|
52737
|
+
|
|
53029
52738
|
/**
|
|
53030
|
-
*
|
|
53031
|
-
*
|
|
53032
|
-
* @
|
|
53033
|
-
* @param {
|
|
53034
|
-
* @param {number}
|
|
53035
|
-
* @param {
|
|
53036
|
-
* @param {number}
|
|
53037
|
-
* @param {number}
|
|
52739
|
+
* Assumes both samplers are RGBA uint8 with values 0-255
|
|
52740
|
+
* @param {Sampler2D} destination
|
|
52741
|
+
* @param {Sampler2D} source
|
|
52742
|
+
* @param {number} sourceX
|
|
52743
|
+
* @param {number} sourceY
|
|
52744
|
+
* @param {number} destinationX
|
|
52745
|
+
* @param {number} destinationY
|
|
52746
|
+
* @param {number} width
|
|
52747
|
+
* @param {number} height
|
|
52748
|
+
* @param {BlendingType} [blendMode]
|
|
53038
52749
|
*/
|
|
53039
|
-
function
|
|
53040
|
-
source,
|
|
53041
|
-
source_position,
|
|
52750
|
+
function sampler2d_paint(
|
|
53042
52751
|
destination,
|
|
53043
|
-
|
|
53044
|
-
|
|
52752
|
+
source,
|
|
52753
|
+
sourceX, sourceY,
|
|
52754
|
+
destinationX, destinationY,
|
|
52755
|
+
width, height,
|
|
52756
|
+
blendMode = BlendingType.Normal
|
|
53045
52757
|
) {
|
|
53046
|
-
assert.isNonNegativeInteger(source_position, 'source_position');
|
|
53047
|
-
assert.isNonNegativeInteger(destination_position, 'destination_position');
|
|
53048
|
-
assert.isNonNegativeInteger(length, 'length');
|
|
53049
52758
|
|
|
53050
|
-
let
|
|
52759
|
+
let blendFunction;
|
|
52760
|
+
if (blendMode === BlendingType.Normal) {
|
|
52761
|
+
blendFunction = blendFunctionNormal;
|
|
52762
|
+
} else {
|
|
52763
|
+
throw new Error(`Unsupported blendType(=${blendMode})`);
|
|
52764
|
+
}
|
|
53051
52765
|
|
|
53052
|
-
|
|
53053
|
-
|
|
53054
|
-
j = destination_position + k;
|
|
52766
|
+
const _w = Math.min(width, source.width - sourceX, destination.width - destinationX);
|
|
52767
|
+
const _h = Math.min(height, source.height - sourceY, destination.height - destinationY);
|
|
53055
52768
|
|
|
53056
|
-
|
|
52769
|
+
const _x0 = Math.max(0, -destinationX);
|
|
52770
|
+
const _y0 = Math.max(0, -destinationY);
|
|
52771
|
+
|
|
52772
|
+
const c0 = [0, 0, 0, 255];
|
|
52773
|
+
const c1 = [0, 0, 0, 255];
|
|
52774
|
+
|
|
52775
|
+
const c3 = [];
|
|
52776
|
+
|
|
52777
|
+
let x, y;
|
|
52778
|
+
|
|
52779
|
+
for (y = _y0; y < _h; y++) {
|
|
52780
|
+
for (x = _x0; x < _w; x++) {
|
|
52781
|
+
const d_x = Math.round(x + destinationX);
|
|
52782
|
+
const d_y = Math.round(y + destinationY);
|
|
52783
|
+
|
|
52784
|
+
destination.read(d_x, d_y, c0);
|
|
52785
|
+
|
|
52786
|
+
const s_x = Math.round(x + sourceY);
|
|
52787
|
+
const s_y = Math.round(y + sourceY);
|
|
52788
|
+
|
|
52789
|
+
source.read(s_x, s_y, c1);
|
|
52790
|
+
|
|
52791
|
+
blendFunction(c1, c0, c3);
|
|
52792
|
+
|
|
52793
|
+
destination.set(d_x, d_y, c3);
|
|
52794
|
+
|
|
52795
|
+
}
|
|
53057
52796
|
}
|
|
52797
|
+
|
|
52798
|
+
|
|
53058
52799
|
}
|
|
53059
52800
|
|
|
53060
52801
|
/**
|
|
@@ -53112,7 +52853,7 @@ class TerrainOverlay {
|
|
|
53112
52853
|
*/
|
|
53113
52854
|
this.size = new Vector2(size.x, size.y);
|
|
53114
52855
|
|
|
53115
|
-
|
|
52856
|
+
/**
|
|
53116
52857
|
*
|
|
53117
52858
|
* @type {ObservedString}
|
|
53118
52859
|
*/
|
|
@@ -53163,7 +52904,7 @@ class TerrainOverlay {
|
|
|
53163
52904
|
*
|
|
53164
52905
|
* @returns {string}
|
|
53165
52906
|
*/
|
|
53166
|
-
get baseTileImage(){
|
|
52907
|
+
get baseTileImage() {
|
|
53167
52908
|
return this.stack.length === 0 ? this.tileImage.getValue() : this.stack[0].tileImage
|
|
53168
52909
|
}
|
|
53169
52910
|
|
|
@@ -53171,7 +52912,7 @@ class TerrainOverlay {
|
|
|
53171
52912
|
*
|
|
53172
52913
|
* @param {string} v
|
|
53173
52914
|
*/
|
|
53174
|
-
set baseTileImage(v){
|
|
52915
|
+
set baseTileImage(v) {
|
|
53175
52916
|
if (this.stack.length === 0) {
|
|
53176
52917
|
this.tileImage.set(v);
|
|
53177
52918
|
} else {
|
|
@@ -53359,7 +53100,7 @@ class TerrainOverlay {
|
|
|
53359
53100
|
const scaled_source = Sampler2D.uint8(4, dWidth, dHeight);
|
|
53360
53101
|
sampler2d_scale(source, scaled_source);
|
|
53361
53102
|
|
|
53362
|
-
this
|
|
53103
|
+
sampler2d_paint(this, scaled_source, 0, 0, dx, dy, dWidth, dHeight);
|
|
53363
53104
|
|
|
53364
53105
|
this.texture.needsUpdate = true;
|
|
53365
53106
|
}
|
|
@@ -53396,31 +53137,30 @@ function loadCloudTexture(url) {
|
|
|
53396
53137
|
|
|
53397
53138
|
|
|
53398
53139
|
class Clouds {
|
|
53399
|
-
|
|
53400
|
-
|
|
53401
|
-
|
|
53402
|
-
|
|
53403
|
-
|
|
53404
|
-
|
|
53405
|
-
|
|
53406
|
-
|
|
53407
|
-
|
|
53408
|
-
|
|
53409
|
-
|
|
53410
|
-
|
|
53411
|
-
|
|
53412
|
-
this.time = 0;
|
|
53140
|
+
/**
|
|
53141
|
+
*
|
|
53142
|
+
* @type {boolean}
|
|
53143
|
+
* @private
|
|
53144
|
+
*/
|
|
53145
|
+
__enabled = false;
|
|
53146
|
+
/**
|
|
53147
|
+
*
|
|
53148
|
+
* @type {Array}
|
|
53149
|
+
* @private
|
|
53150
|
+
*/
|
|
53151
|
+
materials = [];
|
|
53152
|
+
time = 0;
|
|
53413
53153
|
|
|
53414
53154
|
|
|
53415
|
-
|
|
53416
|
-
|
|
53417
|
-
|
|
53155
|
+
__speed0 = new Vector2();
|
|
53156
|
+
__speed1 = new Vector2();
|
|
53157
|
+
__speed2 = new Vector2();
|
|
53418
53158
|
|
|
53419
|
-
|
|
53420
|
-
|
|
53159
|
+
//how fast clouds reform
|
|
53160
|
+
variability = 0.37;
|
|
53421
53161
|
|
|
53162
|
+
constructor() {
|
|
53422
53163
|
this.setSpeed(0.5, -0.5);
|
|
53423
|
-
|
|
53424
53164
|
}
|
|
53425
53165
|
|
|
53426
53166
|
/**
|
|
@@ -55270,7 +55010,7 @@ function rgb2uint24(r, g, b) {
|
|
|
55270
55010
|
/**
|
|
55271
55011
|
* Convert a decimal value to hex
|
|
55272
55012
|
* @param {number} c generally expects b byte value, 0-255
|
|
55273
|
-
* @returns {string}
|
|
55013
|
+
* @returns {string} zero-padded value, for example instead of "0", will return "00" and instead of "F" will return "0F"
|
|
55274
55014
|
*/
|
|
55275
55015
|
function dec2hex(c) {
|
|
55276
55016
|
const hex = Math.round(c).toString(16);
|
|
@@ -72149,6 +71889,25 @@ BitSet.fixedSize = function (x) {
|
|
|
72149
71889
|
*/
|
|
72150
71890
|
|
|
72151
71891
|
class EntityObserver {
|
|
71892
|
+
/**
|
|
71893
|
+
*
|
|
71894
|
+
* @type {BitSet}
|
|
71895
|
+
*/
|
|
71896
|
+
componentMask = new BitSet();
|
|
71897
|
+
|
|
71898
|
+
/**
|
|
71899
|
+
* Mapping from component index to position in array of observed component types,
|
|
71900
|
+
* this is used to build arguments for callbacks
|
|
71901
|
+
* @type {number[]}
|
|
71902
|
+
*/
|
|
71903
|
+
componentIndexMapping = [];
|
|
71904
|
+
|
|
71905
|
+
/**
|
|
71906
|
+
*
|
|
71907
|
+
* @type {EntityComponentDataset|null}
|
|
71908
|
+
*/
|
|
71909
|
+
dataset = null;
|
|
71910
|
+
|
|
72152
71911
|
/**
|
|
72153
71912
|
*
|
|
72154
71913
|
* @param {Array} componentTypes
|
|
@@ -72157,7 +71916,12 @@ class EntityObserver {
|
|
|
72157
71916
|
* @param {*} [thisArg=undefined] will assume {@link this} value inside callbacks
|
|
72158
71917
|
* @constructor
|
|
72159
71918
|
*/
|
|
72160
|
-
constructor(
|
|
71919
|
+
constructor(
|
|
71920
|
+
componentTypes,
|
|
71921
|
+
completedCallback,
|
|
71922
|
+
brokenCallback,
|
|
71923
|
+
thisArg
|
|
71924
|
+
) {
|
|
72161
71925
|
assert.isArray(componentTypes, 'componentTypes must be an array, instead was something else');
|
|
72162
71926
|
assert.isFunction(completedCallback, 'completedCallback');
|
|
72163
71927
|
assert.isFunction(brokenCallback, 'brokenCallback');
|
|
@@ -72196,26 +71960,6 @@ class EntityObserver {
|
|
|
72196
71960
|
* @type {*}
|
|
72197
71961
|
*/
|
|
72198
71962
|
this.thisArg = thisArg;
|
|
72199
|
-
|
|
72200
|
-
|
|
72201
|
-
/**
|
|
72202
|
-
*
|
|
72203
|
-
* @type {BitSet}
|
|
72204
|
-
*/
|
|
72205
|
-
this.componentMask = new BitSet();
|
|
72206
|
-
|
|
72207
|
-
/**
|
|
72208
|
-
* Mapping from component index to position in array of observed component types,
|
|
72209
|
-
* this is used to build arguments for callbacks
|
|
72210
|
-
* @type {number[]}
|
|
72211
|
-
*/
|
|
72212
|
-
this.componentIndexMapping = [];
|
|
72213
|
-
|
|
72214
|
-
/**
|
|
72215
|
-
*
|
|
72216
|
-
* @type {EntityComponentDataset|null}
|
|
72217
|
-
*/
|
|
72218
|
-
this.dataset = null;
|
|
72219
71963
|
}
|
|
72220
71964
|
|
|
72221
71965
|
/**
|
|
@@ -73300,6 +73044,9 @@ class EntityManager {
|
|
|
73300
73044
|
on = {
|
|
73301
73045
|
systemStarted: new Signal(),
|
|
73302
73046
|
systemStopped: new Signal(),
|
|
73047
|
+
/**
|
|
73048
|
+
* @type {Signal<System>}
|
|
73049
|
+
*/
|
|
73303
73050
|
systemAdded: new Signal(),
|
|
73304
73051
|
systemRemoved: new Signal(),
|
|
73305
73052
|
};
|
|
@@ -74726,17 +74473,43 @@ ParentEntity.serializable = false;
|
|
|
74726
74473
|
const DEFAULT_FLAGS$1 = EntityNodeFlags.LiveManagement;
|
|
74727
74474
|
|
|
74728
74475
|
class EntityNode {
|
|
74476
|
+
/**
|
|
74477
|
+
*
|
|
74478
|
+
* @type {EntityNode|null}
|
|
74479
|
+
* @private
|
|
74480
|
+
*/
|
|
74481
|
+
__parent = null;
|
|
74482
|
+
|
|
74483
|
+
/**
|
|
74484
|
+
*
|
|
74485
|
+
* @type {EntityNode[]}
|
|
74486
|
+
* @private
|
|
74487
|
+
*/
|
|
74488
|
+
__children = [];
|
|
74489
|
+
|
|
74490
|
+
/**
|
|
74491
|
+
* Local transform
|
|
74492
|
+
* @type {Transform}
|
|
74493
|
+
* @private
|
|
74494
|
+
*/
|
|
74495
|
+
__transform = new Transform();
|
|
74496
|
+
|
|
74497
|
+
on = {
|
|
74498
|
+
built: new Signal(),
|
|
74499
|
+
destroyed: new Signal()
|
|
74500
|
+
};
|
|
74501
|
+
|
|
74502
|
+
/**
|
|
74503
|
+
*
|
|
74504
|
+
* @type {number}
|
|
74505
|
+
*/
|
|
74506
|
+
flags = DEFAULT_FLAGS$1;
|
|
74507
|
+
|
|
74729
74508
|
/**
|
|
74730
74509
|
*
|
|
74731
74510
|
* @param {Entity} [entity] optional entity to be wrapped
|
|
74732
74511
|
*/
|
|
74733
74512
|
constructor(entity = new Entity()) {
|
|
74734
|
-
/**
|
|
74735
|
-
*
|
|
74736
|
-
* @type {EntityNode|null}
|
|
74737
|
-
* @private
|
|
74738
|
-
*/
|
|
74739
|
-
this.__parent = null;
|
|
74740
74513
|
|
|
74741
74514
|
/**
|
|
74742
74515
|
*
|
|
@@ -74745,30 +74518,6 @@ class EntityNode {
|
|
|
74745
74518
|
*/
|
|
74746
74519
|
this.__entity = entity;
|
|
74747
74520
|
|
|
74748
|
-
/**
|
|
74749
|
-
*
|
|
74750
|
-
* @type {EntityNode[]}
|
|
74751
|
-
* @private
|
|
74752
|
-
*/
|
|
74753
|
-
this.__children = [];
|
|
74754
|
-
|
|
74755
|
-
/**
|
|
74756
|
-
* Local transform
|
|
74757
|
-
* @type {Transform}
|
|
74758
|
-
* @private
|
|
74759
|
-
*/
|
|
74760
|
-
this.__transform = new Transform();
|
|
74761
|
-
|
|
74762
|
-
this.on = {
|
|
74763
|
-
built: new Signal(),
|
|
74764
|
-
destroyed: new Signal()
|
|
74765
|
-
};
|
|
74766
|
-
|
|
74767
|
-
/**
|
|
74768
|
-
*
|
|
74769
|
-
* @type {number}
|
|
74770
|
-
*/
|
|
74771
|
-
this.flags = DEFAULT_FLAGS$1;
|
|
74772
74521
|
}
|
|
74773
74522
|
|
|
74774
74523
|
/**
|
|
@@ -79439,7 +79188,6 @@ class EnginePlugin extends BaseProcess {
|
|
|
79439
79188
|
*/
|
|
79440
79189
|
engine = null;
|
|
79441
79190
|
|
|
79442
|
-
|
|
79443
79191
|
attach() {
|
|
79444
79192
|
/**
|
|
79445
79193
|
* Must be unique for each plugin
|
|
@@ -82587,10 +82335,12 @@ const SerializationFlags = {
|
|
|
82587
82335
|
};
|
|
82588
82336
|
|
|
82589
82337
|
class SerializationMetadata {
|
|
82590
|
-
constructor() {
|
|
82591
|
-
this.flags = 0;
|
|
82592
|
-
}
|
|
82593
82338
|
|
|
82339
|
+
/**
|
|
82340
|
+
*
|
|
82341
|
+
* @type {number}
|
|
82342
|
+
*/
|
|
82343
|
+
flags = 0;
|
|
82594
82344
|
|
|
82595
82345
|
/**
|
|
82596
82346
|
*
|
|
@@ -109375,6 +109125,64 @@ class IdPool {
|
|
|
109375
109125
|
}
|
|
109376
109126
|
}
|
|
109377
109127
|
|
|
109128
|
+
/**
|
|
109129
|
+
* @template T
|
|
109130
|
+
* @param {T} object
|
|
109131
|
+
* @return {T}
|
|
109132
|
+
*/
|
|
109133
|
+
function invokeObjectClone(object) {
|
|
109134
|
+
return object.clone();
|
|
109135
|
+
}
|
|
109136
|
+
|
|
109137
|
+
/**
|
|
109138
|
+
* Copy a patch from another sampler with the same itemSize
|
|
109139
|
+
* @param {Sampler2D} destination
|
|
109140
|
+
* @param {Sampler2D} source where to copy from
|
|
109141
|
+
* @param {Number} sourceX where to start reading from, X coordinate
|
|
109142
|
+
* @param {Number} sourceY where to start reading from, X coordinate
|
|
109143
|
+
* @param {Number} destinationX where to start writing to, X coordinate
|
|
109144
|
+
* @param {Number} destinationY where to start writing to, X coordinate
|
|
109145
|
+
* @param {Number} width size of the patch that is to be copied
|
|
109146
|
+
* @param {Number} height size of the patch that is to be copied
|
|
109147
|
+
*/
|
|
109148
|
+
function sampler2d_sub_copy_same_item_size(destination, source, sourceX, sourceY, destinationX, destinationY, width, height) {
|
|
109149
|
+
const itemSize = destination.itemSize;
|
|
109150
|
+
const sItemSize = source.itemSize;
|
|
109151
|
+
|
|
109152
|
+
assert.equal(sItemSize, sItemSize, `source.itemSize(=${sItemSize}) != destination.itemSize(=${itemSize})`);
|
|
109153
|
+
|
|
109154
|
+
const _w = Math.min(width, source.width - sourceX, destination.width - destinationX);
|
|
109155
|
+
const _h = Math.min(height, source.height - sourceY, destination.height - destinationY);
|
|
109156
|
+
|
|
109157
|
+
|
|
109158
|
+
const dRowSize = itemSize * destination.width;
|
|
109159
|
+
const sRowSize = itemSize * source.width;
|
|
109160
|
+
|
|
109161
|
+
const sData = source.data;
|
|
109162
|
+
const dData = destination.data;
|
|
109163
|
+
|
|
109164
|
+
const patchRowSize = _w * itemSize;
|
|
109165
|
+
|
|
109166
|
+
let y, i;
|
|
109167
|
+
|
|
109168
|
+
for (y = 0; y < _h; y++) {
|
|
109169
|
+
const dA = (y + destinationY) * dRowSize;
|
|
109170
|
+
const sA = (y + sourceY) * sRowSize;
|
|
109171
|
+
|
|
109172
|
+
const dOffset = dA + destinationX * itemSize;
|
|
109173
|
+
const sOffset = sA + sourceX * itemSize;
|
|
109174
|
+
|
|
109175
|
+
for (i = 0; i < patchRowSize; i++) {
|
|
109176
|
+
|
|
109177
|
+
dData[dOffset + i] = sData[sOffset + i];
|
|
109178
|
+
|
|
109179
|
+
}
|
|
109180
|
+
}
|
|
109181
|
+
|
|
109182
|
+
// update destination version
|
|
109183
|
+
destination.version++;
|
|
109184
|
+
}
|
|
109185
|
+
|
|
109378
109186
|
class AtlasPatch {
|
|
109379
109187
|
constructor() {
|
|
109380
109188
|
/**
|
|
@@ -109543,15 +109351,6 @@ const AtlasPatchFlag = {
|
|
|
109543
109351
|
Attached: 4
|
|
109544
109352
|
};
|
|
109545
109353
|
|
|
109546
|
-
/**
|
|
109547
|
-
* @template T
|
|
109548
|
-
* @param {T} object
|
|
109549
|
-
* @return {T}
|
|
109550
|
-
*/
|
|
109551
|
-
function invokeObjectClone(object) {
|
|
109552
|
-
return object.clone();
|
|
109553
|
-
}
|
|
109554
|
-
|
|
109555
109354
|
class TextureAtlas extends AbstractTextureAtlas {
|
|
109556
109355
|
/**
|
|
109557
109356
|
*
|
|
@@ -109750,7 +109549,8 @@ class TextureAtlas extends AbstractTextureAtlas {
|
|
|
109750
109549
|
const patch_position = patch.position;
|
|
109751
109550
|
const patch_size = patch.size;
|
|
109752
109551
|
|
|
109753
|
-
|
|
109552
|
+
sampler2d_sub_copy_same_item_size(
|
|
109553
|
+
target,
|
|
109754
109554
|
source,
|
|
109755
109555
|
0, 0,
|
|
109756
109556
|
patch_position.x, patch_position.y, patch_size.x, patch_size.y
|
|
@@ -113546,29 +113346,31 @@ var FrustumProjector = {
|
|
|
113546
113346
|
};
|
|
113547
113347
|
|
|
113548
113348
|
class SystemEntityContext {
|
|
113549
|
-
constructor() {
|
|
113550
113349
|
|
|
113551
|
-
|
|
113350
|
+
/**
|
|
113351
|
+
*
|
|
113352
|
+
* @type {number}
|
|
113353
|
+
*/
|
|
113354
|
+
entity = -1;
|
|
113552
113355
|
|
|
113553
|
-
|
|
113554
|
-
|
|
113555
|
-
|
|
113556
|
-
|
|
113557
|
-
|
|
113356
|
+
/**
|
|
113357
|
+
* Pointer back to the system
|
|
113358
|
+
* @type {System}
|
|
113359
|
+
*/
|
|
113360
|
+
system = null;
|
|
113558
113361
|
|
|
113559
|
-
|
|
113560
|
-
|
|
113561
|
-
|
|
113562
|
-
|
|
113563
|
-
|
|
113362
|
+
/**
|
|
113363
|
+
*
|
|
113364
|
+
* @type {*[]}
|
|
113365
|
+
*/
|
|
113366
|
+
components = [];
|
|
113564
113367
|
|
|
113565
|
-
|
|
113566
|
-
|
|
113567
|
-
|
|
113568
|
-
|
|
113569
|
-
|
|
113570
|
-
|
|
113571
|
-
}
|
|
113368
|
+
/**
|
|
113369
|
+
*
|
|
113370
|
+
* @type {boolean}
|
|
113371
|
+
* @protected
|
|
113372
|
+
*/
|
|
113373
|
+
__is_linked = false;
|
|
113572
113374
|
|
|
113573
113375
|
/**
|
|
113574
113376
|
*
|