@woosh/meep-engine 2.62.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 +1043 -1047
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +1043 -1047
- 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/bvh3/EBBVHLeafProxy.js +4 -2
- package/src/core/cache/LoadingCache.js +4 -1
- package/src/core/collection/map/BiMap.js +49 -0
- 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/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/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/grid/ORTHOGONAL_NEIGHBOURHOOD_MASK.js +11 -0
- package/src/core/binary/stringToByteArray.js +0 -24
- package/src/engine/save/storage/LocalStorage.js +0 -148
- package/src/engine/save/storage/MsgPackCodec.js +0 -22
package/package.json
CHANGED
|
@@ -1,58 +1,22 @@
|
|
|
1
|
+
import { BiMap } from "../collection/map/BiMap.js";
|
|
1
2
|
import { BinaryBuffer } from "./BinaryBuffer.js";
|
|
2
3
|
|
|
3
|
-
class
|
|
4
|
-
constructor() {
|
|
5
|
-
this.forward = new Map();
|
|
6
|
-
this.backward = new Map();
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
* @param {*} value
|
|
12
|
-
* @param {number} address
|
|
13
|
-
*/
|
|
14
|
-
add(value, address) {
|
|
15
|
-
this.forward.set(address, value);
|
|
16
|
-
this.backward.set(value, address);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
* @param {*} value
|
|
22
|
-
* @returns {number|undefined}
|
|
23
|
-
*/
|
|
24
|
-
getAddress(value) {
|
|
25
|
-
return this.backward.get(value);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @param {number} address
|
|
31
|
-
* @returns {*}
|
|
32
|
-
*/
|
|
33
|
-
getValue(address) {
|
|
34
|
-
return this.forward.get(address);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
4
|
+
export class EncodingBinaryBuffer extends BinaryBuffer {
|
|
37
5
|
|
|
6
|
+
__dictionary = new BiMap();
|
|
38
7
|
|
|
39
|
-
export class EncodingBinaryBuffer extends BinaryBuffer {
|
|
40
|
-
constructor() {
|
|
41
|
-
super();
|
|
42
|
-
this.__dictionary = new Dictionary();
|
|
43
|
-
}
|
|
44
8
|
|
|
45
9
|
writeUTF8String(value) {
|
|
46
|
-
const address = this.__dictionary.
|
|
10
|
+
const address = this.__dictionary.getKeyByValue(value);
|
|
47
11
|
|
|
48
12
|
if (address === undefined) {
|
|
49
13
|
this.writeUint8(0); //mark as complete value
|
|
50
14
|
|
|
51
|
-
const
|
|
15
|
+
const current_address = this.position;
|
|
52
16
|
|
|
53
17
|
super.writeUTF8String(value);
|
|
54
18
|
|
|
55
|
-
this.__dictionary.add(value,
|
|
19
|
+
this.__dictionary.add(value, current_address);
|
|
56
20
|
} else {
|
|
57
21
|
//write as reference
|
|
58
22
|
this.writeUint32LE(1 | (address << 1));
|
|
@@ -72,7 +36,7 @@ export class EncodingBinaryBuffer extends BinaryBuffer {
|
|
|
72
36
|
|
|
73
37
|
const address = header >> 1;
|
|
74
38
|
|
|
75
|
-
let value = this.__dictionary.
|
|
39
|
+
let value = this.__dictionary.getValueByKey(address);
|
|
76
40
|
|
|
77
41
|
if (value === undefined) {
|
|
78
42
|
//remember position
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EncodingBinaryBuffer } from "./EncodingBinaryBuffer.js";
|
|
2
|
+
|
|
3
|
+
test("read/write strings", () => {
|
|
4
|
+
|
|
5
|
+
const buffer = new EncodingBinaryBuffer();
|
|
6
|
+
|
|
7
|
+
buffer.writeUTF8String("hello world");
|
|
8
|
+
buffer.writeUTF8String("cat");
|
|
9
|
+
buffer.writeUTF8String("hello world");
|
|
10
|
+
|
|
11
|
+
buffer.position = 0;
|
|
12
|
+
|
|
13
|
+
expect(buffer.readUTF8String()).toEqual("hello world");
|
|
14
|
+
expect(buffer.readUTF8String()).toEqual("cat");
|
|
15
|
+
expect(buffer.readUTF8String()).toEqual("hello world");
|
|
16
|
+
});
|
|
@@ -50,8 +50,10 @@ export class EBBVHLeafProxy {
|
|
|
50
50
|
unlink() {
|
|
51
51
|
assert.equal(this.is_linked, true, 'not linked');
|
|
52
52
|
|
|
53
|
-
this.#
|
|
54
|
-
|
|
53
|
+
const node_id = this.#node_id;
|
|
54
|
+
|
|
55
|
+
this.#tree.remove_leaf(node_id);
|
|
56
|
+
this.#tree.release_node(node_id);
|
|
55
57
|
|
|
56
58
|
this.#node_id = -1;
|
|
57
59
|
this.#tree = null;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
//
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { assert } from "../assert.js";
|
|
4
4
|
import { current_time_in_seconds } from "../time/current_time_in_seconds.js";
|
|
5
|
+
import { Cache } from "./Cache.js";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @template R
|
|
@@ -79,6 +80,8 @@ export class LoadingCache {
|
|
|
79
80
|
retryFailed = true
|
|
80
81
|
}) {
|
|
81
82
|
|
|
83
|
+
assert.isFunction(load, 'load');
|
|
84
|
+
|
|
82
85
|
this.#internal = new Cache({
|
|
83
86
|
maxWeight,
|
|
84
87
|
keyWeigher,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bi-directional map
|
|
3
|
+
* @template K,V
|
|
4
|
+
*/
|
|
5
|
+
export class BiMap {
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @type {Map<K, V>}
|
|
10
|
+
*/
|
|
11
|
+
forward = new Map();
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @type {Map<V, K>}
|
|
15
|
+
*/
|
|
16
|
+
backward = new Map();
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @param {K} key
|
|
22
|
+
* @param {V} value
|
|
23
|
+
*/
|
|
24
|
+
add(key, value) {
|
|
25
|
+
this.forward.set(value, key);
|
|
26
|
+
this.backward.set(key, value);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @param {V} value
|
|
32
|
+
* @returns {K|undefined}
|
|
33
|
+
*/
|
|
34
|
+
getKeyByValue(value) {
|
|
35
|
+
return this.backward.get(value);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
* @param {K} address
|
|
41
|
+
* @returns {V|undefined}
|
|
42
|
+
*/
|
|
43
|
+
getValueByKey(address) {
|
|
44
|
+
return this.forward.get(address);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
BiMap.prototype.get = BiMap.prototype.getValueByKey;
|
|
49
|
+
BiMap.prototype.set = BiMap.prototype.add;
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
import { computeStringHash } from "../../../core/primitives/strings/computeStringHash.js";
|
|
7
6
|
import { assert } from "../../../core/assert.js";
|
|
7
|
+
import { isArrayEqualStrict } from "../../../core/collection/array/isArrayEqualStrict.js";
|
|
8
|
+
import { computeStringHash } from "../../../core/primitives/strings/computeStringHash.js";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Stores textual tags, useful for marking entities
|
|
@@ -12,7 +13,7 @@ import { assert } from "../../../core/assert.js";
|
|
|
12
13
|
export class Tag {
|
|
13
14
|
/**
|
|
14
15
|
* @private
|
|
15
|
-
* @type {
|
|
16
|
+
* @type {string[]}
|
|
16
17
|
*/
|
|
17
18
|
values = [];
|
|
18
19
|
|
|
@@ -194,41 +195,31 @@ export class Tag {
|
|
|
194
195
|
* @return {boolean}
|
|
195
196
|
*/
|
|
196
197
|
equals(other) {
|
|
197
|
-
|
|
198
|
-
const s0 = this.values;
|
|
199
|
-
|
|
200
|
-
const s1 = other.values;
|
|
201
|
-
|
|
202
|
-
const n0 = s0.length;
|
|
203
|
-
const n1 = s1.length;
|
|
204
|
-
|
|
205
|
-
if (n0 !== n1) {
|
|
206
|
-
//wrong length
|
|
207
|
-
return false;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
for (let i = 0; i < n0; i++) {
|
|
211
|
-
const v0 = s0[i];
|
|
212
|
-
const v1 = s1[i];
|
|
213
|
-
|
|
214
|
-
if (v0 !== v1) {
|
|
215
|
-
return false;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
return true;
|
|
198
|
+
return isArrayEqualStrict(this.values, other.values);
|
|
220
199
|
}
|
|
221
200
|
|
|
222
201
|
toJSON() {
|
|
223
202
|
return this.values;
|
|
224
203
|
}
|
|
225
204
|
|
|
205
|
+
/**
|
|
206
|
+
*
|
|
207
|
+
* @param {string[]|string} json
|
|
208
|
+
*/
|
|
226
209
|
fromJSON(json) {
|
|
210
|
+
|
|
211
|
+
this.clear();
|
|
212
|
+
|
|
227
213
|
if (typeof json === "string") {
|
|
228
|
-
this.clear();
|
|
229
214
|
this.add(json);
|
|
230
|
-
} else
|
|
231
|
-
|
|
215
|
+
} else {
|
|
216
|
+
assert.isArray(json, 'json');
|
|
217
|
+
|
|
218
|
+
const n = json.length;
|
|
219
|
+
|
|
220
|
+
for (let i = 0; i < n; i++) {
|
|
221
|
+
this.add(json[i]);
|
|
222
|
+
}
|
|
232
223
|
}
|
|
233
224
|
}
|
|
234
225
|
|
|
@@ -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,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
|
/**
|
|
@@ -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
|
/**
|