@woosh/meep-engine 2.61.0 → 2.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/meep.cjs +234 -212
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +234 -212
- package/package.json +1 -1
- package/src/core/bvh2/BinaryNode.js +16 -13
- package/src/core/bvh2/LeafNode.js +6 -3
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_sphere.js +81 -0
- package/src/core/geom/3d/aabb/AABB3.js +24 -36
- package/src/core/geom/3d/aabb/aabb3_array_compute_from_sphere.js +22 -0
- package/src/core/geom/3d/aabb/aabb3_array_intersects_sphere.js +22 -0
- package/src/core/geom/3d/aabb/aabb3_array_intersects_sphere_array.js +11 -0
- package/src/core/geom/3d/aabb/aabb3_signed_distance_to_aabb3.js +28 -0
- package/src/core/geom/3d/aabb/serializeAABB3Quantized16Uint.js +19 -10
- package/src/core/geom/3d/tetrahedra/delaunay/Cavity.js +3 -4
- package/src/engine/ecs/foliage/ecs/Foliage2System.js +3 -0
- package/src/engine/ecs/foliage/ecs/InstancedMeshComponent.js +4 -1
- package/src/engine/ecs/foliage/ecs/convertInstancedMeshComponents2Entities.js +64 -0
- package/src/engine/ecs/foliage/ecs/{InstancedMeshUtils.js → optimizeIndividualMeshesEntitiesToInstances.js} +11 -70
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +25 -27
- package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +49 -52
- package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +40 -42
- package/src/engine/graphics/particles/ecs/ParticleEmitterSystem.js +43 -25
- package/src/engine/graphics/particles/particular/engine/ParticularEngine.js +10 -6
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +37 -41
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +44 -46
- package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +24 -26
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +40 -42
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +36 -38
- package/src/engine/graphics/shadows/testShadowMapRendering.js +19 -19
- package/src/engine/sound/dB2Volume.js +8 -0
- package/src/engine/sound/ecs/emitter/SoundEmitter.js +125 -99
- package/src/engine/sound/ecs/emitter/SoundEmitterComponentContext.js +4 -42
- package/src/engine/sound/ecs/emitter/SoundEmitterSystem.js +31 -121
- package/src/engine/sound/volume2dB.js +8 -0
- package/src/generation/theme/ThemeEngine.js +19 -53
- package/src/engine/graphics/geometry/bvh/buffered/BVHFromBufferGeometry.js +0 -133
|
@@ -1,75 +1,73 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '../../../../../../../../css/game.scss';
|
|
2
|
+
import FacingDirectionSystem from "../../../../../../model/game/ecs/system/FacingDirectionSystem.js";
|
|
2
3
|
import { makeEngineOptionsModel } from "../../../../../../model/game/options/makeEngineOptionsModel.js";
|
|
3
|
-
import
|
|
4
|
+
import { enableEditor } from "../../../../../editor/enableEditor.js";
|
|
4
5
|
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
6
|
+
import { CanvasView } from "../../../../view/elements/CanvasView.js";
|
|
7
|
+
import { GameAssetType } from "../../../asset/GameAssetType.js";
|
|
8
|
+
import { GLTFAssetLoader } from "../../../asset/loaders/GLTFAssetLoader.js";
|
|
9
|
+
import { ImageRGBADataLoader } from "../../../asset/loaders/image/ImageRGBADataLoader.js";
|
|
10
|
+
import { JsonAssetLoader } from "../../../asset/loaders/JsonAssetLoader.js";
|
|
11
|
+
import { TextureAssetLoader } from "../../../asset/loaders/texture/TextureAssetLoader.js";
|
|
11
12
|
import { Animation } from "../../../ecs/animation/Animation.js";
|
|
12
|
-
import {
|
|
13
|
+
import { AttachmentSystem } from "../../../ecs/attachment/AttachmentSystem.js";
|
|
14
|
+
import Entity from "../../../ecs/Entity.js";
|
|
15
|
+
import { EntityBlueprint } from "../../../ecs/EntityBlueprint.js";
|
|
13
16
|
import GUIElementSystem from "../../../ecs/gui/GUIElementSystem.js";
|
|
14
17
|
import HeadsUpDisplaySystem from "../../../ecs/gui/hud/HeadsUpDisplaySystem.js";
|
|
18
|
+
import ViewportPositionSystem from "../../../ecs/gui/position/ViewportPositionSystem.js";
|
|
19
|
+
import { InverseKinematicsSystem } from "../../../ecs/ik/InverseKinematicsSystem.js";
|
|
20
|
+
import AnimationSystem from "../../../ecs/systems/AnimationSystem.js";
|
|
21
|
+
import MotionSystem from "../../../ecs/systems/MotionSystem.js";
|
|
15
22
|
import ScriptSystem from "../../../ecs/systems/ScriptSystem.js";
|
|
16
|
-
import FacingDirectionSystem from "../../../../../../model/game/ecs/system/FacingDirectionSystem.js";
|
|
17
|
-
import PathFollowingSystem from "../../../navigation/ecs/path_following/PathFollowingSystem.js";
|
|
18
23
|
import SteeringSystem from "../../../ecs/systems/SteeringSystem.js";
|
|
19
|
-
import MotionSystem from "../../../ecs/systems/MotionSystem.js";
|
|
20
24
|
import TagSystem from "../../../ecs/systems/TagSystem.js";
|
|
21
|
-
import { AttachmentSystem } from "../../../ecs/attachment/AttachmentSystem.js";
|
|
22
25
|
import TimerSystem from "../../../ecs/systems/TimerSystem.js";
|
|
23
|
-
import AnimationSystem from "../../../ecs/systems/AnimationSystem.js";
|
|
24
|
-
import TopDownCameraControllerSystem from "../camera/topdown/TopDownCameraControllerSystem.js";
|
|
25
|
-
import { TopDownCameraLanderSystem } from "../camera/topdown/TopDownCameraLanderSystem.js";
|
|
26
|
-
import { CameraSystem } from "../camera/CameraSystem.js";
|
|
27
|
-
import { MeshSystem } from "../mesh/MeshSystem.js";
|
|
28
26
|
import ClingToTerrainSystem from "../../../ecs/terrain/ecs/cling/ClingToTerrainSystem.js";
|
|
29
27
|
import TerrainSystem from "../../../ecs/terrain/ecs/TerrainSystem.js";
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import {
|
|
33
|
-
import ViewportPositionSystem from "../../../ecs/gui/position/ViewportPositionSystem.js";
|
|
28
|
+
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
29
|
+
import { EngineConfiguration } from "../../../EngineConfiguration.js";
|
|
30
|
+
import { EngineHarness } from "../../../EngineHarness.js";
|
|
34
31
|
import InputControllerSystem from "../../../input/ecs/systems/InputControllerSystem.js";
|
|
35
32
|
import { InputSystem } from "../../../input/ecs/systems/InputSystem.js";
|
|
36
|
-
import MeshHighlightSystem from "../highlight/system/MeshHighlightSystem.js";
|
|
37
|
-
import LightSystem from "../light/LightSystem.js";
|
|
38
|
-
import AnimationControllerSystem from "../animation/AnimationControllerSystem.js";
|
|
39
|
-
import { AnimationGraphSystem } from "../animation/animator/AnimationGraphSystem.js";
|
|
40
33
|
import { BehaviorSystem } from "../../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import Entity from "../../../ecs/Entity.js";
|
|
46
|
-
import { enableEditor } from "../../../../../editor/enableEditor.js";
|
|
47
|
-
import { GameAssetType } from "../../../asset/GameAssetType.js";
|
|
48
|
-
import { GLTFAssetLoader } from "../../../asset/loaders/GLTFAssetLoader.js";
|
|
49
|
-
import { JsonAssetLoader } from "../../../asset/loaders/JsonAssetLoader.js";
|
|
50
|
-
import { ImageRGBADataLoader } from "../../../asset/loaders/image/ImageRGBADataLoader.js";
|
|
34
|
+
import { computeCatmullRomSpline } from "../../../navigation/ecs/components/computeCatmullRomSpline.js";
|
|
35
|
+
import { InterpolationType } from "../../../navigation/ecs/components/InterpolationType.js";
|
|
36
|
+
import Path from "../../../navigation/ecs/components/Path.js";
|
|
37
|
+
import PathFollowingSystem from "../../../navigation/ecs/path_following/PathFollowingSystem.js";
|
|
51
38
|
import {
|
|
52
39
|
AmbientOcclusionPostProcessEffect
|
|
53
40
|
} from "../../render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js";
|
|
54
|
-
import {
|
|
55
|
-
import
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import
|
|
60
|
-
import {
|
|
61
|
-
import
|
|
41
|
+
import { GizmoRenderingPlugin } from "../../render/gizmo/GizmoRenderingPlugin.js";
|
|
42
|
+
import AnimationControllerSystem from "../animation/AnimationControllerSystem.js";
|
|
43
|
+
import { AnimationGraphSystem } from "../animation/animator/AnimationGraphSystem.js";
|
|
44
|
+
import { Camera } from "../camera/Camera.js";
|
|
45
|
+
import { CameraSystem } from "../camera/CameraSystem.js";
|
|
46
|
+
import TopDownCameraControllerSystem from "../camera/topdown/TopDownCameraControllerSystem.js";
|
|
47
|
+
import { TopDownCameraLanderSystem } from "../camera/topdown/TopDownCameraLanderSystem.js";
|
|
48
|
+
import Highlight from "../highlight/Highlight.js";
|
|
49
|
+
import MeshHighlightSystem from "../highlight/system/MeshHighlightSystem.js";
|
|
50
|
+
import { ShadedGeometryHighlightSystem } from "../highlight/system/ShadedGeometryHighlightSystem.js";
|
|
51
|
+
import LightSystem from "../light/LightSystem.js";
|
|
62
52
|
import { ShadedGeometrySystem } from "../mesh-v2/ShadedGeometrySystem.js";
|
|
63
|
-
import
|
|
64
|
-
import {
|
|
53
|
+
import Mesh from "../mesh/Mesh.js";
|
|
54
|
+
import { MeshSystem } from "../mesh/MeshSystem.js";
|
|
55
|
+
import Trail2DSystem from "../trail2d/Trail2DSystem.js";
|
|
56
|
+
import WaterSystem from "../water/WaterSystem.js";
|
|
57
|
+
import { EntityPathMarkerDefinition } from "./entity/EntityPathMarkerDefinition.js";
|
|
58
|
+
import { EntityPathStyle } from "./entity/EntityPathStyle.js";
|
|
65
59
|
import { PathDisplayHighlightSystem } from "./highlight/PathDisplayHighlightSystem.js";
|
|
66
|
-
import {
|
|
60
|
+
import { PathDisplay } from "./PathDisplay.js";
|
|
61
|
+
import { PathDisplaySpec } from "./PathDisplaySpec.js";
|
|
62
|
+
import { PathDisplaySystem } from "./PathDisplaySystem.js";
|
|
63
|
+
import { PathDisplayType } from "./PathDisplayType.js";
|
|
67
64
|
import { BasicMaterialDefinition } from "./tube/BasicMaterialDefinition.js";
|
|
68
|
-
|
|
69
|
-
import
|
|
70
|
-
import { GizmoRenderingPlugin } from "../../render/gizmo/GizmoRenderingPlugin.js";
|
|
65
|
+
import { CapType } from "./tube/CapType.js";
|
|
66
|
+
import { MatcapMaterialDefinition } from "./tube/MatcapMaterialDefinition.js";
|
|
71
67
|
import { PathNormalType } from "./tube/PathNormalType.js";
|
|
72
|
-
import {
|
|
68
|
+
import { StandardMaterialDefinition } from "./tube/StandardMaterialDefinition.js";
|
|
69
|
+
import { TubeMaterialType } from "./tube/TubeMaterialType.js";
|
|
70
|
+
import { TubePathStyle } from "./tube/TubePathStyle.js";
|
|
73
71
|
|
|
74
72
|
const engineHarness = new EngineHarness();
|
|
75
73
|
|
|
@@ -108,7 +106,6 @@ function makeConfig(engine) {
|
|
|
108
106
|
new TerrainSystem(graphics, assetManager),
|
|
109
107
|
new WaterSystem(graphics),
|
|
110
108
|
new Trail2DSystem(engine),
|
|
111
|
-
new Foliage2System(assetManager, graphics),
|
|
112
109
|
new ViewportPositionSystem(graphics.viewport.size),
|
|
113
110
|
new InputControllerSystem(devices),
|
|
114
111
|
new InputSystem(devices),
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import FacingDirectionSystem from "../../../../../../../model/game/ecs/system/FacingDirectionSystem.js";
|
|
2
|
-
import {makeEngineOptionsModel} from "../../../../../../../model/game/options/makeEngineOptionsModel.js";
|
|
3
|
-
import {enableEditor} from "../../../../../../editor/enableEditor.js";
|
|
2
|
+
import { makeEngineOptionsModel } from "../../../../../../../model/game/options/makeEngineOptionsModel.js";
|
|
3
|
+
import { enableEditor } from "../../../../../../editor/enableEditor.js";
|
|
4
4
|
import Vector3 from "../../../../../core/geom/Vector3.js";
|
|
5
|
-
import {pingpong} from "../../../../../core/math/pingpong.js";
|
|
6
|
-
import {CanvasView} from "../../../../../view/elements/CanvasView.js";
|
|
7
|
-
import {GameAssetType} from "../../../../asset/GameAssetType.js";
|
|
8
|
-
import {GLTFAssetLoader} from "../../../../asset/loaders/GLTFAssetLoader.js";
|
|
9
|
-
import {ImageRGBADataLoader} from "../../../../asset/loaders/image/ImageRGBADataLoader.js";
|
|
10
|
-
import {JsonAssetLoader} from "../../../../asset/loaders/JsonAssetLoader.js";
|
|
11
|
-
import {TextureAssetLoader} from "../../../../asset/loaders/texture/TextureAssetLoader.js";
|
|
12
|
-
import {Animation} from "../../../../ecs/animation/Animation.js";
|
|
13
|
-
import {AttachmentSystem} from "../../../../ecs/attachment/AttachmentSystem.js";
|
|
5
|
+
import { pingpong } from "../../../../../core/math/pingpong.js";
|
|
6
|
+
import { CanvasView } from "../../../../../view/elements/CanvasView.js";
|
|
7
|
+
import { GameAssetType } from "../../../../asset/GameAssetType.js";
|
|
8
|
+
import { GLTFAssetLoader } from "../../../../asset/loaders/GLTFAssetLoader.js";
|
|
9
|
+
import { ImageRGBADataLoader } from "../../../../asset/loaders/image/ImageRGBADataLoader.js";
|
|
10
|
+
import { JsonAssetLoader } from "../../../../asset/loaders/JsonAssetLoader.js";
|
|
11
|
+
import { TextureAssetLoader } from "../../../../asset/loaders/texture/TextureAssetLoader.js";
|
|
12
|
+
import { Animation } from "../../../../ecs/animation/Animation.js";
|
|
13
|
+
import { AttachmentSystem } from "../../../../ecs/attachment/AttachmentSystem.js";
|
|
14
14
|
import Entity from "../../../../ecs/Entity.js";
|
|
15
|
-
import {EntityBlueprint} from "../../../../ecs/EntityBlueprint.js";
|
|
16
|
-
import {Foliage2System} from "../../../../ecs/foliage/ecs/Foliage2System.js";
|
|
15
|
+
import { EntityBlueprint } from "../../../../ecs/EntityBlueprint.js";
|
|
17
16
|
import GUIElementSystem from "../../../../ecs/gui/GUIElementSystem.js";
|
|
18
17
|
import HeadsUpDisplaySystem from "../../../../ecs/gui/hud/HeadsUpDisplaySystem.js";
|
|
19
18
|
import ViewportPositionSystem from "../../../../ecs/gui/position/ViewportPositionSystem.js";
|
|
20
|
-
import {InverseKinematicsSystem} from "../../../../ecs/ik/InverseKinematicsSystem.js";
|
|
19
|
+
import { InverseKinematicsSystem } from "../../../../ecs/ik/InverseKinematicsSystem.js";
|
|
21
20
|
import AnimationSystem from "../../../../ecs/systems/AnimationSystem.js";
|
|
22
21
|
import MotionSystem from "../../../../ecs/systems/MotionSystem.js";
|
|
23
22
|
import ScriptSystem from "../../../../ecs/systems/ScriptSystem.js";
|
|
@@ -26,50 +25,50 @@ import TagSystem from "../../../../ecs/systems/TagSystem.js";
|
|
|
26
25
|
import TimerSystem from "../../../../ecs/systems/TimerSystem.js";
|
|
27
26
|
import ClingToTerrainSystem from "../../../../ecs/terrain/ecs/cling/ClingToTerrainSystem.js";
|
|
28
27
|
import TerrainSystem from "../../../../ecs/terrain/ecs/TerrainSystem.js";
|
|
29
|
-
import {Transform} from "../../../../ecs/transform/Transform.js";
|
|
30
|
-
import {EngineConfiguration} from "../../../../EngineConfiguration.js";
|
|
31
|
-
import {EngineHarness} from "../../../../EngineHarness.js";
|
|
32
|
-
import {GridPosition2TransformSystem} from "../../../../grid/grid2transform/GridPosition2TransformSystem.js";
|
|
28
|
+
import { Transform } from "../../../../ecs/transform/Transform.js";
|
|
29
|
+
import { EngineConfiguration } from "../../../../EngineConfiguration.js";
|
|
30
|
+
import { EngineHarness } from "../../../../EngineHarness.js";
|
|
31
|
+
import { GridPosition2TransformSystem } from "../../../../grid/grid2transform/GridPosition2TransformSystem.js";
|
|
33
32
|
import GridPositionSystem from "../../../../grid/position/GridPositionSystem.js";
|
|
34
|
-
import {Transform2GridPositionSystem} from "../../../../grid/transform2grid/Transform2GridPositionSystem.js";
|
|
33
|
+
import { Transform2GridPositionSystem } from "../../../../grid/transform2grid/Transform2GridPositionSystem.js";
|
|
35
34
|
import InputControllerSystem from "../../../../input/ecs/systems/InputControllerSystem.js";
|
|
36
|
-
import {InputSystem} from "../../../../input/ecs/systems/InputSystem.js";
|
|
37
|
-
import {BehaviorComponent} from "../../../../intelligence/behavior/ecs/BehaviorComponent.js";
|
|
38
|
-
import {BehaviorSystem} from "../../../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
39
|
-
import {computeCatmullRomSpline} from "../../../../navigation/ecs/components/computeCatmullRomSpline.js";
|
|
40
|
-
import {InterpolationType} from "../../../../navigation/ecs/components/InterpolationType.js";
|
|
35
|
+
import { InputSystem } from "../../../../input/ecs/systems/InputSystem.js";
|
|
36
|
+
import { BehaviorComponent } from "../../../../intelligence/behavior/ecs/BehaviorComponent.js";
|
|
37
|
+
import { BehaviorSystem } from "../../../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
38
|
+
import { computeCatmullRomSpline } from "../../../../navigation/ecs/components/computeCatmullRomSpline.js";
|
|
39
|
+
import { InterpolationType } from "../../../../navigation/ecs/components/InterpolationType.js";
|
|
41
40
|
import Path from "../../../../navigation/ecs/components/Path.js";
|
|
42
|
-
import {PathEvents} from "../../../../navigation/ecs/components/PathEvents.js";
|
|
41
|
+
import { PathEvents } from "../../../../navigation/ecs/components/PathEvents.js";
|
|
43
42
|
import PathFollowingSystem from "../../../../navigation/ecs/path_following/PathFollowingSystem.js";
|
|
44
|
-
import {SoundEmitterSystem} from "../../../../sound/ecs/emitter/SoundEmitterSystem.js";
|
|
43
|
+
import { SoundEmitterSystem } from "../../../../sound/ecs/emitter/SoundEmitterSystem.js";
|
|
45
44
|
import SoundControllerSystem from "../../../../sound/ecs/SoundControllerSystem.js";
|
|
46
45
|
import SoundListenerSystem from "../../../../sound/ecs/SoundListenerSystem.js";
|
|
47
46
|
import {
|
|
48
47
|
AmbientOcclusionPostProcessEffect
|
|
49
48
|
} from "../../../render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js";
|
|
50
49
|
import AnimationControllerSystem from "../../animation/AnimationControllerSystem.js";
|
|
51
|
-
import {AnimationGraphSystem} from "../../animation/animator/AnimationGraphSystem.js";
|
|
52
|
-
import {CameraSystem} from "../../camera/CameraSystem.js";
|
|
50
|
+
import { AnimationGraphSystem } from "../../animation/animator/AnimationGraphSystem.js";
|
|
51
|
+
import { CameraSystem } from "../../camera/CameraSystem.js";
|
|
53
52
|
import TopDownCameraControllerSystem from "../../camera/topdown/TopDownCameraControllerSystem.js";
|
|
54
|
-
import {TopDownCameraLanderSystem} from "../../camera/topdown/TopDownCameraLanderSystem.js";
|
|
53
|
+
import { TopDownCameraLanderSystem } from "../../camera/topdown/TopDownCameraLanderSystem.js";
|
|
55
54
|
import Highlight from "../../highlight/Highlight.js";
|
|
56
55
|
import MeshHighlightSystem from "../../highlight/system/MeshHighlightSystem.js";
|
|
57
56
|
import LightSystem from "../../light/LightSystem.js";
|
|
58
|
-
import {ShadedGeometrySystem} from "../../mesh-v2/ShadedGeometrySystem.js";
|
|
57
|
+
import { ShadedGeometrySystem } from "../../mesh-v2/ShadedGeometrySystem.js";
|
|
59
58
|
import Mesh from "../../mesh/Mesh.js";
|
|
60
|
-
import {MeshSystem} from "../../mesh/MeshSystem.js";
|
|
59
|
+
import { MeshSystem } from "../../mesh/MeshSystem.js";
|
|
61
60
|
import Trail2DSystem from "../../trail2d/Trail2DSystem.js";
|
|
62
61
|
import WaterSystem from "../../water/WaterSystem.js";
|
|
63
|
-
import {EntityPathMarkerDefinition} from "../entity/EntityPathMarkerDefinition.js";
|
|
64
|
-
import {EntityPathStyle} from "../entity/EntityPathStyle.js";
|
|
65
|
-
import {PathDisplay} from "../PathDisplay.js";
|
|
66
|
-
import {PathDisplaySpec} from "../PathDisplaySpec.js";
|
|
67
|
-
import {PathDisplaySystem} from "../PathDisplaySystem.js";
|
|
68
|
-
import {PathDisplayType} from "../PathDisplayType.js";
|
|
69
|
-
import {RibbonPathStyle} from "../ribbon/RibbonPathStyle.js";
|
|
70
|
-
import {MatcapMaterialDefinition} from "./MatcapMaterialDefinition.js";
|
|
71
|
-
import {TubeMaterialType} from "./TubeMaterialType.js";
|
|
72
|
-
import {TubePathStyle} from "./TubePathStyle.js";
|
|
62
|
+
import { EntityPathMarkerDefinition } from "../entity/EntityPathMarkerDefinition.js";
|
|
63
|
+
import { EntityPathStyle } from "../entity/EntityPathStyle.js";
|
|
64
|
+
import { PathDisplay } from "../PathDisplay.js";
|
|
65
|
+
import { PathDisplaySpec } from "../PathDisplaySpec.js";
|
|
66
|
+
import { PathDisplaySystem } from "../PathDisplaySystem.js";
|
|
67
|
+
import { PathDisplayType } from "../PathDisplayType.js";
|
|
68
|
+
import { RibbonPathStyle } from "../ribbon/RibbonPathStyle.js";
|
|
69
|
+
import { MatcapMaterialDefinition } from "./MatcapMaterialDefinition.js";
|
|
70
|
+
import { TubeMaterialType } from "./TubeMaterialType.js";
|
|
71
|
+
import { TubePathStyle } from "./TubePathStyle.js";
|
|
73
72
|
|
|
74
73
|
const engineHarness = new EngineHarness();
|
|
75
74
|
|
|
@@ -111,7 +110,6 @@ function makeConfig(engine) {
|
|
|
111
110
|
new TerrainSystem(graphics, assetManager),
|
|
112
111
|
new WaterSystem(graphics),
|
|
113
112
|
new Trail2DSystem(engine),
|
|
114
|
-
new Foliage2System(assetManager, graphics),
|
|
115
113
|
new ViewportPositionSystem(graphics.viewport.size),
|
|
116
114
|
new GridPosition2TransformSystem(),
|
|
117
115
|
new Transform2GridPositionSystem(),
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
1
|
+
import {assert} from "../../../../core/assert.js";
|
|
2
|
+
import {
|
|
3
|
+
bvh_query_user_data_overlaps_frustum
|
|
4
|
+
} from "../../../../core/bvh2/bvh3/query/bvh_query_user_data_overlaps_frustum.js";
|
|
5
|
+
import {ResourceAccessKind} from "../../../../core/model/ResourceAccessKind.js";
|
|
6
|
+
import {ResourceAccessSpecification} from "../../../../core/model/ResourceAccessSpecification.js";
|
|
7
|
+
import {ImageRGBADataLoader} from "../../../asset/loaders/image/ImageRGBADataLoader.js";
|
|
8
|
+
import {System} from "../../../ecs/System.js";
|
|
9
|
+
import {Transform} from "../../../ecs/transform/Transform.js";
|
|
10
|
+
import {RenderPassType} from "../../render/RenderPassType.js";
|
|
11
|
+
import {StandardFrameBuffers} from "../../StandardFrameBuffers.js";
|
|
12
|
+
import {ParticleEmitter} from "../particular/engine/emitter/ParticleEmitter.js";
|
|
13
|
+
import {ParticleEmitterFlag} from "../particular/engine/emitter/ParticleEmitterFlag.js";
|
|
14
|
+
import {ParticularEngine} from "../particular/engine/ParticularEngine.js";
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
*
|
|
@@ -19,6 +22,7 @@ function extractRenderable(emitter) {
|
|
|
19
22
|
return emitter.mesh;
|
|
20
23
|
}
|
|
21
24
|
|
|
25
|
+
const scratch_array = [];
|
|
22
26
|
|
|
23
27
|
export class ParticleEmitterSystem extends System {
|
|
24
28
|
/**
|
|
@@ -63,19 +67,9 @@ export class ParticleEmitterSystem extends System {
|
|
|
63
67
|
*/
|
|
64
68
|
this.renderLayer = null;
|
|
65
69
|
|
|
66
|
-
/**
|
|
67
|
-
*
|
|
68
|
-
* @type {BinaryNode}
|
|
69
|
-
*/
|
|
70
|
-
this.bvh = null;
|
|
71
|
-
|
|
72
70
|
this.__handlers = [];
|
|
73
71
|
}
|
|
74
72
|
|
|
75
|
-
get componentClass() {
|
|
76
|
-
return ParticleEmitter;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
73
|
async startup(entityManager, readyCallback, errorCallback) {
|
|
80
74
|
const am = this.assetManager;
|
|
81
75
|
|
|
@@ -95,7 +89,32 @@ export class ParticleEmitterSystem extends System {
|
|
|
95
89
|
|
|
96
90
|
renderLayer.renderPass = RenderPassType.Transparent;
|
|
97
91
|
|
|
98
|
-
renderLayer.
|
|
92
|
+
renderLayer.buildVisibleSet = (destination, destination_offset, view) => {
|
|
93
|
+
|
|
94
|
+
const ecd = entityManager.dataset;
|
|
95
|
+
|
|
96
|
+
if (ecd === null) {
|
|
97
|
+
return 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const view_frustum = view.frustum;
|
|
101
|
+
|
|
102
|
+
const hit_count = bvh_query_user_data_overlaps_frustum(scratch_array, 0, this.particleEngine.bvh, view_frustum);
|
|
103
|
+
|
|
104
|
+
for (let i = 0; i < hit_count; i++) {
|
|
105
|
+
const id = scratch_array[i];
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @type {ParticleEmitter}
|
|
109
|
+
*/
|
|
110
|
+
const emitter = ecd.getComponent(id, ParticleEmitter);
|
|
111
|
+
|
|
112
|
+
destination[destination_offset + i] = emitter.mesh;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return hit_count;
|
|
116
|
+
};
|
|
117
|
+
|
|
99
118
|
renderLayer.visibleSet.onAdded.add((points) => {
|
|
100
119
|
/**
|
|
101
120
|
*
|
|
@@ -121,9 +140,6 @@ export class ParticleEmitterSystem extends System {
|
|
|
121
140
|
// console.log('Removed', emitter, renderLayer.visibleSet.version);
|
|
122
141
|
});
|
|
123
142
|
|
|
124
|
-
this.bvh = renderLayer.bvh;
|
|
125
|
-
this.bvh.insertNode(this.particleEngine.bvh);
|
|
126
|
-
|
|
127
143
|
|
|
128
144
|
const depthBuffer = graphicsEngine.frameBuffers.getById(StandardFrameBuffers.ColorAndDepth);
|
|
129
145
|
|
|
@@ -236,6 +252,8 @@ export class ParticleEmitterSystem extends System {
|
|
|
236
252
|
//initialize emitter as suspended to prevent needless updates
|
|
237
253
|
emitter.setFlag(ParticleEmitterFlag.Sleeping);
|
|
238
254
|
|
|
255
|
+
emitter.id = entity;
|
|
256
|
+
|
|
239
257
|
// emitter.bvhLeaf.entity = entity; //this line makes emitter selectable via bounding box in editor
|
|
240
258
|
|
|
241
259
|
this.particleEngine.add(emitter);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ExplicitBinaryBoundingVolumeHierarchy
|
|
3
|
+
} from "../../../../../core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js";
|
|
2
4
|
import List from "../../../../../core/collection/list/List.js";
|
|
3
5
|
import {ParticleEmitterFlag} from "./emitter/ParticleEmitterFlag.js";
|
|
4
6
|
import {ShaderManager} from "./shader/ShaderManager.js";
|
|
@@ -21,7 +23,11 @@ export class ParticularEngine {
|
|
|
21
23
|
*/
|
|
22
24
|
emitters = new List();
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
/**
|
|
27
|
+
* @readonly
|
|
28
|
+
* @type {ExplicitBinaryBoundingVolumeHierarchy}
|
|
29
|
+
*/
|
|
30
|
+
bvh = new ExplicitBinaryBoundingVolumeHierarchy();
|
|
25
31
|
|
|
26
32
|
|
|
27
33
|
/**
|
|
@@ -43,8 +49,6 @@ export class ParticularEngine {
|
|
|
43
49
|
*/
|
|
44
50
|
constructor(assetManager, material_manager) {
|
|
45
51
|
this.shaderManager = new ShaderManager(assetManager, material_manager);
|
|
46
|
-
|
|
47
|
-
this.bvh.setNegativelyInfiniteBounds();
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
/**
|
|
@@ -63,7 +67,7 @@ export class ParticularEngine {
|
|
|
63
67
|
|
|
64
68
|
this.shaderManager.register(emitter);
|
|
65
69
|
|
|
66
|
-
this.bvh
|
|
70
|
+
emitter.bvh_leaf.link(this.bvh, emitter.id);
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
/**
|
|
@@ -81,7 +85,7 @@ export class ParticularEngine {
|
|
|
81
85
|
|
|
82
86
|
this.shaderManager.deregister(emitter);
|
|
83
87
|
|
|
84
|
-
emitter.
|
|
88
|
+
emitter.bvh_leaf.unlink();
|
|
85
89
|
|
|
86
90
|
return true;
|
|
87
91
|
}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {Box3, BufferGeometry, Frustum, Points, PointsMaterial} from 'three';
|
|
2
|
+
import {assert} from "../../../../../../core/assert.js";
|
|
3
|
+
import {EBBVHLeafProxy} from "../../../../../../core/bvh2/bvh3/EBBVHLeafProxy.js";
|
|
4
|
+
import {computeHashIntegerArray} from "../../../../../../core/collection/array/computeHashIntegerArray.js";
|
|
2
5
|
import List from "../../../../../../core/collection/list/List.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { Box3, BufferGeometry, Frustum, Points, PointsMaterial } from 'three';
|
|
7
|
-
import { ParticlePool } from "./ParticlePool.js";
|
|
8
|
-
import { ParticleParameter } from "../parameter/ParticleParameter.js";
|
|
9
|
-
import { ParameterSet } from "../parameter/ParameterSet.js";
|
|
10
|
-
import { assert } from "../../../../../../core/assert.js";
|
|
11
|
-
import { LeafNode } from "../../../../../../core/bvh2/LeafNode.js";
|
|
12
|
-
import { ParticleLayer } from "./ParticleLayer.js";
|
|
13
|
-
import { ParticleParameters } from "./ParticleParameters.js";
|
|
14
|
-
import { BlendingType } from "../../../../texture/sampler/BlendingType.js";
|
|
6
|
+
import {AABB3} from "../../../../../../core/geom/3d/aabb/AABB3.js";
|
|
7
|
+
import {aabb3_array_combine} from "../../../../../../core/geom/3d/aabb/aabb3_array_combine.js";
|
|
8
|
+
import {compose_matrix4_array} from "../../../../../../core/geom/3d/compose_matrix4_array.js";
|
|
15
9
|
import Quaternion from "../../../../../../core/geom/Quaternion.js";
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
10
|
+
import {v3_dot_array_array} from "../../../../../../core/geom/vec3/v3_dot_array_array.js";
|
|
11
|
+
import Vector3 from "../../../../../../core/geom/Vector3.js";
|
|
12
|
+
import {lerp} from "../../../../../../core/math/lerp.js";
|
|
13
|
+
import {max2} from "../../../../../../core/math/max2.js";
|
|
14
|
+
import {min2} from "../../../../../../core/math/min2.js";
|
|
15
|
+
import {frustum_from_camera} from "../../../../ecs/camera/frustum_from_camera.js";
|
|
16
|
+
import {BlendingType} from "../../../../texture/sampler/BlendingType.js";
|
|
17
|
+
import {ParameterSet} from "../parameter/ParameterSet.js";
|
|
18
|
+
import {ParticleParameter} from "../parameter/ParticleParameter.js";
|
|
19
|
+
import {update_parameters} from "../simulator/update_parameters.js";
|
|
20
|
+
import {computeEmissionFunction} from "./computeEmissionFunction.js";
|
|
18
21
|
import {
|
|
19
22
|
PARTICLE_ATTRIBUTE_AGE,
|
|
20
23
|
PARTICLE_ATTRIBUTE_BLEND,
|
|
@@ -28,13 +31,11 @@ import {
|
|
|
28
31
|
PARTICLE_ATTRIBUTE_UV,
|
|
29
32
|
PARTICLE_ATTRIBUTE_VELOCITY
|
|
30
33
|
} from "./PARTICLE_ATTRIBUTES.js";
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import { v3_dot_array_array } from "../../../../../../core/geom/vec3/v3_dot_array_array.js";
|
|
37
|
-
import { compose_matrix4_array } from "../../../../../../core/geom/3d/compose_matrix4_array.js";
|
|
34
|
+
import {ParticleEmitterFlag} from "./ParticleEmitterFlag.js";
|
|
35
|
+
import {ParticleLayer} from "./ParticleLayer.js";
|
|
36
|
+
import {ParticleParameters} from "./ParticleParameters.js";
|
|
37
|
+
import {ParticlePool} from "./ParticlePool.js";
|
|
38
|
+
import {PARTICULAR_PARTICLE_SPECIFICATION} from "./PARTICULAR_PARTICLE_SPECIFICATION.js";
|
|
38
39
|
|
|
39
40
|
const EMPTY_GEOMETRY = new BufferGeometry();
|
|
40
41
|
|
|
@@ -111,7 +112,13 @@ function write_particle_patch_uv(patch, particles, ref) {
|
|
|
111
112
|
);
|
|
112
113
|
}
|
|
113
114
|
|
|
115
|
+
let id_counter = 0;
|
|
116
|
+
|
|
114
117
|
export class ParticleEmitter {
|
|
118
|
+
/**
|
|
119
|
+
* @type {number}
|
|
120
|
+
*/
|
|
121
|
+
id = id_counter++;
|
|
115
122
|
|
|
116
123
|
/**
|
|
117
124
|
* @private
|
|
@@ -160,13 +167,14 @@ export class ParticleEmitter {
|
|
|
160
167
|
mesh = null;
|
|
161
168
|
|
|
162
169
|
/**
|
|
163
|
-
*
|
|
164
|
-
* @type {
|
|
170
|
+
* @readonly
|
|
171
|
+
* @type {EBBVHLeafProxy}
|
|
165
172
|
*/
|
|
166
|
-
|
|
173
|
+
bvh_leaf = new EBBVHLeafProxy();
|
|
174
|
+
|
|
167
175
|
|
|
168
176
|
/**
|
|
169
|
-
*
|
|
177
|
+
* Upper-bound of bounds for an individual particle
|
|
170
178
|
* @type {AABB3}
|
|
171
179
|
*/
|
|
172
180
|
particleBounds = new AABB3(Infinity, Infinity, Infinity, -Infinity, -Infinity, -Infinity);
|
|
@@ -542,21 +550,9 @@ export class ParticleEmitter {
|
|
|
542
550
|
const ebb = this.emissionBounds;
|
|
543
551
|
const pbb = this.particleBounds;
|
|
544
552
|
|
|
545
|
-
|
|
546
|
-
const bounds_y0 = min2(ebb.y0, pbb.y0);
|
|
547
|
-
const bounds_z0 = min2(ebb.z0, pbb.z0);
|
|
548
|
-
|
|
549
|
-
const bounds_x1 = max2(ebb.x1, pbb.x1);
|
|
550
|
-
const bounds_y1 = max2(ebb.y1, pbb.y1);
|
|
551
|
-
const bounds_z1 = max2(ebb.z1, pbb.z1);
|
|
553
|
+
aabb3_array_combine(this.bvh_leaf.bounds, ebb, pbb);
|
|
552
554
|
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
bvhLeaf.setBounds(bounds_x0, bounds_y0, bounds_z0, bounds_x1, bounds_y1, bounds_z1);
|
|
556
|
-
|
|
557
|
-
if (bvhLeaf.parentNode !== null) {
|
|
558
|
-
bvhLeaf.parentNode.bubbleRefit();
|
|
559
|
-
}
|
|
555
|
+
this.bvh_leaf.write_bounds();
|
|
560
556
|
|
|
561
557
|
}
|
|
562
558
|
|
|
@@ -1221,7 +1217,7 @@ ParticleEmitter.SERIALIZABLE_FLAGS = SERIALIZABLE_FLAGS;
|
|
|
1221
1217
|
|
|
1222
1218
|
const matrix4 = new Float32Array(16);
|
|
1223
1219
|
|
|
1224
|
-
const defaultPointsMaterial = new PointsMaterial({
|
|
1220
|
+
const defaultPointsMaterial = new PointsMaterial({color: 0xFFFFFF});
|
|
1225
1221
|
|
|
1226
1222
|
const frustum = new Frustum();
|
|
1227
1223
|
|