@woosh/meep-engine 2.61.0 → 2.63.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 +1277 -1259
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +1277 -1259
- package/package.json +1 -1
- package/src/core/binary/EncodingBinaryBuffer.js +7 -43
- package/src/core/binary/EncodingBinaryBuffer.spec.js +16 -0
- package/src/core/bvh2/BinaryNode.js +16 -13
- package/src/core/bvh2/LeafNode.js +6 -3
- package/src/core/bvh2/bvh3/EBBVHLeafProxy.js +4 -2
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_sphere.js +81 -0
- package/src/core/cache/LoadingCache.js +4 -1
- package/src/core/collection/map/BiMap.js +49 -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/components/Tag.d.ts +2 -0
- package/src/engine/ecs/components/Tag.js +19 -28
- package/src/engine/ecs/components/Tag.spec.js +47 -0
- 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/ecs/fow/FogOfWar.js +4 -0
- package/src/engine/ecs/fow/FogOfWarEditor.js +3 -0
- package/src/engine/ecs/terrain/TerrainPreview.js +45 -44
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrain.js +22 -4
- package/src/engine/ecs/terrain/tiles/TerrainTile.js +17 -12
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +25 -27
- package/src/engine/graphics/ecs/mesh/Mesh.d.ts +0 -4
- package/src/engine/graphics/ecs/mesh/Mesh.js +0 -11
- package/src/engine/graphics/ecs/mesh/MeshSystem.js +57 -67
- 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/grid/ORTHOGONAL_NEIGHBOURHOOD_MASK.js +11 -0
- 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/core/binary/stringToByteArray.js +0 -24
- package/src/engine/graphics/geometry/bvh/buffered/BVHFromBufferGeometry.js +0 -133
- package/src/engine/save/storage/LocalStorage.js +0 -148
- package/src/engine/save/storage/MsgPackCodec.js +0 -22
|
@@ -4,9 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
import { BoxBufferGeometry, MeshLambertMaterial } from "three";
|
|
7
|
+
import { assert } from "../../../../core/assert.js";
|
|
8
|
+
import {
|
|
9
|
+
ExplicitBinaryBoundingVolumeHierarchy
|
|
10
|
+
} from "../../../../core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js";
|
|
11
|
+
import {
|
|
12
|
+
bvh_query_user_data_overlaps_frustum
|
|
13
|
+
} from "../../../../core/bvh2/bvh3/query/bvh_query_user_data_overlaps_frustum.js";
|
|
7
14
|
import { SignalBinding } from "../../../../core/events/signal/SignalBinding.js";
|
|
8
15
|
|
|
9
16
|
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
17
|
+
import { ResourceAccessKind } from "../../../../core/model/ResourceAccessKind.js";
|
|
18
|
+
import { ResourceAccessSpecification } from "../../../../core/model/ResourceAccessSpecification.js";
|
|
19
|
+
import { GLTFAssetLoader } from "../../../asset/loaders/GLTFAssetLoader.js";
|
|
10
20
|
import { System } from "../../../ecs/System.js";
|
|
11
21
|
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
12
22
|
|
|
@@ -15,26 +25,16 @@ import checkerTexture from "../../texture/CheckersTexture.js";
|
|
|
15
25
|
import ThreeFactory from "../../three/ThreeFactory.js";
|
|
16
26
|
import { assetTypeByPath } from "./assetTypeByPath.js";
|
|
17
27
|
import Mesh, { MeshFlags } from "./Mesh.js";
|
|
18
|
-
import { applyComponentPropertiesToThreeObject, setMesh } from "./setMesh.js";
|
|
19
|
-
import { GLTFAssetLoader } from "../../../asset/loaders/GLTFAssetLoader.js";
|
|
20
28
|
import { MeshEvents } from "./MeshEvents.js";
|
|
21
|
-
import {
|
|
22
|
-
import { ResourceAccessSpecification } from "../../../../core/model/ResourceAccessSpecification.js";
|
|
23
|
-
import { ResourceAccessKind } from "../../../../core/model/ResourceAccessKind.js";
|
|
24
|
-
import {
|
|
25
|
-
ExplicitBinaryBoundingVolumeHierarchy
|
|
26
|
-
} from "../../../../core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js";
|
|
27
|
-
import {
|
|
28
|
-
bvh_query_user_data_overlaps_frustum
|
|
29
|
-
} from "../../../../core/bvh2/bvh3/query/bvh_query_user_data_overlaps_frustum.js";
|
|
29
|
+
import { setMesh } from "./setMesh.js";
|
|
30
30
|
|
|
31
|
-
const
|
|
31
|
+
const PLACEHOLDER_GEOMETRY = new BoxBufferGeometry(1, 1, 1);
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
PLACEHOLDER_GEOMETRY.computeBoundingSphere();
|
|
34
34
|
|
|
35
|
-
const
|
|
35
|
+
const PLACEHOLDER_TEXTURE = checkerTexture.create();
|
|
36
36
|
|
|
37
|
-
const
|
|
37
|
+
const PLACEHOLDER_MATERIAL = new MeshLambertMaterial({ map: PLACEHOLDER_TEXTURE });
|
|
38
38
|
|
|
39
39
|
const scratch_array = [];
|
|
40
40
|
|
|
@@ -134,13 +134,6 @@ export class MeshSystem extends System {
|
|
|
134
134
|
|
|
135
135
|
component.setFlag(MeshFlags.Loaded);
|
|
136
136
|
|
|
137
|
-
// override
|
|
138
|
-
if (asset.override_mesh !== undefined) {
|
|
139
|
-
component.override_mesh = asset.override_mesh.clone();
|
|
140
|
-
|
|
141
|
-
applyComponentPropertiesToThreeObject(component, component.override_mesh, entity);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
137
|
setMesh(dataset, entity, component, mesh);
|
|
145
138
|
|
|
146
139
|
|
|
@@ -318,8 +311,6 @@ export class MeshSystem extends System {
|
|
|
318
311
|
bScale
|
|
319
312
|
];
|
|
320
313
|
|
|
321
|
-
apply_transform();
|
|
322
|
-
|
|
323
314
|
model.__bvh_leaf.link(this.__bvh_binary, entity);
|
|
324
315
|
}
|
|
325
316
|
|
|
@@ -375,38 +366,6 @@ export class MeshSystem extends System {
|
|
|
375
366
|
|
|
376
367
|
const dataset = em.dataset;
|
|
377
368
|
|
|
378
|
-
/**
|
|
379
|
-
*
|
|
380
|
-
* @param {Asset<Object3D>} asset
|
|
381
|
-
*/
|
|
382
|
-
const assetLoaded = (asset) => {
|
|
383
|
-
if (!dataset.entityExists(entity)) {
|
|
384
|
-
//entity no longer exists, probably dataset has been switched, abort
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
//check that component is still actual
|
|
389
|
-
const actualComponent = dataset.getComponent(entity, Mesh);
|
|
390
|
-
|
|
391
|
-
if (actualComponent === component) {
|
|
392
|
-
// scene.remove(component.mesh);
|
|
393
|
-
this.__set_mesh_from_asset(entity, dataset, asset, component);
|
|
394
|
-
|
|
395
|
-
} else {
|
|
396
|
-
//component is no longer in the manager. do nothing.
|
|
397
|
-
//console.warn("component is no longer in the manager");
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
function assetFailure(error) {
|
|
403
|
-
console.error("failed to load model " + component.url, error);
|
|
404
|
-
|
|
405
|
-
dataset.sendEvent(entity, MeshEvents.AssetLoadFailed, {
|
|
406
|
-
reason: error
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
|
|
410
369
|
if (component.hasMesh()) {
|
|
411
370
|
//do not re-run if mesh is set
|
|
412
371
|
setMesh(dataset, entity, component, component.mesh);
|
|
@@ -425,28 +384,59 @@ export class MeshSystem extends System {
|
|
|
425
384
|
if (asset !== null) {
|
|
426
385
|
// asset is already loaded, use it
|
|
427
386
|
this.__set_mesh_from_asset(entity, dataset, asset, component);
|
|
428
|
-
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// mesh was not found, use temp mesh and submit a request
|
|
391
|
+
|
|
392
|
+
if (this.__use_placeholder_mesh) {
|
|
393
|
+
// set placeholder mesh
|
|
394
|
+
const mesh = ThreeFactory.createMesh(PLACEHOLDER_GEOMETRY, PLACEHOLDER_MATERIAL);
|
|
395
|
+
|
|
396
|
+
setMesh(dataset, entity, component, mesh);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
function assetFailure(error) {
|
|
400
|
+
console.error("failed to load model " + component.url, error);
|
|
401
|
+
|
|
402
|
+
dataset.sendEvent(entity, MeshEvents.AssetLoadFailed, {
|
|
403
|
+
reason: error
|
|
404
|
+
});
|
|
405
|
+
}
|
|
429
406
|
|
|
430
|
-
|
|
407
|
+
if (assetType === null) {
|
|
408
|
+
// couldn't figure out what the asset type is
|
|
409
|
+
assetFailure("no asset type deduced");
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
431
412
|
|
|
432
|
-
if (this.__use_placeholder_mesh) {
|
|
433
|
-
// set placeholder mesh
|
|
434
|
-
const mesh = ThreeFactory.createMesh(placeholderGeometry, placeholderMaterial);
|
|
435
413
|
|
|
436
|
-
|
|
414
|
+
/**
|
|
415
|
+
*
|
|
416
|
+
* @param {Asset<Object3D>} asset
|
|
417
|
+
*/
|
|
418
|
+
const assetLoaded = (asset) => {
|
|
419
|
+
if (!dataset.entityExists(entity)) {
|
|
420
|
+
//entity no longer exists, probably dataset has been switched, abort
|
|
421
|
+
return;
|
|
437
422
|
}
|
|
438
423
|
|
|
439
|
-
|
|
424
|
+
//check that component is still actual
|
|
425
|
+
const actualComponent = dataset.getComponent(entity, Mesh);
|
|
440
426
|
|
|
441
|
-
|
|
427
|
+
if (actualComponent === component) {
|
|
428
|
+
// scene.remove(component.mesh);
|
|
429
|
+
this.__set_mesh_from_asset(entity, dataset, asset, component);
|
|
442
430
|
|
|
443
431
|
} else {
|
|
444
|
-
//
|
|
445
|
-
|
|
432
|
+
//component is no longer in the manager. do nothing.
|
|
433
|
+
//console.warn("component is no longer in the manager");
|
|
446
434
|
}
|
|
447
435
|
}
|
|
448
436
|
|
|
449
|
-
|
|
437
|
+
// load the asset
|
|
438
|
+
am.get({ path: component.url, type: assetType, callback: assetLoaded, failure: assetFailure });
|
|
439
|
+
|
|
450
440
|
}
|
|
451
441
|
|
|
452
442
|
update(timeDelta) {
|
|
@@ -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
|
}
|