@woosh/meep-engine 2.75.7 → 2.75.9
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 +1052 -1234
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +1052 -1234
- package/editor/actions/concrete/ModifyPatchSampler2DAction.js +6 -3
- package/editor/actions/concrete/PatchTerrainTextureAction.js +6 -3
- package/editor/ecs/component/createObjectEditor.js +2 -2
- 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/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/core/model/object/ImmutableObjectPool.js +14 -5
- 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/storage/BinaryBufferDeSerializer.js +7 -9
- package/src/engine/ecs/storage/BinaryBufferSerializer.js +15 -16
- package/src/engine/ecs/storage/binary/BinaryClassUpgrader.js +10 -59
- package/src/engine/ecs/storage/binary/BinarySerializationRegistry.js +14 -15
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionDeSerializer.js +3 -3
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +60 -62
- package/src/engine/ecs/storage/binary/executeBinaryClassUpgraderChain.js +46 -0
- package/src/engine/ecs/storage/binary/object/BinaryObjectSerializationAdapter.js +2 -2
- 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/layers/TerrainLayer.js +37 -31
- package/src/engine/ecs/terrain/ecs/layers/TerrainLayers.js +8 -7
- 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/RendererPool.js +36 -40
- package/src/engine/graphics/render/buffer/FrameBuffer.js +25 -24
- package/src/engine/graphics/render/buffer/RenderGraph.js +21 -21
- package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +0 -4
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +1 -5
- package/src/engine/graphics/render/frame_graph/IRenderContext.js +31 -1
- package/src/engine/graphics/render/frame_graph/RenderGraph.js +5 -5
- package/src/engine/graphics/render/frame_graph/RenderTarget.js +9 -0
- package/src/engine/graphics/render/frame_graph/RenderTextureManager.js +57 -0
- package/src/engine/graphics/render/frame_graph/ResourceEntry.js +7 -5
- package/src/engine/graphics/render/frame_graph/TextureDescriptor.js +48 -33
- package/src/engine/graphics/render/frame_graph/TextureInitialState.js +14 -0
- package/src/engine/graphics/render/frame_graph/sample/deferred/CopyPass.js +20 -0
- package/src/engine/graphics/render/frame_graph/sample/deferred/LightingPass.js +4 -0
- package/src/engine/graphics/render/frame_graph/sample/deferred/run.js +34 -6
- package/src/engine/graphics/render/frame_graph/webgl/WebGLRenderContext.js +34 -0
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +3 -6
- package/src/engine/graphics/sh3/gi/prototypeSHGI.js +92 -0
- 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/{v2/VirtualTextureMemoryMapping.js → VirtualTextureMemoryMapping.js} +2 -26
- package/src/engine/graphics/texture/virtual/{v2/VirtualTexturePage.js → VirtualTexturePage.js} +10 -10
- package/src/engine/graphics/texture/virtual/{v2/VirtualTextureTileLoader.js → VirtualTextureTileLoader.js} +7 -7
- package/src/engine/graphics/texture/virtual/{v2/VirtualTextureUsage.js → VirtualTextureUsage.js} +1 -1
- package/src/engine/graphics/texture/virtual/{v2/VirtualTextureUsageUpdater.js → VirtualTextureUsageUpdater.js} +7 -7
- package/src/engine/graphics/texture/virtual/{v2/debug → debug}/ResidencyDebugView.js +4 -4
- package/src/engine/graphics/texture/virtual/{v2/debug → debug}/UsageDebugView.js +2 -2
- package/src/engine/graphics/texture/virtual/{v2/debug → debug}/UsagePyramidDebugView.js +4 -4
- package/src/engine/graphics/texture/virtual/{v2/prototype.js → prototype.js} +7 -7
- package/src/engine/graphics/texture/virtual/{v2/tile → tile}/compose_finger_print.js +1 -1
- package/src/engine/graphics/texture/virtual/{v2/tile → tile}/compose_tile_address.js +2 -2
- package/src/engine/graphics/texture/virtual/{v2/tile → tile}/tile_address_to_finger_print.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/storage/json/Blueprint.js +0 -129
- package/src/engine/ecs/storage/json/EntityFactory.js +0 -207
- package/src/engine/ecs/storage/json/JSONDeSerializer.js +0 -148
- package/src/engine/ecs/storage/json/JSONSerializer.js +0 -132
- package/src/engine/ecs/storage/json/README.md +0 -5
- 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/render/webgpu/sample/MeshInstance.js +0 -108
- package/src/engine/graphics/render/webgpu/sample/fragmentDeferredRendering.wgsl +0 -71
- package/src/engine/graphics/render/webgpu/sample/fragmentGBuffersDebugView.wgsl +0 -39
- package/src/engine/graphics/render/webgpu/sample/fragmentWriteGBuffers.wgsl +0 -21
- package/src/engine/graphics/render/webgpu/sample/lightUpdate.wgsl +0 -41
- package/src/engine/graphics/render/webgpu/sample/main.js +0 -605
- package/src/engine/graphics/render/webgpu/sample/vertexTextureQuad.wgsl +0 -9
- package/src/engine/graphics/render/webgpu/sample/vertexWriteGBuffers.wgsl +0 -30
- 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/virtual/TileOperation.js +0 -13
- package/src/engine/graphics/texture/virtual/TileTree.js +0 -150
- package/src/engine/graphics/texture/virtual/TileTree.spec.js +0 -58
- package/src/engine/graphics/texture/virtual/TileUsage.js +0 -137
- package/src/engine/graphics/texture/virtual/VirtualTexture.js +0 -238
- package/src/engine/graphics/texture/virtual/VirtualTexture.spec.js +0 -39
- package/src/engine/graphics/texture/virtual/page/TilePage.js +0 -148
- package/src/engine/graphics/texture/virtual/page/TilePageSlot.js +0 -36
- package/src/engine/graphics/texture/virtual/tile/Tile.js +0 -44
- package/src/engine/graphics/texture/virtual/tile/Tile.spec.js +0 -11
- package/src/engine/graphics/texture/virtual/tile/TileAddress.js +0 -63
- package/src/engine/graphics/texture/virtual/tile/TileAddress.spec.js +0 -30
- package/src/engine/graphics/texture/virtual/tile/TileLoader.js +0 -178
- package/src/engine/graphics/texture/virtual/tile/TileRequest.js +0 -40
- package/src/engine/graphics/texture/virtual/tile/TileStatus.js +0 -10
- package/src/engine/navigation/ecs/components/computeNonuniformCatmullRomSplineSample.js +0 -242
- /package/src/engine/graphics/texture/virtual/{v2/NOTES.md → NOTES.md} +0 -0
- /package/src/engine/graphics/texture/virtual/{v2/VirtualTextureMaterial.js → VirtualTextureMaterial.js} +0 -0
- /package/src/engine/graphics/texture/virtual/{v2/VirtualTextureUsageShader.js → VirtualTextureUsageShader.js} +0 -0
- /package/src/engine/graphics/texture/virtual/{v2/tile → tile}/VirtualTextureTile.js +0 -0
- /package/src/engine/graphics/texture/virtual/{v2/tile → tile}/decompose_finger_print.js +0 -0
- /package/src/engine/graphics/texture/virtual/{v2/tile → tile}/finger_print_to_tile_address.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);
|
|
@@ -61263,46 +61003,47 @@ function heightMap2NormalMap(renderer, sampler) {
|
|
|
61263
61003
|
return new Sampler2D(rgb, 3, width, height);
|
|
61264
61004
|
}
|
|
61265
61005
|
|
|
61266
|
-
|
|
61267
|
-
this.used = new Set();
|
|
61268
|
-
}
|
|
61006
|
+
class WebGLRendererPool {
|
|
61269
61007
|
|
|
61270
|
-
|
|
61271
|
-
const canvas = document.createElement('canvas');
|
|
61272
|
-
const context = canvas.getContext('webgl2', { antialias: true });
|
|
61008
|
+
used = new Set();
|
|
61273
61009
|
|
|
61274
|
-
|
|
61275
|
-
|
|
61276
|
-
context,
|
|
61277
|
-
canvas
|
|
61278
|
-
});
|
|
61010
|
+
get(options) {
|
|
61011
|
+
const canvas = document.createElement('canvas');
|
|
61012
|
+
const context = canvas.getContext('webgl2', { antialias: true });
|
|
61279
61013
|
|
|
61280
|
-
|
|
61014
|
+
const renderer = new WebGLRenderer({
|
|
61015
|
+
alpha: true,
|
|
61016
|
+
context,
|
|
61017
|
+
canvas
|
|
61018
|
+
});
|
|
61281
61019
|
|
|
61282
|
-
|
|
61283
|
-
return renderer;
|
|
61284
|
-
};
|
|
61020
|
+
assert.equal(renderer.domElement, canvas, 'renderer.domElement !== canvas');
|
|
61285
61021
|
|
|
61286
|
-
|
|
61287
|
-
|
|
61288
|
-
* @param {THREE.WebGLRenderer} renderer
|
|
61289
|
-
* @returns {boolean}
|
|
61290
|
-
*/
|
|
61291
|
-
WebGLRendererPool.prototype.release = function (renderer) {
|
|
61292
|
-
if (!this.used.has(renderer)) {
|
|
61293
|
-
//not from this pool
|
|
61294
|
-
return false;
|
|
61022
|
+
this.used.add(renderer);
|
|
61023
|
+
return renderer;
|
|
61295
61024
|
}
|
|
61296
|
-
this.used.delete(renderer);
|
|
61297
61025
|
|
|
61298
|
-
|
|
61299
|
-
|
|
61300
|
-
|
|
61026
|
+
/**
|
|
61027
|
+
*
|
|
61028
|
+
* @param {THREE.WebGLRenderer} renderer
|
|
61029
|
+
* @returns {boolean}
|
|
61030
|
+
*/
|
|
61031
|
+
release(renderer) {
|
|
61032
|
+
if (!this.used.has(renderer)) {
|
|
61033
|
+
//not from this pool
|
|
61034
|
+
return false;
|
|
61035
|
+
}
|
|
61036
|
+
this.used.delete(renderer);
|
|
61301
61037
|
|
|
61302
|
-
|
|
61303
|
-
|
|
61038
|
+
renderer.forceContextLoss();
|
|
61039
|
+
renderer.dispose();
|
|
61040
|
+
renderer.domElement = null;
|
|
61304
61041
|
|
|
61305
|
-
|
|
61042
|
+
return true;
|
|
61043
|
+
}
|
|
61044
|
+
|
|
61045
|
+
static global = new WebGLRendererPool();
|
|
61046
|
+
}
|
|
61306
61047
|
|
|
61307
61048
|
/**
|
|
61308
61049
|
*
|
|
@@ -62972,185 +62713,6 @@ Cache.prototype.delete = Cache.prototype.remove;
|
|
|
62972
62713
|
*/
|
|
62973
62714
|
Cache.prototype.has = Cache.prototype.contains;
|
|
62974
62715
|
|
|
62975
|
-
/**
|
|
62976
|
-
* Compute byte size of a UTF8 string
|
|
62977
|
-
* @param {string} value
|
|
62978
|
-
* @returns {number}
|
|
62979
|
-
*/
|
|
62980
|
-
function string_compute_byte_size(value) {
|
|
62981
|
-
const length = value.length;
|
|
62982
|
-
|
|
62983
|
-
let p = 0;
|
|
62984
|
-
|
|
62985
|
-
for (let i = 0; i < length; i++) {
|
|
62986
|
-
let c = value.charCodeAt(i);
|
|
62987
|
-
while (c > 0xff) {
|
|
62988
|
-
p++;
|
|
62989
|
-
c >>= 8;
|
|
62990
|
-
}
|
|
62991
|
-
p++;
|
|
62992
|
-
}
|
|
62993
|
-
|
|
62994
|
-
return p;
|
|
62995
|
-
}
|
|
62996
|
-
|
|
62997
|
-
/**
|
|
62998
|
-
*
|
|
62999
|
-
* @type {Cache<String,Sampler2D>}
|
|
63000
|
-
*/
|
|
63001
|
-
const cache$1 = new Cache({
|
|
63002
|
-
maxWeight: 304857600,
|
|
63003
|
-
keyHashFunction: computeStringHash,
|
|
63004
|
-
keyWeigher: string_compute_byte_size,
|
|
63005
|
-
/**
|
|
63006
|
-
*
|
|
63007
|
-
* @param {Sampler2D} sampler
|
|
63008
|
-
* @returns {number}
|
|
63009
|
-
*/
|
|
63010
|
-
valueWeigher(sampler) {
|
|
63011
|
-
return sampler.computeByteSize();
|
|
63012
|
-
}
|
|
63013
|
-
});
|
|
63014
|
-
|
|
63015
|
-
class TerrainLayer {
|
|
63016
|
-
constructor() {
|
|
63017
|
-
/**
|
|
63018
|
-
*
|
|
63019
|
-
* @type {String}
|
|
63020
|
-
*/
|
|
63021
|
-
this.textureDiffuseURL = "";
|
|
63022
|
-
|
|
63023
|
-
/**
|
|
63024
|
-
*
|
|
63025
|
-
* @type {Sampler2D}
|
|
63026
|
-
*/
|
|
63027
|
-
this.diffuse = Sampler2D.uint8(3, 1, 1);
|
|
63028
|
-
|
|
63029
|
-
/**
|
|
63030
|
-
*
|
|
63031
|
-
* @type {Vector2}
|
|
63032
|
-
*/
|
|
63033
|
-
this.size = new Vector2(1, 1);
|
|
63034
|
-
|
|
63035
|
-
/**
|
|
63036
|
-
* Additional free-form JSON metadata
|
|
63037
|
-
* @type {Object}
|
|
63038
|
-
*/
|
|
63039
|
-
this.extra = {};
|
|
63040
|
-
|
|
63041
|
-
/**
|
|
63042
|
-
*
|
|
63043
|
-
* @type {Signal}
|
|
63044
|
-
*/
|
|
63045
|
-
this.onChanged = new Signal();
|
|
63046
|
-
}
|
|
63047
|
-
|
|
63048
|
-
toJSON() {
|
|
63049
|
-
return {
|
|
63050
|
-
textureDiffuseURL: this.textureDiffuseURL,
|
|
63051
|
-
size: this.size.toJSON(),
|
|
63052
|
-
extra: this.extra
|
|
63053
|
-
};
|
|
63054
|
-
}
|
|
63055
|
-
|
|
63056
|
-
fromJSON({ textureDiffuseURL, size, extra = {} }) {
|
|
63057
|
-
this.textureDiffuseURL = textureDiffuseURL;
|
|
63058
|
-
this.size.fromJSON(size);
|
|
63059
|
-
this.extra = extra;
|
|
63060
|
-
}
|
|
63061
|
-
|
|
63062
|
-
/**
|
|
63063
|
-
*
|
|
63064
|
-
* @param {string} url
|
|
63065
|
-
* @param {number} width
|
|
63066
|
-
* @param {number} height
|
|
63067
|
-
*/
|
|
63068
|
-
static from(url, width, height) {
|
|
63069
|
-
const r = new TerrainLayer();
|
|
63070
|
-
|
|
63071
|
-
r.textureDiffuseURL = url;
|
|
63072
|
-
r.size.set(width, height);
|
|
63073
|
-
|
|
63074
|
-
return r;
|
|
63075
|
-
}
|
|
63076
|
-
|
|
63077
|
-
/**
|
|
63078
|
-
*
|
|
63079
|
-
* @param {TerrainLayerDescription} d
|
|
63080
|
-
* @returns {TerrainLayer}
|
|
63081
|
-
*/
|
|
63082
|
-
static fromDescription(d) {
|
|
63083
|
-
return TerrainLayer.from(
|
|
63084
|
-
d.diffuse,
|
|
63085
|
-
d.size.x,
|
|
63086
|
-
d.size.y
|
|
63087
|
-
);
|
|
63088
|
-
}
|
|
63089
|
-
|
|
63090
|
-
/**
|
|
63091
|
-
*
|
|
63092
|
-
* @param {AssetManager} assetManager
|
|
63093
|
-
* @returns {Promise}
|
|
63094
|
-
*/
|
|
63095
|
-
loadTextureData(assetManager) {
|
|
63096
|
-
|
|
63097
|
-
const path = this.textureDiffuseURL;
|
|
63098
|
-
|
|
63099
|
-
/**
|
|
63100
|
-
*
|
|
63101
|
-
* @type {Sampler2D|null}
|
|
63102
|
-
*/
|
|
63103
|
-
const cached = cache$1.get(path);
|
|
63104
|
-
|
|
63105
|
-
if (cached !== null) {
|
|
63106
|
-
|
|
63107
|
-
console.log('Using cached terrain layer data for ', path);
|
|
63108
|
-
|
|
63109
|
-
this.diffuse.resize(cached.width, cached.height, false);
|
|
63110
|
-
|
|
63111
|
-
this.diffuse.data.set(cached.data);
|
|
63112
|
-
|
|
63113
|
-
this.onChanged.send0();
|
|
63114
|
-
|
|
63115
|
-
return Promise.resolve();
|
|
63116
|
-
|
|
63117
|
-
}
|
|
63118
|
-
|
|
63119
|
-
const assetPromise = assetManager.promise(path, GameAssetType.Image);
|
|
63120
|
-
|
|
63121
|
-
return assetPromise
|
|
63122
|
-
.then(assert => {
|
|
63123
|
-
const image = assert.create();
|
|
63124
|
-
|
|
63125
|
-
const source_item_size = image.itemSize;
|
|
63126
|
-
|
|
63127
|
-
const source_data = image.data;
|
|
63128
|
-
|
|
63129
|
-
// RGB
|
|
63130
|
-
const destination_item_size = 3;
|
|
63131
|
-
|
|
63132
|
-
if (this.diffuse === null || this.diffuse.width !== image.width || this.diffuse.height !== image.height) {
|
|
63133
|
-
// loaded image does not match the side of the layer
|
|
63134
|
-
this.diffuse = Sampler2D.uint8(destination_item_size, image.width, image.height);
|
|
63135
|
-
}
|
|
63136
|
-
|
|
63137
|
-
const source = new Sampler2D(source_data, source_item_size, image.width, image.height);
|
|
63138
|
-
|
|
63139
|
-
copy_Sampler2D_channel_data(source, this.diffuse);
|
|
63140
|
-
|
|
63141
|
-
this.onChanged.send0();
|
|
63142
|
-
|
|
63143
|
-
// write to cache
|
|
63144
|
-
const cacheCopy = Sampler2D.uint8(destination_item_size, image.width, image.height);
|
|
63145
|
-
|
|
63146
|
-
cacheCopy.data.set(this.diffuse.data);
|
|
63147
|
-
|
|
63148
|
-
cache$1.put(path, cacheCopy);
|
|
63149
|
-
|
|
63150
|
-
});
|
|
63151
|
-
}
|
|
63152
|
-
}
|
|
63153
|
-
|
|
63154
62716
|
/**
|
|
63155
62717
|
* @template T
|
|
63156
62718
|
* @param {T[]} array
|
|
@@ -64178,6 +63740,191 @@ function conditionEqualsStrict(v) {
|
|
|
64178
63740
|
return this === v;
|
|
64179
63741
|
}
|
|
64180
63742
|
|
|
63743
|
+
/**
|
|
63744
|
+
* Compute byte size of a UTF8 string
|
|
63745
|
+
* @param {string} value
|
|
63746
|
+
* @returns {number}
|
|
63747
|
+
*/
|
|
63748
|
+
function string_compute_byte_size(value) {
|
|
63749
|
+
const length = value.length;
|
|
63750
|
+
|
|
63751
|
+
let p = 0;
|
|
63752
|
+
|
|
63753
|
+
for (let i = 0; i < length; i++) {
|
|
63754
|
+
let c = value.charCodeAt(i);
|
|
63755
|
+
while (c > 0xff) {
|
|
63756
|
+
p++;
|
|
63757
|
+
c >>= 8;
|
|
63758
|
+
}
|
|
63759
|
+
p++;
|
|
63760
|
+
}
|
|
63761
|
+
|
|
63762
|
+
return p;
|
|
63763
|
+
}
|
|
63764
|
+
|
|
63765
|
+
/**
|
|
63766
|
+
*
|
|
63767
|
+
* @type {Cache<String,Sampler2D>}
|
|
63768
|
+
*/
|
|
63769
|
+
const cache$1 = new Cache({
|
|
63770
|
+
maxWeight: 304857600,
|
|
63771
|
+
keyHashFunction: computeStringHash,
|
|
63772
|
+
keyWeigher: string_compute_byte_size,
|
|
63773
|
+
/**
|
|
63774
|
+
*
|
|
63775
|
+
* @param {Sampler2D} sampler
|
|
63776
|
+
* @returns {number}
|
|
63777
|
+
*/
|
|
63778
|
+
valueWeigher(sampler) {
|
|
63779
|
+
return sampler.computeByteSize();
|
|
63780
|
+
}
|
|
63781
|
+
});
|
|
63782
|
+
|
|
63783
|
+
class TerrainLayer {
|
|
63784
|
+
|
|
63785
|
+
/**
|
|
63786
|
+
*
|
|
63787
|
+
* @type {String}
|
|
63788
|
+
*/
|
|
63789
|
+
textureDiffuseURL = "";
|
|
63790
|
+
|
|
63791
|
+
/**
|
|
63792
|
+
*
|
|
63793
|
+
* @type {Sampler2D}
|
|
63794
|
+
*/
|
|
63795
|
+
diffuse = Sampler2D.uint8(3, 1, 1);
|
|
63796
|
+
|
|
63797
|
+
/**
|
|
63798
|
+
*
|
|
63799
|
+
* @type {Vector2}
|
|
63800
|
+
*/
|
|
63801
|
+
size = new Vector2(1, 1);
|
|
63802
|
+
|
|
63803
|
+
/**
|
|
63804
|
+
* Additional free-form JSON metadata
|
|
63805
|
+
* @type {Object}
|
|
63806
|
+
*/
|
|
63807
|
+
extra = {};
|
|
63808
|
+
|
|
63809
|
+
/**
|
|
63810
|
+
*
|
|
63811
|
+
* @type {Signal}
|
|
63812
|
+
*/
|
|
63813
|
+
onChanged = new Signal();
|
|
63814
|
+
|
|
63815
|
+
|
|
63816
|
+
toJSON() {
|
|
63817
|
+
return {
|
|
63818
|
+
textureDiffuseURL: this.textureDiffuseURL,
|
|
63819
|
+
size: this.size.toJSON(),
|
|
63820
|
+
extra: this.extra
|
|
63821
|
+
};
|
|
63822
|
+
}
|
|
63823
|
+
|
|
63824
|
+
fromJSON({ textureDiffuseURL, size, extra = {} }) {
|
|
63825
|
+
this.textureDiffuseURL = textureDiffuseURL;
|
|
63826
|
+
this.size.fromJSON(size);
|
|
63827
|
+
this.extra = extra;
|
|
63828
|
+
}
|
|
63829
|
+
|
|
63830
|
+
/**
|
|
63831
|
+
*
|
|
63832
|
+
* @param {string} url
|
|
63833
|
+
* @param {number} width
|
|
63834
|
+
* @param {number} height
|
|
63835
|
+
*/
|
|
63836
|
+
static from(url, width, height) {
|
|
63837
|
+
const r = new TerrainLayer();
|
|
63838
|
+
|
|
63839
|
+
r.textureDiffuseURL = url;
|
|
63840
|
+
r.size.set(width, height);
|
|
63841
|
+
|
|
63842
|
+
return r;
|
|
63843
|
+
}
|
|
63844
|
+
|
|
63845
|
+
/**
|
|
63846
|
+
*
|
|
63847
|
+
* @param {TerrainLayerDescription} d
|
|
63848
|
+
* @returns {TerrainLayer}
|
|
63849
|
+
*/
|
|
63850
|
+
static fromDescription(d) {
|
|
63851
|
+
return TerrainLayer.from(
|
|
63852
|
+
d.diffuse,
|
|
63853
|
+
d.size.x,
|
|
63854
|
+
d.size.y
|
|
63855
|
+
);
|
|
63856
|
+
}
|
|
63857
|
+
|
|
63858
|
+
/**
|
|
63859
|
+
*
|
|
63860
|
+
* @param {AssetManager} assetManager
|
|
63861
|
+
* @returns {Promise}
|
|
63862
|
+
*/
|
|
63863
|
+
loadTextureData(assetManager) {
|
|
63864
|
+
|
|
63865
|
+
const path = this.textureDiffuseURL;
|
|
63866
|
+
|
|
63867
|
+
/**
|
|
63868
|
+
*
|
|
63869
|
+
* @type {Sampler2D|null}
|
|
63870
|
+
*/
|
|
63871
|
+
const cached = cache$1.get(path);
|
|
63872
|
+
|
|
63873
|
+
if (cached !== null) {
|
|
63874
|
+
|
|
63875
|
+
console.log('Using cached terrain layer data for ', path);
|
|
63876
|
+
|
|
63877
|
+
this.diffuse.resize(cached.width, cached.height, false);
|
|
63878
|
+
|
|
63879
|
+
this.diffuse.data.set(cached.data);
|
|
63880
|
+
|
|
63881
|
+
this.onChanged.send0();
|
|
63882
|
+
|
|
63883
|
+
return Promise.resolve();
|
|
63884
|
+
|
|
63885
|
+
}
|
|
63886
|
+
|
|
63887
|
+
const assetPromise = assetManager.promise(path, GameAssetType.Image);
|
|
63888
|
+
|
|
63889
|
+
return assetPromise
|
|
63890
|
+
.then(assert => {
|
|
63891
|
+
const image = assert.create();
|
|
63892
|
+
|
|
63893
|
+
const source_item_size = image.itemSize;
|
|
63894
|
+
|
|
63895
|
+
const source_data = image.data;
|
|
63896
|
+
|
|
63897
|
+
// RGB
|
|
63898
|
+
const destination_item_size = 3;
|
|
63899
|
+
|
|
63900
|
+
if (this.diffuse === null || this.diffuse.width !== image.width || this.diffuse.height !== image.height) {
|
|
63901
|
+
// loaded image does not match the side of the layer
|
|
63902
|
+
this.diffuse = Sampler2D.uint8(destination_item_size, image.width, image.height);
|
|
63903
|
+
}
|
|
63904
|
+
|
|
63905
|
+
const source = new Sampler2D(source_data, source_item_size, image.width, image.height);
|
|
63906
|
+
|
|
63907
|
+
copy_Sampler2D_channel_data(source, this.diffuse);
|
|
63908
|
+
|
|
63909
|
+
this.onChanged.send0();
|
|
63910
|
+
|
|
63911
|
+
// write to cache
|
|
63912
|
+
const cacheCopy = Sampler2D.uint8(destination_item_size, image.width, image.height);
|
|
63913
|
+
|
|
63914
|
+
cacheCopy.data.set(this.diffuse.data);
|
|
63915
|
+
|
|
63916
|
+
cache$1.put(path, cacheCopy);
|
|
63917
|
+
|
|
63918
|
+
});
|
|
63919
|
+
}
|
|
63920
|
+
}
|
|
63921
|
+
|
|
63922
|
+
/**
|
|
63923
|
+
* @readonly
|
|
63924
|
+
* @type {boolean}
|
|
63925
|
+
*/
|
|
63926
|
+
TerrainLayer.prototype.isTerrainLayer = true;
|
|
63927
|
+
|
|
64181
63928
|
class ScaledTextureKey {
|
|
64182
63929
|
uri = '';
|
|
64183
63930
|
|
|
@@ -64432,6 +64179,7 @@ class TerrainLayers {
|
|
|
64432
64179
|
*/
|
|
64433
64180
|
addLayer(layer) {
|
|
64434
64181
|
assert.defined(layer);
|
|
64182
|
+
assert.equal(layer.isTerrainLayer, true, 'layer.isTerrainLayer !== true');
|
|
64435
64183
|
|
|
64436
64184
|
const index = this.layers.length;
|
|
64437
64185
|
|
|
@@ -72141,6 +71889,25 @@ BitSet.fixedSize = function (x) {
|
|
|
72141
71889
|
*/
|
|
72142
71890
|
|
|
72143
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
|
+
|
|
72144
71911
|
/**
|
|
72145
71912
|
*
|
|
72146
71913
|
* @param {Array} componentTypes
|
|
@@ -72149,7 +71916,12 @@ class EntityObserver {
|
|
|
72149
71916
|
* @param {*} [thisArg=undefined] will assume {@link this} value inside callbacks
|
|
72150
71917
|
* @constructor
|
|
72151
71918
|
*/
|
|
72152
|
-
constructor(
|
|
71919
|
+
constructor(
|
|
71920
|
+
componentTypes,
|
|
71921
|
+
completedCallback,
|
|
71922
|
+
brokenCallback,
|
|
71923
|
+
thisArg
|
|
71924
|
+
) {
|
|
72153
71925
|
assert.isArray(componentTypes, 'componentTypes must be an array, instead was something else');
|
|
72154
71926
|
assert.isFunction(completedCallback, 'completedCallback');
|
|
72155
71927
|
assert.isFunction(brokenCallback, 'brokenCallback');
|
|
@@ -72188,26 +71960,6 @@ class EntityObserver {
|
|
|
72188
71960
|
* @type {*}
|
|
72189
71961
|
*/
|
|
72190
71962
|
this.thisArg = thisArg;
|
|
72191
|
-
|
|
72192
|
-
|
|
72193
|
-
/**
|
|
72194
|
-
*
|
|
72195
|
-
* @type {BitSet}
|
|
72196
|
-
*/
|
|
72197
|
-
this.componentMask = new BitSet();
|
|
72198
|
-
|
|
72199
|
-
/**
|
|
72200
|
-
* Mapping from component index to position in array of observed component types,
|
|
72201
|
-
* this is used to build arguments for callbacks
|
|
72202
|
-
* @type {number[]}
|
|
72203
|
-
*/
|
|
72204
|
-
this.componentIndexMapping = [];
|
|
72205
|
-
|
|
72206
|
-
/**
|
|
72207
|
-
*
|
|
72208
|
-
* @type {EntityComponentDataset|null}
|
|
72209
|
-
*/
|
|
72210
|
-
this.dataset = null;
|
|
72211
71963
|
}
|
|
72212
71964
|
|
|
72213
71965
|
/**
|
|
@@ -73292,6 +73044,9 @@ class EntityManager {
|
|
|
73292
73044
|
on = {
|
|
73293
73045
|
systemStarted: new Signal(),
|
|
73294
73046
|
systemStopped: new Signal(),
|
|
73047
|
+
/**
|
|
73048
|
+
* @type {Signal<System>}
|
|
73049
|
+
*/
|
|
73295
73050
|
systemAdded: new Signal(),
|
|
73296
73051
|
systemRemoved: new Signal(),
|
|
73297
73052
|
};
|
|
@@ -74718,17 +74473,43 @@ ParentEntity.serializable = false;
|
|
|
74718
74473
|
const DEFAULT_FLAGS$1 = EntityNodeFlags.LiveManagement;
|
|
74719
74474
|
|
|
74720
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
|
+
|
|
74721
74508
|
/**
|
|
74722
74509
|
*
|
|
74723
74510
|
* @param {Entity} [entity] optional entity to be wrapped
|
|
74724
74511
|
*/
|
|
74725
74512
|
constructor(entity = new Entity()) {
|
|
74726
|
-
/**
|
|
74727
|
-
*
|
|
74728
|
-
* @type {EntityNode|null}
|
|
74729
|
-
* @private
|
|
74730
|
-
*/
|
|
74731
|
-
this.__parent = null;
|
|
74732
74513
|
|
|
74733
74514
|
/**
|
|
74734
74515
|
*
|
|
@@ -74737,30 +74518,6 @@ class EntityNode {
|
|
|
74737
74518
|
*/
|
|
74738
74519
|
this.__entity = entity;
|
|
74739
74520
|
|
|
74740
|
-
/**
|
|
74741
|
-
*
|
|
74742
|
-
* @type {EntityNode[]}
|
|
74743
|
-
* @private
|
|
74744
|
-
*/
|
|
74745
|
-
this.__children = [];
|
|
74746
|
-
|
|
74747
|
-
/**
|
|
74748
|
-
* Local transform
|
|
74749
|
-
* @type {Transform}
|
|
74750
|
-
* @private
|
|
74751
|
-
*/
|
|
74752
|
-
this.__transform = new Transform();
|
|
74753
|
-
|
|
74754
|
-
this.on = {
|
|
74755
|
-
built: new Signal(),
|
|
74756
|
-
destroyed: new Signal()
|
|
74757
|
-
};
|
|
74758
|
-
|
|
74759
|
-
/**
|
|
74760
|
-
*
|
|
74761
|
-
* @type {number}
|
|
74762
|
-
*/
|
|
74763
|
-
this.flags = DEFAULT_FLAGS$1;
|
|
74764
74521
|
}
|
|
74765
74522
|
|
|
74766
74523
|
/**
|
|
@@ -79431,7 +79188,6 @@ class EnginePlugin extends BaseProcess {
|
|
|
79431
79188
|
*/
|
|
79432
79189
|
engine = null;
|
|
79433
79190
|
|
|
79434
|
-
|
|
79435
79191
|
attach() {
|
|
79436
79192
|
/**
|
|
79437
79193
|
* Must be unique for each plugin
|
|
@@ -82579,10 +82335,12 @@ const SerializationFlags = {
|
|
|
82579
82335
|
};
|
|
82580
82336
|
|
|
82581
82337
|
class SerializationMetadata {
|
|
82582
|
-
constructor() {
|
|
82583
|
-
this.flags = 0;
|
|
82584
|
-
}
|
|
82585
82338
|
|
|
82339
|
+
/**
|
|
82340
|
+
*
|
|
82341
|
+
* @type {number}
|
|
82342
|
+
*/
|
|
82343
|
+
flags = 0;
|
|
82586
82344
|
|
|
82587
82345
|
/**
|
|
82588
82346
|
*
|
|
@@ -88676,20 +88434,19 @@ class Graph {
|
|
|
88676
88434
|
* Contains serializers for various data types as well as data upgraders which enable support for serialization format changes
|
|
88677
88435
|
*/
|
|
88678
88436
|
class BinarySerializationRegistry {
|
|
88679
|
-
|
|
88680
|
-
|
|
88681
|
-
|
|
88682
|
-
|
|
88683
|
-
|
|
88684
|
-
|
|
88685
|
-
|
|
88686
|
-
|
|
88687
|
-
|
|
88688
|
-
|
|
88689
|
-
|
|
88690
|
-
|
|
88691
|
-
|
|
88692
|
-
}
|
|
88437
|
+
|
|
88438
|
+
/**
|
|
88439
|
+
* @readonly
|
|
88440
|
+
* @private
|
|
88441
|
+
* @type {Map<string, Graph<BinaryClassUpgrader>>}
|
|
88442
|
+
*/
|
|
88443
|
+
upgraders = new Map();
|
|
88444
|
+
/**
|
|
88445
|
+
* @readonly
|
|
88446
|
+
* @private
|
|
88447
|
+
* @type {Map<string, BinaryClassSerializationAdapter>}
|
|
88448
|
+
*/
|
|
88449
|
+
serializers = new Map();
|
|
88693
88450
|
|
|
88694
88451
|
/**
|
|
88695
88452
|
*
|
|
@@ -89508,6 +89265,30 @@ class MaterialManager {
|
|
|
89508
89265
|
}
|
|
89509
89266
|
|
|
89510
89267
|
class FrameBuffer {
|
|
89268
|
+
/**
|
|
89269
|
+
* is expected to be bound during initialization
|
|
89270
|
+
* @type {WebGLRenderTarget}
|
|
89271
|
+
*/
|
|
89272
|
+
renderTarget = null;
|
|
89273
|
+
|
|
89274
|
+
/**
|
|
89275
|
+
* Number of users of the frame buffer
|
|
89276
|
+
* @type {number}
|
|
89277
|
+
*/
|
|
89278
|
+
referenceCount = 0;
|
|
89279
|
+
|
|
89280
|
+
/**
|
|
89281
|
+
* Dependency frame buffers
|
|
89282
|
+
* @type {string[]}
|
|
89283
|
+
*/
|
|
89284
|
+
dependencies = [];
|
|
89285
|
+
|
|
89286
|
+
/**
|
|
89287
|
+
* Size of the frame buffer in pixels
|
|
89288
|
+
* @type {Vector2}
|
|
89289
|
+
*/
|
|
89290
|
+
size = new Vector2(0, 0);
|
|
89291
|
+
|
|
89511
89292
|
/**
|
|
89512
89293
|
*
|
|
89513
89294
|
* @param {string} id
|
|
@@ -89520,29 +89301,6 @@ class FrameBuffer {
|
|
|
89520
89301
|
*/
|
|
89521
89302
|
this.id = id;
|
|
89522
89303
|
|
|
89523
|
-
/**
|
|
89524
|
-
* is expected to be bound during initialization
|
|
89525
|
-
* @type {WebGLRenderTarget}
|
|
89526
|
-
*/
|
|
89527
|
-
this.renderTarget = null;
|
|
89528
|
-
|
|
89529
|
-
/**
|
|
89530
|
-
* Number of users of the frame buffer
|
|
89531
|
-
* @type {number}
|
|
89532
|
-
*/
|
|
89533
|
-
this.referenceCount = 0;
|
|
89534
|
-
|
|
89535
|
-
/**
|
|
89536
|
-
* Dependency frame buffers
|
|
89537
|
-
* @type {string[]}
|
|
89538
|
-
*/
|
|
89539
|
-
this.dependencies = [];
|
|
89540
|
-
|
|
89541
|
-
/**
|
|
89542
|
-
* Size of the frame buffer in pixels
|
|
89543
|
-
* @type {Vector2}
|
|
89544
|
-
*/
|
|
89545
|
-
this.size = new Vector2(0, 0);
|
|
89546
89304
|
|
|
89547
89305
|
}
|
|
89548
89306
|
|
|
@@ -100099,6 +99857,12 @@ ObjectPoolFactory.prototype.release = function (object) {
|
|
|
100099
99857
|
* @template Key, Value
|
|
100100
99858
|
*/
|
|
100101
99859
|
class ImmutableObjectPool {
|
|
99860
|
+
/**
|
|
99861
|
+
*
|
|
99862
|
+
* @type {Signal<Key,Value>}
|
|
99863
|
+
*/
|
|
99864
|
+
onRemoved = new Signal()
|
|
99865
|
+
|
|
100102
99866
|
constructor({ capacity = 100, perKeyCapacity = 10 } = {}) {
|
|
100103
99867
|
/**
|
|
100104
99868
|
*
|
|
@@ -100183,15 +99947,17 @@ class ImmutableObjectPool {
|
|
|
100183
99947
|
|
|
100184
99948
|
const elements = this.data.get(key);
|
|
100185
99949
|
|
|
100186
|
-
|
|
100187
|
-
this.data.delete(key);
|
|
100188
|
-
} else {
|
|
100189
|
-
const i = elements.indexOf(el);
|
|
99950
|
+
const i = elements.indexOf(el);
|
|
100190
99951
|
|
|
100191
|
-
|
|
99952
|
+
elements.splice(i, 1);
|
|
99953
|
+
|
|
99954
|
+
if (elements.length === 0) {
|
|
99955
|
+
this.data.delete(key);
|
|
100192
99956
|
}
|
|
100193
99957
|
|
|
100194
99958
|
this.size--;
|
|
99959
|
+
|
|
99960
|
+
this.onRemoved.send2(key, el.value);
|
|
100195
99961
|
}
|
|
100196
99962
|
|
|
100197
99963
|
add(key, value) {
|
|
@@ -109359,6 +109125,64 @@ class IdPool {
|
|
|
109359
109125
|
}
|
|
109360
109126
|
}
|
|
109361
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
|
+
|
|
109362
109186
|
class AtlasPatch {
|
|
109363
109187
|
constructor() {
|
|
109364
109188
|
/**
|
|
@@ -109527,15 +109351,6 @@ const AtlasPatchFlag = {
|
|
|
109527
109351
|
Attached: 4
|
|
109528
109352
|
};
|
|
109529
109353
|
|
|
109530
|
-
/**
|
|
109531
|
-
* @template T
|
|
109532
|
-
* @param {T} object
|
|
109533
|
-
* @return {T}
|
|
109534
|
-
*/
|
|
109535
|
-
function invokeObjectClone(object) {
|
|
109536
|
-
return object.clone();
|
|
109537
|
-
}
|
|
109538
|
-
|
|
109539
109354
|
class TextureAtlas extends AbstractTextureAtlas {
|
|
109540
109355
|
/**
|
|
109541
109356
|
*
|
|
@@ -109734,7 +109549,8 @@ class TextureAtlas extends AbstractTextureAtlas {
|
|
|
109734
109549
|
const patch_position = patch.position;
|
|
109735
109550
|
const patch_size = patch.size;
|
|
109736
109551
|
|
|
109737
|
-
|
|
109552
|
+
sampler2d_sub_copy_same_item_size(
|
|
109553
|
+
target,
|
|
109738
109554
|
source,
|
|
109739
109555
|
0, 0,
|
|
109740
109556
|
patch_position.x, patch_position.y, patch_size.x, patch_size.y
|
|
@@ -113530,29 +113346,31 @@ var FrustumProjector = {
|
|
|
113530
113346
|
};
|
|
113531
113347
|
|
|
113532
113348
|
class SystemEntityContext {
|
|
113533
|
-
constructor() {
|
|
113534
113349
|
|
|
113535
|
-
|
|
113350
|
+
/**
|
|
113351
|
+
*
|
|
113352
|
+
* @type {number}
|
|
113353
|
+
*/
|
|
113354
|
+
entity = -1;
|
|
113536
113355
|
|
|
113537
|
-
|
|
113538
|
-
|
|
113539
|
-
|
|
113540
|
-
|
|
113541
|
-
|
|
113356
|
+
/**
|
|
113357
|
+
* Pointer back to the system
|
|
113358
|
+
* @type {System}
|
|
113359
|
+
*/
|
|
113360
|
+
system = null;
|
|
113542
113361
|
|
|
113543
|
-
|
|
113544
|
-
|
|
113545
|
-
|
|
113546
|
-
|
|
113547
|
-
|
|
113362
|
+
/**
|
|
113363
|
+
*
|
|
113364
|
+
* @type {*[]}
|
|
113365
|
+
*/
|
|
113366
|
+
components = [];
|
|
113548
113367
|
|
|
113549
|
-
|
|
113550
|
-
|
|
113551
|
-
|
|
113552
|
-
|
|
113553
|
-
|
|
113554
|
-
|
|
113555
|
-
}
|
|
113368
|
+
/**
|
|
113369
|
+
*
|
|
113370
|
+
* @type {boolean}
|
|
113371
|
+
* @protected
|
|
113372
|
+
*/
|
|
113373
|
+
__is_linked = false;
|
|
113556
113374
|
|
|
113557
113375
|
/**
|
|
113558
113376
|
*
|