@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
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
|
-
* @param {
|
|
3
|
+
* @param {number[]|Float32Array|mat4} result
|
|
4
4
|
* @param {Vector3} position
|
|
5
5
|
* @param {Quaternion} rotation
|
|
6
6
|
* @param {Vector3} scale
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
9
|
-
const te = result.elements;
|
|
10
|
-
|
|
8
|
+
export function compose_matrix4_array(result, position, rotation, scale) {
|
|
11
9
|
const x = rotation.x;
|
|
12
10
|
const y = rotation.y;
|
|
13
11
|
const z = rotation.z;
|
|
@@ -33,23 +31,35 @@ export function composeMatrix4(result, position, rotation, scale) {
|
|
|
33
31
|
const sy = scale.y;
|
|
34
32
|
const sz = scale.z;
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
34
|
+
result[0] = (1 - (yy + zz)) * sx;
|
|
35
|
+
result[1] = (xy + wz) * sx;
|
|
36
|
+
result[2] = (xz - wy) * sx;
|
|
37
|
+
result[3] = 0;
|
|
38
|
+
|
|
39
|
+
result[4] = (xy - wz) * sy;
|
|
40
|
+
result[5] = (1 - (xx + zz)) * sy;
|
|
41
|
+
result[6] = (yz + wx) * sy;
|
|
42
|
+
result[7] = 0;
|
|
43
|
+
|
|
44
|
+
result[8] = (xz + wy) * sz;
|
|
45
|
+
result[9] = (yz - wx) * sz;
|
|
46
|
+
result[10] = (1 - (xx + yy)) * sz;
|
|
47
|
+
result[11] = 0;
|
|
48
|
+
|
|
49
|
+
result[12] = position.x;
|
|
50
|
+
result[13] = position.y;
|
|
51
|
+
result[14] = position.z;
|
|
52
|
+
result[15] = 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
* @param {Matrix4} result
|
|
58
|
+
* @param {Vector3} position
|
|
59
|
+
* @param {Quaternion} rotation
|
|
60
|
+
* @param {Vector3} scale
|
|
61
|
+
*/
|
|
62
|
+
export function composeMatrix4(result, position, rotation, scale) {
|
|
63
|
+
const te = result.elements;
|
|
64
|
+
compose_matrix4_array(te, position, rotation, scale);
|
|
55
65
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number[]} m
|
|
4
|
+
* @param {Vector3} position
|
|
5
|
+
* @param {Quaternion} rotation
|
|
6
|
+
* @param {Vector3} scale
|
|
7
|
+
*/
|
|
8
|
+
export function decompose_matrix_4_array(m, position, rotation, scale) {
|
|
9
|
+
const m11 = m[0];
|
|
10
|
+
const m12 = m[1];
|
|
11
|
+
const m13 = m[2];
|
|
12
|
+
|
|
13
|
+
const m21 = m[4];
|
|
14
|
+
const m22 = m[5];
|
|
15
|
+
const m23 = m[6];
|
|
16
|
+
|
|
17
|
+
const m31 = m[8];
|
|
18
|
+
const m32 = m[9];
|
|
19
|
+
const m33 = m[10];
|
|
20
|
+
|
|
21
|
+
const scale_x = Math.hypot(m11, m12, m13);
|
|
22
|
+
const scale_y = Math.hypot(m21, m22, m23);
|
|
23
|
+
const scale_z = Math.hypot(m31, m32, m33);
|
|
24
|
+
|
|
25
|
+
// extract rotation
|
|
26
|
+
const is1 = 1 / scale_x;
|
|
27
|
+
const is2 = 1 / scale_y;
|
|
28
|
+
const is3 = 1 / scale_z;
|
|
29
|
+
|
|
30
|
+
const sm11 = m11 * is1;
|
|
31
|
+
const sm12 = m12 * is1;
|
|
32
|
+
const sm13 = m13 * is1;
|
|
33
|
+
|
|
34
|
+
const sm21 = m21 * is2;
|
|
35
|
+
const sm22 = m22 * is2;
|
|
36
|
+
const sm23 = m23 * is2;
|
|
37
|
+
|
|
38
|
+
const sm31 = m31 * is3;
|
|
39
|
+
const sm32 = m32 * is3;
|
|
40
|
+
const sm33 = m33 * is3;
|
|
41
|
+
|
|
42
|
+
// write out results
|
|
43
|
+
|
|
44
|
+
position.set(
|
|
45
|
+
m[12],
|
|
46
|
+
m[13],
|
|
47
|
+
m[14]
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
scale.set(
|
|
51
|
+
scale_x,
|
|
52
|
+
scale_y,
|
|
53
|
+
scale_z
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
rotation.__setFromRotationMatrix(
|
|
57
|
+
sm11, sm21, sm31,
|
|
58
|
+
sm12, sm22, sm32,
|
|
59
|
+
sm13, sm23, sm33
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
import Vector2 from '../../../core/geom/Vector2.js';
|
|
7
|
-
import { computeHashIntegerArray } from "../../../core/math/MathUtils.js";
|
|
8
7
|
import { assert } from "../../../core/assert.js";
|
|
9
8
|
import { BinaryClassSerializationAdapter } from "../../ecs/storage/binary/BinaryClassSerializationAdapter.js";
|
|
10
9
|
import { computeIntegerArrayHash } from "../../../core/primitives/array/computeIntegerArrayHash.js";
|
|
11
10
|
import { isArrayEqualStrict } from "../../../core/collection/array/isArrayEqualStrict.js";
|
|
11
|
+
import { computeHashIntegerArray } from "../../../core/collection/array/computeHashIntegerArray.js";
|
|
12
12
|
|
|
13
13
|
class GridObstacle {
|
|
14
14
|
constructor() {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { assert } from "../../../../core/assert.js";
|
|
2
2
|
import { ClockChannelType } from "./ClockChannelType.js";
|
|
3
|
+
import { RepeatBehavior } from "../decorator/RepeatBehavior.js";
|
|
4
|
+
import { ActionBehavior } from "../primitive/ActionBehavior.js";
|
|
3
5
|
|
|
4
6
|
export const BehaviorComponentFlag = {
|
|
5
7
|
AllowSleep: 1
|
|
@@ -25,24 +27,38 @@ export class BehaviorComponent {
|
|
|
25
27
|
*/
|
|
26
28
|
this.flags = 0;
|
|
27
29
|
}
|
|
28
|
-
}
|
|
29
30
|
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
* @param {Behavior} b
|
|
33
|
-
* @returns {BehaviorComponent}
|
|
34
|
-
*/
|
|
35
|
-
BehaviorComponent.fromOne = function (b) {
|
|
36
|
-
assert.notEqual(b, undefined, 'behavior is undefined');
|
|
37
|
-
assert.notEqual(b, null, 'behavior is null');
|
|
38
|
-
assert.equal(b.isBehavior, true, 'b.isBehavior !== true');
|
|
39
31
|
|
|
40
|
-
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @param {function} f
|
|
35
|
+
* @param {*} [thisArg]
|
|
36
|
+
* @returns {BehaviorComponent}
|
|
37
|
+
*/
|
|
38
|
+
static looping_function(f, thisArg) {
|
|
39
|
+
return BehaviorComponent.fromOne(RepeatBehavior.from(
|
|
40
|
+
new ActionBehavior(f, thisArg)
|
|
41
|
+
));
|
|
42
|
+
}
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @param {Behavior} b
|
|
47
|
+
* @returns {BehaviorComponent}
|
|
48
|
+
*/
|
|
49
|
+
static fromOne(b) {
|
|
50
|
+
assert.notEqual(b, undefined, 'behavior is undefined');
|
|
51
|
+
assert.notEqual(b, null, 'behavior is null');
|
|
52
|
+
assert.equal(b.isBehavior, true, 'b.isBehavior !== true');
|
|
43
53
|
|
|
44
|
-
|
|
45
|
-
|
|
54
|
+
const result = new BehaviorComponent();
|
|
55
|
+
|
|
56
|
+
result.list.push(b);
|
|
57
|
+
|
|
58
|
+
return result;
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
}
|
|
46
62
|
|
|
47
63
|
/**
|
|
48
64
|
* @readonly
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { computeHashFloat, computeHashIntegerArray } from "../../../../core/math/MathUtils.js";
|
|
2
1
|
import { assert } from "../../../../core/assert.js";
|
|
3
2
|
import { invokeObjectEquals } from "../../../../core/model/object/invokeObjectEquals.js";
|
|
4
3
|
import { invokeObjectHash } from "../../../../core/model/object/invokeObjectHash.js";
|
|
4
|
+
import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
|
|
5
|
+
import { computeHashFloat } from "../../../../core/math/hash/computeHashFloat.js";
|
|
5
6
|
|
|
6
7
|
export class WeightedElement {
|
|
7
8
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { randomFromArray} from "../../../core/math/MathUtils.js";
|
|
2
1
|
import { seededRandom } from "../../../core/math/random/seededRandom.js";
|
|
2
|
+
import { randomFromArray } from "../../../core/math/random/randomFromArray.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Hill climbing optimizer based on random moves
|
|
@@ -222,7 +222,7 @@ export class StaticKnowledgeDataTable {
|
|
|
222
222
|
} catch (e) {
|
|
223
223
|
|
|
224
224
|
let id;
|
|
225
|
-
//attempt to extract
|
|
225
|
+
//attempt to extract item ID
|
|
226
226
|
try {
|
|
227
227
|
id = datum.id;
|
|
228
228
|
} catch (e) {
|
|
@@ -243,6 +243,11 @@ export class StaticKnowledgeDataTable {
|
|
|
243
243
|
return;
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
+
if (this.contains(id)) {
|
|
247
|
+
console.error(`Duplicate id '${id}'`);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
|
|
246
251
|
this.__json.set(id, datum);
|
|
247
252
|
|
|
248
253
|
const added = this.add(element);
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
import { line3_computeSegmentPointDistance_sqr } from "../../../../core/geom/LineSegment.js";
|
|
7
6
|
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
8
7
|
|
|
9
8
|
import { CatmullRomCurve3 } from "three";
|
|
@@ -18,6 +17,7 @@ import { min2 } from "../../../../core/math/min2.js";
|
|
|
18
17
|
import { computeNonuniformCatmullRomSplineSample } from "./computeNonuniformCatmullRomSplineSample.js";
|
|
19
18
|
import { InterpolationType } from "./InterpolationType.js";
|
|
20
19
|
import { v3_distance } from "../../../../core/geom/v3_distance.js";
|
|
20
|
+
import { line3_computeSegmentPointDistance_sqr } from "../../../../core/geom/3d/line/line3_computeSegmentPointDistance_sqr.js";
|
|
21
21
|
|
|
22
22
|
const v3_a = new Vector3();
|
|
23
23
|
const v3_b = new Vector3();
|
|
@@ -270,11 +270,6 @@ class Path {
|
|
|
270
270
|
copy(other) {
|
|
271
271
|
this.__data.copy(other.__data);
|
|
272
272
|
this.interpolation = other.interpolation;
|
|
273
|
-
|
|
274
|
-
// Traversal variables
|
|
275
|
-
this.markerOffset = other.markerOffset;
|
|
276
|
-
this.markerIndex = other.markerIndex;
|
|
277
|
-
this.markerDistanceToNext = other.markerDistanceToNext;
|
|
278
273
|
}
|
|
279
274
|
|
|
280
275
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { seededRandom } from "../../../core/math/random/seededRandom.js";
|
|
2
2
|
import BinaryHeap from "./FastBinaryHeap.js";
|
|
3
3
|
import { passThrough, returnZero } from "../../../core/function/Functions.js";
|
|
4
|
-
import { randomIntegerBetween} from "../../../core/math/
|
|
4
|
+
import { randomIntegerBetween } from "../../../core/math/random/randomIntegerBetween.js";
|
|
5
5
|
|
|
6
6
|
test("constructor doesn't throw", () => {
|
|
7
7
|
new BinaryHeap(returnZero);
|
|
@@ -10,11 +10,12 @@ import { SoundEmitterFlags } from "./SoundEmitterFlags.js";
|
|
|
10
10
|
import { SoundAttenuationFunction } from "./SoundAttenuationFunction.js";
|
|
11
11
|
import { attenuateSoundLinear } from "./attenuate/attenuateSoundLinear.js";
|
|
12
12
|
import { attenuateSoundLogarithmic } from "./attenuate/attenuateSoundLogarithmic.js";
|
|
13
|
-
import { computeHashFloat, computeHashIntegerArray } from "../../../../core/math/MathUtils.js";
|
|
14
13
|
import { SoundPanningModelType } from "./SoundPanningModelType.js";
|
|
15
14
|
import { attenuateSoundSmith } from "./attenuate/attenuateSoundSmith.js";
|
|
16
15
|
import { objectKeyByValue } from "../../../../core/model/object/objectKeyByValue.js";
|
|
17
16
|
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
17
|
+
import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
|
|
18
|
+
import { computeHashFloat } from "../../../../core/math/hash/computeHashFloat.js";
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Convert decibel to percentage volume
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import Signal from "../../../../core/events/signal/Signal.js";
|
|
2
2
|
import { SoundTrackFlags } from "./SoundTrackFlags.js";
|
|
3
|
-
import { computeHashFloat, computeHashIntegerArray } from "../../../../core/math/MathUtils.js";
|
|
4
3
|
import { assert } from "../../../../core/assert.js";
|
|
5
4
|
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
5
|
+
import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
|
|
6
|
+
import { computeHashFloat } from "../../../../core/math/hash/computeHashFloat.js";
|
|
6
7
|
|
|
7
8
|
const DEFAULT_FLAGS = SoundTrackFlags.StartWhenReady;
|
|
8
9
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractSoundMaterialDefinition } from "../AbstractSoundMaterialDefinition.js";
|
|
2
|
-
import { randomFromArray } from "../../../../core/math/MathUtils.js";
|
|
3
2
|
import { SoundAssetPlaybackSpec } from "../../asset/SoundAssetPlaybackSpec.js";
|
|
3
|
+
import { randomFromArray } from "../../../../core/math/random/randomFromArray.js";
|
|
4
4
|
|
|
5
5
|
export class RandomSoundMaterial extends AbstractSoundMaterialDefinition {
|
|
6
6
|
constructor() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Notification } from "../../notify/Notification.js";
|
|
2
|
-
import { randomFromArray } from "../../../core/math/MathUtils.js";
|
|
3
2
|
import { NotificationAreaKind } from "../GUIEngine.js";
|
|
3
|
+
import { randomFromArray } from "../../../core/math/random/randomFromArray.js";
|
|
4
4
|
|
|
5
5
|
function notificationGenerator(callback, timeout = 5) {
|
|
6
6
|
const phrases = [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CellFilter } from "../../CellFilter.js";
|
|
2
|
-
import { gaussian } from "../../../../core/math/
|
|
2
|
+
import { gaussian } from "../../../../core/math/gaussian.js";
|
|
3
3
|
|
|
4
4
|
function buildKernel(result, samplesX, samplesY, sigma_x, sigma_y) {
|
|
5
5
|
const half_samples_x = (samplesX / 2);
|
|
@@ -3,9 +3,10 @@ import { GridTaskGenerator } from "../GridTaskGenerator.js";
|
|
|
3
3
|
import Task from "../../../core/process/task/Task.js";
|
|
4
4
|
import TaskSignal from "../../../core/process/task/TaskSignal.js";
|
|
5
5
|
import { BitSet } from "../../../core/binary/BitSet.js";
|
|
6
|
-
import { PI_HALF
|
|
6
|
+
import { PI_HALF } from "../../../core/math/MathUtils.js";
|
|
7
7
|
import { actionTask } from "../../../core/process/task/TaskUtils.js";
|
|
8
8
|
import TaskGroup from "../../../core/process/task/TaskGroup.js";
|
|
9
|
+
import { randomIntegerBetween } from "../../../core/math/random/randomIntegerBetween.js";
|
|
9
10
|
|
|
10
11
|
export class GridTaskExecuteRuleTimes extends GridTaskGenerator {
|
|
11
12
|
constructor() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { seededRandom } from "../../../core/math/random/seededRandom.js";
|
|
2
2
|
import { MarkerNodeAction } from "./MarkerNodeAction.js";
|
|
3
3
|
import { assert } from "../../../core/assert.js";
|
|
4
|
-
import { randomFromArray} from "../../../core/math/
|
|
4
|
+
import { randomFromArray } from "../../../core/math/random/randomFromArray.js";
|
|
5
5
|
|
|
6
6
|
export class MarkerNodeActionSelectRandom extends MarkerNodeAction {
|
|
7
7
|
constructor() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { seededRandom } from "../../../core/math/random/seededRandom.js";
|
|
2
2
|
import { MarkerNodeTransformer } from "./MarkerNodeTransformer.js";
|
|
3
|
-
import { randomIntegerBetween} from "../../../core/math/MathUtils.js";
|
|
4
3
|
import { assert } from "../../../core/assert.js";
|
|
4
|
+
import { randomIntegerBetween } from "../../../core/math/random/randomIntegerBetween.js";
|
|
5
5
|
|
|
6
6
|
export class MarkerNodeTransformerRecordUniqueRandomEnum extends MarkerNodeTransformer {
|
|
7
7
|
constructor() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { seededRandom } from "../../../../core/math/random/seededRandom.js";
|
|
2
2
|
import { GridCellAction } from "../GridCellAction.js";
|
|
3
|
-
import { randomFromArray} from "../../../../core/math/MathUtils.js";
|
|
4
3
|
import { assert } from "../../../../core/assert.js";
|
|
4
|
+
import { randomFromArray } from "../../../../core/math/random/randomFromArray.js";
|
|
5
5
|
|
|
6
6
|
export class CellActionSelectRandom extends GridCellAction {
|
|
7
7
|
constructor() {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { QuadTreeNode } from "../../core/geom/2d/quad-tree/QuadTreeNode.js";
|
|
2
2
|
import { assert } from "../../core/assert.js";
|
|
3
3
|
import { obtainTerrain } from "../../../model/game/scenes/SceneUtils.js";
|
|
4
|
-
import { randomFloatBetween } from "../../core/math/MathUtils.js";
|
|
5
4
|
import { seededRandom } from "../../core/math/random/seededRandom.js";
|
|
6
5
|
import { TerrainLayerRuleAggregator } from "./TerrainLayerRuleAggregator.js";
|
|
7
6
|
import { actionTask, countTask, emptyTask, futureTask } from "../../core/process/task/TaskUtils.js";
|
|
@@ -17,6 +16,7 @@ import { HashMap } from "../../core/collection/HashMap.js";
|
|
|
17
16
|
import { TerrainLayer } from "../../engine/ecs/terrain/ecs/layers/TerrainLayer.js";
|
|
18
17
|
import { TerrainFlags } from "../../engine/ecs/terrain/ecs/TerrainFlags.js";
|
|
19
18
|
import { binarySearchLowIndex } from "../../core/collection/array/binarySearchLowIndex.js";
|
|
19
|
+
import { randomFloatBetween } from "../../core/math/random/randomFloatBetween.js";
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Cache } from "../core/cache/Cache.js";
|
|
2
|
-
import { computeHashIntegerArray } from "../core/math/MathUtils.js";
|
|
3
2
|
import { computeMaterialEquality } from "../engine/asset/loaders/material/computeMaterialEquality.js";
|
|
4
3
|
import { computeMaterialHash } from "../engine/asset/loaders/material/computeMaterialHash.js";
|
|
5
4
|
import { makeMaterialIcon } from "./makeMaterialIcon.js";
|
|
5
|
+
import { computeHashIntegerArray } from "../core/collection/array/computeHashIntegerArray.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
@@ -47,4 +47,4 @@ export function makeMaterialIconCached(material, renderer, size) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
return sampler;
|
|
50
|
-
}
|
|
50
|
+
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"productName": "Meep",
|
|
5
5
|
"description": "production-ready JavaScript game engine based on Entity Component System Architecture",
|
|
6
6
|
"author": "Alexander Goldring",
|
|
7
|
-
"version": "2.33.
|
|
7
|
+
"version": "2.33.27",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"fast-levenshtein": "2.0.6",
|
|
10
10
|
"opentype.js": "1.3.3",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { computeHashArray, computeHashIntegerArray } from "../../../core/math/MathUtils.js";
|
|
2
1
|
import { isArrayEqual } from "../../../core/collection/ArrayUtils.js";
|
|
3
2
|
import { KeyValuePair } from "../../../core/collection/KeyValuePair.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";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
*
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import View from "../../View.js";
|
|
2
2
|
import SVG, { svgCircularPath } from "../../SVG.js";
|
|
3
|
-
import {
|
|
3
|
+
import { PI2 } from "../../../core/math/MathUtils.js";
|
|
4
4
|
import { assert } from "../../../core/assert.js";
|
|
5
|
+
import { isValueBetween } from "../../../core/math/isValueBetween.js";
|
|
5
6
|
|
|
6
7
|
let idCount = 0;
|
|
7
8
|
|
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DataTexture,
|
|
3
|
-
LinearMipMapLinearFilter,
|
|
4
|
-
NearestFilter,
|
|
5
|
-
NormalBlending,
|
|
6
|
-
Points,
|
|
7
|
-
RGBAFormat,
|
|
8
|
-
ShaderMaterial,
|
|
9
|
-
Vector2 as ThreeVector2
|
|
10
|
-
} from 'three';
|
|
1
|
+
import { DataTexture, Points } from 'three';
|
|
11
2
|
import { AssetManager } from "../../../engine/asset/AssetManager.js";
|
|
12
3
|
import { ManagedAtlas } from "../../../engine/graphics/texture/atlas/ManagedTextureAtlas.js";
|
|
13
|
-
import {
|
|
14
|
-
ParticleAttributeType,
|
|
15
|
-
ParticleDataType,
|
|
16
|
-
} from "../../../engine/graphics/particles/particular/group/ParticleGroup.js";
|
|
17
4
|
import { EntityObserver } from "../../../engine/ecs/EntityObserver.js";
|
|
18
5
|
import { Transform } from "../../../engine/ecs/transform/Transform.js";
|
|
19
6
|
import MinimapMarker from "../../../../model/game/ecs/component/minimap/MinimapMarker.js";
|
|
@@ -24,91 +11,10 @@ import { ParticleSpecification } from "../../../engine/graphics/particles/partic
|
|
|
24
11
|
import { ParticleAttribute } from "../../../engine/graphics/particles/particular/group/ParticleAttribute.js";
|
|
25
12
|
import Vector2 from "../../../core/geom/Vector2.js";
|
|
26
13
|
import { writeSample2DDataToDataTexture } from "../../../engine/graphics/texture/sampler/writeSampler2DDataToDataTexture.js";
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
*/
|
|
32
|
-
function buildMaterial() {
|
|
33
|
-
function vertexShader() {
|
|
34
|
-
return `
|
|
35
|
-
attribute float size;
|
|
36
|
-
attribute vec4 aPatch;
|
|
37
|
-
|
|
38
|
-
varying vec4 vPatch;
|
|
39
|
-
|
|
40
|
-
uniform vec2 resolution;
|
|
41
|
-
|
|
42
|
-
vec2 extractScale2D(mat4 matrix){
|
|
43
|
-
float sx = length(matrix[0].xy);
|
|
44
|
-
float sz = length(matrix[2].xy);
|
|
45
|
-
|
|
46
|
-
return vec2(sx, sz);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
void main() {
|
|
50
|
-
vPatch = aPatch;
|
|
51
|
-
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
|
|
52
|
-
|
|
53
|
-
//extract scale
|
|
54
|
-
vec2 scale = extractScale2D(projectionMatrix);
|
|
55
|
-
|
|
56
|
-
float radius = size / 2.0;
|
|
57
|
-
|
|
58
|
-
gl_Position = projectionMatrix * mvPosition;
|
|
59
|
-
gl_PointSize = resolution.y * radius * max(scale.x, scale.y);
|
|
60
|
-
}`;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function fragmentShader() {
|
|
64
|
-
return `
|
|
65
|
-
uniform sampler2D atlas;
|
|
66
|
-
|
|
67
|
-
varying vec4 vPatch;
|
|
68
|
-
void main() {
|
|
69
|
-
vec2 uv = gl_PointCoord*vPatch.zw + vPatch.xy;
|
|
70
|
-
vec4 texel = texture2D( atlas, uv );
|
|
71
|
-
|
|
72
|
-
if(texel.a == 0.0){
|
|
73
|
-
discard;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
gl_FragColor = texel;
|
|
77
|
-
}`;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const dataTexture = new DataTexture(new Uint8Array(4), 1, 1, RGBAFormat);
|
|
82
|
-
dataTexture.flipY = false;
|
|
83
|
-
dataTexture.generateMipmaps = true;
|
|
84
|
-
dataTexture.minFilter = LinearMipMapLinearFilter;
|
|
85
|
-
dataTexture.magFilter = NearestFilter;
|
|
86
|
-
|
|
87
|
-
const uniforms = {
|
|
88
|
-
atlas: {
|
|
89
|
-
type: 't',
|
|
90
|
-
value: dataTexture
|
|
91
|
-
},
|
|
92
|
-
resolution: {
|
|
93
|
-
type: 'v2',
|
|
94
|
-
value: new ThreeVector2()
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const material = new ShaderMaterial({
|
|
99
|
-
uniforms,
|
|
100
|
-
vertexShader: vertexShader(),
|
|
101
|
-
fragmentShader: fragmentShader(),
|
|
102
|
-
blending: NormalBlending,
|
|
103
|
-
lights: false,
|
|
104
|
-
fog: false,
|
|
105
|
-
depthTest: false,
|
|
106
|
-
transparent: true,
|
|
107
|
-
vertexColors: false
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
return material;
|
|
111
|
-
}
|
|
14
|
+
import { ParticleDataType } from "../../../engine/graphics/particles/particular/group/ParticleDataType.js";
|
|
15
|
+
import { ParticleAttributeType } from "../../../engine/graphics/particles/particular/group/ParticleAttributeType.js";
|
|
16
|
+
import { buildMaterial } from "./buildMaterial.js";
|
|
17
|
+
import { ParticleGroup } from "../../../engine/graphics/particles/particular/group/ParticleGroup.js";
|
|
112
18
|
|
|
113
19
|
/**
|
|
114
20
|
*
|
|
@@ -164,7 +70,7 @@ export class MinimapMarkersGL extends MinimapWorldLayer {
|
|
|
164
70
|
*
|
|
165
71
|
* @type {ParticleGroup}
|
|
166
72
|
*/
|
|
167
|
-
const particles = this.particles = particleSpecification
|
|
73
|
+
const particles = this.particles = new ParticleGroup(particleSpecification);
|
|
168
74
|
|
|
169
75
|
this.entityObserver = new EntityObserver([Transform, MinimapMarker], addElement, removeElement);
|
|
170
76
|
|
|
@@ -171,13 +171,20 @@ export class MinimapWorldGL {
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
update() {
|
|
174
|
-
this.layers
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
const layers = this.layers;
|
|
175
|
+
const layer_count = layers.length;
|
|
176
|
+
|
|
177
|
+
for (let i = 0; i < layer_count; i++) {
|
|
178
|
+
const layer = layers[i];
|
|
179
|
+
|
|
180
|
+
layer.update(this.camera);
|
|
181
|
+
|
|
182
|
+
if (layer.needsRender) {
|
|
177
183
|
this.renderNeedsUpdate = true;
|
|
178
|
-
|
|
184
|
+
layer.needsRender = false;
|
|
179
185
|
}
|
|
180
|
-
|
|
186
|
+
|
|
187
|
+
}
|
|
181
188
|
|
|
182
189
|
if (this.renderNeedsUpdate) {
|
|
183
190
|
this.render();
|