@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
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import Tag from "./Tag.js";
|
|
2
|
+
|
|
3
|
+
test("constructor", () => {
|
|
4
|
+
new Tag();
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
test("containsOneOf", () => {
|
|
8
|
+
|
|
9
|
+
const tag = Tag.fromJSON(['a', 'b']);
|
|
10
|
+
|
|
11
|
+
expect(tag.containsOneOf([])).toBe(false);
|
|
12
|
+
expect(tag.containsOneOf(['c'])).toBe(false);
|
|
13
|
+
expect(tag.containsOneOf(['a'])).toBe(true);
|
|
14
|
+
expect(tag.containsOneOf(['b'])).toBe(true);
|
|
15
|
+
expect(tag.containsOneOf(['a', 'b'])).toBe(true);
|
|
16
|
+
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test("hash", () => {
|
|
20
|
+
|
|
21
|
+
const tag = Tag.fromJSON(['a', 'b']);
|
|
22
|
+
|
|
23
|
+
const hash = tag.hash();
|
|
24
|
+
|
|
25
|
+
expect(tag.hash()).toEqual(hash);
|
|
26
|
+
|
|
27
|
+
expect(typeof hash).toBe("number");
|
|
28
|
+
expect(Number.isInteger(hash)).toBe(true);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("equals", () => {
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
const a = Tag.fromJSON(['a', 'b']);
|
|
35
|
+
const b = Tag.fromJSON([]);
|
|
36
|
+
const c = Tag.fromJSON(['a']);
|
|
37
|
+
const d = Tag.fromJSON(['b']);
|
|
38
|
+
const e = Tag.fromJSON(['a', 'b']);
|
|
39
|
+
const f = Tag.fromJSON(['a', 'c']);
|
|
40
|
+
|
|
41
|
+
expect(a.equals(b)).toBe(false);
|
|
42
|
+
expect(a.equals(c)).toBe(false);
|
|
43
|
+
expect(a.equals(d)).toBe(false);
|
|
44
|
+
expect(a.equals(e)).toBe(true);
|
|
45
|
+
expect(a.equals(f)).toBe(false);
|
|
46
|
+
|
|
47
|
+
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import List from "../../../../core/collection/list/List.js";
|
|
2
|
-
import {
|
|
2
|
+
import {InstancedMeshLayer} from "./InstancedMeshLayer.js";
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated use {@link ShadedGeometry} instead with instanced rendering
|
|
7
|
+
*/
|
|
5
8
|
export class InstancedMeshComponent {
|
|
6
9
|
constructor() {
|
|
7
10
|
/**
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {assert} from "../../../../core/assert.js";
|
|
2
|
+
import Mesh from "../../../graphics/ecs/mesh/Mesh.js";
|
|
3
|
+
import Entity from "../../Entity.js";
|
|
4
|
+
import {Transform} from "../../transform/Transform.js";
|
|
5
|
+
import {loadFoliageLayer} from "./Foliage2System.js";
|
|
6
|
+
import {InstancedMeshComponent} from "./InstancedMeshComponent.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Convert all existing instanced mesh components to individual Transform+Mesh pairs
|
|
10
|
+
* @param {EntityComponentDataset} dataset
|
|
11
|
+
* @param assetManager
|
|
12
|
+
*/
|
|
13
|
+
export function convertInstancedMeshComponents2Entities(dataset, assetManager) {
|
|
14
|
+
assert.notEqual(dataset, undefined, 'dataset is undefined');
|
|
15
|
+
assert.notEqual(assetManager, undefined, 'assetManager is undefined');
|
|
16
|
+
|
|
17
|
+
const entitiesToStrip = [];
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @param {InstancedMeshComponent} foliage2
|
|
22
|
+
* @param entity
|
|
23
|
+
*/
|
|
24
|
+
function visitFoliageEntities(foliage2, entity) {
|
|
25
|
+
foliage2.layers.forEach(function (layer) {
|
|
26
|
+
const modelURL = layer.modelURL.getValue();
|
|
27
|
+
|
|
28
|
+
loadFoliageLayer(layer, assetManager)
|
|
29
|
+
.then(function (instancedFoliage) {
|
|
30
|
+
|
|
31
|
+
const data = instancedFoliage.data;
|
|
32
|
+
const numInstances = data.length;
|
|
33
|
+
|
|
34
|
+
for (let i = 0; i < numInstances; i++) {
|
|
35
|
+
const transform = new Transform();
|
|
36
|
+
|
|
37
|
+
instancedFoliage.read(i, transform.position, transform.rotation, transform.scale);
|
|
38
|
+
|
|
39
|
+
const mesh = new Mesh();
|
|
40
|
+
mesh.url = modelURL;
|
|
41
|
+
|
|
42
|
+
mesh.castShadow = layer.castShadow.getValue();
|
|
43
|
+
mesh.receiveShadow = layer.receiveShadow.getValue();
|
|
44
|
+
|
|
45
|
+
//TODO Consider moving BVH info here also, to make this process faster
|
|
46
|
+
|
|
47
|
+
const entityBuilder = new Entity();
|
|
48
|
+
|
|
49
|
+
entityBuilder.add(transform).add(mesh).build(dataset);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
entitiesToStrip.push(entity);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
dataset.traverseEntities([InstancedMeshComponent], visitFoliageEntities);
|
|
58
|
+
|
|
59
|
+
//remove converted foliage components
|
|
60
|
+
entitiesToStrip.forEach(function (entity) {
|
|
61
|
+
dataset.removeComponentFromEntity(entity, InstancedMeshComponent);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
@@ -1,73 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { loadFoliageLayer } from "./Foliage2System.js";
|
|
3
|
-
import Mesh, { MeshFlags } from "../../../graphics/ecs/mesh/Mesh.js";
|
|
4
|
-
import { Transform } from "../../transform/Transform.js";
|
|
5
|
-
import { InstancedMeshComponent } from "./InstancedMeshComponent.js";
|
|
6
|
-
import { InstancedFoliage } from "../InstancedFoliage.js";
|
|
7
|
-
import { buildTreeOptimizationTask } from "../../../../core/bvh2/BVHTasks.js";
|
|
1
|
+
import {buildTreeOptimizationTask} from "../../../../core/bvh2/BVHTasks.js";
|
|
8
2
|
import Task from "../../../../core/process/task/Task.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* @param assetManager
|
|
19
|
-
*/
|
|
20
|
-
export function convertInstancedMeshComponents2Entities(dataset, assetManager) {
|
|
21
|
-
assert.notEqual(dataset, undefined, 'dataset is undefined');
|
|
22
|
-
assert.notEqual(assetManager, undefined, 'assetManager is undefined');
|
|
23
|
-
|
|
24
|
-
const entitiesToStrip = [];
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @param {InstancedMeshComponent} foliage2
|
|
29
|
-
* @param entity
|
|
30
|
-
*/
|
|
31
|
-
function visitFoliageEntities(foliage2, entity) {
|
|
32
|
-
foliage2.layers.forEach(function (layer) {
|
|
33
|
-
const modelURL = layer.modelURL.getValue();
|
|
34
|
-
|
|
35
|
-
loadFoliageLayer(layer, assetManager)
|
|
36
|
-
.then(function (instancedFoliage) {
|
|
37
|
-
|
|
38
|
-
const data = instancedFoliage.data;
|
|
39
|
-
const numInstances = data.length;
|
|
40
|
-
|
|
41
|
-
for (let i = 0; i < numInstances; i++) {
|
|
42
|
-
const transform = new Transform();
|
|
43
|
-
|
|
44
|
-
instancedFoliage.read(i, transform.position, transform.rotation, transform.scale);
|
|
45
|
-
|
|
46
|
-
const mesh = new Mesh();
|
|
47
|
-
mesh.url = modelURL;
|
|
48
|
-
|
|
49
|
-
mesh.castShadow = layer.castShadow.getValue();
|
|
50
|
-
mesh.receiveShadow = layer.receiveShadow.getValue();
|
|
51
|
-
|
|
52
|
-
//TODO Consider moving BVH info here also, to make this process faster
|
|
53
|
-
|
|
54
|
-
const entityBuilder = new Entity();
|
|
55
|
-
|
|
56
|
-
entityBuilder.add(transform).add(mesh).build(dataset);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
entitiesToStrip.push(entity);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
dataset.traverseEntities([InstancedMeshComponent], visitFoliageEntities);
|
|
65
|
-
|
|
66
|
-
//remove converted foliage components
|
|
67
|
-
entitiesToStrip.forEach(function (entity) {
|
|
68
|
-
dataset.removeComponentFromEntity(entity, InstancedMeshComponent);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
3
|
+
import {TaskSignal} from "../../../../core/process/task/TaskSignal.js";
|
|
4
|
+
import {countTask} from "../../../../core/process/task/util/countTask.js";
|
|
5
|
+
import {promiseTask} from "../../../../core/process/task/util/promiseTask.js";
|
|
6
|
+
import Mesh, {MeshFlags} from "../../../graphics/ecs/mesh/Mesh.js";
|
|
7
|
+
import Entity from "../../Entity.js";
|
|
8
|
+
import {Transform} from "../../transform/Transform.js";
|
|
9
|
+
import {InstancedFoliage} from "../InstancedFoliage.js";
|
|
10
|
+
import {InstancedMeshComponent} from "./InstancedMeshComponent.js";
|
|
11
|
+
import {InstancedMeshLayer} from "./InstancedMeshLayer.js";
|
|
71
12
|
|
|
72
13
|
/**
|
|
73
14
|
*
|
|
@@ -289,4 +230,4 @@ export function optimizeIndividualMeshesEntitiesToInstances(dataset, threshold =
|
|
|
289
230
|
main: tBuild,
|
|
290
231
|
tasks
|
|
291
232
|
};
|
|
292
|
-
}
|
|
233
|
+
}
|
|
@@ -1,66 +1,67 @@
|
|
|
1
1
|
import Vector2 from "../../../core/geom/Vector2.js";
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export class TerrainPreview {
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
6
6
|
* @type {String}
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
url = "";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
*
|
|
12
12
|
* @type {Vector2}
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
offset = new Vector2(0, 0);
|
|
15
15
|
/**
|
|
16
16
|
*
|
|
17
17
|
* @type {Vector2}
|
|
18
18
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
scale = new Vector2(1, 1);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param {TerrainPreview} other
|
|
24
|
+
*/
|
|
25
|
+
copy(other) {
|
|
26
|
+
this.url = other.url;
|
|
27
|
+
this.scale.copy(other.scale);
|
|
28
|
+
this.offset.copy(other.offset);
|
|
29
|
+
}
|
|
21
30
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this.offset.copy(other.offset);
|
|
30
|
-
};
|
|
31
|
+
toJSON() {
|
|
32
|
+
return {
|
|
33
|
+
url: this.url,
|
|
34
|
+
offset: this.offset.toJSON(),
|
|
35
|
+
scale: this.scale.toJSON()
|
|
36
|
+
};
|
|
37
|
+
}
|
|
31
38
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
+
fromJSON(obj) {
|
|
40
|
+
this.url = obj.url;
|
|
41
|
+
this.offset.fromJSON(obj.offset);
|
|
42
|
+
this.scale.fromJSON(obj.scale);
|
|
43
|
+
}
|
|
39
44
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @param {BinaryBuffer} buffer
|
|
48
|
+
*/
|
|
49
|
+
toBinaryBuffer(buffer) {
|
|
50
|
+
buffer.writeUTF8String(this.url);
|
|
45
51
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*/
|
|
50
|
-
TerrainPreview.prototype.toBinaryBuffer = function (buffer) {
|
|
51
|
-
buffer.writeUTF8String(this.url);
|
|
52
|
+
this.offset.toBinaryBuffer(buffer);
|
|
53
|
+
this.scale.toBinaryBuffer(buffer);
|
|
54
|
+
}
|
|
52
55
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
* @param {BinaryBuffer} buffer
|
|
59
|
+
*/
|
|
60
|
+
fromBinaryBuffer(buffer) {
|
|
61
|
+
this.url = buffer.readUTF8String();
|
|
56
62
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
TerrainPreview.prototype.fromBinaryBuffer = function (buffer) {
|
|
62
|
-
this.url = buffer.readUTF8String();
|
|
63
|
+
this.offset.fromBinaryBuffer(buffer);
|
|
64
|
+
this.scale.fromBinaryBuffer(buffer);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
63
67
|
|
|
64
|
-
this.offset.fromBinaryBuffer(buffer);
|
|
65
|
-
this.scale.fromBinaryBuffer(buffer);
|
|
66
|
-
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Created by Alex on 13/05/2016.
|
|
3
3
|
*/
|
|
4
|
-
import Vector3 from "../../../../../core/geom/Vector3.js";
|
|
5
4
|
import Quaternion from "../../../../../core/geom/Quaternion.js";
|
|
5
|
+
import Vector3 from "../../../../../core/geom/Vector3.js";
|
|
6
6
|
|
|
7
7
|
class ClingToTerrain {
|
|
8
8
|
/**
|
|
@@ -13,12 +13,12 @@ class ClingToTerrain {
|
|
|
13
13
|
* Used internally for caching updates
|
|
14
14
|
* @type {Vector3}
|
|
15
15
|
*/
|
|
16
|
-
__lastPosition=new Vector3(0, 0, 0);
|
|
16
|
+
__lastPosition = new Vector3(0, 0, 0);
|
|
17
17
|
/**
|
|
18
18
|
*
|
|
19
19
|
* @type {Quaternion}
|
|
20
20
|
*/
|
|
21
|
-
__lastRotation=new Quaternion(0, 0, 0, 1);
|
|
21
|
+
__lastRotation = new Quaternion(0, 0, 0, 1);
|
|
22
22
|
/**
|
|
23
23
|
* Speed in Rad/s (Radians/second) by which rotation can change
|
|
24
24
|
* @type {number}
|
|
@@ -26,11 +26,29 @@ class ClingToTerrain {
|
|
|
26
26
|
rotationSpeed = 3;
|
|
27
27
|
|
|
28
28
|
constructor(opt) {
|
|
29
|
-
if(opt !== undefined){
|
|
29
|
+
if (opt !== undefined) {
|
|
30
30
|
throw new Error("constructor options deprecated");
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @param {ClingToTerrain} other
|
|
37
|
+
* @returns {boolean}
|
|
38
|
+
*/
|
|
39
|
+
equals(other) {
|
|
40
|
+
return this.normalAlign === other.normalAlign
|
|
41
|
+
&& this.rotationSpeed === other.rotationSpeed;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @returns {number}
|
|
47
|
+
*/
|
|
48
|
+
hash() {
|
|
49
|
+
return this.normalAlign ? 1 : 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
34
52
|
toJSON() {
|
|
35
53
|
return {
|
|
36
54
|
normalAlign: this.normalAlign,
|
|
@@ -3,31 +3,36 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
import { mat4 } from "gl-matrix";
|
|
6
7
|
import {
|
|
7
8
|
Box3 as ThreeBox3,
|
|
8
9
|
BufferAttribute as ThreeBufferAttribute,
|
|
9
10
|
BufferGeometry as ThreeBufferGeometry,
|
|
11
|
+
MeshBasicMaterial,
|
|
10
12
|
Sphere as ThreeSphere,
|
|
11
13
|
Vector3 as ThreeVector3
|
|
12
14
|
} from 'three';
|
|
13
|
-
import Vector2 from '../../../../core/geom/Vector2.js';
|
|
14
|
-
import Vector3 from '../../../../core/geom/Vector3.js';
|
|
15
15
|
|
|
16
|
-
import
|
|
16
|
+
import IndexedBinaryBVH from '../../../../core/bvh2/binary/IndexedBinaryBVH.js';
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
import { LeafNode } from '../../../../core/bvh2/LeafNode.js';
|
|
20
|
-
|
|
21
|
-
import IndexedBinaryBVH from '../../../../core/bvh2/binary/IndexedBinaryBVH.js';
|
|
22
|
-
import { BVHGeometryRaycaster } from "../../../graphics/geometry/bvh/buffered/BVHGeometryRaycaster.js";
|
|
23
|
-
import ObservedInteger from "../../../../core/model/ObservedInteger.js";
|
|
24
|
-
import { SurfacePoint3 } from "../../../../core/geom/3d/SurfacePoint3.js";
|
|
20
|
+
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
25
21
|
import Signal from "../../../../core/events/signal/Signal.js";
|
|
26
|
-
import {
|
|
22
|
+
import { passThrough } from "../../../../core/function/Functions.js";
|
|
27
23
|
import { AABB3 } from "../../../../core/geom/3d/aabb/AABB3.js";
|
|
24
|
+
import { SurfacePoint3 } from "../../../../core/geom/3d/SurfacePoint3.js";
|
|
25
|
+
import Vector2 from '../../../../core/geom/Vector2.js';
|
|
26
|
+
import Vector3 from '../../../../core/geom/Vector3.js';
|
|
28
27
|
import { NumericInterval } from "../../../../core/math/interval/NumericInterval.js";
|
|
29
|
-
import
|
|
30
|
-
import {
|
|
28
|
+
import ObservedInteger from "../../../../core/model/ObservedInteger.js";
|
|
29
|
+
import { BVHGeometryRaycaster } from "../../../graphics/geometry/bvh/buffered/BVHGeometryRaycaster.js";
|
|
30
|
+
|
|
31
|
+
import ThreeFactory from '../../../graphics/three/ThreeFactory.js';
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
const EMPTY_GEOMETRY = new ThreeBufferGeometry();
|
|
35
|
+
const DEFAULT_MATERIAL = new MeshBasicMaterial();
|
|
31
36
|
|
|
32
37
|
/**
|
|
33
38
|
* terrain tile is a part of a 2d array
|
|
@@ -44,7 +49,7 @@ class TerrainTile {
|
|
|
44
49
|
* @type {Material}
|
|
45
50
|
*/
|
|
46
51
|
material = null;
|
|
47
|
-
mesh = ThreeFactory.createMesh();
|
|
52
|
+
mesh = ThreeFactory.createMesh(EMPTY_GEOMETRY, DEFAULT_MATERIAL);
|
|
48
53
|
|
|
49
54
|
|
|
50
55
|
/**
|
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import {Frustum, OrthographicCamera} from "three";
|
|
1
|
+
import { Frustum, OrthographicCamera } from "three";
|
|
2
2
|
import FacingDirectionSystem from "../../../../../model/game/ecs/system/FacingDirectionSystem.js";
|
|
3
|
-
import {makeEngineOptionsModel} from "../../../../../model/game/options/makeEngineOptionsModel.js";
|
|
4
|
-
import {enableEditor} from "../../../../editor/enableEditor.js";
|
|
3
|
+
import { makeEngineOptionsModel } from "../../../../../model/game/options/makeEngineOptionsModel.js";
|
|
4
|
+
import { enableEditor } from "../../../../editor/enableEditor.js";
|
|
5
5
|
import {
|
|
6
6
|
ThreeClippingPlaneComputingBVHVisitor
|
|
7
7
|
} from "../../../core/bvh2/traversal/ThreeClippingPlaneComputingBVHVisitor.js";
|
|
8
|
-
import {RingBuffer} from "../../../core/collection/RingBuffer.js";
|
|
9
|
-
import {convex_hull_jarvis_2d} from "../../../core/geom/2d/convex-hull/convex_hull_jarvis_2d.js";
|
|
8
|
+
import { RingBuffer } from "../../../core/collection/RingBuffer.js";
|
|
9
|
+
import { convex_hull_jarvis_2d } from "../../../core/geom/2d/convex-hull/convex_hull_jarvis_2d.js";
|
|
10
10
|
import Vector2 from "../../../core/geom/Vector2.js";
|
|
11
11
|
import Vector3 from "../../../core/geom/Vector3.js";
|
|
12
|
-
import {computeStatisticalMean} from "../../../core/math/statistics/computeStatisticalMean.js";
|
|
13
|
-
import {CanvasView} from "../../../view/elements/CanvasView.js";
|
|
12
|
+
import { computeStatisticalMean } from "../../../core/math/statistics/computeStatisticalMean.js";
|
|
13
|
+
import { CanvasView } from "../../../view/elements/CanvasView.js";
|
|
14
14
|
import Entity from "../../ecs/Entity.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {FogOfWarSystem} from "../../ecs/fow/FogOfWarSystem.js";
|
|
15
|
+
import { FogOfWarRevealerSystem } from "../../ecs/fow/FogOfWarRevealerSystem.js";
|
|
16
|
+
import { FogOfWarSystem } from "../../ecs/fow/FogOfWarSystem.js";
|
|
18
17
|
import GUIElement from "../../ecs/gui/GUIElement.js";
|
|
19
18
|
import GUIElementSystem from "../../ecs/gui/GUIElementSystem.js";
|
|
20
19
|
import HeadsUpDisplaySystem from "../../ecs/gui/hud/HeadsUpDisplaySystem.js";
|
|
21
20
|
import ViewportPosition from "../../ecs/gui/position/ViewportPosition.js";
|
|
22
21
|
import ViewportPositionSystem from "../../ecs/gui/position/ViewportPositionSystem.js";
|
|
23
|
-
import {InverseKinematicsSystem} from "../../ecs/ik/InverseKinematicsSystem.js";
|
|
22
|
+
import { InverseKinematicsSystem } from "../../ecs/ik/InverseKinematicsSystem.js";
|
|
24
23
|
import AnimationSystem from "../../ecs/systems/AnimationSystem.js";
|
|
25
24
|
import MotionSystem from "../../ecs/systems/MotionSystem.js";
|
|
26
25
|
import RenderSystem from "../../ecs/systems/RenderSystem.js";
|
|
@@ -30,33 +29,33 @@ import TagSystem from "../../ecs/systems/TagSystem.js";
|
|
|
30
29
|
import TimerSystem from "../../ecs/systems/TimerSystem.js";
|
|
31
30
|
import ClingToTerrainSystem from "../../ecs/terrain/ecs/cling/ClingToTerrainSystem.js";
|
|
32
31
|
import TerrainSystem from "../../ecs/terrain/ecs/TerrainSystem.js";
|
|
33
|
-
import {Transform} from "../../ecs/transform/Transform.js";
|
|
34
|
-
import {EngineConfiguration} from "../../EngineConfiguration.js";
|
|
35
|
-
import {EngineHarness} from "../../EngineHarness.js";
|
|
36
|
-
import {GridPosition2TransformSystem} from "../../grid/grid2transform/GridPosition2TransformSystem.js";
|
|
32
|
+
import { Transform } from "../../ecs/transform/Transform.js";
|
|
33
|
+
import { EngineConfiguration } from "../../EngineConfiguration.js";
|
|
34
|
+
import { EngineHarness } from "../../EngineHarness.js";
|
|
35
|
+
import { GridPosition2TransformSystem } from "../../grid/grid2transform/GridPosition2TransformSystem.js";
|
|
37
36
|
import GridPositionSystem from "../../grid/position/GridPositionSystem.js";
|
|
38
|
-
import {Transform2GridPositionSystem} from "../../grid/transform2grid/Transform2GridPositionSystem.js";
|
|
37
|
+
import { Transform2GridPositionSystem } from "../../grid/transform2grid/Transform2GridPositionSystem.js";
|
|
39
38
|
import InputControllerSystem from "../../input/ecs/systems/InputControllerSystem.js";
|
|
40
|
-
import {InputSystem} from "../../input/ecs/systems/InputSystem.js";
|
|
41
|
-
import {BehaviorSystem} from "../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
39
|
+
import { InputSystem } from "../../input/ecs/systems/InputSystem.js";
|
|
40
|
+
import { BehaviorSystem } from "../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
42
41
|
import PathFollowingSystem from "../../navigation/ecs/path_following/PathFollowingSystem.js";
|
|
43
|
-
import {SoundEmitterSystem} from "../../sound/ecs/emitter/SoundEmitterSystem.js";
|
|
42
|
+
import { SoundEmitterSystem } from "../../sound/ecs/emitter/SoundEmitterSystem.js";
|
|
44
43
|
import SoundControllerSystem from "../../sound/ecs/SoundControllerSystem.js";
|
|
45
44
|
import SoundListenerSystem from "../../sound/ecs/SoundListenerSystem.js";
|
|
46
45
|
import AnimationControllerSystem from "../ecs/animation/AnimationControllerSystem.js";
|
|
47
|
-
import {AnimationGraphSystem} from "../ecs/animation/animator/AnimationGraphSystem.js";
|
|
48
|
-
import {CameraSystem} from "../ecs/camera/CameraSystem.js";
|
|
49
|
-
import {frustum_from_camera} from "../ecs/camera/frustum_from_camera.js";
|
|
46
|
+
import { AnimationGraphSystem } from "../ecs/animation/animator/AnimationGraphSystem.js";
|
|
47
|
+
import { CameraSystem } from "../ecs/camera/CameraSystem.js";
|
|
48
|
+
import { frustum_from_camera } from "../ecs/camera/frustum_from_camera.js";
|
|
50
49
|
import TopDownCameraControllerSystem from "../ecs/camera/topdown/TopDownCameraControllerSystem.js";
|
|
51
|
-
import {TopDownCameraLanderSystem} from "../ecs/camera/topdown/TopDownCameraLanderSystem.js";
|
|
50
|
+
import { TopDownCameraLanderSystem } from "../ecs/camera/topdown/TopDownCameraLanderSystem.js";
|
|
52
51
|
import MeshHighlightSystem from "../ecs/highlight/system/MeshHighlightSystem.js";
|
|
53
52
|
import LightSystem from "../ecs/light/LightSystem.js";
|
|
54
53
|
import Mesh from "../ecs/mesh/Mesh.js";
|
|
55
|
-
import {MeshSystem} from "../ecs/mesh/MeshSystem.js";
|
|
56
|
-
import {PathDisplaySystem} from "../ecs/path/PathDisplaySystem.js";
|
|
54
|
+
import { MeshSystem } from "../ecs/mesh/MeshSystem.js";
|
|
55
|
+
import { PathDisplaySystem } from "../ecs/path/PathDisplaySystem.js";
|
|
57
56
|
import Trail2DSystem from "../ecs/trail2d/Trail2DSystem.js";
|
|
58
57
|
import WaterSystem from "../ecs/water/WaterSystem.js";
|
|
59
|
-
import {computeFrustumCorners} from "../render/forward_plus/computeFrustumCorners.js";
|
|
58
|
+
import { computeFrustumCorners } from "../render/forward_plus/computeFrustumCorners.js";
|
|
60
59
|
|
|
61
60
|
const engineHarness = new EngineHarness();
|
|
62
61
|
|
|
@@ -97,7 +96,6 @@ function makeConfig(engine) {
|
|
|
97
96
|
new TerrainSystem(graphics, assetManager),
|
|
98
97
|
new WaterSystem(graphics),
|
|
99
98
|
new Trail2DSystem(engine),
|
|
100
|
-
new Foliage2System(assetManager, graphics),
|
|
101
99
|
new ViewportPositionSystem(graphics.viewport.size),
|
|
102
100
|
new GridPosition2TransformSystem(),
|
|
103
101
|
new Transform2GridPositionSystem(),
|
|
@@ -51,12 +51,6 @@ class Mesh {
|
|
|
51
51
|
*/
|
|
52
52
|
this.mesh = null;
|
|
53
53
|
|
|
54
|
-
/**
|
|
55
|
-
* Override Mesh data, if available. Typically set via plugins
|
|
56
|
-
* @type {Object3D|null}
|
|
57
|
-
*/
|
|
58
|
-
this.override_mesh = null;
|
|
59
|
-
|
|
60
54
|
/**
|
|
61
55
|
* @transient
|
|
62
56
|
* @type {Asset|null}
|
|
@@ -129,11 +123,6 @@ class Mesh {
|
|
|
129
123
|
aabb3_matrix4_project(this.__bvh_leaf.bounds, this.boundingBox, _t.matrix);
|
|
130
124
|
|
|
131
125
|
this.__bvh_leaf.write_bounds();
|
|
132
|
-
|
|
133
|
-
// override
|
|
134
|
-
if (this.override_mesh !== null) {
|
|
135
|
-
applyTransformToThreeObject(this.override_mesh, _t);
|
|
136
|
-
}
|
|
137
126
|
}
|
|
138
127
|
|
|
139
128
|
/**
|