@woosh/meep-engine 2.75.6 → 2.75.8
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 +268 -252
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +268 -252
- package/editor/ecs/component/createObjectEditor.js +2 -2
- package/package.json +1 -1
- package/src/core/geom/3d/frustum/read_three_planes_to_array.d.ts +3 -0
- package/src/core/model/object/ImmutableObjectPool.js +14 -5
- package/src/engine/ecs/storage/BinaryBufferDeSerializer.js +7 -9
- package/src/engine/ecs/storage/BinaryBufferSerializer.js +15 -16
- package/src/engine/ecs/storage/binary/BinaryClassUpgrader.js +10 -59
- package/src/engine/ecs/storage/binary/BinarySerializationRegistry.js +14 -15
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionDeSerializer.js +3 -3
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +60 -62
- package/src/engine/ecs/storage/binary/executeBinaryClassUpgraderChain.js +46 -0
- package/src/engine/ecs/storage/binary/object/BinaryObjectSerializationAdapter.js +2 -2
- package/src/engine/ecs/terrain/ecs/layers/TerrainLayer.js +37 -31
- package/src/engine/ecs/terrain/ecs/layers/TerrainLayers.js +8 -7
- package/src/engine/graphics/render/RendererPool.js +36 -40
- package/src/engine/graphics/render/buffer/FrameBuffer.js +25 -24
- package/src/engine/graphics/render/buffer/RenderGraph.js +21 -21
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +1 -1
- package/src/engine/graphics/render/frame_graph/IRenderContext.js +31 -1
- package/src/engine/graphics/render/frame_graph/RenderGraph.js +5 -5
- package/src/engine/graphics/render/frame_graph/RenderTarget.js +9 -0
- package/src/engine/graphics/render/frame_graph/RenderTextureManager.js +57 -0
- package/src/engine/graphics/render/frame_graph/ResourceEntry.js +7 -5
- package/src/engine/graphics/render/frame_graph/TextureDescriptor.js +48 -33
- package/src/engine/graphics/render/frame_graph/TextureInitialState.js +14 -0
- package/src/engine/graphics/render/frame_graph/sample/deferred/CopyPass.js +20 -0
- package/src/engine/graphics/render/frame_graph/sample/deferred/LightingPass.js +4 -0
- package/src/engine/graphics/render/frame_graph/sample/deferred/run.js +34 -6
- package/src/engine/graphics/render/frame_graph/webgl/WebGLRenderContext.js +34 -0
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +3 -2
- package/src/engine/graphics/sh3/gi/prototypeSHGI.js +92 -0
- package/src/engine/graphics/texture/virtual/{v2/VirtualTextureMemoryMapping.js → VirtualTextureMemoryMapping.js} +2 -26
- package/src/engine/graphics/texture/virtual/{v2/VirtualTexturePage.js → VirtualTexturePage.js} +10 -10
- package/src/engine/graphics/texture/virtual/{v2/VirtualTextureTileLoader.js → VirtualTextureTileLoader.js} +7 -7
- package/src/engine/graphics/texture/virtual/{v2/VirtualTextureUsage.js → VirtualTextureUsage.js} +1 -1
- package/src/engine/graphics/texture/virtual/{v2/VirtualTextureUsageUpdater.js → VirtualTextureUsageUpdater.js} +7 -7
- package/src/engine/graphics/texture/virtual/{v2/debug → debug}/ResidencyDebugView.js +4 -4
- package/src/engine/graphics/texture/virtual/{v2/debug → debug}/UsageDebugView.js +2 -2
- package/src/engine/graphics/texture/virtual/{v2/debug → debug}/UsagePyramidDebugView.js +4 -4
- package/src/engine/graphics/texture/virtual/{v2/prototype.js → prototype.js} +7 -7
- package/src/engine/graphics/texture/virtual/{v2/tile → tile}/compose_finger_print.js +1 -1
- package/src/engine/graphics/texture/virtual/{v2/tile → tile}/compose_tile_address.js +2 -2
- package/src/engine/graphics/texture/virtual/{v2/tile → tile}/tile_address_to_finger_print.js +1 -1
- package/src/core/geom/3d/frustum/read_frustum_planes_to_array.d.ts +0 -3
- package/src/engine/ecs/storage/json/Blueprint.js +0 -129
- package/src/engine/ecs/storage/json/EntityFactory.js +0 -207
- package/src/engine/ecs/storage/json/JSONDeSerializer.js +0 -148
- package/src/engine/ecs/storage/json/JSONSerializer.js +0 -132
- package/src/engine/ecs/storage/json/README.md +0 -5
- package/src/engine/graphics/render/webgpu/sample/MeshInstance.js +0 -108
- package/src/engine/graphics/render/webgpu/sample/fragmentDeferredRendering.wgsl +0 -71
- package/src/engine/graphics/render/webgpu/sample/fragmentGBuffersDebugView.wgsl +0 -39
- package/src/engine/graphics/render/webgpu/sample/fragmentWriteGBuffers.wgsl +0 -21
- package/src/engine/graphics/render/webgpu/sample/lightUpdate.wgsl +0 -41
- package/src/engine/graphics/render/webgpu/sample/main.js +0 -605
- package/src/engine/graphics/render/webgpu/sample/vertexTextureQuad.wgsl +0 -9
- package/src/engine/graphics/render/webgpu/sample/vertexWriteGBuffers.wgsl +0 -30
- package/src/engine/graphics/texture/virtual/TileOperation.js +0 -13
- package/src/engine/graphics/texture/virtual/TileTree.js +0 -150
- package/src/engine/graphics/texture/virtual/TileTree.spec.js +0 -58
- package/src/engine/graphics/texture/virtual/TileUsage.js +0 -137
- package/src/engine/graphics/texture/virtual/VirtualTexture.js +0 -238
- package/src/engine/graphics/texture/virtual/VirtualTexture.spec.js +0 -39
- package/src/engine/graphics/texture/virtual/page/TilePage.js +0 -148
- package/src/engine/graphics/texture/virtual/page/TilePageSlot.js +0 -36
- package/src/engine/graphics/texture/virtual/tile/Tile.js +0 -44
- package/src/engine/graphics/texture/virtual/tile/Tile.spec.js +0 -11
- package/src/engine/graphics/texture/virtual/tile/TileAddress.js +0 -63
- package/src/engine/graphics/texture/virtual/tile/TileAddress.spec.js +0 -30
- package/src/engine/graphics/texture/virtual/tile/TileLoader.js +0 -178
- package/src/engine/graphics/texture/virtual/tile/TileRequest.js +0 -40
- package/src/engine/graphics/texture/virtual/tile/TileStatus.js +0 -10
- /package/src/engine/graphics/texture/virtual/{v2/NOTES.md → NOTES.md} +0 -0
- /package/src/engine/graphics/texture/virtual/{v2/VirtualTextureMaterial.js → VirtualTextureMaterial.js} +0 -0
- /package/src/engine/graphics/texture/virtual/{v2/VirtualTextureUsageShader.js → VirtualTextureUsageShader.js} +0 -0
- /package/src/engine/graphics/texture/virtual/{v2/tile → tile}/VirtualTextureTile.js +0 -0
- /package/src/engine/graphics/texture/virtual/{v2/tile → tile}/decompose_finger_print.js +0 -0
- /package/src/engine/graphics/texture/virtual/{v2/tile → tile}/finger_print_to_tile_address.js +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { SerializationFlags, SerializationMetadata } from "../components/SerializationMetadata.js";
|
|
2
1
|
import { assert } from "../../../core/assert.js";
|
|
2
|
+
import { current_time_in_seconds } from "../../../core/time/current_time_in_seconds.js";
|
|
3
|
+
import { logger } from "../../logging/GlobalLogger.js";
|
|
4
|
+
import { SerializationFlags, SerializationMetadata } from "../components/SerializationMetadata.js";
|
|
3
5
|
import { BinaryCollectionSerializer } from "./binary/collection/BinaryCollectionSerializer.js";
|
|
4
|
-
import { COMPONENT_SERIALIZATION_TRANSIENT_FIELD } from "./COMPONENT_SERIALIZATION_TRANSIENT_FIELD.js";
|
|
5
6
|
import { BinaryObjectSerializationAdapter } from "./binary/object/BinaryObjectSerializationAdapter.js";
|
|
6
|
-
import {
|
|
7
|
-
import { current_time_in_seconds } from "../../../core/time/current_time_in_seconds.js";
|
|
7
|
+
import { COMPONENT_SERIALIZATION_TRANSIENT_FIELD } from "./COMPONENT_SERIALIZATION_TRANSIENT_FIELD.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @template T
|
|
@@ -50,18 +50,17 @@ function isEntityTransient(entity, dataset, smComponentIndex, componentInstance)
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
class BinaryBufferSerializer {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
* @type {BinarySerializationRegistry}
|
|
56
|
+
*/
|
|
57
|
+
registry = null;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @type {Engine|null}
|
|
62
|
+
*/
|
|
63
|
+
engine = null;
|
|
65
64
|
|
|
66
65
|
/**
|
|
67
66
|
*
|
|
@@ -1,66 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Upgrade binary data by executing a sequnece of upgraders on it
|
|
5
|
-
* @param {BinaryClassUpgrader[]} upgraders
|
|
6
|
-
* @param {BinaryBuffer} buffer
|
|
7
|
-
* @param {BinaryBuffer} tempBuffer0
|
|
8
|
-
* @param {BinaryBuffer} tempBuffer1
|
|
9
|
-
* @return {BinaryBuffer} new buffer with upgraded data
|
|
10
|
-
*/
|
|
11
|
-
export function executeBinaryClassUpgraderChain(upgraders, buffer, tempBuffer0, tempBuffer1) {
|
|
12
|
-
assert.ok(Array.isArray(upgraders), 'upgraders must be an array, instead was something else');
|
|
13
|
-
assert.defined(buffer);
|
|
14
|
-
assert.defined(tempBuffer0);
|
|
15
|
-
assert.defined(tempBuffer1);
|
|
16
|
-
|
|
1
|
+
export class BinaryClassUpgrader {
|
|
17
2
|
|
|
18
3
|
/**
|
|
19
4
|
*
|
|
20
|
-
* @type {
|
|
5
|
+
* @type {number}
|
|
6
|
+
* @protected
|
|
21
7
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
//perform upgrade
|
|
30
|
-
for (
|
|
31
|
-
let i = 0;
|
|
32
|
-
i < upgraderCount;
|
|
33
|
-
i++, sourceBuffer = targetBuffer, targetBuffer = tempBuffers[i % 2]
|
|
34
|
-
) {
|
|
35
|
-
const upgrader = upgraders[i];
|
|
36
|
-
|
|
37
|
-
targetBuffer.position = 0;
|
|
38
|
-
|
|
39
|
-
upgrader.upgrade(sourceBuffer, targetBuffer);
|
|
40
|
-
|
|
41
|
-
//rewind target buffer so it can be read
|
|
42
|
-
targetBuffer.position = 0;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return sourceBuffer;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export class BinaryClassUpgrader {
|
|
49
|
-
constructor() {
|
|
50
|
-
/**
|
|
51
|
-
*
|
|
52
|
-
* @type {number}
|
|
53
|
-
* @protected
|
|
54
|
-
*/
|
|
55
|
-
this.__startVersion = 0;
|
|
56
|
-
/**
|
|
57
|
-
*
|
|
58
|
-
* @type {number}
|
|
59
|
-
* @protected
|
|
60
|
-
*/
|
|
61
|
-
this.__targetVersion = 0;
|
|
62
|
-
}
|
|
63
|
-
|
|
8
|
+
__startVersion = 0;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @type {number}
|
|
12
|
+
* @protected
|
|
13
|
+
*/
|
|
14
|
+
__targetVersion = 0;
|
|
64
15
|
|
|
65
16
|
/**
|
|
66
17
|
*
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import { Graph } from "../../../../core/graph/Graph.js";
|
|
2
1
|
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import { Graph } from "../../../../core/graph/Graph.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Contains serializers for various data types as well as data upgraders which enable support for serialization format changes
|
|
6
6
|
*/
|
|
7
7
|
export class BinarySerializationRegistry {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @readonly
|
|
11
|
+
* @private
|
|
12
|
+
* @type {Map<string, Graph<BinaryClassUpgrader>>}
|
|
13
|
+
*/
|
|
14
|
+
upgraders = new Map();
|
|
15
|
+
/**
|
|
16
|
+
* @readonly
|
|
17
|
+
* @private
|
|
18
|
+
* @type {Map<string, BinaryClassSerializationAdapter>}
|
|
19
|
+
*/
|
|
20
|
+
serializers = new Map();
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
*
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { BinaryBuffer } from "../../../../../core/binary/BinaryBuffer.js";
|
|
2
|
-
import { BinaryCollectionHeaderCodec, BinaryCollectionHeaderLayout } from "./BinaryCollectionHeaderCodec.js";
|
|
3
1
|
import { assert } from "../../../../../core/assert.js";
|
|
2
|
+
import { BinaryBuffer } from "../../../../../core/binary/BinaryBuffer.js";
|
|
4
3
|
import { IllegalStateException } from "../../../../../core/fsm/exceptions/IllegalStateException.js";
|
|
5
|
-
import { executeBinaryClassUpgraderChain } from "../BinaryClassUpgrader.js";
|
|
6
4
|
import { returnEmptyArray } from "../../../../../core/function/Functions.js";
|
|
7
5
|
import { objectKeyByValue } from "../../../../../core/model/object/objectKeyByValue.js";
|
|
6
|
+
import { executeBinaryClassUpgraderChain } from "../executeBinaryClassUpgraderChain.js";
|
|
7
|
+
import { BinaryCollectionHeaderCodec, BinaryCollectionHeaderLayout } from "./BinaryCollectionHeaderCodec.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
@@ -1,70 +1,68 @@
|
|
|
1
1
|
import { assert } from "../../../../../core/assert.js";
|
|
2
|
-
import { BinaryCollectionHeaderCodec, BinaryCollectionHeaderLayout } from "./BinaryCollectionHeaderCodec.js";
|
|
3
2
|
import { HashMap } from "../../../../../core/collection/map/HashMap.js";
|
|
4
3
|
import { returnEmptyArray } from "../../../../../core/function/Functions.js";
|
|
4
|
+
import { BinaryCollectionHeaderCodec, BinaryCollectionHeaderLayout } from "./BinaryCollectionHeaderCodec.js";
|
|
5
5
|
|
|
6
6
|
export class BinaryCollectionSerializer {
|
|
7
|
-
constructor() {
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @private
|
|
11
|
-
* @type {BinarySerializationRegistry}
|
|
12
|
-
*/
|
|
13
|
-
this.registry = null;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @private
|
|
17
|
-
* @type {BinaryBuffer}
|
|
18
|
-
*/
|
|
19
|
-
this.buffer = null;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @private
|
|
23
|
-
* @type {BinaryClassSerializationAdapter}
|
|
24
|
-
*/
|
|
25
|
-
this.adapter = null;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @type {String}
|
|
31
|
-
*/
|
|
32
|
-
this.className = null;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
36
|
-
* @type {boolean}
|
|
37
|
-
* @private
|
|
38
|
-
*/
|
|
39
|
-
this.__dictionaryEnabled = false;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* @private
|
|
43
|
-
* @type {number}
|
|
44
|
-
*/
|
|
45
|
-
this.elementCount = 0;
|
|
46
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @private
|
|
10
|
+
* @type {BinarySerializationRegistry}
|
|
11
|
+
*/
|
|
12
|
+
registry = null;
|
|
47
13
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
14
|
+
/**
|
|
15
|
+
* @private
|
|
16
|
+
* @type {BinaryBuffer}
|
|
17
|
+
*/
|
|
18
|
+
buffer = null;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @private
|
|
22
|
+
* @type {BinaryClassSerializationAdapter}
|
|
23
|
+
*/
|
|
24
|
+
adapter = null;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @type {String}
|
|
30
|
+
*/
|
|
31
|
+
className = null;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @type {boolean}
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
__dictionaryEnabled = false;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @private
|
|
42
|
+
* @type {number}
|
|
43
|
+
*/
|
|
44
|
+
elementCount = 0;
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @private
|
|
49
|
+
* @type {number}
|
|
50
|
+
*/
|
|
51
|
+
startAddress = 0;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @private
|
|
55
|
+
* @type {number}
|
|
56
|
+
*/
|
|
57
|
+
headerAddress = 0;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @private
|
|
61
|
+
* @type {Map<any, number>}
|
|
62
|
+
*/
|
|
63
|
+
dictionary = new HashMap({
|
|
64
|
+
capacity: 1024, //pre-allocate larger size to avoid rehashing
|
|
65
|
+
});
|
|
68
66
|
|
|
69
67
|
/**
|
|
70
68
|
*
|
|
@@ -115,10 +113,10 @@ export class BinaryCollectionSerializer {
|
|
|
115
113
|
*/
|
|
116
114
|
initialize({
|
|
117
115
|
adapterOptionsSupplier = returnEmptyArray,
|
|
118
|
-
|
|
116
|
+
problemConsumer = console.warn
|
|
119
117
|
} = {}) {
|
|
120
118
|
|
|
121
|
-
assert.isFunction(adapterOptionsSupplier,
|
|
119
|
+
assert.isFunction(adapterOptionsSupplier, 'adapterOptionsSupplier');
|
|
122
120
|
|
|
123
121
|
const className = this.className;
|
|
124
122
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Upgrade binary data by executing a sequnece of upgraders on it
|
|
5
|
+
* @param {BinaryClassUpgrader[]} upgraders
|
|
6
|
+
* @param {BinaryBuffer} buffer
|
|
7
|
+
* @param {BinaryBuffer} tempBuffer0
|
|
8
|
+
* @param {BinaryBuffer} tempBuffer1
|
|
9
|
+
* @return {BinaryBuffer} new buffer with upgraded data
|
|
10
|
+
*/
|
|
11
|
+
export function executeBinaryClassUpgraderChain(upgraders, buffer, tempBuffer0, tempBuffer1) {
|
|
12
|
+
assert.ok(Array.isArray(upgraders), 'upgraders must be an array, instead was something else');
|
|
13
|
+
assert.defined(buffer);
|
|
14
|
+
assert.defined(tempBuffer0);
|
|
15
|
+
assert.defined(tempBuffer1);
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @type {BinaryBuffer[]}
|
|
21
|
+
*/
|
|
22
|
+
const tempBuffers = [tempBuffer0, tempBuffer1];
|
|
23
|
+
|
|
24
|
+
let sourceBuffer = buffer;
|
|
25
|
+
let targetBuffer = tempBuffer0;
|
|
26
|
+
|
|
27
|
+
const upgraderCount = upgraders.length;
|
|
28
|
+
|
|
29
|
+
//perform upgrade
|
|
30
|
+
for (
|
|
31
|
+
let i = 0;
|
|
32
|
+
i < upgraderCount;
|
|
33
|
+
i++, sourceBuffer = targetBuffer, targetBuffer = tempBuffers[i % 2]
|
|
34
|
+
) {
|
|
35
|
+
const upgrader = upgraders[i];
|
|
36
|
+
|
|
37
|
+
targetBuffer.position = 0;
|
|
38
|
+
|
|
39
|
+
upgrader.upgrade(sourceBuffer, targetBuffer);
|
|
40
|
+
|
|
41
|
+
//rewind target buffer so it can be read
|
|
42
|
+
targetBuffer.position = 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return sourceBuffer;
|
|
46
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BinaryBuffer } from "../../../../../core/binary/BinaryBuffer.js";
|
|
2
|
-
import { executeBinaryClassUpgraderChain } from "../BinaryClassUpgrader.js";
|
|
3
1
|
import { assert } from "../../../../../core/assert.js";
|
|
2
|
+
import { BinaryBuffer } from "../../../../../core/binary/BinaryBuffer.js";
|
|
3
|
+
import { executeBinaryClassUpgraderChain } from "../executeBinaryClassUpgraderChain.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Tool for serializing and deserializing whole objects
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import Vector2 from "../../../../../core/geom/Vector2.js";
|
|
2
|
-
import { GameAssetType } from "../../../../asset/GameAssetType.js";
|
|
3
|
-
import { Sampler2D } from "../../../../graphics/texture/sampler/Sampler2D.js";
|
|
4
1
|
import { Cache } from "../../../../../core/cache/Cache.js";
|
|
5
2
|
import Signal from "../../../../../core/events/signal/Signal.js";
|
|
3
|
+
import Vector2 from "../../../../../core/geom/Vector2.js";
|
|
6
4
|
import { computeStringHash } from "../../../../../core/primitives/strings/computeStringHash.js";
|
|
7
|
-
import { copy_Sampler2D_channel_data } from "../../../../graphics/texture/sampler/copy_Sampler2D_channel_data.js";
|
|
8
5
|
import { string_compute_byte_size } from "../../../../../core/primitives/strings/string_compute_byte_size.js";
|
|
6
|
+
import { GameAssetType } from "../../../../asset/GameAssetType.js";
|
|
7
|
+
import { copy_Sampler2D_channel_data } from "../../../../graphics/texture/sampler/copy_Sampler2D_channel_data.js";
|
|
8
|
+
import { Sampler2D } from "../../../../graphics/texture/sampler/Sampler2D.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
*
|
|
@@ -26,37 +26,37 @@ const cache = new Cache({
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
export class TerrainLayer {
|
|
29
|
-
constructor() {
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
* @type {String}
|
|
33
|
-
*/
|
|
34
|
-
this.textureDiffuseURL = "";
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @type {String}
|
|
33
|
+
*/
|
|
34
|
+
textureDiffuseURL = "";
|
|
41
35
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @type {Sampler2D}
|
|
39
|
+
*/
|
|
40
|
+
diffuse = Sampler2D.uint8(3, 1, 1);
|
|
47
41
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @type {Vector2}
|
|
45
|
+
*/
|
|
46
|
+
size = new Vector2(1, 1);
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Additional free-form JSON metadata
|
|
50
|
+
* @type {Object}
|
|
51
|
+
*/
|
|
52
|
+
extra = {};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* @type {Signal}
|
|
57
|
+
*/
|
|
58
|
+
onChanged = new Signal();
|
|
53
59
|
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
* @type {Signal}
|
|
57
|
-
*/
|
|
58
|
-
this.onChanged = new Signal();
|
|
59
|
-
}
|
|
60
60
|
|
|
61
61
|
toJSON() {
|
|
62
62
|
return {
|
|
@@ -163,3 +163,9 @@ export class TerrainLayer {
|
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* @readonly
|
|
169
|
+
* @type {boolean}
|
|
170
|
+
*/
|
|
171
|
+
TerrainLayer.prototype.isTerrainLayer = true;
|
|
@@ -13,16 +13,16 @@ import {
|
|
|
13
13
|
UnsignedByteType
|
|
14
14
|
} from "three";
|
|
15
15
|
import { assert } from "../../../../../core/assert.js";
|
|
16
|
-
import Vector2 from "../../../../../core/geom/Vector2.js";
|
|
17
|
-
import { TerrainLayer } from "./TerrainLayer.js";
|
|
18
|
-
import { Sampler2D } from "../../../../graphics/texture/sampler/Sampler2D.js";
|
|
19
|
-
import { sampler2d_scale } from "../../../../graphics/texture/sampler/resize/sampler2d_scale.js";
|
|
20
|
-
import List from "../../../../../core/collection/list/List.js";
|
|
21
16
|
import { Cache } from "../../../../../core/cache/Cache.js";
|
|
22
|
-
import {
|
|
17
|
+
import { typed_array_copy } from "../../../../../core/collection/array/typed/typed_array_copy.js";
|
|
18
|
+
import List from "../../../../../core/collection/list/List.js";
|
|
19
|
+
import Vector2 from "../../../../../core/geom/Vector2.js";
|
|
23
20
|
import { invokeObjectEquals } from "../../../../../core/model/object/invokeObjectEquals.js";
|
|
24
21
|
import { invokeObjectHash } from "../../../../../core/model/object/invokeObjectHash.js";
|
|
25
|
-
import {
|
|
22
|
+
import { computeStringHash } from "../../../../../core/primitives/strings/computeStringHash.js";
|
|
23
|
+
import { sampler2d_scale } from "../../../../graphics/texture/sampler/resize/sampler2d_scale.js";
|
|
24
|
+
import { Sampler2D } from "../../../../graphics/texture/sampler/Sampler2D.js";
|
|
25
|
+
import { TerrainLayer } from "./TerrainLayer.js";
|
|
26
26
|
|
|
27
27
|
class ScaledTextureKey {
|
|
28
28
|
uri = '';
|
|
@@ -278,6 +278,7 @@ export class TerrainLayers {
|
|
|
278
278
|
*/
|
|
279
279
|
addLayer(layer) {
|
|
280
280
|
assert.defined(layer);
|
|
281
|
+
assert.equal(layer.isTerrainLayer, true, 'layer.isTerrainLayer !== true');
|
|
281
282
|
|
|
282
283
|
const index = this.layers.length;
|
|
283
284
|
|
|
@@ -1,48 +1,44 @@
|
|
|
1
1
|
import { WebGLRenderer } from 'three';
|
|
2
2
|
import { assert } from "../../../core/assert.js";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
WebGLRendererPool.prototype.get = function (options) {
|
|
9
|
-
const canvas = document.createElement('canvas');
|
|
10
|
-
const context = canvas.getContext('webgl2', { antialias: true });
|
|
11
|
-
|
|
12
|
-
const renderer = new WebGLRenderer({
|
|
13
|
-
alpha: true,
|
|
14
|
-
context,
|
|
15
|
-
canvas
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
assert.equal(renderer.domElement, canvas, 'renderer.domElement !== canvas');
|
|
19
|
-
|
|
20
|
-
this.used.add(renderer);
|
|
21
|
-
return renderer;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
* @param {THREE.WebGLRenderer} renderer
|
|
27
|
-
* @returns {boolean}
|
|
28
|
-
*/
|
|
29
|
-
WebGLRendererPool.prototype.release = function (renderer) {
|
|
30
|
-
if (!this.used.has(renderer)) {
|
|
31
|
-
//not from this pool
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
this.used.delete(renderer);
|
|
4
|
+
export class WebGLRendererPool {
|
|
5
|
+
|
|
6
|
+
used = new Set();
|
|
35
7
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
8
|
+
get(options) {
|
|
9
|
+
const canvas = document.createElement('canvas');
|
|
10
|
+
const context = canvas.getContext('webgl2', { antialias: true });
|
|
39
11
|
|
|
40
|
-
|
|
41
|
-
|
|
12
|
+
const renderer = new WebGLRenderer({
|
|
13
|
+
alpha: true,
|
|
14
|
+
context,
|
|
15
|
+
canvas
|
|
16
|
+
});
|
|
42
17
|
|
|
43
|
-
|
|
18
|
+
assert.equal(renderer.domElement, canvas, 'renderer.domElement !== canvas');
|
|
44
19
|
|
|
20
|
+
this.used.add(renderer);
|
|
21
|
+
return renderer;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param {THREE.WebGLRenderer} renderer
|
|
27
|
+
* @returns {boolean}
|
|
28
|
+
*/
|
|
29
|
+
release(renderer) {
|
|
30
|
+
if (!this.used.has(renderer)) {
|
|
31
|
+
//not from this pool
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
this.used.delete(renderer);
|
|
35
|
+
|
|
36
|
+
renderer.forceContextLoss();
|
|
37
|
+
renderer.dispose();
|
|
38
|
+
renderer.domElement = null;
|
|
39
|
+
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
};
|
|
43
|
+
static global = new WebGLRendererPool();
|
|
44
|
+
}
|
|
@@ -1,7 +1,31 @@
|
|
|
1
|
-
import Vector2 from "../../../../core/geom/Vector2.js";
|
|
2
1
|
import { WebGLRenderTarget } from "three";
|
|
2
|
+
import Vector2 from "../../../../core/geom/Vector2.js";
|
|
3
3
|
|
|
4
4
|
export class FrameBuffer {
|
|
5
|
+
/**
|
|
6
|
+
* is expected to be bound during initialization
|
|
7
|
+
* @type {WebGLRenderTarget}
|
|
8
|
+
*/
|
|
9
|
+
renderTarget = null;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Number of users of the frame buffer
|
|
13
|
+
* @type {number}
|
|
14
|
+
*/
|
|
15
|
+
referenceCount = 0;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Dependency frame buffers
|
|
19
|
+
* @type {string[]}
|
|
20
|
+
*/
|
|
21
|
+
dependencies = [];
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Size of the frame buffer in pixels
|
|
25
|
+
* @type {Vector2}
|
|
26
|
+
*/
|
|
27
|
+
size = new Vector2(0, 0);
|
|
28
|
+
|
|
5
29
|
/**
|
|
6
30
|
*
|
|
7
31
|
* @param {string} id
|
|
@@ -14,29 +38,6 @@ export class FrameBuffer {
|
|
|
14
38
|
*/
|
|
15
39
|
this.id = id;
|
|
16
40
|
|
|
17
|
-
/**
|
|
18
|
-
* is expected to be bound during initialization
|
|
19
|
-
* @type {WebGLRenderTarget}
|
|
20
|
-
*/
|
|
21
|
-
this.renderTarget = null;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Number of users of the frame buffer
|
|
25
|
-
* @type {number}
|
|
26
|
-
*/
|
|
27
|
-
this.referenceCount = 0;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Dependency frame buffers
|
|
31
|
-
* @type {string[]}
|
|
32
|
-
*/
|
|
33
|
-
this.dependencies = [];
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Size of the frame buffer in pixels
|
|
37
|
-
* @type {Vector2}
|
|
38
|
-
*/
|
|
39
|
-
this.size = new Vector2(0, 0);
|
|
40
41
|
|
|
41
42
|
}
|
|
42
43
|
|