@woosh/meep-engine 2.33.23 → 2.33.27
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/core/binary/BitSet.js +151 -167
- package/core/binary/BitSet.spec.js +99 -1
- package/core/binary/ValidatingBitSetWrapper.js +81 -0
- package/core/bvh2/BinaryNode.js +1 -1
- package/core/bvh2/aabb3/AABB3.js +21 -10
- package/core/bvh2/aabb3/AABB3Math.js +1 -1
- package/core/bvh2/binary/2/BinaryUint32BVH.js +498 -0
- package/core/bvh2/binary/2/BinaryUint32BVH.spec.js +54 -0
- package/core/bvh2/binary/IndexedBinaryBVH.js +22 -26
- package/core/bvh2/traversal/ThreeClippingPlaneComputingBVHVisitor.js +5 -1
- package/core/bvh2/traversal/__detailed_box_volume_intersection.js +22 -5
- package/core/cache/Cache.d.ts +4 -2
- package/core/cache/Cache.js +5 -2
- package/core/collection/ArrayUtils.js +1 -1
- package/core/collection/HashMap.d.ts +9 -2
- package/core/collection/HashSet.d.ts +7 -2
- package/core/collection/HashSet.js +7 -2
- package/core/collection/array/arrayQuickSort.js +9 -6
- package/core/collection/array/array_swap.js +22 -0
- package/core/collection/array/binarySearchHighIndex.js +1 -1
- package/core/collection/array/computeHashArray.js +22 -0
- package/core/collection/array/computeHashIntegerArray.js +15 -0
- package/core/collection/array/copyArray.js +2 -2
- package/core/collection/array/typed/typed_array_copy.js +1 -1
- package/core/collection/table/DataType2TypedArrayConstructorMapping.js +15 -0
- package/core/color/Color.js +2 -1
- package/core/function/FunctionCompiler.js +2 -1
- package/core/geom/3d/aabb/aabb3_computeDistanceAbovePlane.js +9 -33
- package/core/geom/3d/frustum/array_setFromProjectionMatrix.js +3 -3
- package/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +1 -1
- package/core/geom/3d/line/line3_computeSegmentPointDistance_sqr.js +41 -0
- package/core/geom/3d/morton/mortonEncode_magicbits.js +2 -1
- package/core/geom/3d/morton/reinterpret_float32_as_int32.js +13 -0
- package/core/geom/3d/morton/v3_morton_encode_transformed.js +33 -0
- package/core/geom/3d/normal/hemioct/unit_hemioct.spec.js +1 -1
- package/core/geom/3d/ray/ray_computeNearestPointToPoint.js +37 -0
- package/core/geom/3d/shape/AbstractShape3D.js +65 -0
- package/core/geom/3d/shape/TransformedShape3D.js +181 -0
- package/core/geom/3d/shape/TransformedShape3D.spec.js +33 -0
- package/core/geom/3d/shape/UnionShape3D.js +255 -0
- package/core/geom/3d/shape/UnitCubeShape3D.js +101 -0
- package/core/geom/3d/shape/UnitCubeShape3D.spec.js +42 -0
- package/core/geom/3d/shape/UnitSphereShape3D.js +55 -0
- package/core/geom/3d/shape/util/compute_signed_distance_gradient_by_sampling.js +48 -0
- package/core/geom/3d/shape/util/shape_to_visual_entity.js +159 -0
- package/core/geom/AABB2.js +1 -1
- package/core/geom/ConicRay.js +3 -1
- package/core/geom/LineSegment.js +0 -78
- package/core/geom/Matrix4.js +7 -8
- package/core/geom/Rectangle.js +2 -1
- package/core/geom/Vector1.js +1 -1
- package/core/geom/Vector3.js +2 -1
- package/core/geom/Vector4.js +2 -1
- package/core/geom/random/randomPointInBox.js +7 -3
- package/core/geom/random/randomPointInPoint.js +6 -3
- package/core/geom/random/randomPointInSphere.js +9 -5
- package/core/geom/random/randomPointOnBox.js +7 -3
- package/core/geom/random/randomPointOnSphere.js +6 -3
- package/core/geom/v3_length.js +8 -3
- package/core/graph/graph_k_means_cluster.js +1 -1
- package/core/json/resolvePathByArray.js +2 -2
- package/core/math/MathUtils.js +0 -354
- package/core/math/MathUtils.spec.js +7 -1
- package/core/math/gaussian.js +9 -0
- package/core/math/hash/computeHashFloat.js +17 -0
- package/core/math/hash/computeHashFloatArray.js +34 -0
- package/core/math/hash/computeObjectHash.js +54 -0
- package/core/math/intersects1D.js +19 -0
- package/core/math/interval/NumericInterval.js +2 -2
- package/core/math/isValueBetween.js +10 -0
- package/core/math/isValueBetweenInclusive.js +10 -0
- package/core/math/noise/curl_noise_3dt.js +1 -1
- package/core/math/noise/sdnoise.js +10 -10
- package/core/math/overlap1D.js +19 -0
- package/core/math/pingpong.js +17 -0
- package/core/math/random/makeRangedRandom.js +19 -0
- package/core/math/random/randomFloatBetween.js +14 -0
- package/core/math/random/randomFromArray.js +19 -0
- package/core/math/random/randomGaussian.js +15 -0
- package/core/math/random/randomIntegerBetween.js +14 -0
- package/core/math/random/roundFair.js +15 -0
- package/core/math/separation1D.js +21 -0
- package/core/math/solveQuadratic.js +25 -0
- package/core/model/BoundedValue.js +1 -1
- package/core/model/node-graph/node/NodeInstancePortReference.js +1 -1
- package/core/model/node-graph/node/Port.js +1 -1
- package/core/model/reactive/evaluation/MultiPredicateEvaluator.spec.js +3 -1
- package/core/model/reactive/model/ReactiveBinaryExpression.js +1 -1
- package/core/model/reactive/model/terminal/ReactiveLiteralNumber.js +1 -1
- package/core/model/reactive/model/terminal/ReactiveReference.js +1 -1
- package/core/model/reactive/model/util/createRandomReactiveExpression.js +1 -1
- package/core/model/stat/LinearModifier.js +1 -1
- package/core/parser/simple/Token.d.ts +13 -0
- package/core/parser/simple/Token.js +61 -27
- package/{engine/graphics/render/forward_plus/materials → core/primitives/strings}/insert_after.js +3 -0
- package/core/primitives/strings/insert_after_or_replace.js +27 -0
- package/editor/process/symbolic/makeHelperBoxGeometry.js +44 -0
- package/editor/tools/FoliagePaintTool.js +4 -4
- package/editor/view/ecs/EntityEditor.js +2 -2
- package/editor/view/ecs/components/particles/ParticleEmitterController.js +2 -2
- package/engine/EngineHarness.js +1 -0
- package/engine/animation/AnimationUtils.js +5 -5
- package/engine/animation/curve/AnimationCurve.js +72 -0
- package/engine/animation/curve/Keyframe.js +27 -0
- package/engine/animation/keyed2/AnimationTrack.js +27 -3
- package/engine/asset/Asset.js +1 -1
- package/engine/asset/loaders/GLTFAssetLoader.d.ts +1 -1
- package/engine/asset/loaders/GLTFAssetLoader.js +62 -1
- package/engine/asset/loaders/image/ImageDecoderWorker.js +4 -3
- package/engine/asset/loaders/image/ImageRGBADataAsset.js +10 -2
- package/engine/asset/loaders/image/ImageRGBADataLoader.js +3 -3
- package/engine/asset/loaders/image/codec/NativeImageDecoder.js +2 -1
- package/engine/asset/loaders/image/png/PNG.js +113 -6
- package/engine/asset/loaders/image/png/PNGReader.js +5 -0
- package/engine/asset/loaders/material/bitmap2sampler_gl.js +1 -1
- package/engine/asset/loaders/material/computeImageBitmapEquality.js +6 -1
- package/engine/asset/loaders/material/computeMaterialHash.js +3 -1
- package/engine/asset/loaders/material/computeTextureEquality.js +40 -49
- package/engine/asset/loaders/material/computeTextureHash.js +2 -1
- package/engine/ecs/EntityBuilder.js +25 -5
- package/engine/ecs/EntityComponentDataset.js +1 -1
- package/engine/ecs/animation/Animation.js +2 -1
- package/engine/ecs/animation/InverseKinematics.js +2 -1
- package/engine/ecs/attachment/AttachmentBinding.js +8 -0
- package/engine/ecs/attachment/AttachmentSystem.js +4 -0
- package/engine/ecs/attachment/TransformAttachmentBinding.js +14 -44
- package/engine/ecs/components/Tag.js +27 -6
- package/engine/ecs/dynamic_actions/DynamicActorSystem.js +2 -1
- package/engine/ecs/dynamic_actions/DynamicRuleDescriptionTable.spec.js +3 -5
- package/engine/ecs/dynamic_actions/actions/definition/WeightedRandomActionDescription.js +1 -1
- package/engine/ecs/evaluation/complex/PointFitnessGaussianBlur.js +1 -1
- package/engine/ecs/foliage/InstancedFoliage.js +277 -266
- package/engine/ecs/foliage/ecs/Foliage2System.js +7 -7
- package/engine/ecs/foliage/ecs/InstancedMeshComponent.js +37 -0
- package/engine/ecs/foliage/ecs/{Foliage2.js → InstancedMeshLayer.js} +3 -45
- package/engine/ecs/foliage/ecs/InstancedMeshSerializationAdapter.js +6 -5
- package/engine/ecs/foliage/ecs/InstancedMeshUtils.js +7 -6
- package/engine/ecs/fow/FogOfWar.js +4 -0
- package/engine/ecs/fow/FogOfWarSystem.js +2 -0
- package/engine/ecs/fow/shader/FogOfWarRenderer.js +1 -1
- package/engine/ecs/gui/GUIElement.js +1 -1
- package/engine/ecs/gui/hud/HeadsUpDisplay.js +1 -1
- package/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +2 -0
- package/engine/ecs/gui/position/ViewportPosition.js +2 -1
- package/engine/ecs/storage/binary/BinarySerializationRegistry.js +1 -1
- package/engine/ecs/system/AbstractContextSystem.js +1 -1
- package/engine/ecs/systems/RangedAttackSystem.js +1 -1
- package/engine/ecs/systems/SteeringSystem.js +1 -1
- package/engine/ecs/systems/TagSystem.js +17 -0
- package/engine/ecs/terrain/ecs/layers/TerrainLayer.js +12 -16
- package/engine/ecs/terrain/tiles/TerrainTileManager.js +1 -1
- package/engine/ecs/tooltip/TooltipComponent.js +15 -0
- package/engine/ecs/transform/Transform.js +19 -6
- package/engine/graphics/GraphicsEngine.js +11 -6
- package/engine/graphics/composit/CompositLayer.js +17 -4
- package/engine/graphics/composit/CompositingStages.js +8 -0
- package/engine/graphics/composit/LayerCompositer.js +35 -6
- package/engine/graphics/ecs/animation/animator/AnimationClip.js +2 -1
- package/engine/graphics/ecs/animation/animator/AnimationClipDefinition.js +2 -1
- package/engine/graphics/ecs/animation/animator/AnimationNotification.js +2 -1
- package/engine/graphics/ecs/animation/animator/AnimationNotificationDefinition.js +2 -1
- package/engine/graphics/ecs/animation/animator/graph/AnimationGraph.js +2 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +2 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationStateDefinition.js +1 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.js +2 -1
- package/engine/graphics/ecs/camera/CameraClippingPlaneComputer.js +1 -1
- package/engine/graphics/ecs/highlight/HighlightDefinition.js +2 -1
- package/engine/graphics/ecs/highlight/plugin/OutlineRenderPlugin.js +11 -7
- package/engine/graphics/ecs/light/Light.d.ts +1 -1
- package/engine/graphics/ecs/light/Light.js +5 -0
- package/engine/graphics/ecs/light/binding/three/ThreeLightBinding.js +5 -1
- package/engine/graphics/ecs/mesh/Mesh.js +2 -1
- package/engine/graphics/ecs/mesh-v2/DrawMode.js +5 -0
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +13 -0
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +32 -18
- package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts +6 -0
- package/engine/graphics/geometry/AttributeSpec.js +105 -0
- package/engine/graphics/{micron/format/MicronVertexDataSpec.js → geometry/VertexDataSpec.js} +56 -25
- package/engine/graphics/geometry/instancing/InstancedMeshGroup.js +14 -72
- package/engine/graphics/geometry/instancing/rewriteMaterial.js +70 -0
- package/engine/graphics/material/manager/MaterialManager.js +2 -1
- package/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +7 -7
- package/engine/graphics/micron/build/fill_patch_geometry_data.js +1 -1
- package/engine/graphics/micron/buildPatchwork.js +1 -1
- package/engine/graphics/micron/format/MicronGeometry.js +3 -3
- package/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.js +2 -2
- package/engine/graphics/micron/format/serialization/deserialize_attribute_spec.js +1 -1
- package/engine/graphics/micron/format/serialization/serialize_attribute_spec.js +1 -1
- package/engine/graphics/micron/render/PatchCacheKey.js +1 -1
- package/engine/graphics/micron/render/instanced/AttributeDataTexture.js +11 -9
- package/engine/graphics/micron/render/instanced/ThreeInstancedAdapter.js +0 -2
- package/engine/graphics/micron/render/v1/ThreeVirtualGeometryAdapter.js +1 -1
- package/engine/graphics/particles/ParticleEmitterLibrary.js +3 -0
- package/engine/graphics/particles/ecs/{ParticleEmitterSystem2.js → ParticleEmitterSystem.js} +17 -9
- package/engine/graphics/particles/particular/engine/ParticularEngine.js +8 -2
- package/engine/graphics/particles/particular/engine/emitter/PARTICULAR_PARTICLE_SPECIFICATION.js +80 -16
- package/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +71 -77
- package/engine/graphics/particles/particular/engine/emitter/ParticleEmitterFlag.js +5 -0
- package/engine/graphics/particles/particular/engine/emitter/ParticleLayer.js +2 -1
- package/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +141 -14
- package/engine/graphics/particles/particular/engine/emitter/ParticlePool.spec.js +8 -7
- package/engine/graphics/particles/particular/engine/emitter/computeEmissionFunction.js +1 -1
- package/engine/graphics/particles/particular/engine/emitter/serde/ParameterLookupTableSerializationAdapter.js +8 -2
- package/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.js +2 -1
- package/engine/graphics/particles/particular/engine/parameter/ParameterTrack.js +1 -1
- package/engine/graphics/particles/particular/engine/parameter/ParticleParameter.js +1 -1
- package/engine/graphics/particles/particular/engine/renderers/billboard/BILLBOARD_PARTICLE_SPECIFICATION.js +24 -0
- package/engine/graphics/particles/particular/engine/renderers/billboard/ParticleBillboardMaterial.js +262 -71
- package/engine/graphics/particles/particular/engine/renderers/billboard/prototypeBillboardRenderer.js +9 -9
- package/engine/graphics/particles/particular/engine/shader/ShaderManager.js +81 -48
- package/engine/graphics/particles/particular/engine/shader/debugAtlas.js +14 -0
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepApplyForce.js +2 -5
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseAcceleration.js +2 -6
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseVelocity.js +2 -7
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepFixedPhysics.js +2 -5
- package/engine/graphics/particles/particular/engine/simulator/update_parameters.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/distributeParticlesOnObject3D.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/distrubuteParticlesOnMesh.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.js +141 -0
- package/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.js +478 -0
- package/engine/graphics/particles/particular/engine/utils/volume/lut_to_sampler.js +27 -0
- package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +938 -0
- package/engine/graphics/particles/particular/group/Operation.js +18 -0
- package/engine/graphics/particles/particular/group/OperationType.js +9 -0
- package/engine/graphics/particles/particular/group/ParticleAttribute.js +2 -1
- package/engine/graphics/particles/particular/group/ParticleAttributeType.js +11 -0
- package/engine/graphics/particles/particular/group/ParticleDataType.js +10 -0
- package/engine/graphics/particles/particular/group/ParticleGroup.js +7 -245
- package/engine/graphics/particles/particular/group/ParticleGroup.spec.js +3 -1
- package/engine/graphics/particles/particular/group/ParticleSpecification.js +21 -14
- package/engine/graphics/particles/particular/group/itemSizeFromAttributeType.js +20 -0
- package/engine/graphics/particles/particular/group/optimizeCommandQueue.js +162 -0
- package/engine/graphics/particles/particular/group/typedArrayConstructorFromDataType.js +19 -0
- package/engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js +16 -11
- package/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameter.js +2 -1
- package/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameterSet.js +1 -1
- package/engine/graphics/render/forward_plus/LightManager.js +117 -94
- package/engine/graphics/render/forward_plus/PointLight.js +9 -0
- package/engine/graphics/render/forward_plus/PointLightData.js +1 -1
- package/engine/graphics/render/forward_plus/SpotLight.js +9 -0
- package/engine/graphics/render/forward_plus/cluster/compute_light_data_hash_0.js +2 -2
- package/engine/graphics/render/forward_plus/materials/FP_INJECTION_POINT_ACCUMULATION.js +1 -0
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_ACCUMULATION.js +32 -0
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_DECODE_PARS.js +51 -0
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_PREAMBLE.js +25 -0
- package/engine/graphics/render/forward_plus/materials/FPlusDebugMaterial.js +3 -3
- package/engine/graphics/render/forward_plus/materials/ForwardPlusThreeMaterial.js +1 -1
- package/engine/graphics/render/forward_plus/materials/fp_build_fragment_shader.js +31 -120
- package/engine/graphics/render/forward_plus/materials/fp_build_vertex_lighting_shared.js +35 -0
- package/engine/graphics/render/forward_plus/materials/fp_build_vertex_shader.js +4 -5
- package/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.js +1 -1
- package/engine/graphics/render/forward_plus/plugin/MaterialTransformer.js +10 -3
- package/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +594 -59
- package/engine/graphics/render/forward_plus/prototypeLightManager.js +208 -89
- package/engine/graphics/render/forward_plus/query/analytical_triplanar_corner_mapping.js +8 -0
- package/engine/graphics/render/forward_plus/query/cube_mapping.js +38 -0
- package/engine/graphics/render/forward_plus/query/detailed_sphere_frustum_intersection_test.js +86 -0
- package/engine/graphics/render/forward_plus/query/point_light_inside_volume.js +74 -0
- package/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_objects.js +131 -0
- package/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_texture.js +129 -0
- package/engine/graphics/render/forward_plus/query/spot_light_inside_volume.js +33 -0
- package/engine/graphics/render/forward_plus/read_frustum_corner.js +14 -0
- package/engine/graphics/render/forward_plus/testClusterEquality.js +22 -0
- package/engine/graphics/render/visibility/IncrementalDeltaSet.js +11 -0
- package/engine/graphics/render/visibility/hiz/prototypeHiZ.js +1 -1
- package/engine/graphics/shaders/TerrainShader.js +4 -5
- package/engine/graphics/shadows/ShadowMapRenderer.js +8 -2
- package/engine/graphics/texture/atlas/ManagedTextureAtlas.js +12 -1
- package/engine/graphics/texture/sampler/HarmonicDiffusionGrid.spec.js +1 -1
- package/engine/graphics/texture/sampler/SampleTraverser.js +1 -1
- package/engine/graphics/texture/sampler/Sampler2D.js +3 -1
- package/engine/graphics/texture/sampler/convertTexture2Sampler2D.js +1 -1
- package/engine/graphics/texture/sampler/copy_Sampler2D_channel_data.js +66 -0
- package/engine/graphics/texture/sampler/distanceField.spec.js +1 -1
- package/engine/graphics/util/composeMatrix4.js +33 -23
- package/engine/graphics/util/decompose_matrix_4_array.js +61 -0
- package/engine/grid/components/GridObstacle.js +1 -1
- package/engine/intelligence/behavior/ecs/BehaviorComponent.js +30 -14
- package/engine/intelligence/behavior/selector/WeightedElement.js +2 -1
- package/engine/intelligence/optimization/RandomOptimizer.js +1 -1
- package/engine/knowledge/database/StaticKnowledgeDataTable.js +6 -1
- package/engine/navigation/ecs/components/Path.js +1 -6
- package/engine/navigation/grid/FastBinaryHeap.spec.js +1 -1
- package/engine/sound/ecs/emitter/SoundEmitter.js +2 -1
- package/engine/sound/ecs/emitter/SoundTrack.js +2 -1
- package/engine/sound/material/concrete/RandomSoundMaterial.js +1 -1
- package/engine/ui/notification/notificationGenerator.js +1 -1
- package/generation/filtering/numeric/complex/CellFilterGaussianBlur.js +1 -1
- package/generation/grid/generation/GridTaskExecuteRuleTimes.js +2 -1
- package/generation/markers/actions/MarkerNodeActionSelectRandom.js +1 -1
- package/generation/markers/transform/MarkerNodeTransformerRecordUniqueRandomEnum.js +1 -1
- package/generation/placement/action/random/CellActionSelectRandom.js +1 -1
- package/generation/theme/ThemeEngine.js +1 -1
- package/misc/makeMaterialIconCached.js +2 -2
- package/package.json +1 -1
- package/view/elements/image/HTMLElementCacheKey.js +2 -1
- package/view/elements/radial/RadialText.js +2 -1
- package/view/minimap/gl/MinimapMarkersGL.js +6 -100
- package/view/minimap/gl/MinimapWorldGL.js +12 -5
- package/view/minimap/gl/buildMaterial.js +94 -0
- package/engine/graphics/micron/format/MicronGeometryBufferAttributeSpec.js +0 -71
- package/engine/graphics/render/forward_plus/queryBVH_Frustum.js +0 -357
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { inverseLerp } from "../../../core/math/inverseLerp.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number} t
|
|
6
|
+
* @param {Keyframe} keyframe0
|
|
7
|
+
* @param {Keyframe} keyframe1
|
|
8
|
+
* @return {number}
|
|
9
|
+
*/
|
|
10
|
+
function evaluate(t, keyframe0, keyframe1) {
|
|
11
|
+
|
|
12
|
+
const dt = keyframe1.time - keyframe0.time;
|
|
13
|
+
|
|
14
|
+
const m0 = keyframe0.outTangent * dt;
|
|
15
|
+
const m1 = keyframe1.inTangent * dt;
|
|
16
|
+
|
|
17
|
+
const t2 = t * t;
|
|
18
|
+
const t3 = t2 * t;
|
|
19
|
+
|
|
20
|
+
const a = 2 * t3 - 3 * t2 + 1;
|
|
21
|
+
const b = t3 - 2 * t2 + t;
|
|
22
|
+
const c = t3 - t2;
|
|
23
|
+
const d = -2 * t3 + 3 * t2;
|
|
24
|
+
|
|
25
|
+
return a * keyframe0.value + b * m0 + c * m1 + d * keyframe1.value;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Modelled on unity's AnimationCurve
|
|
30
|
+
* @see https://github.com/nothke/ThreadableCurve/blob/master/ThreadableCurve.cs
|
|
31
|
+
*/
|
|
32
|
+
export class AnimationCurve {
|
|
33
|
+
constructor() {
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @type {Keyframe[]}
|
|
37
|
+
*/
|
|
38
|
+
this.keys = [];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
evaluate(t) {
|
|
42
|
+
const keys = this.keys;
|
|
43
|
+
const key_count = keys.length;
|
|
44
|
+
if (key_count === 0) {
|
|
45
|
+
return 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (key_count === 1) {
|
|
49
|
+
return keys[0].value;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (t < keys[0].time) {
|
|
53
|
+
// before start
|
|
54
|
+
return keys[0].value;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
for (let i = 1; i < key_count; i++) {
|
|
58
|
+
const f1 = keys[i];
|
|
59
|
+
|
|
60
|
+
if (t < f1.time) {
|
|
61
|
+
const f0 = keys[i - 1];
|
|
62
|
+
const kt = inverseLerp(f0.time, f1.time, t);
|
|
63
|
+
|
|
64
|
+
return evaluate(kt, f0, f1);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// past end
|
|
69
|
+
return keys[key_count - 1].value;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export class Keyframe {
|
|
2
|
+
constructor() {
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @type {number}
|
|
6
|
+
*/
|
|
7
|
+
this.value = 0;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @type {number}
|
|
12
|
+
*/
|
|
13
|
+
this.time = 0;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @type {number}
|
|
18
|
+
*/
|
|
19
|
+
this.inTangent = 0;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @type {number}
|
|
24
|
+
*/
|
|
25
|
+
this.outTangent = 0;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -19,18 +19,43 @@ function AnimationTrack(properties) {
|
|
|
19
19
|
*/
|
|
20
20
|
this.propertyCount = properties.length;
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @type {number[]}
|
|
25
|
+
*/
|
|
22
26
|
this.keyValues = [];
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @type {number[]}
|
|
31
|
+
*/
|
|
23
32
|
this.keyTimes = [];
|
|
24
33
|
|
|
25
34
|
this.timeStart = Number.POSITIVE_INFINITY;
|
|
26
35
|
this.timeEnd = Number.NEGATIVE_INFINITY;
|
|
27
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Indices of keys from which transition takes place
|
|
39
|
+
* @type {number[]}
|
|
40
|
+
*/
|
|
28
41
|
this.transitionKeys = [];
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Transition function associated with a key
|
|
45
|
+
* @type {function[]}
|
|
46
|
+
*/
|
|
29
47
|
this.transitionFunctions = [];
|
|
30
48
|
}
|
|
31
49
|
|
|
32
|
-
AnimationTrack.prototype.
|
|
33
|
-
const
|
|
50
|
+
AnimationTrack.prototype.optimize = function () {
|
|
51
|
+
const key_value_count = this.keyValues.length;
|
|
52
|
+
const key_count = this.keyTimes.length;
|
|
53
|
+
|
|
54
|
+
// use a common buffer to get better cache locality
|
|
55
|
+
const buffer = new ArrayBuffer(key_count * 4 + key_value_count * 8);
|
|
56
|
+
|
|
57
|
+
const keyTimesTyped = new Float32Array(buffer, 0, key_count);
|
|
58
|
+
const keysTyped = new Float64Array(buffer, key_count * 4, key_value_count);
|
|
34
59
|
|
|
35
60
|
//transfer original keys into typed array
|
|
36
61
|
keysTyped.set(this.keyValues, 0);
|
|
@@ -38,7 +63,6 @@ AnimationTrack.prototype.initialize = function () {
|
|
|
38
63
|
//overwrite the original array
|
|
39
64
|
this.keyValues = keysTyped;
|
|
40
65
|
|
|
41
|
-
const keyTimesTyped = new Float32Array(this.keyTimes.length);
|
|
42
66
|
keyTimesTyped.set(this.keyTimes, 0);
|
|
43
67
|
|
|
44
68
|
this.keyTimes = keyTimesTyped;
|
package/engine/asset/Asset.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* @param {string} type
|
|
5
5
|
* @constructor
|
|
6
6
|
*/
|
|
7
|
-
import { computeHashIntegerArray } from "../../core/math/MathUtils.js";
|
|
8
7
|
import { assert } from "../../core/assert.js";
|
|
9
8
|
import { computeStringHash } from "../../core/primitives/strings/computeStringHash.js";
|
|
9
|
+
import { computeHashIntegerArray } from "../../core/collection/array/computeHashIntegerArray.js";
|
|
10
10
|
|
|
11
11
|
export class AssetDescription {
|
|
12
12
|
/**
|
|
@@ -24,10 +24,42 @@ import { HashSet } from "../../../core/collection/HashSet.js";
|
|
|
24
24
|
import { computeGeometryHash } from "./geometry/geometry/computeGeometryHash.js";
|
|
25
25
|
import { computeGeometryEquality } from "./geometry/geometry/computeGeometryEquality.js";
|
|
26
26
|
import { traverseThreeObject } from "../../graphics/ecs/highlight/renderer/traverseThreeObject.js";
|
|
27
|
+
import { computeTextureHash } from "./material/computeTextureHash.js";
|
|
28
|
+
import { computeTextureEquality } from "./material/computeTextureEquality.js";
|
|
27
29
|
|
|
28
30
|
const animationOptimizer = new AnimationOptimizer();
|
|
29
31
|
const materialCache = StaticMaterialCache.Global;
|
|
30
32
|
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @param {THREE.Material} material
|
|
36
|
+
* @param {HashSet<Texture>} texture_cache
|
|
37
|
+
*/
|
|
38
|
+
function replace_material_textures_from_cache(material, texture_cache) {
|
|
39
|
+
const attachments = TextureAttachmentsByMaterialType[material.type];
|
|
40
|
+
|
|
41
|
+
if (attachments === undefined) {
|
|
42
|
+
// unsupported material
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const attachment_count = attachments.length;
|
|
47
|
+
|
|
48
|
+
for (let i = 0; i < attachment_count; i++) {
|
|
49
|
+
const attachment = attachments[i];
|
|
50
|
+
|
|
51
|
+
const texture = attachment.read(material);
|
|
52
|
+
if (texture !== undefined && texture !== null) {
|
|
53
|
+
const cached = texture_cache.ensure(texture);
|
|
54
|
+
|
|
55
|
+
if (cached !== texture) {
|
|
56
|
+
// got an existing cached texture, write that instead
|
|
57
|
+
attachment.write(material, cached);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
31
63
|
/**
|
|
32
64
|
* Transfer any transform on the root down to the children instead
|
|
33
65
|
* @param {Object3D} root
|
|
@@ -127,6 +159,8 @@ export class GLTFAssetLoader extends AssetLoader {
|
|
|
127
159
|
|
|
128
160
|
this.__dracoLoader = new DRACOLoader();
|
|
129
161
|
this.__dracoLoader.setWorkerLimit(1);
|
|
162
|
+
|
|
163
|
+
// set default path
|
|
130
164
|
this.__dracoLoader.setDecoderPath(buildDracoDecoderPath());
|
|
131
165
|
|
|
132
166
|
const loader = new GLTFLoader();
|
|
@@ -152,10 +186,31 @@ export class GLTFAssetLoader extends AssetLoader {
|
|
|
152
186
|
*/
|
|
153
187
|
this.__geometry_cache = new HashSet({
|
|
154
188
|
keyHashFunction: computeGeometryHash,
|
|
155
|
-
keyEqualityFunction: computeGeometryEquality
|
|
189
|
+
keyEqualityFunction: computeGeometryEquality,
|
|
190
|
+
capacity: 1024
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
*
|
|
196
|
+
* @type {HashSet<Texture>}
|
|
197
|
+
* @private
|
|
198
|
+
*/
|
|
199
|
+
this.__texture_cache = new HashSet({
|
|
200
|
+
keyHashFunction: computeTextureHash,
|
|
201
|
+
keyEqualityFunction: computeTextureEquality,
|
|
202
|
+
capacity: 2048
|
|
156
203
|
});
|
|
157
204
|
}
|
|
158
205
|
|
|
206
|
+
/**
|
|
207
|
+
*
|
|
208
|
+
* @param {string} p
|
|
209
|
+
*/
|
|
210
|
+
setDracoDecoderPath(p) {
|
|
211
|
+
this.__dracoLoader.setDecoderPath(p);
|
|
212
|
+
}
|
|
213
|
+
|
|
159
214
|
/**
|
|
160
215
|
*
|
|
161
216
|
* @param {boolean} v
|
|
@@ -224,9 +279,12 @@ export class GLTFAssetLoader extends AssetLoader {
|
|
|
224
279
|
}
|
|
225
280
|
}
|
|
226
281
|
|
|
282
|
+
|
|
227
283
|
load(path, success, failure, progress) {
|
|
228
284
|
const loader = this.loader;
|
|
229
285
|
const geometry_cache = this.__geometry_cache;
|
|
286
|
+
const texture_cache = this.__texture_cache;
|
|
287
|
+
|
|
230
288
|
|
|
231
289
|
/**
|
|
232
290
|
*
|
|
@@ -243,6 +301,9 @@ export class GLTFAssetLoader extends AssetLoader {
|
|
|
243
301
|
geometry = geometry_cache.ensure(geometry);
|
|
244
302
|
mesh.geometry = geometry;
|
|
245
303
|
|
|
304
|
+
// replace textures from cache
|
|
305
|
+
replace_material_textures_from_cache(mesh.material, texture_cache);
|
|
306
|
+
|
|
246
307
|
const isSkinned = mesh.isSkinnedMesh === true;
|
|
247
308
|
|
|
248
309
|
|
|
@@ -10,7 +10,7 @@ async function decode_png(png_bytes) {
|
|
|
10
10
|
|
|
11
11
|
const png = reader.parse();
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const uint_channels = png.getUint8Data();
|
|
14
14
|
|
|
15
15
|
const width = png.getWidth();
|
|
16
16
|
const height = png.getHeight();
|
|
@@ -19,9 +19,10 @@ async function decode_png(png_bytes) {
|
|
|
19
19
|
// console.profileEnd('decode');
|
|
20
20
|
|
|
21
21
|
resolve({
|
|
22
|
-
data,
|
|
22
|
+
data: uint_channels.data,
|
|
23
23
|
width,
|
|
24
|
-
height
|
|
24
|
+
height,
|
|
25
|
+
itemSize: uint_channels.itemSize
|
|
25
26
|
});
|
|
26
27
|
});
|
|
27
28
|
}
|
|
@@ -6,8 +6,9 @@ export class ImageRGBADataAsset extends Asset {
|
|
|
6
6
|
* @param {number[]|Uint8Array} data
|
|
7
7
|
* @param {number} width
|
|
8
8
|
* @param {number} height
|
|
9
|
+
* @param {number} [itemSize]
|
|
9
10
|
*/
|
|
10
|
-
constructor(data, width, height) {
|
|
11
|
+
constructor(data, width, height, itemSize = 4) {
|
|
11
12
|
super();
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -28,6 +29,12 @@ export class ImageRGBADataAsset extends Asset {
|
|
|
28
29
|
*/
|
|
29
30
|
this.height = height;
|
|
30
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Number of channels
|
|
34
|
+
* @type {number}
|
|
35
|
+
*/
|
|
36
|
+
this.itemSize = itemSize;
|
|
37
|
+
|
|
31
38
|
this.byteSize = data.length;
|
|
32
39
|
}
|
|
33
40
|
|
|
@@ -35,7 +42,8 @@ export class ImageRGBADataAsset extends Asset {
|
|
|
35
42
|
return {
|
|
36
43
|
data: this.data,
|
|
37
44
|
width: this.width,
|
|
38
|
-
height: this.height
|
|
45
|
+
height: this.height,
|
|
46
|
+
itemSize: this.itemSize
|
|
39
47
|
};
|
|
40
48
|
}
|
|
41
49
|
}
|
|
@@ -23,7 +23,7 @@ export class ImageRGBADataLoader extends AssetLoader {
|
|
|
23
23
|
/**
|
|
24
24
|
*
|
|
25
25
|
* @param {string} path
|
|
26
|
-
* @returns {Promise<{data:ArrayBuffer, width: number, height:number}>}
|
|
26
|
+
* @returns {Promise<{data:ArrayBuffer, width: number, height:number, itemSize: number}>}
|
|
27
27
|
* @private
|
|
28
28
|
*/
|
|
29
29
|
async __decode_via_worker(path) {
|
|
@@ -45,7 +45,7 @@ export class ImageRGBADataLoader extends AssetLoader {
|
|
|
45
45
|
|
|
46
46
|
const bitmap = await this.__decode_via_worker(path);
|
|
47
47
|
|
|
48
|
-
return new ImageRGBADataAsset(new Uint8Array(bitmap.data), bitmap.width, bitmap.height);
|
|
48
|
+
return new ImageRGBADataAsset(new Uint8Array(bitmap.data), bitmap.width, bitmap.height, bitmap.itemSize);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
load(path, success, failure, progress) {
|
|
@@ -65,7 +65,7 @@ export class ImageRGBADataLoader extends AssetLoader {
|
|
|
65
65
|
|
|
66
66
|
texture.dispose();
|
|
67
67
|
|
|
68
|
-
const f = new ImageRGBADataAsset(sampler2D.data, sampler2D.width, sampler2D.height);
|
|
68
|
+
const f = new ImageRGBADataAsset(sampler2D.data, sampler2D.width, sampler2D.height, sampler2D.itemSize);
|
|
69
69
|
|
|
70
70
|
success(f);
|
|
71
71
|
|
|
@@ -5,12 +5,23 @@ export function PNG() {
|
|
|
5
5
|
// initialize all members to keep the same hidden class
|
|
6
6
|
this.width = 0;
|
|
7
7
|
this.height = 0;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Number of bits per channel?
|
|
11
|
+
* @type {number}
|
|
12
|
+
*/
|
|
8
13
|
this.bitDepth = 0;
|
|
14
|
+
|
|
9
15
|
this.colorType = 0;
|
|
10
16
|
this.compressionMethod = 0;
|
|
11
17
|
this.filterMethod = 0;
|
|
12
18
|
this.interlaceMethod = 0;
|
|
13
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Number of channels in the image
|
|
22
|
+
* @example RGB = 3, RGBA = 4, etc.
|
|
23
|
+
* @type {number}
|
|
24
|
+
*/
|
|
14
25
|
this.colors = 0;
|
|
15
26
|
this.alpha = false;
|
|
16
27
|
this.pixelBits = 0;
|
|
@@ -23,6 +34,10 @@ export function PNG() {
|
|
|
23
34
|
*/
|
|
24
35
|
this.pixels = null;
|
|
25
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Transparency palette
|
|
39
|
+
* @type {Uint8Array|null}
|
|
40
|
+
*/
|
|
26
41
|
this.trns = null;
|
|
27
42
|
|
|
28
43
|
}
|
|
@@ -138,6 +153,10 @@ PNG.prototype.setInterlaceMethod = function (interlaceMethod) {
|
|
|
138
153
|
this.interlaceMethod = interlaceMethod;
|
|
139
154
|
};
|
|
140
155
|
|
|
156
|
+
/**
|
|
157
|
+
*
|
|
158
|
+
* @param {Uint8Array} trns
|
|
159
|
+
*/
|
|
141
160
|
PNG.prototype.setTRNS = function (trns) {
|
|
142
161
|
this.trns = trns;
|
|
143
162
|
};
|
|
@@ -161,7 +180,9 @@ PNG.prototype.getPalette = function () {
|
|
|
161
180
|
* result is an array: [red, green, blue, alpha]
|
|
162
181
|
*/
|
|
163
182
|
PNG.prototype.getPixel = function (result, result_offset, x, y) {
|
|
164
|
-
|
|
183
|
+
var pixels = this.pixels;
|
|
184
|
+
|
|
185
|
+
if (!pixels) {
|
|
165
186
|
throw new Error("pixel data is empty");
|
|
166
187
|
}
|
|
167
188
|
|
|
@@ -170,7 +191,6 @@ PNG.prototype.getPixel = function (result, result_offset, x, y) {
|
|
|
170
191
|
}
|
|
171
192
|
|
|
172
193
|
var i = this.colors * this.bitDepth / 8 * (y * this.width + x);
|
|
173
|
-
var pixels = this.pixels;
|
|
174
194
|
|
|
175
195
|
let r, g, b, a;
|
|
176
196
|
|
|
@@ -189,14 +209,17 @@ PNG.prototype.getPixel = function (result, result_offset, x, y) {
|
|
|
189
209
|
break;
|
|
190
210
|
case 3:
|
|
191
211
|
a = 255;
|
|
192
|
-
|
|
212
|
+
|
|
213
|
+
if (this.trns != null) {
|
|
193
214
|
a = this.trns[pixels[i]];
|
|
194
215
|
}
|
|
216
|
+
|
|
195
217
|
const offset = pixels[i] * 3;
|
|
196
218
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
219
|
+
const palette = this.palette;
|
|
220
|
+
r = palette[offset];
|
|
221
|
+
g = palette[offset + 1];
|
|
222
|
+
b = palette[offset + 2];
|
|
200
223
|
|
|
201
224
|
break;
|
|
202
225
|
case 4:
|
|
@@ -293,3 +316,87 @@ PNG.prototype.getRGBA8Array = function () {
|
|
|
293
316
|
|
|
294
317
|
return data;
|
|
295
318
|
};
|
|
319
|
+
|
|
320
|
+
PNG.prototype.getUint8Data_case3 = function () {
|
|
321
|
+
const w = this.width;
|
|
322
|
+
const h = this.height;
|
|
323
|
+
|
|
324
|
+
const pixel_count = w * h;
|
|
325
|
+
|
|
326
|
+
let itemSize;
|
|
327
|
+
|
|
328
|
+
const transparency_lookup = this.trns;
|
|
329
|
+
if (transparency_lookup !== null) {
|
|
330
|
+
// has transparency
|
|
331
|
+
itemSize = 4;
|
|
332
|
+
} else {
|
|
333
|
+
itemSize = 3;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const result_data = new Uint8Array(pixel_count * itemSize);
|
|
337
|
+
|
|
338
|
+
const pixels = this.pixels;
|
|
339
|
+
const palette = this.palette;
|
|
340
|
+
|
|
341
|
+
const d = this.colors * this.bitDepth / 8;
|
|
342
|
+
|
|
343
|
+
for (let i = 0; i < pixel_count; i++) {
|
|
344
|
+
const destination_address = i * itemSize;
|
|
345
|
+
|
|
346
|
+
const lookup_value = pixels[i * d];
|
|
347
|
+
|
|
348
|
+
result_data[destination_address] = palette[lookup_value];
|
|
349
|
+
result_data[destination_address + 1] = palette[lookup_value + 1];
|
|
350
|
+
result_data[destination_address + 2] = palette[lookup_value + 2];
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
//transparency
|
|
354
|
+
if (transparency_lookup !== null) {
|
|
355
|
+
for (let i = 0; i < pixel_count; i++) {
|
|
356
|
+
result_data[i * 4 + 3] = transparency_lookup[pixels[i * d]];
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
return {
|
|
361
|
+
data: result_data,
|
|
362
|
+
itemSize: itemSize
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* @returns {{itemSize:number, data:Uint8Array}}
|
|
368
|
+
*/
|
|
369
|
+
PNG.prototype.getUint8Data = function () {
|
|
370
|
+
let data;
|
|
371
|
+
let itemSize = 0; // note, can take this from this.colors
|
|
372
|
+
|
|
373
|
+
switch (this.colorType) {
|
|
374
|
+
case 0:
|
|
375
|
+
data = this.pixels;
|
|
376
|
+
itemSize = 1;
|
|
377
|
+
break;
|
|
378
|
+
case 2:
|
|
379
|
+
data = this.pixels;
|
|
380
|
+
itemSize = 3;
|
|
381
|
+
break;
|
|
382
|
+
case 3:
|
|
383
|
+
// palette
|
|
384
|
+
return this.getUint8Data_case3();
|
|
385
|
+
case 4:
|
|
386
|
+
// grayscale with alpha
|
|
387
|
+
data = this.pixels;
|
|
388
|
+
itemSize = 2;
|
|
389
|
+
break;
|
|
390
|
+
case 6:
|
|
391
|
+
data = this.pixels;
|
|
392
|
+
itemSize = 4;
|
|
393
|
+
break;
|
|
394
|
+
default:
|
|
395
|
+
throw new Error('Unsupported color type');
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
return {
|
|
399
|
+
data,
|
|
400
|
+
itemSize
|
|
401
|
+
};
|
|
402
|
+
};
|
|
@@ -91,6 +91,10 @@ PNGReader.prototype.decodeChunk = function () {
|
|
|
91
91
|
|
|
92
92
|
const type = buffer.readASCIICharacters(4);
|
|
93
93
|
|
|
94
|
+
/**
|
|
95
|
+
*
|
|
96
|
+
* @type {Uint8Array}
|
|
97
|
+
*/
|
|
94
98
|
var chunk = this.readBytes(length);
|
|
95
99
|
|
|
96
100
|
// checksum
|
|
@@ -161,6 +165,7 @@ PNGReader.prototype.decodeIDAT = function (chunk) {
|
|
|
161
165
|
|
|
162
166
|
/**
|
|
163
167
|
* https://www.w3.org/TR/PNG/#11tRNS
|
|
168
|
+
* @param {Uint8Array} chunk
|
|
164
169
|
*/
|
|
165
170
|
PNGReader.prototype.decodeTRNS = function (chunk) {
|
|
166
171
|
this.png.setTRNS(chunk);
|
|
@@ -40,7 +40,7 @@ function obtainSampler(bitmap, ctx) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* Ref holding webgl context, being weak-ref, allows context to be removed when not in use
|
|
44
44
|
* @type {WeakRef<WebGL2RenderingContext>|null}
|
|
45
45
|
*/
|
|
46
46
|
let ctx_ref = null;
|
|
@@ -97,8 +97,13 @@ export function sampler_from_bitmap(bitmap) {
|
|
|
97
97
|
* @returns {boolean}
|
|
98
98
|
*/
|
|
99
99
|
export function computeImageBitmapEquality(a, b) {
|
|
100
|
+
if (a === b) {
|
|
101
|
+
// strict equality check, special case
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
100
104
|
|
|
101
105
|
if (a.width !== b.width || a.height !== b.height) {
|
|
106
|
+
// check dimensions
|
|
102
107
|
return false;
|
|
103
108
|
}
|
|
104
109
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { computeHashArray, computeHashFloat, computeHashIntegerArray } from "../../../../core/math/MathUtils.js";
|
|
2
1
|
import { planeHash } from "./planeHash.js";
|
|
3
2
|
import { computeTextureHash } from "./computeTextureHash.js";
|
|
4
3
|
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
4
|
+
import { computeHashArray } from "../../../../core/collection/array/computeHashArray.js";
|
|
5
|
+
import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
|
|
6
|
+
import { computeHashFloat } from "../../../../core/math/hash/computeHashFloat.js";
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
*
|