@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.module.js
CHANGED
|
@@ -49635,137 +49635,6 @@ const TerrainShader = {
|
|
|
49635
49635
|
fragmentShader: fragment$2()
|
|
49636
49636
|
};
|
|
49637
49637
|
|
|
49638
|
-
/**
|
|
49639
|
-
*
|
|
49640
|
-
* Produces a proportional mix of 2 values, a*(1-portion) + b*portion
|
|
49641
|
-
* Same as lerp
|
|
49642
|
-
*/
|
|
49643
|
-
const mix = lerp$1;
|
|
49644
|
-
|
|
49645
|
-
/**
|
|
49646
|
-
* Color blending modes
|
|
49647
|
-
* @enum {number}
|
|
49648
|
-
*/
|
|
49649
|
-
const BlendingType = {
|
|
49650
|
-
NoBlending: 5,
|
|
49651
|
-
Normal: 0,
|
|
49652
|
-
Add: 1,
|
|
49653
|
-
Subtract: 2,
|
|
49654
|
-
Multiply: 3,
|
|
49655
|
-
MultiplyAdd: 4
|
|
49656
|
-
};
|
|
49657
|
-
|
|
49658
|
-
function typedArrayConstructorByInstance(a) {
|
|
49659
|
-
if (a instanceof Int8Array) {
|
|
49660
|
-
return Int8Array;
|
|
49661
|
-
} else if (a instanceof Int16Array) {
|
|
49662
|
-
return Int16Array;
|
|
49663
|
-
} else if (a instanceof Int32Array) {
|
|
49664
|
-
return Int32Array;
|
|
49665
|
-
} else if (a instanceof Uint8Array) {
|
|
49666
|
-
return Uint8Array;
|
|
49667
|
-
} else if (a instanceof Uint8ClampedArray) {
|
|
49668
|
-
return Uint8ClampedArray;
|
|
49669
|
-
} else if (a instanceof Uint16Array) {
|
|
49670
|
-
return Uint16Array;
|
|
49671
|
-
} else if (a instanceof Uint32Array) {
|
|
49672
|
-
return Uint32Array;
|
|
49673
|
-
} else if (a instanceof Float32Array) {
|
|
49674
|
-
return Float32Array;
|
|
49675
|
-
} else if (a instanceof Float64Array) {
|
|
49676
|
-
return Float64Array;
|
|
49677
|
-
} else if (Array.isArray(a)) {
|
|
49678
|
-
return Array;
|
|
49679
|
-
} else {
|
|
49680
|
-
throw new TypeError(`Unsupported array type`);
|
|
49681
|
-
}
|
|
49682
|
-
}
|
|
49683
|
-
|
|
49684
|
-
/**
|
|
49685
|
-
* @readonly
|
|
49686
|
-
* @enum {string}
|
|
49687
|
-
*/
|
|
49688
|
-
const BinaryDataType = {
|
|
49689
|
-
Uint8: "uint8",
|
|
49690
|
-
Uint16: "uint16",
|
|
49691
|
-
Uint32: "uint32",
|
|
49692
|
-
Uint64: "uint64",
|
|
49693
|
-
|
|
49694
|
-
Int8: "int8",
|
|
49695
|
-
Int16: "int16",
|
|
49696
|
-
Int32: "int32",
|
|
49697
|
-
Int64: "int64",
|
|
49698
|
-
|
|
49699
|
-
Float16: 'float16',
|
|
49700
|
-
Float32: "float32",
|
|
49701
|
-
Float64: "float64"
|
|
49702
|
-
};
|
|
49703
|
-
|
|
49704
|
-
/**
|
|
49705
|
-
*
|
|
49706
|
-
* @param {*} v
|
|
49707
|
-
* @returns {BinaryDataType}
|
|
49708
|
-
*/
|
|
49709
|
-
function typedArrayToDataType(v) {
|
|
49710
|
-
const ctor = Object.getPrototypeOf(v).constructor;
|
|
49711
|
-
|
|
49712
|
-
switch (ctor) {
|
|
49713
|
-
case Uint8Array:
|
|
49714
|
-
case Uint8ClampedArray:
|
|
49715
|
-
return BinaryDataType.Uint8;
|
|
49716
|
-
case Uint16Array:
|
|
49717
|
-
return BinaryDataType.Uint16;
|
|
49718
|
-
case Uint32Array:
|
|
49719
|
-
return BinaryDataType.Uint32;
|
|
49720
|
-
|
|
49721
|
-
case Int8Array:
|
|
49722
|
-
return BinaryDataType.Int8;
|
|
49723
|
-
case Int16Array:
|
|
49724
|
-
return BinaryDataType.Int16;
|
|
49725
|
-
case Int32Array:
|
|
49726
|
-
return BinaryDataType.Int32;
|
|
49727
|
-
|
|
49728
|
-
case Float32Array:
|
|
49729
|
-
return BinaryDataType.Float32;
|
|
49730
|
-
case Float64Array:
|
|
49731
|
-
return BinaryDataType.Float64;
|
|
49732
|
-
default:
|
|
49733
|
-
throw new Error('unsupported constructor type');
|
|
49734
|
-
}
|
|
49735
|
-
}
|
|
49736
|
-
|
|
49737
|
-
/**
|
|
49738
|
-
* Mapping from {@DataType} to TypedArray constructors
|
|
49739
|
-
* @enum {function}
|
|
49740
|
-
*/
|
|
49741
|
-
const DataType2TypedArrayConstructorMapping = {
|
|
49742
|
-
[BinaryDataType.Uint8]: Uint8Array,
|
|
49743
|
-
[BinaryDataType.Uint16]: Uint16Array,
|
|
49744
|
-
[BinaryDataType.Uint32]: Uint32Array,
|
|
49745
|
-
[BinaryDataType.Int8]: Int8Array,
|
|
49746
|
-
[BinaryDataType.Int16]: Int16Array,
|
|
49747
|
-
[BinaryDataType.Int32]: Int32Array,
|
|
49748
|
-
// No float16 array type, using uint16 as a backing instead
|
|
49749
|
-
[BinaryDataType.Float16]: Uint16Array,
|
|
49750
|
-
[BinaryDataType.Float32]: Float32Array,
|
|
49751
|
-
[BinaryDataType.Float64]: Float64Array,
|
|
49752
|
-
};
|
|
49753
|
-
|
|
49754
|
-
/**
|
|
49755
|
-
*
|
|
49756
|
-
* @param {BinaryDataType} dt
|
|
49757
|
-
* @returns {constructor|function}
|
|
49758
|
-
*/
|
|
49759
|
-
function compute_typed_array_constructor_from_data_type(dt) {
|
|
49760
|
-
const r = DataType2TypedArrayConstructorMapping[dt];
|
|
49761
|
-
|
|
49762
|
-
if (r === undefined) {
|
|
49763
|
-
throw new Error(`Unsupported data type '${dt}'`);
|
|
49764
|
-
}
|
|
49765
|
-
|
|
49766
|
-
return r;
|
|
49767
|
-
}
|
|
49768
|
-
|
|
49769
49638
|
/**
|
|
49770
49639
|
* Adapted from https://github.com/beatgammit/base64-js
|
|
49771
49640
|
* @author Jameson Little
|
|
@@ -49978,25 +49847,55 @@ class Base64 {
|
|
|
49978
49847
|
}
|
|
49979
49848
|
|
|
49980
49849
|
/**
|
|
49981
|
-
*
|
|
49982
|
-
* @
|
|
49983
|
-
* @param {number} offset
|
|
49984
|
-
* @param {number} length
|
|
49985
|
-
* @param {number} stride
|
|
49986
|
-
* @return {number}
|
|
49850
|
+
* @readonly
|
|
49851
|
+
* @enum {string}
|
|
49987
49852
|
*/
|
|
49988
|
-
|
|
49989
|
-
|
|
49990
|
-
|
|
49991
|
-
|
|
49853
|
+
const BinaryDataType = {
|
|
49854
|
+
Uint8: "uint8",
|
|
49855
|
+
Uint16: "uint16",
|
|
49856
|
+
Uint32: "uint32",
|
|
49857
|
+
Uint64: "uint64",
|
|
49992
49858
|
|
|
49993
|
-
|
|
49994
|
-
|
|
49859
|
+
Int8: "int8",
|
|
49860
|
+
Int16: "int16",
|
|
49861
|
+
Int32: "int32",
|
|
49862
|
+
Int64: "int64",
|
|
49995
49863
|
|
|
49996
|
-
|
|
49864
|
+
Float16: 'float16',
|
|
49865
|
+
Float32: "float32",
|
|
49866
|
+
Float64: "float64"
|
|
49867
|
+
};
|
|
49868
|
+
|
|
49869
|
+
/**
|
|
49870
|
+
* Mapping from {@DataType} to TypedArray constructors
|
|
49871
|
+
* @enum {function}
|
|
49872
|
+
*/
|
|
49873
|
+
const DataType2TypedArrayConstructorMapping = {
|
|
49874
|
+
[BinaryDataType.Uint8]: Uint8Array,
|
|
49875
|
+
[BinaryDataType.Uint16]: Uint16Array,
|
|
49876
|
+
[BinaryDataType.Uint32]: Uint32Array,
|
|
49877
|
+
[BinaryDataType.Int8]: Int8Array,
|
|
49878
|
+
[BinaryDataType.Int16]: Int16Array,
|
|
49879
|
+
[BinaryDataType.Int32]: Int32Array,
|
|
49880
|
+
// No float16 array type, using uint16 as a backing instead
|
|
49881
|
+
[BinaryDataType.Float16]: Uint16Array,
|
|
49882
|
+
[BinaryDataType.Float32]: Float32Array,
|
|
49883
|
+
[BinaryDataType.Float64]: Float64Array,
|
|
49884
|
+
};
|
|
49885
|
+
|
|
49886
|
+
/**
|
|
49887
|
+
*
|
|
49888
|
+
* @param {BinaryDataType} dt
|
|
49889
|
+
* @returns {constructor|function}
|
|
49890
|
+
*/
|
|
49891
|
+
function compute_typed_array_constructor_from_data_type(dt) {
|
|
49892
|
+
const r = DataType2TypedArrayConstructorMapping[dt];
|
|
49893
|
+
|
|
49894
|
+
if (r === undefined) {
|
|
49895
|
+
throw new Error(`Unsupported data type '${dt}'`);
|
|
49997
49896
|
}
|
|
49998
49897
|
|
|
49999
|
-
return
|
|
49898
|
+
return r;
|
|
50000
49899
|
}
|
|
50001
49900
|
|
|
50002
49901
|
//
|
|
@@ -50066,6 +49965,107 @@ function is_typed_array_equals(a, b) {
|
|
|
50066
49965
|
return isArrayEqualStrict(a_proxy, b_proxy);
|
|
50067
49966
|
}
|
|
50068
49967
|
|
|
49968
|
+
/**
|
|
49969
|
+
*
|
|
49970
|
+
* @param {*} v
|
|
49971
|
+
* @returns {BinaryDataType}
|
|
49972
|
+
*/
|
|
49973
|
+
function typedArrayToDataType(v) {
|
|
49974
|
+
const ctor = Object.getPrototypeOf(v).constructor;
|
|
49975
|
+
|
|
49976
|
+
switch (ctor) {
|
|
49977
|
+
case Uint8Array:
|
|
49978
|
+
case Uint8ClampedArray:
|
|
49979
|
+
return BinaryDataType.Uint8;
|
|
49980
|
+
case Uint16Array:
|
|
49981
|
+
return BinaryDataType.Uint16;
|
|
49982
|
+
case Uint32Array:
|
|
49983
|
+
return BinaryDataType.Uint32;
|
|
49984
|
+
|
|
49985
|
+
case Int8Array:
|
|
49986
|
+
return BinaryDataType.Int8;
|
|
49987
|
+
case Int16Array:
|
|
49988
|
+
return BinaryDataType.Int16;
|
|
49989
|
+
case Int32Array:
|
|
49990
|
+
return BinaryDataType.Int32;
|
|
49991
|
+
|
|
49992
|
+
case Float32Array:
|
|
49993
|
+
return BinaryDataType.Float32;
|
|
49994
|
+
case Float64Array:
|
|
49995
|
+
return BinaryDataType.Float64;
|
|
49996
|
+
default:
|
|
49997
|
+
throw new Error('unsupported constructor type');
|
|
49998
|
+
}
|
|
49999
|
+
}
|
|
50000
|
+
|
|
50001
|
+
/**
|
|
50002
|
+
*
|
|
50003
|
+
* Produces a proportional mix of 2 values, a*(1-portion) + b*portion
|
|
50004
|
+
* Same as lerp
|
|
50005
|
+
*/
|
|
50006
|
+
const mix = lerp$1;
|
|
50007
|
+
|
|
50008
|
+
/**
|
|
50009
|
+
* Based on code from reddit https://www.reddit.com/r/javascript/comments/jxa8x/bicubic_interpolation/
|
|
50010
|
+
* @param {number} t ratio
|
|
50011
|
+
* @param {number} a position -2
|
|
50012
|
+
* @param {number} b position -1
|
|
50013
|
+
* @param {number} c position +1
|
|
50014
|
+
* @param {number} d position +2
|
|
50015
|
+
* @returns {number}
|
|
50016
|
+
*/
|
|
50017
|
+
function interpolate_bicubic(t, a, b, c, d) {
|
|
50018
|
+
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;
|
|
50019
|
+
}
|
|
50020
|
+
|
|
50021
|
+
/**
|
|
50022
|
+
* 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
|
|
50023
|
+
* @param {number[]|Uint32Array|Uint16Array|Uint8Array} array
|
|
50024
|
+
* @param {number} offset
|
|
50025
|
+
* @param {number} length
|
|
50026
|
+
* @param {number} stride
|
|
50027
|
+
* @return {number}
|
|
50028
|
+
*/
|
|
50029
|
+
function computeStridedIntegerArrayHash(
|
|
50030
|
+
array, offset, length, stride
|
|
50031
|
+
) {
|
|
50032
|
+
let result = length;
|
|
50033
|
+
|
|
50034
|
+
for (let i = offset; i < length; i += stride) {
|
|
50035
|
+
const value = array[i];
|
|
50036
|
+
|
|
50037
|
+
result = ((result * 31) + value) | 0;
|
|
50038
|
+
}
|
|
50039
|
+
|
|
50040
|
+
return result;
|
|
50041
|
+
}
|
|
50042
|
+
|
|
50043
|
+
function typedArrayConstructorByInstance(a) {
|
|
50044
|
+
if (a instanceof Int8Array) {
|
|
50045
|
+
return Int8Array;
|
|
50046
|
+
} else if (a instanceof Int16Array) {
|
|
50047
|
+
return Int16Array;
|
|
50048
|
+
} else if (a instanceof Int32Array) {
|
|
50049
|
+
return Int32Array;
|
|
50050
|
+
} else if (a instanceof Uint8Array) {
|
|
50051
|
+
return Uint8Array;
|
|
50052
|
+
} else if (a instanceof Uint8ClampedArray) {
|
|
50053
|
+
return Uint8ClampedArray;
|
|
50054
|
+
} else if (a instanceof Uint16Array) {
|
|
50055
|
+
return Uint16Array;
|
|
50056
|
+
} else if (a instanceof Uint32Array) {
|
|
50057
|
+
return Uint32Array;
|
|
50058
|
+
} else if (a instanceof Float32Array) {
|
|
50059
|
+
return Float32Array;
|
|
50060
|
+
} else if (a instanceof Float64Array) {
|
|
50061
|
+
return Float64Array;
|
|
50062
|
+
} else if (Array.isArray(a)) {
|
|
50063
|
+
return Array;
|
|
50064
|
+
} else {
|
|
50065
|
+
throw new TypeError(`Unsupported array type`);
|
|
50066
|
+
}
|
|
50067
|
+
}
|
|
50068
|
+
|
|
50069
50069
|
/**
|
|
50070
50070
|
* Created by Alex on 11/11/2014.
|
|
50071
50071
|
*/
|
|
@@ -50134,35 +50134,6 @@ class Sampler2D {
|
|
|
50134
50134
|
this.version = 0;
|
|
50135
50135
|
}
|
|
50136
50136
|
|
|
50137
|
-
/**
|
|
50138
|
-
* @deprecated
|
|
50139
|
-
* @param {number} [channel=0]
|
|
50140
|
-
* @returns {{x: number, index: number, y: number, value: number}}
|
|
50141
|
-
*/
|
|
50142
|
-
computeMax(channel = 0) {
|
|
50143
|
-
throw new Error("deprecated, use sampler2d_channel_compute_max");
|
|
50144
|
-
}
|
|
50145
|
-
|
|
50146
|
-
/**
|
|
50147
|
-
* @deprecated
|
|
50148
|
-
* @param {number[]} result
|
|
50149
|
-
* @param {number} result_offset
|
|
50150
|
-
* @param {number} [channel=0]
|
|
50151
|
-
* @returns {number} number of matches written to result array
|
|
50152
|
-
*/
|
|
50153
|
-
computeMinIndices(result, result_offset = 0, channel = 0) {
|
|
50154
|
-
throw new Error("deprecated, use sampler2d_channel_compute_min_indices")
|
|
50155
|
-
}
|
|
50156
|
-
|
|
50157
|
-
/**
|
|
50158
|
-
* @deprecated
|
|
50159
|
-
* @param {number} [channel=0]
|
|
50160
|
-
* @returns {{x: number, index: number, y: number, value: number}}
|
|
50161
|
-
*/
|
|
50162
|
-
computeMin(channel = 0) {
|
|
50163
|
-
throw new Error("deprecated, use sampler2d_channel_compute_min");
|
|
50164
|
-
}
|
|
50165
|
-
|
|
50166
50137
|
/**
|
|
50167
50138
|
*
|
|
50168
50139
|
* @deprecated
|
|
@@ -50172,18 +50143,7 @@ class Sampler2D {
|
|
|
50172
50143
|
* @returns {number}
|
|
50173
50144
|
*/
|
|
50174
50145
|
get(x, y, result) {
|
|
50175
|
-
|
|
50176
|
-
|
|
50177
|
-
const t = [];
|
|
50178
|
-
|
|
50179
|
-
this.sampleBilinear(x, y, t, 0);
|
|
50180
|
-
|
|
50181
|
-
if (result !== undefined) {
|
|
50182
|
-
result.readFromArray(t, 0);
|
|
50183
|
-
return result;
|
|
50184
|
-
} else {
|
|
50185
|
-
return t[0];
|
|
50186
|
-
}
|
|
50146
|
+
throw new Error("Deprecated method, use sampleBilinear instead");
|
|
50187
50147
|
}
|
|
50188
50148
|
|
|
50189
50149
|
/**
|
|
@@ -50386,23 +50346,14 @@ class Sampler2D {
|
|
|
50386
50346
|
const vl2 = data[row3_address + col2_offset];
|
|
50387
50347
|
const vl3 = data[row3_address + col3_offset];
|
|
50388
50348
|
|
|
50389
|
-
|
|
50390
|
-
// return bicubic(xd, yd,
|
|
50391
|
-
// vi0, vi1, vi2, vi3,
|
|
50392
|
-
// vj0, vj1, vj2, vj3,
|
|
50393
|
-
// vk0, vk1, vk2, vk3,
|
|
50394
|
-
// vl0, vl1, vl2, vl3,
|
|
50395
|
-
// );
|
|
50396
|
-
|
|
50397
|
-
|
|
50398
50349
|
// perform filtering in X (rows)
|
|
50399
|
-
const s0 =
|
|
50400
|
-
const s1 =
|
|
50401
|
-
const s2 =
|
|
50402
|
-
const s3 =
|
|
50350
|
+
const s0 = interpolate_bicubic(xd, vi0, vi1, vi2, vi3);
|
|
50351
|
+
const s1 = interpolate_bicubic(xd, vj0, vj1, vj2, vj3);
|
|
50352
|
+
const s2 = interpolate_bicubic(xd, vk0, vk1, vk2, vk3);
|
|
50353
|
+
const s3 = interpolate_bicubic(xd, vl0, vl1, vl2, vl3);
|
|
50403
50354
|
|
|
50404
50355
|
// filter in Y (columns)
|
|
50405
|
-
return
|
|
50356
|
+
return interpolate_bicubic(yd, s0, s1, s2, s3);
|
|
50406
50357
|
}
|
|
50407
50358
|
|
|
50408
50359
|
/**
|
|
@@ -50641,162 +50592,6 @@ class Sampler2D {
|
|
|
50641
50592
|
result.set(x, y);
|
|
50642
50593
|
}
|
|
50643
50594
|
|
|
50644
|
-
/**
|
|
50645
|
-
* Copy a patch from another sampler with a margin.
|
|
50646
|
-
* This is useful for texture rendering where filtering can cause bleeding along the edges of the patch.
|
|
50647
|
-
* @param {Sampler2D} source where to copy from
|
|
50648
|
-
* @param {Number} sourceX where to start reading from, X coordinate
|
|
50649
|
-
* @param {Number} sourceY where to start reading from, X coordinate
|
|
50650
|
-
* @param {Number} destinationX where to start writing to, X coordinate
|
|
50651
|
-
* @param {Number} destinationY where to start writing to, X coordinate
|
|
50652
|
-
* @param {Number} width size of the patch that is to be copied
|
|
50653
|
-
* @param {Number} height size of the patch that is to be copied
|
|
50654
|
-
* @param {Number} marginLeft
|
|
50655
|
-
* @param {Number} marginRight
|
|
50656
|
-
* @param {Number} marginTop
|
|
50657
|
-
* @param {Number} marginBottom
|
|
50658
|
-
*/
|
|
50659
|
-
copyWithMargin(source, sourceX, sourceY, destinationX, destinationY, width, height, marginLeft, marginRight, marginTop, marginBottom) {
|
|
50660
|
-
const dItemSize = this.itemSize;
|
|
50661
|
-
const sItemSize = source.itemSize;
|
|
50662
|
-
const _itemSize = Math.min(dItemSize, sItemSize);
|
|
50663
|
-
|
|
50664
|
-
|
|
50665
|
-
const dRowSize = dItemSize * this.width;
|
|
50666
|
-
const sRowSize = sItemSize * source.width;
|
|
50667
|
-
|
|
50668
|
-
const sData = source.data;
|
|
50669
|
-
const dData = this.data;
|
|
50670
|
-
|
|
50671
|
-
let x, y, i;
|
|
50672
|
-
|
|
50673
|
-
let xMax, yMax;
|
|
50674
|
-
|
|
50675
|
-
let dA, sA, dOffset, sOffset;
|
|
50676
|
-
//Write top-left corner
|
|
50677
|
-
sOffset = sourceY * sRowSize + sourceX * dItemSize;
|
|
50678
|
-
for (y = Math.max(0, destinationY - marginTop), yMax = destinationY; y < yMax; y++) {
|
|
50679
|
-
dA = y * dRowSize;
|
|
50680
|
-
|
|
50681
|
-
for (x = Math.max(0, destinationX - marginLeft), xMax = destinationX; x < xMax; x++) {
|
|
50682
|
-
|
|
50683
|
-
dOffset = dA + x * dItemSize;
|
|
50684
|
-
|
|
50685
|
-
for (i = 0; i < _itemSize; i++) {
|
|
50686
|
-
dData[dOffset + i] = sData[sOffset + i];
|
|
50687
|
-
}
|
|
50688
|
-
}
|
|
50689
|
-
}
|
|
50690
|
-
//Write top margin
|
|
50691
|
-
sA = sourceY * sRowSize;
|
|
50692
|
-
for (y = Math.max(0, destinationY - marginTop), yMax = destinationY; y < yMax; y++) {
|
|
50693
|
-
dA = y * dRowSize;
|
|
50694
|
-
|
|
50695
|
-
for (x = 0; x < width; x++) {
|
|
50696
|
-
|
|
50697
|
-
dOffset = dA + (x + destinationX) * dItemSize;
|
|
50698
|
-
sOffset = sA + (x + sourceX) * dItemSize;
|
|
50699
|
-
for (i = 0; i < _itemSize; i++) {
|
|
50700
|
-
dData[dOffset + i] = sData[sOffset + i];
|
|
50701
|
-
}
|
|
50702
|
-
}
|
|
50703
|
-
}
|
|
50704
|
-
//Write top-right corner
|
|
50705
|
-
sOffset = sourceY * sRowSize + (sourceX + width - 1) * dItemSize;
|
|
50706
|
-
for (y = Math.max(0, destinationY - marginTop), yMax = destinationY; y < yMax; y++) {
|
|
50707
|
-
dA = y * dRowSize;
|
|
50708
|
-
|
|
50709
|
-
for (x = destinationX + width, xMax = Math.min(this.width, x + marginRight); x < xMax; x++) {
|
|
50710
|
-
|
|
50711
|
-
dOffset = dA + x * dItemSize;
|
|
50712
|
-
|
|
50713
|
-
for (i = 0; i < _itemSize; i++) {
|
|
50714
|
-
dData[dOffset + i] = sData[sOffset + i];
|
|
50715
|
-
}
|
|
50716
|
-
}
|
|
50717
|
-
}
|
|
50718
|
-
//Write left margin
|
|
50719
|
-
for (y = 0; y < height; y++) {
|
|
50720
|
-
dA = (y + destinationY) * dRowSize;
|
|
50721
|
-
sA = (y + sourceY) * sRowSize;
|
|
50722
|
-
|
|
50723
|
-
sOffset = sA + (sourceX) * dItemSize;
|
|
50724
|
-
|
|
50725
|
-
for (x = Math.max(0, destinationX - marginLeft), xMax = destinationX; x < xMax; x++) {
|
|
50726
|
-
|
|
50727
|
-
dOffset = dA + x * dItemSize;
|
|
50728
|
-
|
|
50729
|
-
for (i = 0; i < _itemSize; i++) {
|
|
50730
|
-
dData[dOffset + i] = sData[sOffset + i];
|
|
50731
|
-
}
|
|
50732
|
-
}
|
|
50733
|
-
}
|
|
50734
|
-
//write actual patch
|
|
50735
|
-
this.copy(source, sourceX, sourceY, destinationX, destinationY, width, height);
|
|
50736
|
-
|
|
50737
|
-
//Write right margin
|
|
50738
|
-
for (y = 0; y < height; y++) {
|
|
50739
|
-
dA = (y + destinationY) * dRowSize;
|
|
50740
|
-
sA = (y + sourceY) * sRowSize;
|
|
50741
|
-
|
|
50742
|
-
sOffset = sA + (sourceX + width - 1) * dItemSize;
|
|
50743
|
-
|
|
50744
|
-
for (x = destinationX + width, xMax = Math.min(this.width, x + marginRight); x < xMax; x++) {
|
|
50745
|
-
|
|
50746
|
-
dOffset = dA + x * dItemSize;
|
|
50747
|
-
|
|
50748
|
-
for (i = 0; i < _itemSize; i++) {
|
|
50749
|
-
dData[dOffset + i] = sData[sOffset + i];
|
|
50750
|
-
}
|
|
50751
|
-
}
|
|
50752
|
-
}
|
|
50753
|
-
|
|
50754
|
-
//Write Bottom-left margin
|
|
50755
|
-
sOffset = (sourceY + height - 1) * sRowSize + sourceX * dItemSize;
|
|
50756
|
-
for (y = destinationY + width, yMax = Math.min(this.height, y + marginBottom); y < yMax; y++) {
|
|
50757
|
-
dA = y * dRowSize;
|
|
50758
|
-
|
|
50759
|
-
for (x = Math.max(0, destinationX - marginLeft), xMax = destinationX; x < xMax; x++) {
|
|
50760
|
-
|
|
50761
|
-
dOffset = dA + x * dItemSize;
|
|
50762
|
-
|
|
50763
|
-
for (i = 0; i < _itemSize; i++) {
|
|
50764
|
-
dData[dOffset + i] = sData[sOffset + i];
|
|
50765
|
-
}
|
|
50766
|
-
}
|
|
50767
|
-
}
|
|
50768
|
-
//Write Bottom margin
|
|
50769
|
-
sA = (sourceY + height - 1) * sRowSize;
|
|
50770
|
-
for (y = destinationY + width, yMax = Math.min(this.height, y + marginBottom); y < yMax; y++) {
|
|
50771
|
-
dA = y * dRowSize;
|
|
50772
|
-
|
|
50773
|
-
for (x = 0; x < width; x++) {
|
|
50774
|
-
|
|
50775
|
-
dOffset = dA + (x + destinationX) * dItemSize;
|
|
50776
|
-
sOffset = sA + (x + sourceX) * dItemSize;
|
|
50777
|
-
for (i = 0; i < _itemSize; i++) {
|
|
50778
|
-
dData[dOffset + i] = sData[sOffset + i];
|
|
50779
|
-
}
|
|
50780
|
-
}
|
|
50781
|
-
}
|
|
50782
|
-
//Write Bottom-right margin
|
|
50783
|
-
sOffset = (sourceY + height - 1) * sRowSize + (sourceX + width - 1) * dItemSize;
|
|
50784
|
-
for (y = destinationY + width, yMax = Math.min(this.height, y + marginBottom); y < yMax; y++) {
|
|
50785
|
-
dA = y * dRowSize;
|
|
50786
|
-
|
|
50787
|
-
for (x = destinationX + width, xMax = Math.min(this.width, x + marginRight); x < xMax; x++) {
|
|
50788
|
-
|
|
50789
|
-
dOffset = dA + x * dItemSize;
|
|
50790
|
-
|
|
50791
|
-
for (i = 0; i < _itemSize; i++) {
|
|
50792
|
-
dData[dOffset + i] = sData[sOffset + i];
|
|
50793
|
-
}
|
|
50794
|
-
}
|
|
50795
|
-
}
|
|
50796
|
-
|
|
50797
|
-
this.version++;
|
|
50798
|
-
}
|
|
50799
|
-
|
|
50800
50595
|
/**
|
|
50801
50596
|
* Copy a patch from another sampler
|
|
50802
50597
|
* @param {Sampler2D} source where to copy from
|
|
@@ -50853,106 +50648,6 @@ class Sampler2D {
|
|
|
50853
50648
|
this.version++;
|
|
50854
50649
|
}
|
|
50855
50650
|
|
|
50856
|
-
/**
|
|
50857
|
-
* Copy a patch from another sampler with the same itemSize
|
|
50858
|
-
* @param {Sampler2D} source where to copy from
|
|
50859
|
-
* @param {Number} sourceX where to start reading from, X coordinate
|
|
50860
|
-
* @param {Number} sourceY where to start reading from, X coordinate
|
|
50861
|
-
* @param {Number} destinationX where to start writing to, X coordinate
|
|
50862
|
-
* @param {Number} destinationY where to start writing to, X coordinate
|
|
50863
|
-
* @param {Number} width size of the patch that is to be copied
|
|
50864
|
-
* @param {Number} height size of the patch that is to be copied
|
|
50865
|
-
*/
|
|
50866
|
-
copy_sameItemSize(source, sourceX, sourceY, destinationX, destinationY, width, height) {
|
|
50867
|
-
const itemSize = this.itemSize;
|
|
50868
|
-
const sItemSize = source.itemSize;
|
|
50869
|
-
|
|
50870
|
-
assert.equal(sItemSize, sItemSize, `source.itemSize(=${sItemSize}) != this.itemSize(=${itemSize})`);
|
|
50871
|
-
|
|
50872
|
-
const _w = Math.min(width, source.width - sourceX, this.width - destinationX);
|
|
50873
|
-
const _h = Math.min(height, source.height - sourceY, this.height - destinationY);
|
|
50874
|
-
|
|
50875
|
-
|
|
50876
|
-
const dRowSize = itemSize * this.width;
|
|
50877
|
-
const sRowSize = itemSize * source.width;
|
|
50878
|
-
|
|
50879
|
-
const sData = source.data;
|
|
50880
|
-
const dData = this.data;
|
|
50881
|
-
|
|
50882
|
-
const patchRowSize = _w * itemSize;
|
|
50883
|
-
|
|
50884
|
-
let y, i;
|
|
50885
|
-
|
|
50886
|
-
for (y = 0; y < _h; y++) {
|
|
50887
|
-
const dA = (y + destinationY) * dRowSize;
|
|
50888
|
-
const sA = (y + sourceY) * sRowSize;
|
|
50889
|
-
|
|
50890
|
-
const dOffset = dA + destinationX * itemSize;
|
|
50891
|
-
const sOffset = sA + sourceX * itemSize;
|
|
50892
|
-
|
|
50893
|
-
for (i = 0; i < patchRowSize; i++) {
|
|
50894
|
-
|
|
50895
|
-
dData[dOffset + i] = sData[sOffset + i];
|
|
50896
|
-
|
|
50897
|
-
}
|
|
50898
|
-
}
|
|
50899
|
-
|
|
50900
|
-
this.version++;
|
|
50901
|
-
}
|
|
50902
|
-
|
|
50903
|
-
/**
|
|
50904
|
-
* Assumes both samplers are uint8 with values 0-255
|
|
50905
|
-
* @param {Sampler2D} source
|
|
50906
|
-
* @param sourceX
|
|
50907
|
-
* @param sourceY
|
|
50908
|
-
* @param destinationX
|
|
50909
|
-
* @param destinationY
|
|
50910
|
-
* @param width
|
|
50911
|
-
* @param height
|
|
50912
|
-
* @param {BlendingType} [blendMode]
|
|
50913
|
-
*/
|
|
50914
|
-
paint(source, sourceX, sourceY, destinationX, destinationY, width, height, blendMode = BlendingType.Normal) {
|
|
50915
|
-
let blendFunction;
|
|
50916
|
-
if (blendMode === BlendingType.Normal) {
|
|
50917
|
-
blendFunction = blendFunctionNormal;
|
|
50918
|
-
} else {
|
|
50919
|
-
throw new Error(`Unsupported blendType(=${blendMode})`);
|
|
50920
|
-
}
|
|
50921
|
-
|
|
50922
|
-
const _w = Math.min(width, source.width - sourceX, this.width - destinationX);
|
|
50923
|
-
const _h = Math.min(height, source.height - sourceY, this.height - destinationY);
|
|
50924
|
-
|
|
50925
|
-
const _x0 = Math.max(0, -destinationX);
|
|
50926
|
-
const _y0 = Math.max(0, -destinationY);
|
|
50927
|
-
|
|
50928
|
-
const c0 = [0, 0, 0, 255];
|
|
50929
|
-
const c1 = [0, 0, 0, 255];
|
|
50930
|
-
|
|
50931
|
-
const c3 = [];
|
|
50932
|
-
|
|
50933
|
-
let x, y;
|
|
50934
|
-
|
|
50935
|
-
for (y = _y0; y < _h; y++) {
|
|
50936
|
-
for (x = _x0; x < _w; x++) {
|
|
50937
|
-
const d_x = Math.round(x + destinationX);
|
|
50938
|
-
const d_y = Math.round(y + destinationY);
|
|
50939
|
-
|
|
50940
|
-
this.read(d_x, d_y, c0);
|
|
50941
|
-
|
|
50942
|
-
const s_x = Math.round(x + sourceY);
|
|
50943
|
-
const s_y = Math.round(y + sourceY);
|
|
50944
|
-
|
|
50945
|
-
source.read(s_x, s_y, c1);
|
|
50946
|
-
|
|
50947
|
-
blendFunction(c1, c0, c3);
|
|
50948
|
-
|
|
50949
|
-
this.set(d_x, d_y, c3);
|
|
50950
|
-
|
|
50951
|
-
}
|
|
50952
|
-
}
|
|
50953
|
-
|
|
50954
|
-
|
|
50955
|
-
}
|
|
50956
50651
|
|
|
50957
50652
|
/**
|
|
50958
50653
|
* Fill data values with zeros for a given area
|
|
@@ -51213,22 +50908,6 @@ class Sampler2D {
|
|
|
51213
50908
|
return dataSize + 280;
|
|
51214
50909
|
}
|
|
51215
50910
|
|
|
51216
|
-
/**
|
|
51217
|
-
* @deprecated Use {@link Sampler2DSerializationAdapter} adapter instead
|
|
51218
|
-
* @param {BinaryBuffer} buffer
|
|
51219
|
-
*/
|
|
51220
|
-
toBinaryBuffer(buffer) {
|
|
51221
|
-
throw new Error('Deprecated, use Sampler2DSerializationAdapter instead');
|
|
51222
|
-
}
|
|
51223
|
-
|
|
51224
|
-
/**
|
|
51225
|
-
* @deprecated Use {@link Sampler2DSerializationAdapter} adapter instead
|
|
51226
|
-
* @param {BinaryBuffer} buffer
|
|
51227
|
-
*/
|
|
51228
|
-
fromBinaryBuffer(buffer) {
|
|
51229
|
-
throw new Error('Deprecated, use Sampler2DSerializationAdapter instead');
|
|
51230
|
-
}
|
|
51231
|
-
|
|
51232
50911
|
/**
|
|
51233
50912
|
*
|
|
51234
50913
|
* @param {Sampler2D} other
|
|
@@ -51439,38 +51118,7 @@ Sampler2D.prototype.isSampler2D = true;
|
|
|
51439
51118
|
* @readonly
|
|
51440
51119
|
* @type {string}
|
|
51441
51120
|
*/
|
|
51442
|
-
Sampler2D.typeName = "Sampler2D";
|
|
51443
|
-
|
|
51444
|
-
/**
|
|
51445
|
-
* Based on code from reddit https://www.reddit.com/r/javascript/comments/jxa8x/bicubic_interpolation/
|
|
51446
|
-
* @param {number} t
|
|
51447
|
-
* @param {number} a
|
|
51448
|
-
* @param {number} b
|
|
51449
|
-
* @param {number} c
|
|
51450
|
-
* @param {number} d
|
|
51451
|
-
* @returns {number}
|
|
51452
|
-
*/
|
|
51453
|
-
function bicubic_terp(t, a, b, c, d) {
|
|
51454
|
-
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;
|
|
51455
|
-
}
|
|
51456
|
-
|
|
51457
|
-
|
|
51458
|
-
/**
|
|
51459
|
-
*
|
|
51460
|
-
* @param {number[]} source
|
|
51461
|
-
* @param {number[]} destination
|
|
51462
|
-
* @param {Array} result
|
|
51463
|
-
*/
|
|
51464
|
-
function blendFunctionNormal(source, destination, result) {
|
|
51465
|
-
|
|
51466
|
-
const a1 = source[3] / 255;
|
|
51467
|
-
const a0 = destination[3] / 255;
|
|
51468
|
-
|
|
51469
|
-
result[0] = source[0] * a1 + destination[0] * (1 - a1);
|
|
51470
|
-
result[1] = source[1] * a1 + destination[1] * (1 - a1);
|
|
51471
|
-
result[2] = source[2] * a1 + destination[2] * (1 - a1);
|
|
51472
|
-
result[3] = (a1 + a0 * (1 - a1)) * 255;
|
|
51473
|
-
}
|
|
51121
|
+
Sampler2D.typeName = "Sampler2D";
|
|
51474
51122
|
|
|
51475
51123
|
/**
|
|
51476
51124
|
*
|
|
@@ -51779,6 +51427,354 @@ function SplatMaterial(
|
|
|
51779
51427
|
|
|
51780
51428
|
const WHITE_PIXEL_DATA_URL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P///38ACfsD/QVDRcoAAAAASUVORK5CYII=";
|
|
51781
51429
|
|
|
51430
|
+
/**
|
|
51431
|
+
*
|
|
51432
|
+
* @param {number} v
|
|
51433
|
+
* @returns {number}
|
|
51434
|
+
*/
|
|
51435
|
+
function float2uint8(v) {
|
|
51436
|
+
return Math.round(v * 255);
|
|
51437
|
+
}
|
|
51438
|
+
|
|
51439
|
+
/**
|
|
51440
|
+
*
|
|
51441
|
+
* @param {number} v
|
|
51442
|
+
* @returns {number}
|
|
51443
|
+
*/
|
|
51444
|
+
function uint82float(v) {
|
|
51445
|
+
return v / 255;
|
|
51446
|
+
}
|
|
51447
|
+
|
|
51448
|
+
/**
|
|
51449
|
+
* Copy data from one array to another
|
|
51450
|
+
* Follows Java System.arraycopy interface
|
|
51451
|
+
* @template T
|
|
51452
|
+
* @param {T[]|ArrayLike<T>|TypedArray|Uint8ClampedArray|Uint8Array|Uint32Array|Int32Array|Float32Array|Float64Array} source The source array
|
|
51453
|
+
* @param {number} source_position Starting position where to copy from inside the source array
|
|
51454
|
+
* @param {T[]|ArrayLike<T>|TypedArray|Uint8ClampedArray|Uint8Array|Uint32Array|Int32Array|Float32Array|Float64Array} destination The destination array
|
|
51455
|
+
* @param {number} destination_position Starting position where to copy to inside the destination array
|
|
51456
|
+
* @param {number} length How many elements should be copied
|
|
51457
|
+
*/
|
|
51458
|
+
function array_copy(
|
|
51459
|
+
source,
|
|
51460
|
+
source_position,
|
|
51461
|
+
destination,
|
|
51462
|
+
destination_position,
|
|
51463
|
+
length
|
|
51464
|
+
) {
|
|
51465
|
+
assert.isNonNegativeInteger(source_position, 'source_position');
|
|
51466
|
+
assert.isNonNegativeInteger(destination_position, 'destination_position');
|
|
51467
|
+
assert.isNonNegativeInteger(length, 'length');
|
|
51468
|
+
|
|
51469
|
+
let i, j, k;
|
|
51470
|
+
|
|
51471
|
+
for (k = 0; k < length; k++) {
|
|
51472
|
+
i = source_position + k;
|
|
51473
|
+
j = destination_position + k;
|
|
51474
|
+
|
|
51475
|
+
destination[j] = source[i];
|
|
51476
|
+
}
|
|
51477
|
+
}
|
|
51478
|
+
|
|
51479
|
+
/**
|
|
51480
|
+
* @author Alex Goldring
|
|
51481
|
+
* @copyright Alex Goldring 2018
|
|
51482
|
+
*/
|
|
51483
|
+
|
|
51484
|
+
|
|
51485
|
+
class Vector1 extends Number {
|
|
51486
|
+
/**
|
|
51487
|
+
*
|
|
51488
|
+
* @param {number} [x=0]
|
|
51489
|
+
* @constructor
|
|
51490
|
+
* @class
|
|
51491
|
+
* @property {number} x
|
|
51492
|
+
*/
|
|
51493
|
+
constructor(x = 0) {
|
|
51494
|
+
super();
|
|
51495
|
+
|
|
51496
|
+
assert.isNumber( x, 'x');
|
|
51497
|
+
assert.notNaN(x, 'x');
|
|
51498
|
+
|
|
51499
|
+
this.x = x;
|
|
51500
|
+
|
|
51501
|
+
this.onChanged = new Signal();
|
|
51502
|
+
}
|
|
51503
|
+
|
|
51504
|
+
/**
|
|
51505
|
+
* Inherited from Number class
|
|
51506
|
+
* @returns {number}
|
|
51507
|
+
*/
|
|
51508
|
+
valueOf() {
|
|
51509
|
+
return this.x;
|
|
51510
|
+
}
|
|
51511
|
+
|
|
51512
|
+
/**
|
|
51513
|
+
*
|
|
51514
|
+
* @returns {string}
|
|
51515
|
+
*/
|
|
51516
|
+
toString() {
|
|
51517
|
+
return String(this.x);
|
|
51518
|
+
}
|
|
51519
|
+
|
|
51520
|
+
/**
|
|
51521
|
+
*
|
|
51522
|
+
* @returns {number}
|
|
51523
|
+
*/
|
|
51524
|
+
getValue() {
|
|
51525
|
+
return this.x;
|
|
51526
|
+
}
|
|
51527
|
+
|
|
51528
|
+
/**
|
|
51529
|
+
*
|
|
51530
|
+
* @param {Vector1} other
|
|
51531
|
+
* @returns {number}
|
|
51532
|
+
*/
|
|
51533
|
+
compareTo(other) {
|
|
51534
|
+
return this.x - other.x;
|
|
51535
|
+
}
|
|
51536
|
+
|
|
51537
|
+
/**
|
|
51538
|
+
*
|
|
51539
|
+
* @param {number} x
|
|
51540
|
+
* @returns {Vector1}
|
|
51541
|
+
*/
|
|
51542
|
+
set(x) {
|
|
51543
|
+
assert.isNumber( x,'x');
|
|
51544
|
+
assert.notNaN(x, 'x');
|
|
51545
|
+
|
|
51546
|
+
const oldValue = this.x;
|
|
51547
|
+
if (oldValue !== x) {
|
|
51548
|
+
this.x = x;
|
|
51549
|
+
|
|
51550
|
+
if (this.onChanged.hasHandlers()) {
|
|
51551
|
+
this.onChanged.send2(x, oldValue);
|
|
51552
|
+
}
|
|
51553
|
+
}
|
|
51554
|
+
|
|
51555
|
+
return this;
|
|
51556
|
+
}
|
|
51557
|
+
|
|
51558
|
+
/**
|
|
51559
|
+
* Set value without triggering {@link #onChanged} signal
|
|
51560
|
+
* @param {number} x
|
|
51561
|
+
*/
|
|
51562
|
+
setSilent(x) {
|
|
51563
|
+
this.x = x;
|
|
51564
|
+
}
|
|
51565
|
+
|
|
51566
|
+
/**
|
|
51567
|
+
*
|
|
51568
|
+
* @return {boolean}
|
|
51569
|
+
*/
|
|
51570
|
+
isZero() {
|
|
51571
|
+
return this.x === 0;
|
|
51572
|
+
}
|
|
51573
|
+
|
|
51574
|
+
increment() {
|
|
51575
|
+
this._add(1);
|
|
51576
|
+
}
|
|
51577
|
+
|
|
51578
|
+
decrement() {
|
|
51579
|
+
this._add(-1);
|
|
51580
|
+
}
|
|
51581
|
+
|
|
51582
|
+
/**
|
|
51583
|
+
*
|
|
51584
|
+
* @param {Number} v
|
|
51585
|
+
* @return {Vector1}
|
|
51586
|
+
*/
|
|
51587
|
+
_add(v) {
|
|
51588
|
+
return this.set(this.x + v);
|
|
51589
|
+
}
|
|
51590
|
+
|
|
51591
|
+
/**
|
|
51592
|
+
*
|
|
51593
|
+
* @param {Vector1|Vector2|Vector3|Vector4} other
|
|
51594
|
+
*/
|
|
51595
|
+
add(other) {
|
|
51596
|
+
return this._add(other.x);
|
|
51597
|
+
}
|
|
51598
|
+
|
|
51599
|
+
/**
|
|
51600
|
+
*
|
|
51601
|
+
* @param {Number} v
|
|
51602
|
+
* @return {Vector1}
|
|
51603
|
+
*/
|
|
51604
|
+
_sub(v) {
|
|
51605
|
+
return this._add(-v);
|
|
51606
|
+
}
|
|
51607
|
+
|
|
51608
|
+
/**
|
|
51609
|
+
*
|
|
51610
|
+
* @param {Vector1} other
|
|
51611
|
+
* @returns {Vector1}
|
|
51612
|
+
*/
|
|
51613
|
+
sub(other) {
|
|
51614
|
+
return this._sub(other.x);
|
|
51615
|
+
}
|
|
51616
|
+
|
|
51617
|
+
/**
|
|
51618
|
+
*
|
|
51619
|
+
* @param {Vector1} other
|
|
51620
|
+
* @returns {Vector1}
|
|
51621
|
+
*/
|
|
51622
|
+
multiply(other) {
|
|
51623
|
+
return this.set(this.x * other.x);
|
|
51624
|
+
}
|
|
51625
|
+
|
|
51626
|
+
/**
|
|
51627
|
+
*
|
|
51628
|
+
* @param {number} v
|
|
51629
|
+
*/
|
|
51630
|
+
multiplyScalar(v) {
|
|
51631
|
+
this.set(this.x * v);
|
|
51632
|
+
}
|
|
51633
|
+
|
|
51634
|
+
/**
|
|
51635
|
+
*
|
|
51636
|
+
* @param {number} low
|
|
51637
|
+
* @param {number} high
|
|
51638
|
+
* @returns {Vector1}
|
|
51639
|
+
*/
|
|
51640
|
+
clamp(low, high) {
|
|
51641
|
+
return this.set(clamp$1(this.x, low, high));
|
|
51642
|
+
}
|
|
51643
|
+
|
|
51644
|
+
/**
|
|
51645
|
+
*
|
|
51646
|
+
* @param {Vector1|Vector2|Vector3|Vector4} other
|
|
51647
|
+
*/
|
|
51648
|
+
copy(other) {
|
|
51649
|
+
this.set(other.x);
|
|
51650
|
+
}
|
|
51651
|
+
|
|
51652
|
+
/**
|
|
51653
|
+
*
|
|
51654
|
+
* @returns {Vector1}
|
|
51655
|
+
*/
|
|
51656
|
+
clone() {
|
|
51657
|
+
return new Vector1(this.x);
|
|
51658
|
+
}
|
|
51659
|
+
|
|
51660
|
+
/**
|
|
51661
|
+
*
|
|
51662
|
+
* @param {Vector1} other
|
|
51663
|
+
* @returns {boolean}
|
|
51664
|
+
*/
|
|
51665
|
+
equals(other) {
|
|
51666
|
+
return this.x === other.x;
|
|
51667
|
+
}
|
|
51668
|
+
|
|
51669
|
+
/**
|
|
51670
|
+
* @returns {number}
|
|
51671
|
+
*/
|
|
51672
|
+
hash() {
|
|
51673
|
+
return computeHashFloat(this.x);
|
|
51674
|
+
}
|
|
51675
|
+
|
|
51676
|
+
/**
|
|
51677
|
+
*
|
|
51678
|
+
* @param {function(newValue:number, oldValue:number)} handler
|
|
51679
|
+
*/
|
|
51680
|
+
process(handler) {
|
|
51681
|
+
handler(this.x, this.x);
|
|
51682
|
+
this.onChanged.add(handler);
|
|
51683
|
+
}
|
|
51684
|
+
|
|
51685
|
+
toJSON() {
|
|
51686
|
+
return this.x;
|
|
51687
|
+
}
|
|
51688
|
+
|
|
51689
|
+
fromJSON(val) {
|
|
51690
|
+
this.set(val);
|
|
51691
|
+
}
|
|
51692
|
+
|
|
51693
|
+
/**
|
|
51694
|
+
*
|
|
51695
|
+
* @param {number[]} array
|
|
51696
|
+
* @param {number} offset
|
|
51697
|
+
*/
|
|
51698
|
+
readFromArray(array, offset=0) {
|
|
51699
|
+
this.set(array[offset]);
|
|
51700
|
+
}
|
|
51701
|
+
|
|
51702
|
+
/**
|
|
51703
|
+
*
|
|
51704
|
+
* @param {number[]} array
|
|
51705
|
+
* @param {number} offset
|
|
51706
|
+
*/
|
|
51707
|
+
writeToArray(array, offset=0) {
|
|
51708
|
+
array[offset] = this.x;
|
|
51709
|
+
}
|
|
51710
|
+
|
|
51711
|
+
asArray(){
|
|
51712
|
+
return [this.x];
|
|
51713
|
+
}
|
|
51714
|
+
|
|
51715
|
+
/**
|
|
51716
|
+
*
|
|
51717
|
+
* @param {BinaryBuffer} buffer
|
|
51718
|
+
*/
|
|
51719
|
+
toBinaryBuffer(buffer) {
|
|
51720
|
+
buffer.writeFloat64(this.x);
|
|
51721
|
+
}
|
|
51722
|
+
|
|
51723
|
+
/**
|
|
51724
|
+
*
|
|
51725
|
+
* @param {BinaryBuffer} buffer
|
|
51726
|
+
*/
|
|
51727
|
+
fromBinaryBuffer(buffer) {
|
|
51728
|
+
const x = buffer.readFloat64();
|
|
51729
|
+
|
|
51730
|
+
this.set(x);
|
|
51731
|
+
}
|
|
51732
|
+
|
|
51733
|
+
/**
|
|
51734
|
+
*
|
|
51735
|
+
* @param {Vector1} a
|
|
51736
|
+
* @param {Vector1} b
|
|
51737
|
+
* @return {number}
|
|
51738
|
+
*/
|
|
51739
|
+
static compare(a, b) {
|
|
51740
|
+
return a.x - b.x;
|
|
51741
|
+
}
|
|
51742
|
+
|
|
51743
|
+
get 0() {
|
|
51744
|
+
return this.x;
|
|
51745
|
+
}
|
|
51746
|
+
|
|
51747
|
+
set 0(v) {
|
|
51748
|
+
this.x = v;
|
|
51749
|
+
}
|
|
51750
|
+
|
|
51751
|
+
* [Symbol.iterator]() {
|
|
51752
|
+
|
|
51753
|
+
yield this.x;
|
|
51754
|
+
|
|
51755
|
+
}
|
|
51756
|
+
}
|
|
51757
|
+
|
|
51758
|
+
/**
|
|
51759
|
+
* @readonly
|
|
51760
|
+
* @type {boolean}
|
|
51761
|
+
*/
|
|
51762
|
+
Vector1.prototype.isVector1 = true;
|
|
51763
|
+
|
|
51764
|
+
Vector1.typeName = "Vector1";
|
|
51765
|
+
|
|
51766
|
+
/**
|
|
51767
|
+
* @readonly
|
|
51768
|
+
* @type {Vector1}
|
|
51769
|
+
*/
|
|
51770
|
+
Vector1.zero = Object.freeze(new Vector1(0));
|
|
51771
|
+
|
|
51772
|
+
/**
|
|
51773
|
+
* @readonly
|
|
51774
|
+
* @type {Vector1}
|
|
51775
|
+
*/
|
|
51776
|
+
Vector1.one = Object.freeze(new Vector1(1));
|
|
51777
|
+
|
|
51782
51778
|
/**
|
|
51783
51779
|
*
|
|
51784
51780
|
* @param {Uint8Array|number[]|ArrayLike<number>|IArguments} data
|
|
@@ -52276,342 +52272,6 @@ class Vector4 {
|
|
|
52276
52272
|
}
|
|
52277
52273
|
}
|
|
52278
52274
|
|
|
52279
|
-
/**
|
|
52280
|
-
* Created by Alex on 11/11/2014.
|
|
52281
|
-
*/
|
|
52282
|
-
|
|
52283
|
-
|
|
52284
|
-
function canvas2Sampler2D(canvas) {
|
|
52285
|
-
const width = canvas.width;
|
|
52286
|
-
const height = canvas.height;
|
|
52287
|
-
|
|
52288
|
-
const context = canvas.getContext("2d");
|
|
52289
|
-
|
|
52290
|
-
const result = new Sampler2D(null, 4, width, height);
|
|
52291
|
-
|
|
52292
|
-
canvasDataToSampler(result, context);
|
|
52293
|
-
|
|
52294
|
-
return result;
|
|
52295
|
-
|
|
52296
|
-
}
|
|
52297
|
-
|
|
52298
|
-
/**
|
|
52299
|
-
*
|
|
52300
|
-
* @param {Sampler2D} target
|
|
52301
|
-
* @param {CanvasRenderingContext2D} ctx
|
|
52302
|
-
*/
|
|
52303
|
-
function canvasDataToSampler(target, ctx) {
|
|
52304
|
-
const width = target.width;
|
|
52305
|
-
const height = target.height;
|
|
52306
|
-
|
|
52307
|
-
const imageData = ctx.getImageData(0, 0, width, height);
|
|
52308
|
-
|
|
52309
|
-
const data = imageData.data;
|
|
52310
|
-
|
|
52311
|
-
assert.equal(data.length, target.height * target.width * target.itemSize);
|
|
52312
|
-
|
|
52313
|
-
target.data = data;
|
|
52314
|
-
}
|
|
52315
|
-
|
|
52316
|
-
/**
|
|
52317
|
-
* @author Alex Goldring
|
|
52318
|
-
* @copyright Alex Goldring 2018
|
|
52319
|
-
*/
|
|
52320
|
-
|
|
52321
|
-
|
|
52322
|
-
class Vector1 extends Number {
|
|
52323
|
-
/**
|
|
52324
|
-
*
|
|
52325
|
-
* @param {number} [x=0]
|
|
52326
|
-
* @constructor
|
|
52327
|
-
* @class
|
|
52328
|
-
* @property {number} x
|
|
52329
|
-
*/
|
|
52330
|
-
constructor(x = 0) {
|
|
52331
|
-
super();
|
|
52332
|
-
|
|
52333
|
-
assert.isNumber( x, 'x');
|
|
52334
|
-
assert.notNaN(x, 'x');
|
|
52335
|
-
|
|
52336
|
-
this.x = x;
|
|
52337
|
-
|
|
52338
|
-
this.onChanged = new Signal();
|
|
52339
|
-
}
|
|
52340
|
-
|
|
52341
|
-
/**
|
|
52342
|
-
* Inherited from Number class
|
|
52343
|
-
* @returns {number}
|
|
52344
|
-
*/
|
|
52345
|
-
valueOf() {
|
|
52346
|
-
return this.x;
|
|
52347
|
-
}
|
|
52348
|
-
|
|
52349
|
-
/**
|
|
52350
|
-
*
|
|
52351
|
-
* @returns {string}
|
|
52352
|
-
*/
|
|
52353
|
-
toString() {
|
|
52354
|
-
return String(this.x);
|
|
52355
|
-
}
|
|
52356
|
-
|
|
52357
|
-
/**
|
|
52358
|
-
*
|
|
52359
|
-
* @returns {number}
|
|
52360
|
-
*/
|
|
52361
|
-
getValue() {
|
|
52362
|
-
return this.x;
|
|
52363
|
-
}
|
|
52364
|
-
|
|
52365
|
-
/**
|
|
52366
|
-
*
|
|
52367
|
-
* @param {Vector1} other
|
|
52368
|
-
* @returns {number}
|
|
52369
|
-
*/
|
|
52370
|
-
compareTo(other) {
|
|
52371
|
-
return this.x - other.x;
|
|
52372
|
-
}
|
|
52373
|
-
|
|
52374
|
-
/**
|
|
52375
|
-
*
|
|
52376
|
-
* @param {number} x
|
|
52377
|
-
* @returns {Vector1}
|
|
52378
|
-
*/
|
|
52379
|
-
set(x) {
|
|
52380
|
-
assert.isNumber( x,'x');
|
|
52381
|
-
assert.notNaN(x, 'x');
|
|
52382
|
-
|
|
52383
|
-
const oldValue = this.x;
|
|
52384
|
-
if (oldValue !== x) {
|
|
52385
|
-
this.x = x;
|
|
52386
|
-
|
|
52387
|
-
if (this.onChanged.hasHandlers()) {
|
|
52388
|
-
this.onChanged.send2(x, oldValue);
|
|
52389
|
-
}
|
|
52390
|
-
}
|
|
52391
|
-
|
|
52392
|
-
return this;
|
|
52393
|
-
}
|
|
52394
|
-
|
|
52395
|
-
/**
|
|
52396
|
-
* Set value without triggering {@link #onChanged} signal
|
|
52397
|
-
* @param {number} x
|
|
52398
|
-
*/
|
|
52399
|
-
setSilent(x) {
|
|
52400
|
-
this.x = x;
|
|
52401
|
-
}
|
|
52402
|
-
|
|
52403
|
-
/**
|
|
52404
|
-
*
|
|
52405
|
-
* @return {boolean}
|
|
52406
|
-
*/
|
|
52407
|
-
isZero() {
|
|
52408
|
-
return this.x === 0;
|
|
52409
|
-
}
|
|
52410
|
-
|
|
52411
|
-
increment() {
|
|
52412
|
-
this._add(1);
|
|
52413
|
-
}
|
|
52414
|
-
|
|
52415
|
-
decrement() {
|
|
52416
|
-
this._add(-1);
|
|
52417
|
-
}
|
|
52418
|
-
|
|
52419
|
-
/**
|
|
52420
|
-
*
|
|
52421
|
-
* @param {Number} v
|
|
52422
|
-
* @return {Vector1}
|
|
52423
|
-
*/
|
|
52424
|
-
_add(v) {
|
|
52425
|
-
return this.set(this.x + v);
|
|
52426
|
-
}
|
|
52427
|
-
|
|
52428
|
-
/**
|
|
52429
|
-
*
|
|
52430
|
-
* @param {Vector1|Vector2|Vector3|Vector4} other
|
|
52431
|
-
*/
|
|
52432
|
-
add(other) {
|
|
52433
|
-
return this._add(other.x);
|
|
52434
|
-
}
|
|
52435
|
-
|
|
52436
|
-
/**
|
|
52437
|
-
*
|
|
52438
|
-
* @param {Number} v
|
|
52439
|
-
* @return {Vector1}
|
|
52440
|
-
*/
|
|
52441
|
-
_sub(v) {
|
|
52442
|
-
return this._add(-v);
|
|
52443
|
-
}
|
|
52444
|
-
|
|
52445
|
-
/**
|
|
52446
|
-
*
|
|
52447
|
-
* @param {Vector1} other
|
|
52448
|
-
* @returns {Vector1}
|
|
52449
|
-
*/
|
|
52450
|
-
sub(other) {
|
|
52451
|
-
return this._sub(other.x);
|
|
52452
|
-
}
|
|
52453
|
-
|
|
52454
|
-
/**
|
|
52455
|
-
*
|
|
52456
|
-
* @param {Vector1} other
|
|
52457
|
-
* @returns {Vector1}
|
|
52458
|
-
*/
|
|
52459
|
-
multiply(other) {
|
|
52460
|
-
return this.set(this.x * other.x);
|
|
52461
|
-
}
|
|
52462
|
-
|
|
52463
|
-
/**
|
|
52464
|
-
*
|
|
52465
|
-
* @param {number} v
|
|
52466
|
-
*/
|
|
52467
|
-
multiplyScalar(v) {
|
|
52468
|
-
this.set(this.x * v);
|
|
52469
|
-
}
|
|
52470
|
-
|
|
52471
|
-
/**
|
|
52472
|
-
*
|
|
52473
|
-
* @param {number} low
|
|
52474
|
-
* @param {number} high
|
|
52475
|
-
* @returns {Vector1}
|
|
52476
|
-
*/
|
|
52477
|
-
clamp(low, high) {
|
|
52478
|
-
return this.set(clamp$1(this.x, low, high));
|
|
52479
|
-
}
|
|
52480
|
-
|
|
52481
|
-
/**
|
|
52482
|
-
*
|
|
52483
|
-
* @param {Vector1|Vector2|Vector3|Vector4} other
|
|
52484
|
-
*/
|
|
52485
|
-
copy(other) {
|
|
52486
|
-
this.set(other.x);
|
|
52487
|
-
}
|
|
52488
|
-
|
|
52489
|
-
/**
|
|
52490
|
-
*
|
|
52491
|
-
* @returns {Vector1}
|
|
52492
|
-
*/
|
|
52493
|
-
clone() {
|
|
52494
|
-
return new Vector1(this.x);
|
|
52495
|
-
}
|
|
52496
|
-
|
|
52497
|
-
/**
|
|
52498
|
-
*
|
|
52499
|
-
* @param {Vector1} other
|
|
52500
|
-
* @returns {boolean}
|
|
52501
|
-
*/
|
|
52502
|
-
equals(other) {
|
|
52503
|
-
return this.x === other.x;
|
|
52504
|
-
}
|
|
52505
|
-
|
|
52506
|
-
/**
|
|
52507
|
-
* @returns {number}
|
|
52508
|
-
*/
|
|
52509
|
-
hash() {
|
|
52510
|
-
return computeHashFloat(this.x);
|
|
52511
|
-
}
|
|
52512
|
-
|
|
52513
|
-
/**
|
|
52514
|
-
*
|
|
52515
|
-
* @param {function(newValue:number, oldValue:number)} handler
|
|
52516
|
-
*/
|
|
52517
|
-
process(handler) {
|
|
52518
|
-
handler(this.x, this.x);
|
|
52519
|
-
this.onChanged.add(handler);
|
|
52520
|
-
}
|
|
52521
|
-
|
|
52522
|
-
toJSON() {
|
|
52523
|
-
return this.x;
|
|
52524
|
-
}
|
|
52525
|
-
|
|
52526
|
-
fromJSON(val) {
|
|
52527
|
-
this.set(val);
|
|
52528
|
-
}
|
|
52529
|
-
|
|
52530
|
-
/**
|
|
52531
|
-
*
|
|
52532
|
-
* @param {number[]} array
|
|
52533
|
-
* @param {number} offset
|
|
52534
|
-
*/
|
|
52535
|
-
readFromArray(array, offset=0) {
|
|
52536
|
-
this.set(array[offset]);
|
|
52537
|
-
}
|
|
52538
|
-
|
|
52539
|
-
/**
|
|
52540
|
-
*
|
|
52541
|
-
* @param {number[]} array
|
|
52542
|
-
* @param {number} offset
|
|
52543
|
-
*/
|
|
52544
|
-
writeToArray(array, offset=0) {
|
|
52545
|
-
array[offset] = this.x;
|
|
52546
|
-
}
|
|
52547
|
-
|
|
52548
|
-
asArray(){
|
|
52549
|
-
return [this.x];
|
|
52550
|
-
}
|
|
52551
|
-
|
|
52552
|
-
/**
|
|
52553
|
-
*
|
|
52554
|
-
* @param {BinaryBuffer} buffer
|
|
52555
|
-
*/
|
|
52556
|
-
toBinaryBuffer(buffer) {
|
|
52557
|
-
buffer.writeFloat64(this.x);
|
|
52558
|
-
}
|
|
52559
|
-
|
|
52560
|
-
/**
|
|
52561
|
-
*
|
|
52562
|
-
* @param {BinaryBuffer} buffer
|
|
52563
|
-
*/
|
|
52564
|
-
fromBinaryBuffer(buffer) {
|
|
52565
|
-
const x = buffer.readFloat64();
|
|
52566
|
-
|
|
52567
|
-
this.set(x);
|
|
52568
|
-
}
|
|
52569
|
-
|
|
52570
|
-
/**
|
|
52571
|
-
*
|
|
52572
|
-
* @param {Vector1} a
|
|
52573
|
-
* @param {Vector1} b
|
|
52574
|
-
* @return {number}
|
|
52575
|
-
*/
|
|
52576
|
-
static compare(a, b) {
|
|
52577
|
-
return a.x - b.x;
|
|
52578
|
-
}
|
|
52579
|
-
|
|
52580
|
-
get 0() {
|
|
52581
|
-
return this.x;
|
|
52582
|
-
}
|
|
52583
|
-
|
|
52584
|
-
set 0(v) {
|
|
52585
|
-
this.x = v;
|
|
52586
|
-
}
|
|
52587
|
-
|
|
52588
|
-
* [Symbol.iterator]() {
|
|
52589
|
-
|
|
52590
|
-
yield this.x;
|
|
52591
|
-
|
|
52592
|
-
}
|
|
52593
|
-
}
|
|
52594
|
-
|
|
52595
|
-
/**
|
|
52596
|
-
* @readonly
|
|
52597
|
-
* @type {boolean}
|
|
52598
|
-
*/
|
|
52599
|
-
Vector1.prototype.isVector1 = true;
|
|
52600
|
-
|
|
52601
|
-
Vector1.typeName = "Vector1";
|
|
52602
|
-
|
|
52603
|
-
/**
|
|
52604
|
-
* @readonly
|
|
52605
|
-
* @type {Vector1}
|
|
52606
|
-
*/
|
|
52607
|
-
Vector1.zero = Object.freeze(new Vector1(0));
|
|
52608
|
-
|
|
52609
|
-
/**
|
|
52610
|
-
* @readonly
|
|
52611
|
-
* @type {Vector1}
|
|
52612
|
-
*/
|
|
52613
|
-
Vector1.one = Object.freeze(new Vector1(1));
|
|
52614
|
-
|
|
52615
52275
|
/**
|
|
52616
52276
|
*
|
|
52617
52277
|
* @param {string|null|undefined} string
|
|
@@ -52773,6 +52433,43 @@ class ObservedString extends String {
|
|
|
52773
52433
|
*/
|
|
52774
52434
|
ObservedString.prototype.isObservedString = true;
|
|
52775
52435
|
|
|
52436
|
+
/**
|
|
52437
|
+
* Created by Alex on 11/11/2014.
|
|
52438
|
+
*/
|
|
52439
|
+
|
|
52440
|
+
|
|
52441
|
+
function canvas2Sampler2D(canvas) {
|
|
52442
|
+
const width = canvas.width;
|
|
52443
|
+
const height = canvas.height;
|
|
52444
|
+
|
|
52445
|
+
const context = canvas.getContext("2d");
|
|
52446
|
+
|
|
52447
|
+
const result = new Sampler2D(null, 4, width, height);
|
|
52448
|
+
|
|
52449
|
+
canvasDataToSampler(result, context);
|
|
52450
|
+
|
|
52451
|
+
return result;
|
|
52452
|
+
|
|
52453
|
+
}
|
|
52454
|
+
|
|
52455
|
+
/**
|
|
52456
|
+
*
|
|
52457
|
+
* @param {Sampler2D} target
|
|
52458
|
+
* @param {CanvasRenderingContext2D} ctx
|
|
52459
|
+
*/
|
|
52460
|
+
function canvasDataToSampler(target, ctx) {
|
|
52461
|
+
const width = target.width;
|
|
52462
|
+
const height = target.height;
|
|
52463
|
+
|
|
52464
|
+
const imageData = ctx.getImageData(0, 0, width, height);
|
|
52465
|
+
|
|
52466
|
+
const data = imageData.data;
|
|
52467
|
+
|
|
52468
|
+
assert.equal(data.length, target.height * target.width * target.itemSize);
|
|
52469
|
+
|
|
52470
|
+
target.data = data;
|
|
52471
|
+
}
|
|
52472
|
+
|
|
52776
52473
|
/**
|
|
52777
52474
|
*
|
|
52778
52475
|
* @param {Sampler2D} input
|
|
@@ -53007,52 +52704,96 @@ function sampler2d_scale(input, output) {
|
|
|
53007
52704
|
}
|
|
53008
52705
|
|
|
53009
52706
|
/**
|
|
53010
|
-
*
|
|
53011
|
-
* @
|
|
53012
|
-
* @returns {number}
|
|
52707
|
+
* Color blending modes
|
|
52708
|
+
* @enum {number}
|
|
53013
52709
|
*/
|
|
53014
|
-
|
|
53015
|
-
|
|
53016
|
-
|
|
52710
|
+
const BlendingType = {
|
|
52711
|
+
NoBlending: 5,
|
|
52712
|
+
Normal: 0,
|
|
52713
|
+
Add: 1,
|
|
52714
|
+
Subtract: 2,
|
|
52715
|
+
Multiply: 3,
|
|
52716
|
+
MultiplyAdd: 4
|
|
52717
|
+
};
|
|
53017
52718
|
|
|
53018
52719
|
/**
|
|
53019
52720
|
*
|
|
53020
|
-
* @param {number}
|
|
53021
|
-
* @
|
|
52721
|
+
* @param {number[]} source
|
|
52722
|
+
* @param {number[]} destination
|
|
52723
|
+
* @param {Array} result
|
|
53022
52724
|
*/
|
|
53023
|
-
function
|
|
53024
|
-
|
|
53025
|
-
|
|
53026
|
-
|
|
52725
|
+
function blendFunctionNormal(source, destination, result) {
|
|
52726
|
+
|
|
52727
|
+
const a1 = source[3] / 255;
|
|
52728
|
+
const a0 = destination[3] / 255;
|
|
52729
|
+
|
|
52730
|
+
result[0] = source[0] * a1 + destination[0] * (1 - a1);
|
|
52731
|
+
result[1] = source[1] * a1 + destination[1] * (1 - a1);
|
|
52732
|
+
result[2] = source[2] * a1 + destination[2] * (1 - a1);
|
|
52733
|
+
result[3] = (a1 + a0 * (1 - a1)) * 255;
|
|
52734
|
+
}
|
|
52735
|
+
|
|
53027
52736
|
/**
|
|
53028
|
-
*
|
|
53029
|
-
*
|
|
53030
|
-
* @
|
|
53031
|
-
* @param {
|
|
53032
|
-
* @param {number}
|
|
53033
|
-
* @param {
|
|
53034
|
-
* @param {number}
|
|
53035
|
-
* @param {number}
|
|
52737
|
+
* Assumes both samplers are RGBA uint8 with values 0-255
|
|
52738
|
+
* @param {Sampler2D} destination
|
|
52739
|
+
* @param {Sampler2D} source
|
|
52740
|
+
* @param {number} sourceX
|
|
52741
|
+
* @param {number} sourceY
|
|
52742
|
+
* @param {number} destinationX
|
|
52743
|
+
* @param {number} destinationY
|
|
52744
|
+
* @param {number} width
|
|
52745
|
+
* @param {number} height
|
|
52746
|
+
* @param {BlendingType} [blendMode]
|
|
53036
52747
|
*/
|
|
53037
|
-
function
|
|
53038
|
-
source,
|
|
53039
|
-
source_position,
|
|
52748
|
+
function sampler2d_paint(
|
|
53040
52749
|
destination,
|
|
53041
|
-
|
|
53042
|
-
|
|
52750
|
+
source,
|
|
52751
|
+
sourceX, sourceY,
|
|
52752
|
+
destinationX, destinationY,
|
|
52753
|
+
width, height,
|
|
52754
|
+
blendMode = BlendingType.Normal
|
|
53043
52755
|
) {
|
|
53044
|
-
assert.isNonNegativeInteger(source_position, 'source_position');
|
|
53045
|
-
assert.isNonNegativeInteger(destination_position, 'destination_position');
|
|
53046
|
-
assert.isNonNegativeInteger(length, 'length');
|
|
53047
52756
|
|
|
53048
|
-
let
|
|
52757
|
+
let blendFunction;
|
|
52758
|
+
if (blendMode === BlendingType.Normal) {
|
|
52759
|
+
blendFunction = blendFunctionNormal;
|
|
52760
|
+
} else {
|
|
52761
|
+
throw new Error(`Unsupported blendType(=${blendMode})`);
|
|
52762
|
+
}
|
|
53049
52763
|
|
|
53050
|
-
|
|
53051
|
-
|
|
53052
|
-
j = destination_position + k;
|
|
52764
|
+
const _w = Math.min(width, source.width - sourceX, destination.width - destinationX);
|
|
52765
|
+
const _h = Math.min(height, source.height - sourceY, destination.height - destinationY);
|
|
53053
52766
|
|
|
53054
|
-
|
|
52767
|
+
const _x0 = Math.max(0, -destinationX);
|
|
52768
|
+
const _y0 = Math.max(0, -destinationY);
|
|
52769
|
+
|
|
52770
|
+
const c0 = [0, 0, 0, 255];
|
|
52771
|
+
const c1 = [0, 0, 0, 255];
|
|
52772
|
+
|
|
52773
|
+
const c3 = [];
|
|
52774
|
+
|
|
52775
|
+
let x, y;
|
|
52776
|
+
|
|
52777
|
+
for (y = _y0; y < _h; y++) {
|
|
52778
|
+
for (x = _x0; x < _w; x++) {
|
|
52779
|
+
const d_x = Math.round(x + destinationX);
|
|
52780
|
+
const d_y = Math.round(y + destinationY);
|
|
52781
|
+
|
|
52782
|
+
destination.read(d_x, d_y, c0);
|
|
52783
|
+
|
|
52784
|
+
const s_x = Math.round(x + sourceY);
|
|
52785
|
+
const s_y = Math.round(y + sourceY);
|
|
52786
|
+
|
|
52787
|
+
source.read(s_x, s_y, c1);
|
|
52788
|
+
|
|
52789
|
+
blendFunction(c1, c0, c3);
|
|
52790
|
+
|
|
52791
|
+
destination.set(d_x, d_y, c3);
|
|
52792
|
+
|
|
52793
|
+
}
|
|
53055
52794
|
}
|
|
52795
|
+
|
|
52796
|
+
|
|
53056
52797
|
}
|
|
53057
52798
|
|
|
53058
52799
|
/**
|
|
@@ -53110,7 +52851,7 @@ class TerrainOverlay {
|
|
|
53110
52851
|
*/
|
|
53111
52852
|
this.size = new Vector2(size.x, size.y);
|
|
53112
52853
|
|
|
53113
|
-
|
|
52854
|
+
/**
|
|
53114
52855
|
*
|
|
53115
52856
|
* @type {ObservedString}
|
|
53116
52857
|
*/
|
|
@@ -53161,7 +52902,7 @@ class TerrainOverlay {
|
|
|
53161
52902
|
*
|
|
53162
52903
|
* @returns {string}
|
|
53163
52904
|
*/
|
|
53164
|
-
get baseTileImage(){
|
|
52905
|
+
get baseTileImage() {
|
|
53165
52906
|
return this.stack.length === 0 ? this.tileImage.getValue() : this.stack[0].tileImage
|
|
53166
52907
|
}
|
|
53167
52908
|
|
|
@@ -53169,7 +52910,7 @@ class TerrainOverlay {
|
|
|
53169
52910
|
*
|
|
53170
52911
|
* @param {string} v
|
|
53171
52912
|
*/
|
|
53172
|
-
set baseTileImage(v){
|
|
52913
|
+
set baseTileImage(v) {
|
|
53173
52914
|
if (this.stack.length === 0) {
|
|
53174
52915
|
this.tileImage.set(v);
|
|
53175
52916
|
} else {
|
|
@@ -53357,7 +53098,7 @@ class TerrainOverlay {
|
|
|
53357
53098
|
const scaled_source = Sampler2D.uint8(4, dWidth, dHeight);
|
|
53358
53099
|
sampler2d_scale(source, scaled_source);
|
|
53359
53100
|
|
|
53360
|
-
this
|
|
53101
|
+
sampler2d_paint(this, scaled_source, 0, 0, dx, dy, dWidth, dHeight);
|
|
53361
53102
|
|
|
53362
53103
|
this.texture.needsUpdate = true;
|
|
53363
53104
|
}
|
|
@@ -53394,31 +53135,30 @@ function loadCloudTexture(url) {
|
|
|
53394
53135
|
|
|
53395
53136
|
|
|
53396
53137
|
class Clouds {
|
|
53397
|
-
|
|
53398
|
-
|
|
53399
|
-
|
|
53400
|
-
|
|
53401
|
-
|
|
53402
|
-
|
|
53403
|
-
|
|
53404
|
-
|
|
53405
|
-
|
|
53406
|
-
|
|
53407
|
-
|
|
53408
|
-
|
|
53409
|
-
|
|
53410
|
-
this.time = 0;
|
|
53138
|
+
/**
|
|
53139
|
+
*
|
|
53140
|
+
* @type {boolean}
|
|
53141
|
+
* @private
|
|
53142
|
+
*/
|
|
53143
|
+
__enabled = false;
|
|
53144
|
+
/**
|
|
53145
|
+
*
|
|
53146
|
+
* @type {Array}
|
|
53147
|
+
* @private
|
|
53148
|
+
*/
|
|
53149
|
+
materials = [];
|
|
53150
|
+
time = 0;
|
|
53411
53151
|
|
|
53412
53152
|
|
|
53413
|
-
|
|
53414
|
-
|
|
53415
|
-
|
|
53153
|
+
__speed0 = new Vector2();
|
|
53154
|
+
__speed1 = new Vector2();
|
|
53155
|
+
__speed2 = new Vector2();
|
|
53416
53156
|
|
|
53417
|
-
|
|
53418
|
-
|
|
53157
|
+
//how fast clouds reform
|
|
53158
|
+
variability = 0.37;
|
|
53419
53159
|
|
|
53160
|
+
constructor() {
|
|
53420
53161
|
this.setSpeed(0.5, -0.5);
|
|
53421
|
-
|
|
53422
53162
|
}
|
|
53423
53163
|
|
|
53424
53164
|
/**
|
|
@@ -55268,7 +55008,7 @@ function rgb2uint24(r, g, b) {
|
|
|
55268
55008
|
/**
|
|
55269
55009
|
* Convert a decimal value to hex
|
|
55270
55010
|
* @param {number} c generally expects b byte value, 0-255
|
|
55271
|
-
* @returns {string}
|
|
55011
|
+
* @returns {string} zero-padded value, for example instead of "0", will return "00" and instead of "F" will return "0F"
|
|
55272
55012
|
*/
|
|
55273
55013
|
function dec2hex(c) {
|
|
55274
55014
|
const hex = Math.round(c).toString(16);
|
|
@@ -61261,46 +61001,47 @@ function heightMap2NormalMap(renderer, sampler) {
|
|
|
61261
61001
|
return new Sampler2D(rgb, 3, width, height);
|
|
61262
61002
|
}
|
|
61263
61003
|
|
|
61264
|
-
|
|
61265
|
-
this.used = new Set();
|
|
61266
|
-
}
|
|
61004
|
+
class WebGLRendererPool {
|
|
61267
61005
|
|
|
61268
|
-
|
|
61269
|
-
const canvas = document.createElement('canvas');
|
|
61270
|
-
const context = canvas.getContext('webgl2', { antialias: true });
|
|
61006
|
+
used = new Set();
|
|
61271
61007
|
|
|
61272
|
-
|
|
61273
|
-
|
|
61274
|
-
context,
|
|
61275
|
-
canvas
|
|
61276
|
-
});
|
|
61008
|
+
get(options) {
|
|
61009
|
+
const canvas = document.createElement('canvas');
|
|
61010
|
+
const context = canvas.getContext('webgl2', { antialias: true });
|
|
61277
61011
|
|
|
61278
|
-
|
|
61012
|
+
const renderer = new WebGLRenderer({
|
|
61013
|
+
alpha: true,
|
|
61014
|
+
context,
|
|
61015
|
+
canvas
|
|
61016
|
+
});
|
|
61279
61017
|
|
|
61280
|
-
|
|
61281
|
-
return renderer;
|
|
61282
|
-
};
|
|
61018
|
+
assert.equal(renderer.domElement, canvas, 'renderer.domElement !== canvas');
|
|
61283
61019
|
|
|
61284
|
-
|
|
61285
|
-
|
|
61286
|
-
* @param {THREE.WebGLRenderer} renderer
|
|
61287
|
-
* @returns {boolean}
|
|
61288
|
-
*/
|
|
61289
|
-
WebGLRendererPool.prototype.release = function (renderer) {
|
|
61290
|
-
if (!this.used.has(renderer)) {
|
|
61291
|
-
//not from this pool
|
|
61292
|
-
return false;
|
|
61020
|
+
this.used.add(renderer);
|
|
61021
|
+
return renderer;
|
|
61293
61022
|
}
|
|
61294
|
-
this.used.delete(renderer);
|
|
61295
61023
|
|
|
61296
|
-
|
|
61297
|
-
|
|
61298
|
-
|
|
61024
|
+
/**
|
|
61025
|
+
*
|
|
61026
|
+
* @param {THREE.WebGLRenderer} renderer
|
|
61027
|
+
* @returns {boolean}
|
|
61028
|
+
*/
|
|
61029
|
+
release(renderer) {
|
|
61030
|
+
if (!this.used.has(renderer)) {
|
|
61031
|
+
//not from this pool
|
|
61032
|
+
return false;
|
|
61033
|
+
}
|
|
61034
|
+
this.used.delete(renderer);
|
|
61299
61035
|
|
|
61300
|
-
|
|
61301
|
-
|
|
61036
|
+
renderer.forceContextLoss();
|
|
61037
|
+
renderer.dispose();
|
|
61038
|
+
renderer.domElement = null;
|
|
61302
61039
|
|
|
61303
|
-
|
|
61040
|
+
return true;
|
|
61041
|
+
}
|
|
61042
|
+
|
|
61043
|
+
static global = new WebGLRendererPool();
|
|
61044
|
+
}
|
|
61304
61045
|
|
|
61305
61046
|
/**
|
|
61306
61047
|
*
|
|
@@ -62970,185 +62711,6 @@ Cache.prototype.delete = Cache.prototype.remove;
|
|
|
62970
62711
|
*/
|
|
62971
62712
|
Cache.prototype.has = Cache.prototype.contains;
|
|
62972
62713
|
|
|
62973
|
-
/**
|
|
62974
|
-
* Compute byte size of a UTF8 string
|
|
62975
|
-
* @param {string} value
|
|
62976
|
-
* @returns {number}
|
|
62977
|
-
*/
|
|
62978
|
-
function string_compute_byte_size(value) {
|
|
62979
|
-
const length = value.length;
|
|
62980
|
-
|
|
62981
|
-
let p = 0;
|
|
62982
|
-
|
|
62983
|
-
for (let i = 0; i < length; i++) {
|
|
62984
|
-
let c = value.charCodeAt(i);
|
|
62985
|
-
while (c > 0xff) {
|
|
62986
|
-
p++;
|
|
62987
|
-
c >>= 8;
|
|
62988
|
-
}
|
|
62989
|
-
p++;
|
|
62990
|
-
}
|
|
62991
|
-
|
|
62992
|
-
return p;
|
|
62993
|
-
}
|
|
62994
|
-
|
|
62995
|
-
/**
|
|
62996
|
-
*
|
|
62997
|
-
* @type {Cache<String,Sampler2D>}
|
|
62998
|
-
*/
|
|
62999
|
-
const cache$1 = new Cache({
|
|
63000
|
-
maxWeight: 304857600,
|
|
63001
|
-
keyHashFunction: computeStringHash,
|
|
63002
|
-
keyWeigher: string_compute_byte_size,
|
|
63003
|
-
/**
|
|
63004
|
-
*
|
|
63005
|
-
* @param {Sampler2D} sampler
|
|
63006
|
-
* @returns {number}
|
|
63007
|
-
*/
|
|
63008
|
-
valueWeigher(sampler) {
|
|
63009
|
-
return sampler.computeByteSize();
|
|
63010
|
-
}
|
|
63011
|
-
});
|
|
63012
|
-
|
|
63013
|
-
class TerrainLayer {
|
|
63014
|
-
constructor() {
|
|
63015
|
-
/**
|
|
63016
|
-
*
|
|
63017
|
-
* @type {String}
|
|
63018
|
-
*/
|
|
63019
|
-
this.textureDiffuseURL = "";
|
|
63020
|
-
|
|
63021
|
-
/**
|
|
63022
|
-
*
|
|
63023
|
-
* @type {Sampler2D}
|
|
63024
|
-
*/
|
|
63025
|
-
this.diffuse = Sampler2D.uint8(3, 1, 1);
|
|
63026
|
-
|
|
63027
|
-
/**
|
|
63028
|
-
*
|
|
63029
|
-
* @type {Vector2}
|
|
63030
|
-
*/
|
|
63031
|
-
this.size = new Vector2(1, 1);
|
|
63032
|
-
|
|
63033
|
-
/**
|
|
63034
|
-
* Additional free-form JSON metadata
|
|
63035
|
-
* @type {Object}
|
|
63036
|
-
*/
|
|
63037
|
-
this.extra = {};
|
|
63038
|
-
|
|
63039
|
-
/**
|
|
63040
|
-
*
|
|
63041
|
-
* @type {Signal}
|
|
63042
|
-
*/
|
|
63043
|
-
this.onChanged = new Signal();
|
|
63044
|
-
}
|
|
63045
|
-
|
|
63046
|
-
toJSON() {
|
|
63047
|
-
return {
|
|
63048
|
-
textureDiffuseURL: this.textureDiffuseURL,
|
|
63049
|
-
size: this.size.toJSON(),
|
|
63050
|
-
extra: this.extra
|
|
63051
|
-
};
|
|
63052
|
-
}
|
|
63053
|
-
|
|
63054
|
-
fromJSON({ textureDiffuseURL, size, extra = {} }) {
|
|
63055
|
-
this.textureDiffuseURL = textureDiffuseURL;
|
|
63056
|
-
this.size.fromJSON(size);
|
|
63057
|
-
this.extra = extra;
|
|
63058
|
-
}
|
|
63059
|
-
|
|
63060
|
-
/**
|
|
63061
|
-
*
|
|
63062
|
-
* @param {string} url
|
|
63063
|
-
* @param {number} width
|
|
63064
|
-
* @param {number} height
|
|
63065
|
-
*/
|
|
63066
|
-
static from(url, width, height) {
|
|
63067
|
-
const r = new TerrainLayer();
|
|
63068
|
-
|
|
63069
|
-
r.textureDiffuseURL = url;
|
|
63070
|
-
r.size.set(width, height);
|
|
63071
|
-
|
|
63072
|
-
return r;
|
|
63073
|
-
}
|
|
63074
|
-
|
|
63075
|
-
/**
|
|
63076
|
-
*
|
|
63077
|
-
* @param {TerrainLayerDescription} d
|
|
63078
|
-
* @returns {TerrainLayer}
|
|
63079
|
-
*/
|
|
63080
|
-
static fromDescription(d) {
|
|
63081
|
-
return TerrainLayer.from(
|
|
63082
|
-
d.diffuse,
|
|
63083
|
-
d.size.x,
|
|
63084
|
-
d.size.y
|
|
63085
|
-
);
|
|
63086
|
-
}
|
|
63087
|
-
|
|
63088
|
-
/**
|
|
63089
|
-
*
|
|
63090
|
-
* @param {AssetManager} assetManager
|
|
63091
|
-
* @returns {Promise}
|
|
63092
|
-
*/
|
|
63093
|
-
loadTextureData(assetManager) {
|
|
63094
|
-
|
|
63095
|
-
const path = this.textureDiffuseURL;
|
|
63096
|
-
|
|
63097
|
-
/**
|
|
63098
|
-
*
|
|
63099
|
-
* @type {Sampler2D|null}
|
|
63100
|
-
*/
|
|
63101
|
-
const cached = cache$1.get(path);
|
|
63102
|
-
|
|
63103
|
-
if (cached !== null) {
|
|
63104
|
-
|
|
63105
|
-
console.log('Using cached terrain layer data for ', path);
|
|
63106
|
-
|
|
63107
|
-
this.diffuse.resize(cached.width, cached.height, false);
|
|
63108
|
-
|
|
63109
|
-
this.diffuse.data.set(cached.data);
|
|
63110
|
-
|
|
63111
|
-
this.onChanged.send0();
|
|
63112
|
-
|
|
63113
|
-
return Promise.resolve();
|
|
63114
|
-
|
|
63115
|
-
}
|
|
63116
|
-
|
|
63117
|
-
const assetPromise = assetManager.promise(path, GameAssetType.Image);
|
|
63118
|
-
|
|
63119
|
-
return assetPromise
|
|
63120
|
-
.then(assert => {
|
|
63121
|
-
const image = assert.create();
|
|
63122
|
-
|
|
63123
|
-
const source_item_size = image.itemSize;
|
|
63124
|
-
|
|
63125
|
-
const source_data = image.data;
|
|
63126
|
-
|
|
63127
|
-
// RGB
|
|
63128
|
-
const destination_item_size = 3;
|
|
63129
|
-
|
|
63130
|
-
if (this.diffuse === null || this.diffuse.width !== image.width || this.diffuse.height !== image.height) {
|
|
63131
|
-
// loaded image does not match the side of the layer
|
|
63132
|
-
this.diffuse = Sampler2D.uint8(destination_item_size, image.width, image.height);
|
|
63133
|
-
}
|
|
63134
|
-
|
|
63135
|
-
const source = new Sampler2D(source_data, source_item_size, image.width, image.height);
|
|
63136
|
-
|
|
63137
|
-
copy_Sampler2D_channel_data(source, this.diffuse);
|
|
63138
|
-
|
|
63139
|
-
this.onChanged.send0();
|
|
63140
|
-
|
|
63141
|
-
// write to cache
|
|
63142
|
-
const cacheCopy = Sampler2D.uint8(destination_item_size, image.width, image.height);
|
|
63143
|
-
|
|
63144
|
-
cacheCopy.data.set(this.diffuse.data);
|
|
63145
|
-
|
|
63146
|
-
cache$1.put(path, cacheCopy);
|
|
63147
|
-
|
|
63148
|
-
});
|
|
63149
|
-
}
|
|
63150
|
-
}
|
|
63151
|
-
|
|
63152
62714
|
/**
|
|
63153
62715
|
* @template T
|
|
63154
62716
|
* @param {T[]} array
|
|
@@ -64176,6 +63738,191 @@ function conditionEqualsStrict(v) {
|
|
|
64176
63738
|
return this === v;
|
|
64177
63739
|
}
|
|
64178
63740
|
|
|
63741
|
+
/**
|
|
63742
|
+
* Compute byte size of a UTF8 string
|
|
63743
|
+
* @param {string} value
|
|
63744
|
+
* @returns {number}
|
|
63745
|
+
*/
|
|
63746
|
+
function string_compute_byte_size(value) {
|
|
63747
|
+
const length = value.length;
|
|
63748
|
+
|
|
63749
|
+
let p = 0;
|
|
63750
|
+
|
|
63751
|
+
for (let i = 0; i < length; i++) {
|
|
63752
|
+
let c = value.charCodeAt(i);
|
|
63753
|
+
while (c > 0xff) {
|
|
63754
|
+
p++;
|
|
63755
|
+
c >>= 8;
|
|
63756
|
+
}
|
|
63757
|
+
p++;
|
|
63758
|
+
}
|
|
63759
|
+
|
|
63760
|
+
return p;
|
|
63761
|
+
}
|
|
63762
|
+
|
|
63763
|
+
/**
|
|
63764
|
+
*
|
|
63765
|
+
* @type {Cache<String,Sampler2D>}
|
|
63766
|
+
*/
|
|
63767
|
+
const cache$1 = new Cache({
|
|
63768
|
+
maxWeight: 304857600,
|
|
63769
|
+
keyHashFunction: computeStringHash,
|
|
63770
|
+
keyWeigher: string_compute_byte_size,
|
|
63771
|
+
/**
|
|
63772
|
+
*
|
|
63773
|
+
* @param {Sampler2D} sampler
|
|
63774
|
+
* @returns {number}
|
|
63775
|
+
*/
|
|
63776
|
+
valueWeigher(sampler) {
|
|
63777
|
+
return sampler.computeByteSize();
|
|
63778
|
+
}
|
|
63779
|
+
});
|
|
63780
|
+
|
|
63781
|
+
class TerrainLayer {
|
|
63782
|
+
|
|
63783
|
+
/**
|
|
63784
|
+
*
|
|
63785
|
+
* @type {String}
|
|
63786
|
+
*/
|
|
63787
|
+
textureDiffuseURL = "";
|
|
63788
|
+
|
|
63789
|
+
/**
|
|
63790
|
+
*
|
|
63791
|
+
* @type {Sampler2D}
|
|
63792
|
+
*/
|
|
63793
|
+
diffuse = Sampler2D.uint8(3, 1, 1);
|
|
63794
|
+
|
|
63795
|
+
/**
|
|
63796
|
+
*
|
|
63797
|
+
* @type {Vector2}
|
|
63798
|
+
*/
|
|
63799
|
+
size = new Vector2(1, 1);
|
|
63800
|
+
|
|
63801
|
+
/**
|
|
63802
|
+
* Additional free-form JSON metadata
|
|
63803
|
+
* @type {Object}
|
|
63804
|
+
*/
|
|
63805
|
+
extra = {};
|
|
63806
|
+
|
|
63807
|
+
/**
|
|
63808
|
+
*
|
|
63809
|
+
* @type {Signal}
|
|
63810
|
+
*/
|
|
63811
|
+
onChanged = new Signal();
|
|
63812
|
+
|
|
63813
|
+
|
|
63814
|
+
toJSON() {
|
|
63815
|
+
return {
|
|
63816
|
+
textureDiffuseURL: this.textureDiffuseURL,
|
|
63817
|
+
size: this.size.toJSON(),
|
|
63818
|
+
extra: this.extra
|
|
63819
|
+
};
|
|
63820
|
+
}
|
|
63821
|
+
|
|
63822
|
+
fromJSON({ textureDiffuseURL, size, extra = {} }) {
|
|
63823
|
+
this.textureDiffuseURL = textureDiffuseURL;
|
|
63824
|
+
this.size.fromJSON(size);
|
|
63825
|
+
this.extra = extra;
|
|
63826
|
+
}
|
|
63827
|
+
|
|
63828
|
+
/**
|
|
63829
|
+
*
|
|
63830
|
+
* @param {string} url
|
|
63831
|
+
* @param {number} width
|
|
63832
|
+
* @param {number} height
|
|
63833
|
+
*/
|
|
63834
|
+
static from(url, width, height) {
|
|
63835
|
+
const r = new TerrainLayer();
|
|
63836
|
+
|
|
63837
|
+
r.textureDiffuseURL = url;
|
|
63838
|
+
r.size.set(width, height);
|
|
63839
|
+
|
|
63840
|
+
return r;
|
|
63841
|
+
}
|
|
63842
|
+
|
|
63843
|
+
/**
|
|
63844
|
+
*
|
|
63845
|
+
* @param {TerrainLayerDescription} d
|
|
63846
|
+
* @returns {TerrainLayer}
|
|
63847
|
+
*/
|
|
63848
|
+
static fromDescription(d) {
|
|
63849
|
+
return TerrainLayer.from(
|
|
63850
|
+
d.diffuse,
|
|
63851
|
+
d.size.x,
|
|
63852
|
+
d.size.y
|
|
63853
|
+
);
|
|
63854
|
+
}
|
|
63855
|
+
|
|
63856
|
+
/**
|
|
63857
|
+
*
|
|
63858
|
+
* @param {AssetManager} assetManager
|
|
63859
|
+
* @returns {Promise}
|
|
63860
|
+
*/
|
|
63861
|
+
loadTextureData(assetManager) {
|
|
63862
|
+
|
|
63863
|
+
const path = this.textureDiffuseURL;
|
|
63864
|
+
|
|
63865
|
+
/**
|
|
63866
|
+
*
|
|
63867
|
+
* @type {Sampler2D|null}
|
|
63868
|
+
*/
|
|
63869
|
+
const cached = cache$1.get(path);
|
|
63870
|
+
|
|
63871
|
+
if (cached !== null) {
|
|
63872
|
+
|
|
63873
|
+
console.log('Using cached terrain layer data for ', path);
|
|
63874
|
+
|
|
63875
|
+
this.diffuse.resize(cached.width, cached.height, false);
|
|
63876
|
+
|
|
63877
|
+
this.diffuse.data.set(cached.data);
|
|
63878
|
+
|
|
63879
|
+
this.onChanged.send0();
|
|
63880
|
+
|
|
63881
|
+
return Promise.resolve();
|
|
63882
|
+
|
|
63883
|
+
}
|
|
63884
|
+
|
|
63885
|
+
const assetPromise = assetManager.promise(path, GameAssetType.Image);
|
|
63886
|
+
|
|
63887
|
+
return assetPromise
|
|
63888
|
+
.then(assert => {
|
|
63889
|
+
const image = assert.create();
|
|
63890
|
+
|
|
63891
|
+
const source_item_size = image.itemSize;
|
|
63892
|
+
|
|
63893
|
+
const source_data = image.data;
|
|
63894
|
+
|
|
63895
|
+
// RGB
|
|
63896
|
+
const destination_item_size = 3;
|
|
63897
|
+
|
|
63898
|
+
if (this.diffuse === null || this.diffuse.width !== image.width || this.diffuse.height !== image.height) {
|
|
63899
|
+
// loaded image does not match the side of the layer
|
|
63900
|
+
this.diffuse = Sampler2D.uint8(destination_item_size, image.width, image.height);
|
|
63901
|
+
}
|
|
63902
|
+
|
|
63903
|
+
const source = new Sampler2D(source_data, source_item_size, image.width, image.height);
|
|
63904
|
+
|
|
63905
|
+
copy_Sampler2D_channel_data(source, this.diffuse);
|
|
63906
|
+
|
|
63907
|
+
this.onChanged.send0();
|
|
63908
|
+
|
|
63909
|
+
// write to cache
|
|
63910
|
+
const cacheCopy = Sampler2D.uint8(destination_item_size, image.width, image.height);
|
|
63911
|
+
|
|
63912
|
+
cacheCopy.data.set(this.diffuse.data);
|
|
63913
|
+
|
|
63914
|
+
cache$1.put(path, cacheCopy);
|
|
63915
|
+
|
|
63916
|
+
});
|
|
63917
|
+
}
|
|
63918
|
+
}
|
|
63919
|
+
|
|
63920
|
+
/**
|
|
63921
|
+
* @readonly
|
|
63922
|
+
* @type {boolean}
|
|
63923
|
+
*/
|
|
63924
|
+
TerrainLayer.prototype.isTerrainLayer = true;
|
|
63925
|
+
|
|
64179
63926
|
class ScaledTextureKey {
|
|
64180
63927
|
uri = '';
|
|
64181
63928
|
|
|
@@ -64430,6 +64177,7 @@ class TerrainLayers {
|
|
|
64430
64177
|
*/
|
|
64431
64178
|
addLayer(layer) {
|
|
64432
64179
|
assert.defined(layer);
|
|
64180
|
+
assert.equal(layer.isTerrainLayer, true, 'layer.isTerrainLayer !== true');
|
|
64433
64181
|
|
|
64434
64182
|
const index = this.layers.length;
|
|
64435
64183
|
|
|
@@ -72139,6 +71887,25 @@ BitSet.fixedSize = function (x) {
|
|
|
72139
71887
|
*/
|
|
72140
71888
|
|
|
72141
71889
|
class EntityObserver {
|
|
71890
|
+
/**
|
|
71891
|
+
*
|
|
71892
|
+
* @type {BitSet}
|
|
71893
|
+
*/
|
|
71894
|
+
componentMask = new BitSet();
|
|
71895
|
+
|
|
71896
|
+
/**
|
|
71897
|
+
* Mapping from component index to position in array of observed component types,
|
|
71898
|
+
* this is used to build arguments for callbacks
|
|
71899
|
+
* @type {number[]}
|
|
71900
|
+
*/
|
|
71901
|
+
componentIndexMapping = [];
|
|
71902
|
+
|
|
71903
|
+
/**
|
|
71904
|
+
*
|
|
71905
|
+
* @type {EntityComponentDataset|null}
|
|
71906
|
+
*/
|
|
71907
|
+
dataset = null;
|
|
71908
|
+
|
|
72142
71909
|
/**
|
|
72143
71910
|
*
|
|
72144
71911
|
* @param {Array} componentTypes
|
|
@@ -72147,7 +71914,12 @@ class EntityObserver {
|
|
|
72147
71914
|
* @param {*} [thisArg=undefined] will assume {@link this} value inside callbacks
|
|
72148
71915
|
* @constructor
|
|
72149
71916
|
*/
|
|
72150
|
-
constructor(
|
|
71917
|
+
constructor(
|
|
71918
|
+
componentTypes,
|
|
71919
|
+
completedCallback,
|
|
71920
|
+
brokenCallback,
|
|
71921
|
+
thisArg
|
|
71922
|
+
) {
|
|
72151
71923
|
assert.isArray(componentTypes, 'componentTypes must be an array, instead was something else');
|
|
72152
71924
|
assert.isFunction(completedCallback, 'completedCallback');
|
|
72153
71925
|
assert.isFunction(brokenCallback, 'brokenCallback');
|
|
@@ -72186,26 +71958,6 @@ class EntityObserver {
|
|
|
72186
71958
|
* @type {*}
|
|
72187
71959
|
*/
|
|
72188
71960
|
this.thisArg = thisArg;
|
|
72189
|
-
|
|
72190
|
-
|
|
72191
|
-
/**
|
|
72192
|
-
*
|
|
72193
|
-
* @type {BitSet}
|
|
72194
|
-
*/
|
|
72195
|
-
this.componentMask = new BitSet();
|
|
72196
|
-
|
|
72197
|
-
/**
|
|
72198
|
-
* Mapping from component index to position in array of observed component types,
|
|
72199
|
-
* this is used to build arguments for callbacks
|
|
72200
|
-
* @type {number[]}
|
|
72201
|
-
*/
|
|
72202
|
-
this.componentIndexMapping = [];
|
|
72203
|
-
|
|
72204
|
-
/**
|
|
72205
|
-
*
|
|
72206
|
-
* @type {EntityComponentDataset|null}
|
|
72207
|
-
*/
|
|
72208
|
-
this.dataset = null;
|
|
72209
71961
|
}
|
|
72210
71962
|
|
|
72211
71963
|
/**
|
|
@@ -73290,6 +73042,9 @@ class EntityManager {
|
|
|
73290
73042
|
on = {
|
|
73291
73043
|
systemStarted: new Signal(),
|
|
73292
73044
|
systemStopped: new Signal(),
|
|
73045
|
+
/**
|
|
73046
|
+
* @type {Signal<System>}
|
|
73047
|
+
*/
|
|
73293
73048
|
systemAdded: new Signal(),
|
|
73294
73049
|
systemRemoved: new Signal(),
|
|
73295
73050
|
};
|
|
@@ -74716,17 +74471,43 @@ ParentEntity.serializable = false;
|
|
|
74716
74471
|
const DEFAULT_FLAGS$1 = EntityNodeFlags.LiveManagement;
|
|
74717
74472
|
|
|
74718
74473
|
class EntityNode {
|
|
74474
|
+
/**
|
|
74475
|
+
*
|
|
74476
|
+
* @type {EntityNode|null}
|
|
74477
|
+
* @private
|
|
74478
|
+
*/
|
|
74479
|
+
__parent = null;
|
|
74480
|
+
|
|
74481
|
+
/**
|
|
74482
|
+
*
|
|
74483
|
+
* @type {EntityNode[]}
|
|
74484
|
+
* @private
|
|
74485
|
+
*/
|
|
74486
|
+
__children = [];
|
|
74487
|
+
|
|
74488
|
+
/**
|
|
74489
|
+
* Local transform
|
|
74490
|
+
* @type {Transform}
|
|
74491
|
+
* @private
|
|
74492
|
+
*/
|
|
74493
|
+
__transform = new Transform();
|
|
74494
|
+
|
|
74495
|
+
on = {
|
|
74496
|
+
built: new Signal(),
|
|
74497
|
+
destroyed: new Signal()
|
|
74498
|
+
};
|
|
74499
|
+
|
|
74500
|
+
/**
|
|
74501
|
+
*
|
|
74502
|
+
* @type {number}
|
|
74503
|
+
*/
|
|
74504
|
+
flags = DEFAULT_FLAGS$1;
|
|
74505
|
+
|
|
74719
74506
|
/**
|
|
74720
74507
|
*
|
|
74721
74508
|
* @param {Entity} [entity] optional entity to be wrapped
|
|
74722
74509
|
*/
|
|
74723
74510
|
constructor(entity = new Entity()) {
|
|
74724
|
-
/**
|
|
74725
|
-
*
|
|
74726
|
-
* @type {EntityNode|null}
|
|
74727
|
-
* @private
|
|
74728
|
-
*/
|
|
74729
|
-
this.__parent = null;
|
|
74730
74511
|
|
|
74731
74512
|
/**
|
|
74732
74513
|
*
|
|
@@ -74735,30 +74516,6 @@ class EntityNode {
|
|
|
74735
74516
|
*/
|
|
74736
74517
|
this.__entity = entity;
|
|
74737
74518
|
|
|
74738
|
-
/**
|
|
74739
|
-
*
|
|
74740
|
-
* @type {EntityNode[]}
|
|
74741
|
-
* @private
|
|
74742
|
-
*/
|
|
74743
|
-
this.__children = [];
|
|
74744
|
-
|
|
74745
|
-
/**
|
|
74746
|
-
* Local transform
|
|
74747
|
-
* @type {Transform}
|
|
74748
|
-
* @private
|
|
74749
|
-
*/
|
|
74750
|
-
this.__transform = new Transform();
|
|
74751
|
-
|
|
74752
|
-
this.on = {
|
|
74753
|
-
built: new Signal(),
|
|
74754
|
-
destroyed: new Signal()
|
|
74755
|
-
};
|
|
74756
|
-
|
|
74757
|
-
/**
|
|
74758
|
-
*
|
|
74759
|
-
* @type {number}
|
|
74760
|
-
*/
|
|
74761
|
-
this.flags = DEFAULT_FLAGS$1;
|
|
74762
74519
|
}
|
|
74763
74520
|
|
|
74764
74521
|
/**
|
|
@@ -79429,7 +79186,6 @@ class EnginePlugin extends BaseProcess {
|
|
|
79429
79186
|
*/
|
|
79430
79187
|
engine = null;
|
|
79431
79188
|
|
|
79432
|
-
|
|
79433
79189
|
attach() {
|
|
79434
79190
|
/**
|
|
79435
79191
|
* Must be unique for each plugin
|
|
@@ -82577,10 +82333,12 @@ const SerializationFlags = {
|
|
|
82577
82333
|
};
|
|
82578
82334
|
|
|
82579
82335
|
class SerializationMetadata {
|
|
82580
|
-
constructor() {
|
|
82581
|
-
this.flags = 0;
|
|
82582
|
-
}
|
|
82583
82336
|
|
|
82337
|
+
/**
|
|
82338
|
+
*
|
|
82339
|
+
* @type {number}
|
|
82340
|
+
*/
|
|
82341
|
+
flags = 0;
|
|
82584
82342
|
|
|
82585
82343
|
/**
|
|
82586
82344
|
*
|
|
@@ -88674,20 +88432,19 @@ class Graph {
|
|
|
88674
88432
|
* Contains serializers for various data types as well as data upgraders which enable support for serialization format changes
|
|
88675
88433
|
*/
|
|
88676
88434
|
class BinarySerializationRegistry {
|
|
88677
|
-
|
|
88678
|
-
|
|
88679
|
-
|
|
88680
|
-
|
|
88681
|
-
|
|
88682
|
-
|
|
88683
|
-
|
|
88684
|
-
|
|
88685
|
-
|
|
88686
|
-
|
|
88687
|
-
|
|
88688
|
-
|
|
88689
|
-
|
|
88690
|
-
}
|
|
88435
|
+
|
|
88436
|
+
/**
|
|
88437
|
+
* @readonly
|
|
88438
|
+
* @private
|
|
88439
|
+
* @type {Map<string, Graph<BinaryClassUpgrader>>}
|
|
88440
|
+
*/
|
|
88441
|
+
upgraders = new Map();
|
|
88442
|
+
/**
|
|
88443
|
+
* @readonly
|
|
88444
|
+
* @private
|
|
88445
|
+
* @type {Map<string, BinaryClassSerializationAdapter>}
|
|
88446
|
+
*/
|
|
88447
|
+
serializers = new Map();
|
|
88691
88448
|
|
|
88692
88449
|
/**
|
|
88693
88450
|
*
|
|
@@ -89506,6 +89263,30 @@ class MaterialManager {
|
|
|
89506
89263
|
}
|
|
89507
89264
|
|
|
89508
89265
|
class FrameBuffer {
|
|
89266
|
+
/**
|
|
89267
|
+
* is expected to be bound during initialization
|
|
89268
|
+
* @type {WebGLRenderTarget}
|
|
89269
|
+
*/
|
|
89270
|
+
renderTarget = null;
|
|
89271
|
+
|
|
89272
|
+
/**
|
|
89273
|
+
* Number of users of the frame buffer
|
|
89274
|
+
* @type {number}
|
|
89275
|
+
*/
|
|
89276
|
+
referenceCount = 0;
|
|
89277
|
+
|
|
89278
|
+
/**
|
|
89279
|
+
* Dependency frame buffers
|
|
89280
|
+
* @type {string[]}
|
|
89281
|
+
*/
|
|
89282
|
+
dependencies = [];
|
|
89283
|
+
|
|
89284
|
+
/**
|
|
89285
|
+
* Size of the frame buffer in pixels
|
|
89286
|
+
* @type {Vector2}
|
|
89287
|
+
*/
|
|
89288
|
+
size = new Vector2(0, 0);
|
|
89289
|
+
|
|
89509
89290
|
/**
|
|
89510
89291
|
*
|
|
89511
89292
|
* @param {string} id
|
|
@@ -89518,29 +89299,6 @@ class FrameBuffer {
|
|
|
89518
89299
|
*/
|
|
89519
89300
|
this.id = id;
|
|
89520
89301
|
|
|
89521
|
-
/**
|
|
89522
|
-
* is expected to be bound during initialization
|
|
89523
|
-
* @type {WebGLRenderTarget}
|
|
89524
|
-
*/
|
|
89525
|
-
this.renderTarget = null;
|
|
89526
|
-
|
|
89527
|
-
/**
|
|
89528
|
-
* Number of users of the frame buffer
|
|
89529
|
-
* @type {number}
|
|
89530
|
-
*/
|
|
89531
|
-
this.referenceCount = 0;
|
|
89532
|
-
|
|
89533
|
-
/**
|
|
89534
|
-
* Dependency frame buffers
|
|
89535
|
-
* @type {string[]}
|
|
89536
|
-
*/
|
|
89537
|
-
this.dependencies = [];
|
|
89538
|
-
|
|
89539
|
-
/**
|
|
89540
|
-
* Size of the frame buffer in pixels
|
|
89541
|
-
* @type {Vector2}
|
|
89542
|
-
*/
|
|
89543
|
-
this.size = new Vector2(0, 0);
|
|
89544
89302
|
|
|
89545
89303
|
}
|
|
89546
89304
|
|
|
@@ -100097,6 +99855,12 @@ ObjectPoolFactory.prototype.release = function (object) {
|
|
|
100097
99855
|
* @template Key, Value
|
|
100098
99856
|
*/
|
|
100099
99857
|
class ImmutableObjectPool {
|
|
99858
|
+
/**
|
|
99859
|
+
*
|
|
99860
|
+
* @type {Signal<Key,Value>}
|
|
99861
|
+
*/
|
|
99862
|
+
onRemoved = new Signal()
|
|
99863
|
+
|
|
100100
99864
|
constructor({ capacity = 100, perKeyCapacity = 10 } = {}) {
|
|
100101
99865
|
/**
|
|
100102
99866
|
*
|
|
@@ -100181,15 +99945,17 @@ class ImmutableObjectPool {
|
|
|
100181
99945
|
|
|
100182
99946
|
const elements = this.data.get(key);
|
|
100183
99947
|
|
|
100184
|
-
|
|
100185
|
-
this.data.delete(key);
|
|
100186
|
-
} else {
|
|
100187
|
-
const i = elements.indexOf(el);
|
|
99948
|
+
const i = elements.indexOf(el);
|
|
100188
99949
|
|
|
100189
|
-
|
|
99950
|
+
elements.splice(i, 1);
|
|
99951
|
+
|
|
99952
|
+
if (elements.length === 0) {
|
|
99953
|
+
this.data.delete(key);
|
|
100190
99954
|
}
|
|
100191
99955
|
|
|
100192
99956
|
this.size--;
|
|
99957
|
+
|
|
99958
|
+
this.onRemoved.send2(key, el.value);
|
|
100193
99959
|
}
|
|
100194
99960
|
|
|
100195
99961
|
add(key, value) {
|
|
@@ -109357,6 +109123,64 @@ class IdPool {
|
|
|
109357
109123
|
}
|
|
109358
109124
|
}
|
|
109359
109125
|
|
|
109126
|
+
/**
|
|
109127
|
+
* @template T
|
|
109128
|
+
* @param {T} object
|
|
109129
|
+
* @return {T}
|
|
109130
|
+
*/
|
|
109131
|
+
function invokeObjectClone(object) {
|
|
109132
|
+
return object.clone();
|
|
109133
|
+
}
|
|
109134
|
+
|
|
109135
|
+
/**
|
|
109136
|
+
* Copy a patch from another sampler with the same itemSize
|
|
109137
|
+
* @param {Sampler2D} destination
|
|
109138
|
+
* @param {Sampler2D} source where to copy from
|
|
109139
|
+
* @param {Number} sourceX where to start reading from, X coordinate
|
|
109140
|
+
* @param {Number} sourceY where to start reading from, X coordinate
|
|
109141
|
+
* @param {Number} destinationX where to start writing to, X coordinate
|
|
109142
|
+
* @param {Number} destinationY where to start writing to, X coordinate
|
|
109143
|
+
* @param {Number} width size of the patch that is to be copied
|
|
109144
|
+
* @param {Number} height size of the patch that is to be copied
|
|
109145
|
+
*/
|
|
109146
|
+
function sampler2d_sub_copy_same_item_size(destination, source, sourceX, sourceY, destinationX, destinationY, width, height) {
|
|
109147
|
+
const itemSize = destination.itemSize;
|
|
109148
|
+
const sItemSize = source.itemSize;
|
|
109149
|
+
|
|
109150
|
+
assert.equal(sItemSize, sItemSize, `source.itemSize(=${sItemSize}) != destination.itemSize(=${itemSize})`);
|
|
109151
|
+
|
|
109152
|
+
const _w = Math.min(width, source.width - sourceX, destination.width - destinationX);
|
|
109153
|
+
const _h = Math.min(height, source.height - sourceY, destination.height - destinationY);
|
|
109154
|
+
|
|
109155
|
+
|
|
109156
|
+
const dRowSize = itemSize * destination.width;
|
|
109157
|
+
const sRowSize = itemSize * source.width;
|
|
109158
|
+
|
|
109159
|
+
const sData = source.data;
|
|
109160
|
+
const dData = destination.data;
|
|
109161
|
+
|
|
109162
|
+
const patchRowSize = _w * itemSize;
|
|
109163
|
+
|
|
109164
|
+
let y, i;
|
|
109165
|
+
|
|
109166
|
+
for (y = 0; y < _h; y++) {
|
|
109167
|
+
const dA = (y + destinationY) * dRowSize;
|
|
109168
|
+
const sA = (y + sourceY) * sRowSize;
|
|
109169
|
+
|
|
109170
|
+
const dOffset = dA + destinationX * itemSize;
|
|
109171
|
+
const sOffset = sA + sourceX * itemSize;
|
|
109172
|
+
|
|
109173
|
+
for (i = 0; i < patchRowSize; i++) {
|
|
109174
|
+
|
|
109175
|
+
dData[dOffset + i] = sData[sOffset + i];
|
|
109176
|
+
|
|
109177
|
+
}
|
|
109178
|
+
}
|
|
109179
|
+
|
|
109180
|
+
// update destination version
|
|
109181
|
+
destination.version++;
|
|
109182
|
+
}
|
|
109183
|
+
|
|
109360
109184
|
class AtlasPatch {
|
|
109361
109185
|
constructor() {
|
|
109362
109186
|
/**
|
|
@@ -109525,15 +109349,6 @@ const AtlasPatchFlag = {
|
|
|
109525
109349
|
Attached: 4
|
|
109526
109350
|
};
|
|
109527
109351
|
|
|
109528
|
-
/**
|
|
109529
|
-
* @template T
|
|
109530
|
-
* @param {T} object
|
|
109531
|
-
* @return {T}
|
|
109532
|
-
*/
|
|
109533
|
-
function invokeObjectClone(object) {
|
|
109534
|
-
return object.clone();
|
|
109535
|
-
}
|
|
109536
|
-
|
|
109537
109352
|
class TextureAtlas extends AbstractTextureAtlas {
|
|
109538
109353
|
/**
|
|
109539
109354
|
*
|
|
@@ -109732,7 +109547,8 @@ class TextureAtlas extends AbstractTextureAtlas {
|
|
|
109732
109547
|
const patch_position = patch.position;
|
|
109733
109548
|
const patch_size = patch.size;
|
|
109734
109549
|
|
|
109735
|
-
|
|
109550
|
+
sampler2d_sub_copy_same_item_size(
|
|
109551
|
+
target,
|
|
109736
109552
|
source,
|
|
109737
109553
|
0, 0,
|
|
109738
109554
|
patch_position.x, patch_position.y, patch_size.x, patch_size.y
|
|
@@ -113528,29 +113344,31 @@ var FrustumProjector = {
|
|
|
113528
113344
|
};
|
|
113529
113345
|
|
|
113530
113346
|
class SystemEntityContext {
|
|
113531
|
-
constructor() {
|
|
113532
113347
|
|
|
113533
|
-
|
|
113348
|
+
/**
|
|
113349
|
+
*
|
|
113350
|
+
* @type {number}
|
|
113351
|
+
*/
|
|
113352
|
+
entity = -1;
|
|
113534
113353
|
|
|
113535
|
-
|
|
113536
|
-
|
|
113537
|
-
|
|
113538
|
-
|
|
113539
|
-
|
|
113354
|
+
/**
|
|
113355
|
+
* Pointer back to the system
|
|
113356
|
+
* @type {System}
|
|
113357
|
+
*/
|
|
113358
|
+
system = null;
|
|
113540
113359
|
|
|
113541
|
-
|
|
113542
|
-
|
|
113543
|
-
|
|
113544
|
-
|
|
113545
|
-
|
|
113360
|
+
/**
|
|
113361
|
+
*
|
|
113362
|
+
* @type {*[]}
|
|
113363
|
+
*/
|
|
113364
|
+
components = [];
|
|
113546
113365
|
|
|
113547
|
-
|
|
113548
|
-
|
|
113549
|
-
|
|
113550
|
-
|
|
113551
|
-
|
|
113552
|
-
|
|
113553
|
-
}
|
|
113366
|
+
/**
|
|
113367
|
+
*
|
|
113368
|
+
* @type {boolean}
|
|
113369
|
+
* @protected
|
|
113370
|
+
*/
|
|
113371
|
+
__is_linked = false;
|
|
113554
113372
|
|
|
113555
113373
|
/**
|
|
113556
113374
|
*
|