@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,4 +1,3 @@
|
|
|
1
|
-
import { min2 } from "../../../../../core/math/min2.js";
|
|
2
1
|
import { seededRandom } from "../../../../../core/math/random/seededRandom.js";
|
|
3
2
|
import { EngineHarness } from "../../../../EngineHarness.js";
|
|
4
3
|
import { EngineConfiguration } from "../../../../EngineConfiguration.js";
|
|
@@ -44,7 +43,15 @@ import { BehaviorSystem } from "../../../../intelligence/behavior/ecs/BehaviorSy
|
|
|
44
43
|
import { SerializationMetadataSystem } from "../../../../ecs/systems/SerializationMetadataSystem.js";
|
|
45
44
|
import { InverseKinematicsSystem } from "../../../../ecs/animation/InverseKinematicsSystem.js";
|
|
46
45
|
import { PathDisplaySystem } from "../../../ecs/path/PathDisplaySystem.js";
|
|
47
|
-
import {
|
|
46
|
+
import {
|
|
47
|
+
BoxBufferGeometry,
|
|
48
|
+
Group,
|
|
49
|
+
Mesh as ThreeMesh,
|
|
50
|
+
MeshBasicMaterial,
|
|
51
|
+
MeshStandardMaterial,
|
|
52
|
+
OctahedronBufferGeometry,
|
|
53
|
+
TorusKnotBufferGeometry
|
|
54
|
+
} from "three";
|
|
48
55
|
import RenderSystem from "../../../../ecs/systems/RenderSystem.js";
|
|
49
56
|
import { makeEngineOptionsModel } from "../../../../../../model/game/options/makeEngineOptionsModel.js";
|
|
50
57
|
import { enableEditor } from "../../../../../editor/enableEditor.js";
|
|
@@ -59,26 +66,28 @@ import { BehaviorComponent } from "../../../../intelligence/behavior/ecs/Behavio
|
|
|
59
66
|
import { Light } from "../../../ecs/light/Light.js";
|
|
60
67
|
import { LightType } from "../../../ecs/light/LightType.js";
|
|
61
68
|
import { parseColor } from "../../../../../core/color/ColorUtils.js";
|
|
62
|
-
import { randomFloatBetween } from "../../../../../core/math/MathUtils.js";
|
|
63
69
|
import Renderable from "../../../../ecs/components/Renderable.js";
|
|
64
70
|
import { makeHelperSphereGeometry } from "../../../../../editor/process/symbolic/makeHelperSphereGeometry.js";
|
|
65
|
-
import GUIElement from "../../../../ecs/gui/GUIElement.js";
|
|
66
|
-
import View from "../../../../../view/View.js";
|
|
67
|
-
import { buildLightClusterWidget } from "../debug/buildLightClusterWidget.js";
|
|
68
|
-
import ViewportPosition from "../../../../ecs/gui/position/ViewportPosition.js";
|
|
69
71
|
import TopDownCameraController from "../../../ecs/camera/topdown/TopDownCameraController.js";
|
|
70
72
|
import ThreeFactory from "../../../three/ThreeFactory.js";
|
|
71
73
|
import { obtainTerrain } from "../../../../../../model/game/scenes/SceneUtils.js";
|
|
72
|
-
import Vector4 from "../../../../../core/geom/Vector4.js";
|
|
73
74
|
import { JsonAssetLoader } from "../../../../asset/loaders/JsonAssetLoader.js";
|
|
74
75
|
import { TextureAssetLoader } from "../../../../asset/loaders/texture/TextureAssetLoader.js";
|
|
75
76
|
import { GameAssetType } from "../../../../asset/GameAssetType.js";
|
|
76
77
|
import { GLTFAssetLoader } from "../../../../asset/loaders/GLTFAssetLoader.js";
|
|
77
78
|
import { ImageRGBADataLoader } from "../../../../asset/loaders/image/ImageRGBADataLoader.js";
|
|
78
|
-
import {
|
|
79
|
-
import {
|
|
80
|
-
|
|
79
|
+
import { randomFloatBetween } from "../../../../../core/math/random/randomFloatBetween.js";
|
|
80
|
+
import { ParticleEmitter } from "../../../particles/particular/engine/emitter/ParticleEmitter.js";
|
|
81
|
+
import { ParticleEmitterSystem } from "../../../particles/ecs/ParticleEmitterSystem.js";
|
|
82
|
+
import { ShadedGeometrySystem } from "../../../ecs/mesh-v2/ShadedGeometrySystem.js";
|
|
83
|
+
import { FogOfWar } from "../../../../ecs/fow/FogOfWar.js";
|
|
84
|
+
import { FogOfWarRevealer } from "../../../../ecs/fow/FogOfWarRevealer.js";
|
|
85
|
+
import Team from "../../../../../../model/game/ecs/component/Team.js";
|
|
86
|
+
|
|
87
|
+
const geo_light_center_octahedron = new BoxBufferGeometry(0.1, 0.1, 0.1);
|
|
81
88
|
const engineHarness = new EngineHarness();
|
|
89
|
+
const sphere_geometry = new OctahedronBufferGeometry(1, 5);
|
|
90
|
+
const sphere_geometry_shell = makeHelperSphereGeometry(1);
|
|
82
91
|
|
|
83
92
|
function makeConfig(engine) {
|
|
84
93
|
|
|
@@ -137,22 +146,24 @@ function makeConfig(engine) {
|
|
|
137
146
|
new InputSystem(devices),
|
|
138
147
|
new MeshHighlightSystem(engine),
|
|
139
148
|
new LightSystem(engine, {
|
|
140
|
-
shadowResolution:
|
|
149
|
+
shadowResolution: 2048
|
|
141
150
|
}),
|
|
142
151
|
new AnimationControllerSystem(),
|
|
143
152
|
new AnimationGraphSystem(graphics.viewport.size),
|
|
144
153
|
headsUpDisplaySystem,
|
|
154
|
+
new ParticleEmitterSystem(engine),
|
|
145
155
|
new FogOfWarSystem(graphics),
|
|
146
156
|
new FogOfWarRevealerSystem(0),
|
|
147
157
|
new BehaviorSystem(engine),
|
|
148
158
|
new SerializationMetadataSystem(),
|
|
149
159
|
new InverseKinematicsSystem(),
|
|
150
160
|
new PathDisplaySystem(engine),
|
|
161
|
+
new ShadedGeometrySystem(engine)
|
|
151
162
|
);
|
|
152
163
|
|
|
153
164
|
// Plugins
|
|
154
165
|
config.addPlugin(ForwardPlusRenderingPlugin);
|
|
155
|
-
config.addPlugin(MicronRenderPlugin);
|
|
166
|
+
// config.addPlugin(MicronRenderPlugin);
|
|
156
167
|
|
|
157
168
|
// Knowledge
|
|
158
169
|
|
|
@@ -198,19 +209,30 @@ function makeLight(position, radius, color, intensity = 1) {
|
|
|
198
209
|
light.distance.set(radius);
|
|
199
210
|
light.intensity.set(intensity);
|
|
200
211
|
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
212
|
+
const color_uint = light.color.toUint();
|
|
213
|
+
const visual_group = new Group();
|
|
214
|
+
|
|
215
|
+
const mesh_center_0 = new ThreeMesh(sphere_geometry, new MeshBasicMaterial({
|
|
216
|
+
color: color_uint
|
|
217
|
+
}));
|
|
218
|
+
mesh_center_0.scale.setScalar(0.1);
|
|
219
|
+
mesh_center_0.matrixAutoUpdate = false;
|
|
220
|
+
|
|
221
|
+
visual_group.add(mesh_center_0);
|
|
222
|
+
|
|
223
|
+
const mesh_center_1 = new ThreeMesh(sphere_geometry, new MeshBasicMaterial({
|
|
224
|
+
color: color_uint,
|
|
204
225
|
transparent: true,
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
});
|
|
226
|
+
opacity: 0.06
|
|
227
|
+
}));
|
|
228
|
+
mesh_center_1.scale.setScalar(0.3);
|
|
229
|
+
mesh_center_1.matrixAutoUpdate = false;
|
|
210
230
|
|
|
211
|
-
|
|
231
|
+
visual_group.add(mesh_center_1);
|
|
232
|
+
|
|
233
|
+
const renderable = new Renderable(visual_group);
|
|
234
|
+
renderable.matrixAutoUpdate = true;
|
|
212
235
|
|
|
213
|
-
const renderable = new Renderable(new Line(geometry, sphere_material));
|
|
214
236
|
return new EntityBuilder()
|
|
215
237
|
.add(Transform.fromJSON({
|
|
216
238
|
position: {
|
|
@@ -219,8 +241,9 @@ function makeLight(position, radius, color, intensity = 1) {
|
|
|
219
241
|
z: position[2]
|
|
220
242
|
}
|
|
221
243
|
}))
|
|
244
|
+
// .add(center_geo)
|
|
222
245
|
.add(light)
|
|
223
|
-
|
|
246
|
+
.add(renderable)
|
|
224
247
|
}
|
|
225
248
|
|
|
226
249
|
|
|
@@ -266,13 +289,13 @@ function setup_scene_0(engine, ecd) {
|
|
|
266
289
|
|
|
267
290
|
console.log(terrain);
|
|
268
291
|
|
|
269
|
-
terrain.overlay.size.set(50, 50);
|
|
270
|
-
for (let i = 0; i < 50; i++) {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
292
|
+
// terrain.overlay.size.set(50, 50);
|
|
293
|
+
// for (let i = 0; i < 50; i++) {
|
|
294
|
+
// for (let j = 0; j < 50; j++) {
|
|
295
|
+
//
|
|
296
|
+
// terrain.overlay.paintPoint(i, j, new Vector4(random(), random(), random(), 0.9));
|
|
297
|
+
// }
|
|
298
|
+
// }
|
|
276
299
|
|
|
277
300
|
/**
|
|
278
301
|
*
|
|
@@ -286,7 +309,7 @@ function setup_scene_0(engine, ecd) {
|
|
|
286
309
|
"y": 1,
|
|
287
310
|
"z": -0.3141130871587056
|
|
288
311
|
},
|
|
289
|
-
"pitch":
|
|
312
|
+
"pitch": 0.47999999999999965,
|
|
290
313
|
"yaw": 4.279999999999975,
|
|
291
314
|
"roll": 0,
|
|
292
315
|
"distance": 28,
|
|
@@ -299,16 +322,16 @@ function setup_scene_0(engine, ecd) {
|
|
|
299
322
|
camera_controller.target.add(offset);
|
|
300
323
|
|
|
301
324
|
|
|
302
|
-
for (let i = 0; i <
|
|
325
|
+
for (let i = 0; i < 10; i++) {
|
|
303
326
|
|
|
304
327
|
const builder = makeLight([
|
|
305
328
|
randomFloatBetween(random, -18, 18) + offset.x,
|
|
306
|
-
randomFloatBetween(random, 0,
|
|
329
|
+
randomFloatBetween(random, 0.5, 13) + offset.y,
|
|
307
330
|
randomFloatBetween(random, -10, 10) + offset.z
|
|
308
331
|
],
|
|
309
|
-
randomFloatBetween(random,
|
|
332
|
+
randomFloatBetween(random, 5, 5),
|
|
310
333
|
`hsv(${random().toFixed(4)}, 1, 1)`,
|
|
311
|
-
|
|
334
|
+
5
|
|
312
335
|
);
|
|
313
336
|
|
|
314
337
|
const light = builder.getComponent(Light);
|
|
@@ -330,7 +353,154 @@ function setup_scene_0(engine, ecd) {
|
|
|
330
353
|
.build(ecd);
|
|
331
354
|
}
|
|
332
355
|
|
|
333
|
-
|
|
356
|
+
new EntityBuilder()
|
|
357
|
+
.add(ParticleEmitter.fromJSON({
|
|
358
|
+
"parameters": [
|
|
359
|
+
{
|
|
360
|
+
"name": "scale",
|
|
361
|
+
"itemSize": 1,
|
|
362
|
+
"defaultTrackValue": {
|
|
363
|
+
"itemSize": 1,
|
|
364
|
+
"data": [
|
|
365
|
+
1
|
|
366
|
+
],
|
|
367
|
+
"positions": [
|
|
368
|
+
0
|
|
369
|
+
]
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
"name": "color",
|
|
374
|
+
"itemSize": 4,
|
|
375
|
+
"defaultTrackValue": {
|
|
376
|
+
"itemSize": 4,
|
|
377
|
+
"data": [
|
|
378
|
+
1,
|
|
379
|
+
1,
|
|
380
|
+
1,
|
|
381
|
+
1
|
|
382
|
+
],
|
|
383
|
+
"positions": [
|
|
384
|
+
0
|
|
385
|
+
]
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
],
|
|
389
|
+
"preWarm": true,
|
|
390
|
+
"readDepth": true,
|
|
391
|
+
"softDepth": true,
|
|
392
|
+
"depthSort": true,
|
|
393
|
+
"velocityAlign": false,
|
|
394
|
+
"receiveLight": true,
|
|
395
|
+
"blendingMode": 0,
|
|
396
|
+
"layers": [
|
|
397
|
+
{
|
|
398
|
+
"imageURL": "data/textures/particle/smokeparticle.png",
|
|
399
|
+
"particleLife": {
|
|
400
|
+
"min": 3,
|
|
401
|
+
"max": 5
|
|
402
|
+
},
|
|
403
|
+
"particleSize": {
|
|
404
|
+
"min": 0.05,
|
|
405
|
+
"max": 0.1
|
|
406
|
+
},
|
|
407
|
+
"particleRotation": {
|
|
408
|
+
"min": 0,
|
|
409
|
+
"max": 0
|
|
410
|
+
},
|
|
411
|
+
"particleRotationSpeed": {
|
|
412
|
+
"min": 0,
|
|
413
|
+
"max": 0
|
|
414
|
+
},
|
|
415
|
+
"emissionShape": 1,
|
|
416
|
+
"emissionFrom": 1,
|
|
417
|
+
"emissionRate": 5000,
|
|
418
|
+
"emissionImmediate": 0,
|
|
419
|
+
"parameterTracks": [
|
|
420
|
+
{
|
|
421
|
+
"name": "color",
|
|
422
|
+
"track": {
|
|
423
|
+
"itemSize": 4,
|
|
424
|
+
"data": [
|
|
425
|
+
1,
|
|
426
|
+
1,
|
|
427
|
+
1,
|
|
428
|
+
0,
|
|
429
|
+
|
|
430
|
+
1,
|
|
431
|
+
1,
|
|
432
|
+
1,
|
|
433
|
+
0.7,
|
|
434
|
+
|
|
435
|
+
1,
|
|
436
|
+
1,
|
|
437
|
+
1,
|
|
438
|
+
0.7,
|
|
439
|
+
|
|
440
|
+
1,
|
|
441
|
+
1,
|
|
442
|
+
1,
|
|
443
|
+
0,
|
|
444
|
+
],
|
|
445
|
+
"positions": [
|
|
446
|
+
0,
|
|
447
|
+
0.2,
|
|
448
|
+
0.8,
|
|
449
|
+
1
|
|
450
|
+
]
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
"name": "scale",
|
|
455
|
+
"track": {
|
|
456
|
+
"itemSize": 1,
|
|
457
|
+
"data": [
|
|
458
|
+
1
|
|
459
|
+
],
|
|
460
|
+
"positions": [
|
|
461
|
+
0
|
|
462
|
+
]
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
],
|
|
466
|
+
"position": {
|
|
467
|
+
"x": 0,
|
|
468
|
+
"y": 0,
|
|
469
|
+
"z": 0
|
|
470
|
+
},
|
|
471
|
+
"scale": {
|
|
472
|
+
"x": 1,
|
|
473
|
+
"y": 1,
|
|
474
|
+
"z": 1
|
|
475
|
+
},
|
|
476
|
+
"particleVelocityDirection": {
|
|
477
|
+
"direction": {
|
|
478
|
+
"x": 0,
|
|
479
|
+
"y": 1,
|
|
480
|
+
"z": 0
|
|
481
|
+
},
|
|
482
|
+
"angle": 1.8
|
|
483
|
+
},
|
|
484
|
+
"particleSpeed": {
|
|
485
|
+
"min": 0.03,
|
|
486
|
+
"max": 0.2
|
|
487
|
+
},
|
|
488
|
+
"steps": [
|
|
489
|
+
{
|
|
490
|
+
"type": "FixedPhysics",
|
|
491
|
+
"parameters": []
|
|
492
|
+
}
|
|
493
|
+
]
|
|
494
|
+
}
|
|
495
|
+
]
|
|
496
|
+
}))
|
|
497
|
+
.add(Transform.fromJSON({
|
|
498
|
+
position: new Vector3(offset.x, offset.y + 7, offset.z),
|
|
499
|
+
scale: new Vector3(40, 14, 26)
|
|
500
|
+
}))
|
|
501
|
+
.build(ecd);
|
|
502
|
+
|
|
503
|
+
for (let i = 0; i < 100; i++) {
|
|
334
504
|
|
|
335
505
|
const builder = makeLight([
|
|
336
506
|
randomFloatBetween(random, -18, 18) + offset.x,
|
|
@@ -365,6 +535,370 @@ function setup_scene_0(engine, ecd) {
|
|
|
365
535
|
.build(ecd);
|
|
366
536
|
}
|
|
367
537
|
|
|
538
|
+
/**
|
|
539
|
+
* @param {Engine} engine
|
|
540
|
+
* @param {EntityComponentDataset} ecd
|
|
541
|
+
*/
|
|
542
|
+
function setup_scene_3(engine, ecd) {
|
|
543
|
+
|
|
544
|
+
const random = seededRandom(0);
|
|
545
|
+
//
|
|
546
|
+
// const light_key = new Light();
|
|
547
|
+
// light_key.intensity.set(0.1);
|
|
548
|
+
// light_key.type.set(LightType.DIRECTION);
|
|
549
|
+
// light_key.castShadow.set(true);
|
|
550
|
+
//
|
|
551
|
+
// const key_light_transform = new Transform();
|
|
552
|
+
// key_light_transform.position.set(10, 10, 0);
|
|
553
|
+
// key_light_transform.lookAt(new Vector3(0, 0, 0));
|
|
554
|
+
//
|
|
555
|
+
// new EntityBuilder()
|
|
556
|
+
// .add(light_key)
|
|
557
|
+
// .add(key_light_transform)
|
|
558
|
+
// .build(ecd);
|
|
559
|
+
|
|
560
|
+
const light_fill = new Light();
|
|
561
|
+
light_fill.intensity.set(0.03);
|
|
562
|
+
light_fill.type.set(LightType.AMBIENT);
|
|
563
|
+
light_fill.castShadow.set(false);
|
|
564
|
+
|
|
565
|
+
const fill_light_transform = new Transform();
|
|
566
|
+
fill_light_transform.position.set(40, 15, 30);
|
|
567
|
+
fill_light_transform.lookAt(new Vector3(30, 0, 20));
|
|
568
|
+
|
|
569
|
+
new EntityBuilder()
|
|
570
|
+
.add(light_fill)
|
|
571
|
+
.add(fill_light_transform)
|
|
572
|
+
.build(ecd);
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
const camera = CameraSystem.getFirstActiveCamera(ecd);
|
|
576
|
+
|
|
577
|
+
camera.component.fov.set(30);
|
|
578
|
+
camera.component.object.fov = 30;
|
|
579
|
+
|
|
580
|
+
// camera.component.autoClip = false;
|
|
581
|
+
// camera.component.object.near = 2;
|
|
582
|
+
// camera.component.object.far = 40;
|
|
583
|
+
|
|
584
|
+
EngineHarness.buildTerrain({
|
|
585
|
+
engine,
|
|
586
|
+
enableWater: false,
|
|
587
|
+
resolution: 4,
|
|
588
|
+
size: new Vector2(40, 40),
|
|
589
|
+
diffuse0: "data/textures/materials/terrain_township_set/1024/Grass_3.png"
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
const terrain = obtainTerrain(ecd, (terrain, entity) => {
|
|
593
|
+
|
|
594
|
+
const fow = new FogOfWar();
|
|
595
|
+
|
|
596
|
+
fow.scale.set(2);
|
|
597
|
+
fow.color.set(0.1, 0.1, 0.1, 1);
|
|
598
|
+
|
|
599
|
+
// ecd.addComponentToEntity(entity, fow);
|
|
600
|
+
});
|
|
601
|
+
|
|
602
|
+
console.log(terrain);
|
|
603
|
+
|
|
604
|
+
// terrain.overlay.size.set(50, 50);
|
|
605
|
+
// for (let i = 0; i < 50; i++) {
|
|
606
|
+
// for (let j = 0; j < 50; j++) {
|
|
607
|
+
//
|
|
608
|
+
// terrain.overlay.paintPoint(i, j, new Vector4(random(), random(), random(), 0.9));
|
|
609
|
+
// }
|
|
610
|
+
// }
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
*
|
|
614
|
+
* @type {TopDownCameraController|undefined}
|
|
615
|
+
*/
|
|
616
|
+
const camera_controller = ecd.getComponent(camera.entity, TopDownCameraController);
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
const offset = new Vector3(40, 0, 40);
|
|
620
|
+
|
|
621
|
+
camera_controller.fromJSON({
|
|
622
|
+
"target": offset,
|
|
623
|
+
"pitch": 0.7399999999999984,
|
|
624
|
+
"yaw": 2.283185307179597,
|
|
625
|
+
"roll": 0,
|
|
626
|
+
"distance": 37,
|
|
627
|
+
"distanceMin": 0,
|
|
628
|
+
"distanceMax": 1000
|
|
629
|
+
});
|
|
630
|
+
|
|
631
|
+
const volume_dim = new Vector3(15, 2, 15);
|
|
632
|
+
|
|
633
|
+
for (let i = 0; i < 0; i++) {
|
|
634
|
+
|
|
635
|
+
const builder = makeLight([
|
|
636
|
+
randomFloatBetween(random, -volume_dim.x / 2, volume_dim.x / 2) + offset.x,
|
|
637
|
+
randomFloatBetween(random, -volume_dim.y * 0.3, +volume_dim.y * 0.3) + offset.y,
|
|
638
|
+
randomFloatBetween(random, -volume_dim.z / 2, volume_dim.z / 2) + offset.z
|
|
639
|
+
],
|
|
640
|
+
randomFloatBetween(random, 10, 10),
|
|
641
|
+
`hsv(${random().toFixed(4)}, 1, 1)`,
|
|
642
|
+
5
|
|
643
|
+
);
|
|
644
|
+
|
|
645
|
+
const light = builder.getComponent(Light);
|
|
646
|
+
|
|
647
|
+
const b = new OrbitingBehavior();
|
|
648
|
+
|
|
649
|
+
const size = light.distance.getValue();
|
|
650
|
+
|
|
651
|
+
b.radius = randomFloatBetween(random, size, size * 3);
|
|
652
|
+
b.easing = 0;
|
|
653
|
+
b.rate = (random() < 0.5 ? 1 : -1) * randomFloatBetween(random, 2, 3) / b.radius;
|
|
654
|
+
|
|
655
|
+
const transform = builder.getComponent(Transform);
|
|
656
|
+
|
|
657
|
+
b.offset.copy(transform.position);
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
builder
|
|
661
|
+
.add(BehaviorComponent.fromOne(b))
|
|
662
|
+
// .add(BehaviorComponent.looping_function(()=>{
|
|
663
|
+
//
|
|
664
|
+
// }))
|
|
665
|
+
.build(ecd);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
new EntityBuilder()
|
|
669
|
+
.add(ParticleEmitter.fromJSON({
|
|
670
|
+
"parameters": [
|
|
671
|
+
{
|
|
672
|
+
"name": "scale",
|
|
673
|
+
"itemSize": 1,
|
|
674
|
+
"defaultTrackValue": {
|
|
675
|
+
"itemSize": 1,
|
|
676
|
+
"data": [
|
|
677
|
+
1
|
|
678
|
+
],
|
|
679
|
+
"positions": [
|
|
680
|
+
0
|
|
681
|
+
]
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
"name": "color",
|
|
686
|
+
"itemSize": 4,
|
|
687
|
+
"defaultTrackValue": {
|
|
688
|
+
"itemSize": 4,
|
|
689
|
+
"data": [
|
|
690
|
+
1,
|
|
691
|
+
1,
|
|
692
|
+
1,
|
|
693
|
+
1
|
|
694
|
+
],
|
|
695
|
+
"positions": [
|
|
696
|
+
0
|
|
697
|
+
]
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
],
|
|
701
|
+
"preWarm": true,
|
|
702
|
+
"readDepth": true,
|
|
703
|
+
"softDepth": true,
|
|
704
|
+
"depthSort": true,
|
|
705
|
+
"velocityAlign": false,
|
|
706
|
+
"receiveLight": true,
|
|
707
|
+
"blendingMode": 0,
|
|
708
|
+
"layers": [
|
|
709
|
+
{
|
|
710
|
+
"imageURL": "data/textures/particle/UETools/Cloud_04.png",
|
|
711
|
+
"particleLife": {
|
|
712
|
+
"min": 11,
|
|
713
|
+
"max": 11
|
|
714
|
+
},
|
|
715
|
+
"particleSize": {
|
|
716
|
+
"min": 0.05,
|
|
717
|
+
"max": 0.05
|
|
718
|
+
},
|
|
719
|
+
"particleRotation": {
|
|
720
|
+
"min": 0,
|
|
721
|
+
"max": 3.14
|
|
722
|
+
},
|
|
723
|
+
"particleRotationSpeed": {
|
|
724
|
+
"min": 0,
|
|
725
|
+
"max": 0
|
|
726
|
+
},
|
|
727
|
+
"emissionShape": 1,
|
|
728
|
+
"emissionFrom": 1,
|
|
729
|
+
"emissionRate": 1000,
|
|
730
|
+
"emissionImmediate": 0,
|
|
731
|
+
"parameterTracks": [
|
|
732
|
+
{
|
|
733
|
+
"name": "color",
|
|
734
|
+
"track": {
|
|
735
|
+
"itemSize": 4,
|
|
736
|
+
"data": [
|
|
737
|
+
1,
|
|
738
|
+
1,
|
|
739
|
+
1,
|
|
740
|
+
0.1,
|
|
741
|
+
|
|
742
|
+
1,
|
|
743
|
+
1,
|
|
744
|
+
1,
|
|
745
|
+
0.7,
|
|
746
|
+
|
|
747
|
+
1,
|
|
748
|
+
1,
|
|
749
|
+
1,
|
|
750
|
+
0.7,
|
|
751
|
+
|
|
752
|
+
1,
|
|
753
|
+
1,
|
|
754
|
+
1,
|
|
755
|
+
0,
|
|
756
|
+
],
|
|
757
|
+
"positions": [
|
|
758
|
+
0,
|
|
759
|
+
0.1,
|
|
760
|
+
0.8,
|
|
761
|
+
1
|
|
762
|
+
]
|
|
763
|
+
}
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
"name": "scale",
|
|
767
|
+
"track": {
|
|
768
|
+
"itemSize": 1,
|
|
769
|
+
"data": [
|
|
770
|
+
1.5,
|
|
771
|
+
1,
|
|
772
|
+
1,
|
|
773
|
+
0.2
|
|
774
|
+
],
|
|
775
|
+
"positions": [
|
|
776
|
+
0,
|
|
777
|
+
0.1,
|
|
778
|
+
0.8,
|
|
779
|
+
1
|
|
780
|
+
]
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
],
|
|
784
|
+
"position": {
|
|
785
|
+
"x": 0,
|
|
786
|
+
"y": 2.3,
|
|
787
|
+
"z": 0
|
|
788
|
+
},
|
|
789
|
+
"scale": {
|
|
790
|
+
"x": 1,
|
|
791
|
+
"y": 0.5,
|
|
792
|
+
"z": 1
|
|
793
|
+
},
|
|
794
|
+
"particleVelocityDirection": {
|
|
795
|
+
"direction": {
|
|
796
|
+
"x": 0,
|
|
797
|
+
"y": -1,
|
|
798
|
+
"z": 0
|
|
799
|
+
},
|
|
800
|
+
"angle": 0
|
|
801
|
+
},
|
|
802
|
+
"particleSpeed": {
|
|
803
|
+
"min": 0.2,
|
|
804
|
+
"max": 0.7
|
|
805
|
+
},
|
|
806
|
+
"steps": [
|
|
807
|
+
{
|
|
808
|
+
"type": "FixedPhysics",
|
|
809
|
+
"parameters": []
|
|
810
|
+
}
|
|
811
|
+
]
|
|
812
|
+
}
|
|
813
|
+
]
|
|
814
|
+
}))
|
|
815
|
+
.add(Transform.fromJSON({
|
|
816
|
+
position: new Vector3(offset.x, offset.y + volume_dim.y / 2, offset.z),
|
|
817
|
+
scale: new Vector3(volume_dim.x, volume_dim.y, volume_dim.z)
|
|
818
|
+
}))
|
|
819
|
+
.build(ecd);
|
|
820
|
+
|
|
821
|
+
const light_grid_size = 6;
|
|
822
|
+
for (let i = 0; i < light_grid_size; i++) {
|
|
823
|
+
for (let j = 0; j < light_grid_size; j++) {
|
|
824
|
+
|
|
825
|
+
const builder = makeLight([
|
|
826
|
+
((i / (light_grid_size - 1)) - 0.5) * volume_dim.x + offset.x,
|
|
827
|
+
volume_dim.y * 0.5 + offset.y,
|
|
828
|
+
((j / (light_grid_size - 1)) - 0.5) * volume_dim.z + offset.z
|
|
829
|
+
],
|
|
830
|
+
3,
|
|
831
|
+
`hsv(${random().toFixed(4)}, 0.8, 1)`,
|
|
832
|
+
10
|
|
833
|
+
);
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
builder
|
|
837
|
+
.build(ecd);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
new EntityBuilder()
|
|
843
|
+
.add(Transform.fromJSON({
|
|
844
|
+
position: offset,
|
|
845
|
+
scale: {
|
|
846
|
+
x: 4.5,
|
|
847
|
+
y: 4.5,
|
|
848
|
+
z: 4.5
|
|
849
|
+
}
|
|
850
|
+
}))
|
|
851
|
+
.add(FogOfWarRevealer.fromJSON({
|
|
852
|
+
radius: 5
|
|
853
|
+
}))
|
|
854
|
+
.add(new Team(0))
|
|
855
|
+
.add(Mesh.fromJSON({
|
|
856
|
+
url: 'data/models/LowPolyTownshipSet/Town_Hall/model.gltf',
|
|
857
|
+
castShadow: true,
|
|
858
|
+
receiveShadow: true
|
|
859
|
+
}))
|
|
860
|
+
.build(ecd);
|
|
861
|
+
|
|
862
|
+
const tree_grid_size = 5;
|
|
863
|
+
|
|
864
|
+
for (let i = 0; i < tree_grid_size; i++) {
|
|
865
|
+
for (let j = 0; j < tree_grid_size; j++) {
|
|
866
|
+
|
|
867
|
+
// const p = new Vector3(
|
|
868
|
+
// offset.x + ((i / (tree_grid_size - 1)) - 0.5) * (volume_dim.x * 0.9),
|
|
869
|
+
// offset.y,
|
|
870
|
+
// offset.z + ((j / (tree_grid_size - 1)) - 0.5) * (volume_dim.z * 0.9)
|
|
871
|
+
// );
|
|
872
|
+
|
|
873
|
+
const p = new Vector3(
|
|
874
|
+
offset.x + randomFloatBetween(random, -volume_dim.x * 0.5, volume_dim.x * 0.5),
|
|
875
|
+
offset.y,
|
|
876
|
+
offset.x + randomFloatBetween(random, -volume_dim.z * 0.5, volume_dim.z * 0.5),
|
|
877
|
+
);
|
|
878
|
+
|
|
879
|
+
if (p.distanceTo(offset) < 3) {
|
|
880
|
+
continue;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
new EntityBuilder()
|
|
884
|
+
.add(Transform.fromJSON({
|
|
885
|
+
position: p,
|
|
886
|
+
scale: {
|
|
887
|
+
x: 1,
|
|
888
|
+
y: 1,
|
|
889
|
+
z: 1
|
|
890
|
+
}
|
|
891
|
+
}))
|
|
892
|
+
.add(Mesh.fromJSON({
|
|
893
|
+
url: 'data/models/LowPolyTownshipSet/Tree_1/Tree_1.gltf',
|
|
894
|
+
castShadow: true,
|
|
895
|
+
receiveShadow: true
|
|
896
|
+
}))
|
|
897
|
+
.build(ecd);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
|
|
368
902
|
/**
|
|
369
903
|
* @param {Engine} engine
|
|
370
904
|
* @param {EntityComponentDataset} ecd
|
|
@@ -586,7 +1120,7 @@ function main(engine) {
|
|
|
586
1120
|
// pitch: -0.5,
|
|
587
1121
|
// yaw: 2.2,
|
|
588
1122
|
// distance: 3
|
|
589
|
-
pitch: 0.9,
|
|
1123
|
+
pitch: -0.9,
|
|
590
1124
|
yaw: 3.1,
|
|
591
1125
|
distance: 20,
|
|
592
1126
|
enableLights: false
|
|
@@ -595,10 +1129,10 @@ function main(engine) {
|
|
|
595
1129
|
|
|
596
1130
|
engine.graphics.renderer.setClearColor('rgba(99,99,99,1)');
|
|
597
1131
|
|
|
598
|
-
|
|
1132
|
+
setup_scene_3(engine, ecd);
|
|
599
1133
|
// setup_scene_1(engine, ecd);
|
|
600
1134
|
|
|
601
|
-
engine.graphics.loadEnvironmentMap(buildCubeURLs('data/textures/cubemaps/hip_miramar/32/', '.png'));
|
|
1135
|
+
// engine.graphics.loadEnvironmentMap(buildCubeURLs('data/textures/cubemaps/hip_miramar/32/', '.png'));
|
|
602
1136
|
|
|
603
1137
|
/**
|
|
604
1138
|
*
|
|
@@ -606,26 +1140,27 @@ function main(engine) {
|
|
|
606
1140
|
*/
|
|
607
1141
|
const plugin = engine.plugins.getPlugin(ForwardPlusRenderingPlugin);
|
|
608
1142
|
const lm = plugin.getLightManager();
|
|
609
|
-
lm.setTileMapResolution(
|
|
1143
|
+
lm.setTileMapResolution(14, 8, 14);
|
|
610
1144
|
|
|
611
1145
|
console.log(lm);
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
const
|
|
615
|
-
|
|
616
|
-
v.
|
|
617
|
-
v.
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
1146
|
+
window.lm = lm;
|
|
1147
|
+
|
|
1148
|
+
// const v = new View();
|
|
1149
|
+
// const clusterWidget = buildLightClusterWidget(lm, engine.graphics.camera);
|
|
1150
|
+
// v.el = clusterWidget.domElement;
|
|
1151
|
+
// v.size.setSilent(256, 256);
|
|
1152
|
+
// v.css({
|
|
1153
|
+
// pointerEvents: 'auto'
|
|
1154
|
+
// });
|
|
1155
|
+
|
|
1156
|
+
// new EntityBuilder()
|
|
1157
|
+
// .add(ViewportPosition.fromJSON({
|
|
1158
|
+
// anchor: Vector2.one,
|
|
1159
|
+
// offset: new Vector2(-0, -0),
|
|
1160
|
+
// position: new Vector2(1, 1)
|
|
1161
|
+
// }))
|
|
1162
|
+
// .add(GUIElement.fromView(v))
|
|
1163
|
+
// .build(ecd);
|
|
629
1164
|
|
|
630
1165
|
engine.graphics.on.preRender.add(
|
|
631
1166
|
/**
|
|
@@ -657,7 +1192,7 @@ function main(engine) {
|
|
|
657
1192
|
// camera.updateProjectionMatrix();
|
|
658
1193
|
// camera.updateMatrixWorld(true);
|
|
659
1194
|
|
|
660
|
-
clusterWidget.update();
|
|
1195
|
+
// clusterWidget.update();
|
|
661
1196
|
|
|
662
1197
|
});
|
|
663
1198
|
|