@woosh/meep-engine 2.75.7 → 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/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/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
package/build/meep.module.js
CHANGED
|
@@ -61261,46 +61261,47 @@ function heightMap2NormalMap(renderer, sampler) {
|
|
|
61261
61261
|
return new Sampler2D(rgb, 3, width, height);
|
|
61262
61262
|
}
|
|
61263
61263
|
|
|
61264
|
-
|
|
61265
|
-
this.used = new Set();
|
|
61266
|
-
}
|
|
61264
|
+
class WebGLRendererPool {
|
|
61267
61265
|
|
|
61268
|
-
|
|
61269
|
-
const canvas = document.createElement('canvas');
|
|
61270
|
-
const context = canvas.getContext('webgl2', { antialias: true });
|
|
61266
|
+
used = new Set();
|
|
61271
61267
|
|
|
61272
|
-
|
|
61273
|
-
|
|
61274
|
-
context,
|
|
61275
|
-
canvas
|
|
61276
|
-
});
|
|
61268
|
+
get(options) {
|
|
61269
|
+
const canvas = document.createElement('canvas');
|
|
61270
|
+
const context = canvas.getContext('webgl2', { antialias: true });
|
|
61277
61271
|
|
|
61278
|
-
|
|
61272
|
+
const renderer = new WebGLRenderer({
|
|
61273
|
+
alpha: true,
|
|
61274
|
+
context,
|
|
61275
|
+
canvas
|
|
61276
|
+
});
|
|
61279
61277
|
|
|
61280
|
-
|
|
61281
|
-
return renderer;
|
|
61282
|
-
};
|
|
61278
|
+
assert.equal(renderer.domElement, canvas, 'renderer.domElement !== canvas');
|
|
61283
61279
|
|
|
61284
|
-
|
|
61285
|
-
|
|
61286
|
-
* @param {THREE.WebGLRenderer} renderer
|
|
61287
|
-
* @returns {boolean}
|
|
61288
|
-
*/
|
|
61289
|
-
WebGLRendererPool.prototype.release = function (renderer) {
|
|
61290
|
-
if (!this.used.has(renderer)) {
|
|
61291
|
-
//not from this pool
|
|
61292
|
-
return false;
|
|
61280
|
+
this.used.add(renderer);
|
|
61281
|
+
return renderer;
|
|
61293
61282
|
}
|
|
61294
|
-
this.used.delete(renderer);
|
|
61295
61283
|
|
|
61296
|
-
|
|
61297
|
-
|
|
61298
|
-
|
|
61284
|
+
/**
|
|
61285
|
+
*
|
|
61286
|
+
* @param {THREE.WebGLRenderer} renderer
|
|
61287
|
+
* @returns {boolean}
|
|
61288
|
+
*/
|
|
61289
|
+
release(renderer) {
|
|
61290
|
+
if (!this.used.has(renderer)) {
|
|
61291
|
+
//not from this pool
|
|
61292
|
+
return false;
|
|
61293
|
+
}
|
|
61294
|
+
this.used.delete(renderer);
|
|
61295
|
+
|
|
61296
|
+
renderer.forceContextLoss();
|
|
61297
|
+
renderer.dispose();
|
|
61298
|
+
renderer.domElement = null;
|
|
61299
61299
|
|
|
61300
|
-
|
|
61301
|
-
}
|
|
61300
|
+
return true;
|
|
61301
|
+
}
|
|
61302
61302
|
|
|
61303
|
-
|
|
61303
|
+
static global = new WebGLRendererPool();
|
|
61304
|
+
}
|
|
61304
61305
|
|
|
61305
61306
|
/**
|
|
61306
61307
|
*
|
|
@@ -62970,185 +62971,6 @@ Cache.prototype.delete = Cache.prototype.remove;
|
|
|
62970
62971
|
*/
|
|
62971
62972
|
Cache.prototype.has = Cache.prototype.contains;
|
|
62972
62973
|
|
|
62973
|
-
/**
|
|
62974
|
-
* Compute byte size of a UTF8 string
|
|
62975
|
-
* @param {string} value
|
|
62976
|
-
* @returns {number}
|
|
62977
|
-
*/
|
|
62978
|
-
function string_compute_byte_size(value) {
|
|
62979
|
-
const length = value.length;
|
|
62980
|
-
|
|
62981
|
-
let p = 0;
|
|
62982
|
-
|
|
62983
|
-
for (let i = 0; i < length; i++) {
|
|
62984
|
-
let c = value.charCodeAt(i);
|
|
62985
|
-
while (c > 0xff) {
|
|
62986
|
-
p++;
|
|
62987
|
-
c >>= 8;
|
|
62988
|
-
}
|
|
62989
|
-
p++;
|
|
62990
|
-
}
|
|
62991
|
-
|
|
62992
|
-
return p;
|
|
62993
|
-
}
|
|
62994
|
-
|
|
62995
|
-
/**
|
|
62996
|
-
*
|
|
62997
|
-
* @type {Cache<String,Sampler2D>}
|
|
62998
|
-
*/
|
|
62999
|
-
const cache$1 = new Cache({
|
|
63000
|
-
maxWeight: 304857600,
|
|
63001
|
-
keyHashFunction: computeStringHash,
|
|
63002
|
-
keyWeigher: string_compute_byte_size,
|
|
63003
|
-
/**
|
|
63004
|
-
*
|
|
63005
|
-
* @param {Sampler2D} sampler
|
|
63006
|
-
* @returns {number}
|
|
63007
|
-
*/
|
|
63008
|
-
valueWeigher(sampler) {
|
|
63009
|
-
return sampler.computeByteSize();
|
|
63010
|
-
}
|
|
63011
|
-
});
|
|
63012
|
-
|
|
63013
|
-
class TerrainLayer {
|
|
63014
|
-
constructor() {
|
|
63015
|
-
/**
|
|
63016
|
-
*
|
|
63017
|
-
* @type {String}
|
|
63018
|
-
*/
|
|
63019
|
-
this.textureDiffuseURL = "";
|
|
63020
|
-
|
|
63021
|
-
/**
|
|
63022
|
-
*
|
|
63023
|
-
* @type {Sampler2D}
|
|
63024
|
-
*/
|
|
63025
|
-
this.diffuse = Sampler2D.uint8(3, 1, 1);
|
|
63026
|
-
|
|
63027
|
-
/**
|
|
63028
|
-
*
|
|
63029
|
-
* @type {Vector2}
|
|
63030
|
-
*/
|
|
63031
|
-
this.size = new Vector2(1, 1);
|
|
63032
|
-
|
|
63033
|
-
/**
|
|
63034
|
-
* Additional free-form JSON metadata
|
|
63035
|
-
* @type {Object}
|
|
63036
|
-
*/
|
|
63037
|
-
this.extra = {};
|
|
63038
|
-
|
|
63039
|
-
/**
|
|
63040
|
-
*
|
|
63041
|
-
* @type {Signal}
|
|
63042
|
-
*/
|
|
63043
|
-
this.onChanged = new Signal();
|
|
63044
|
-
}
|
|
63045
|
-
|
|
63046
|
-
toJSON() {
|
|
63047
|
-
return {
|
|
63048
|
-
textureDiffuseURL: this.textureDiffuseURL,
|
|
63049
|
-
size: this.size.toJSON(),
|
|
63050
|
-
extra: this.extra
|
|
63051
|
-
};
|
|
63052
|
-
}
|
|
63053
|
-
|
|
63054
|
-
fromJSON({ textureDiffuseURL, size, extra = {} }) {
|
|
63055
|
-
this.textureDiffuseURL = textureDiffuseURL;
|
|
63056
|
-
this.size.fromJSON(size);
|
|
63057
|
-
this.extra = extra;
|
|
63058
|
-
}
|
|
63059
|
-
|
|
63060
|
-
/**
|
|
63061
|
-
*
|
|
63062
|
-
* @param {string} url
|
|
63063
|
-
* @param {number} width
|
|
63064
|
-
* @param {number} height
|
|
63065
|
-
*/
|
|
63066
|
-
static from(url, width, height) {
|
|
63067
|
-
const r = new TerrainLayer();
|
|
63068
|
-
|
|
63069
|
-
r.textureDiffuseURL = url;
|
|
63070
|
-
r.size.set(width, height);
|
|
63071
|
-
|
|
63072
|
-
return r;
|
|
63073
|
-
}
|
|
63074
|
-
|
|
63075
|
-
/**
|
|
63076
|
-
*
|
|
63077
|
-
* @param {TerrainLayerDescription} d
|
|
63078
|
-
* @returns {TerrainLayer}
|
|
63079
|
-
*/
|
|
63080
|
-
static fromDescription(d) {
|
|
63081
|
-
return TerrainLayer.from(
|
|
63082
|
-
d.diffuse,
|
|
63083
|
-
d.size.x,
|
|
63084
|
-
d.size.y
|
|
63085
|
-
);
|
|
63086
|
-
}
|
|
63087
|
-
|
|
63088
|
-
/**
|
|
63089
|
-
*
|
|
63090
|
-
* @param {AssetManager} assetManager
|
|
63091
|
-
* @returns {Promise}
|
|
63092
|
-
*/
|
|
63093
|
-
loadTextureData(assetManager) {
|
|
63094
|
-
|
|
63095
|
-
const path = this.textureDiffuseURL;
|
|
63096
|
-
|
|
63097
|
-
/**
|
|
63098
|
-
*
|
|
63099
|
-
* @type {Sampler2D|null}
|
|
63100
|
-
*/
|
|
63101
|
-
const cached = cache$1.get(path);
|
|
63102
|
-
|
|
63103
|
-
if (cached !== null) {
|
|
63104
|
-
|
|
63105
|
-
console.log('Using cached terrain layer data for ', path);
|
|
63106
|
-
|
|
63107
|
-
this.diffuse.resize(cached.width, cached.height, false);
|
|
63108
|
-
|
|
63109
|
-
this.diffuse.data.set(cached.data);
|
|
63110
|
-
|
|
63111
|
-
this.onChanged.send0();
|
|
63112
|
-
|
|
63113
|
-
return Promise.resolve();
|
|
63114
|
-
|
|
63115
|
-
}
|
|
63116
|
-
|
|
63117
|
-
const assetPromise = assetManager.promise(path, GameAssetType.Image);
|
|
63118
|
-
|
|
63119
|
-
return assetPromise
|
|
63120
|
-
.then(assert => {
|
|
63121
|
-
const image = assert.create();
|
|
63122
|
-
|
|
63123
|
-
const source_item_size = image.itemSize;
|
|
63124
|
-
|
|
63125
|
-
const source_data = image.data;
|
|
63126
|
-
|
|
63127
|
-
// RGB
|
|
63128
|
-
const destination_item_size = 3;
|
|
63129
|
-
|
|
63130
|
-
if (this.diffuse === null || this.diffuse.width !== image.width || this.diffuse.height !== image.height) {
|
|
63131
|
-
// loaded image does not match the side of the layer
|
|
63132
|
-
this.diffuse = Sampler2D.uint8(destination_item_size, image.width, image.height);
|
|
63133
|
-
}
|
|
63134
|
-
|
|
63135
|
-
const source = new Sampler2D(source_data, source_item_size, image.width, image.height);
|
|
63136
|
-
|
|
63137
|
-
copy_Sampler2D_channel_data(source, this.diffuse);
|
|
63138
|
-
|
|
63139
|
-
this.onChanged.send0();
|
|
63140
|
-
|
|
63141
|
-
// write to cache
|
|
63142
|
-
const cacheCopy = Sampler2D.uint8(destination_item_size, image.width, image.height);
|
|
63143
|
-
|
|
63144
|
-
cacheCopy.data.set(this.diffuse.data);
|
|
63145
|
-
|
|
63146
|
-
cache$1.put(path, cacheCopy);
|
|
63147
|
-
|
|
63148
|
-
});
|
|
63149
|
-
}
|
|
63150
|
-
}
|
|
63151
|
-
|
|
63152
62974
|
/**
|
|
63153
62975
|
* @template T
|
|
63154
62976
|
* @param {T[]} array
|
|
@@ -64176,6 +63998,191 @@ function conditionEqualsStrict(v) {
|
|
|
64176
63998
|
return this === v;
|
|
64177
63999
|
}
|
|
64178
64000
|
|
|
64001
|
+
/**
|
|
64002
|
+
* Compute byte size of a UTF8 string
|
|
64003
|
+
* @param {string} value
|
|
64004
|
+
* @returns {number}
|
|
64005
|
+
*/
|
|
64006
|
+
function string_compute_byte_size(value) {
|
|
64007
|
+
const length = value.length;
|
|
64008
|
+
|
|
64009
|
+
let p = 0;
|
|
64010
|
+
|
|
64011
|
+
for (let i = 0; i < length; i++) {
|
|
64012
|
+
let c = value.charCodeAt(i);
|
|
64013
|
+
while (c > 0xff) {
|
|
64014
|
+
p++;
|
|
64015
|
+
c >>= 8;
|
|
64016
|
+
}
|
|
64017
|
+
p++;
|
|
64018
|
+
}
|
|
64019
|
+
|
|
64020
|
+
return p;
|
|
64021
|
+
}
|
|
64022
|
+
|
|
64023
|
+
/**
|
|
64024
|
+
*
|
|
64025
|
+
* @type {Cache<String,Sampler2D>}
|
|
64026
|
+
*/
|
|
64027
|
+
const cache$1 = new Cache({
|
|
64028
|
+
maxWeight: 304857600,
|
|
64029
|
+
keyHashFunction: computeStringHash,
|
|
64030
|
+
keyWeigher: string_compute_byte_size,
|
|
64031
|
+
/**
|
|
64032
|
+
*
|
|
64033
|
+
* @param {Sampler2D} sampler
|
|
64034
|
+
* @returns {number}
|
|
64035
|
+
*/
|
|
64036
|
+
valueWeigher(sampler) {
|
|
64037
|
+
return sampler.computeByteSize();
|
|
64038
|
+
}
|
|
64039
|
+
});
|
|
64040
|
+
|
|
64041
|
+
class TerrainLayer {
|
|
64042
|
+
|
|
64043
|
+
/**
|
|
64044
|
+
*
|
|
64045
|
+
* @type {String}
|
|
64046
|
+
*/
|
|
64047
|
+
textureDiffuseURL = "";
|
|
64048
|
+
|
|
64049
|
+
/**
|
|
64050
|
+
*
|
|
64051
|
+
* @type {Sampler2D}
|
|
64052
|
+
*/
|
|
64053
|
+
diffuse = Sampler2D.uint8(3, 1, 1);
|
|
64054
|
+
|
|
64055
|
+
/**
|
|
64056
|
+
*
|
|
64057
|
+
* @type {Vector2}
|
|
64058
|
+
*/
|
|
64059
|
+
size = new Vector2(1, 1);
|
|
64060
|
+
|
|
64061
|
+
/**
|
|
64062
|
+
* Additional free-form JSON metadata
|
|
64063
|
+
* @type {Object}
|
|
64064
|
+
*/
|
|
64065
|
+
extra = {};
|
|
64066
|
+
|
|
64067
|
+
/**
|
|
64068
|
+
*
|
|
64069
|
+
* @type {Signal}
|
|
64070
|
+
*/
|
|
64071
|
+
onChanged = new Signal();
|
|
64072
|
+
|
|
64073
|
+
|
|
64074
|
+
toJSON() {
|
|
64075
|
+
return {
|
|
64076
|
+
textureDiffuseURL: this.textureDiffuseURL,
|
|
64077
|
+
size: this.size.toJSON(),
|
|
64078
|
+
extra: this.extra
|
|
64079
|
+
};
|
|
64080
|
+
}
|
|
64081
|
+
|
|
64082
|
+
fromJSON({ textureDiffuseURL, size, extra = {} }) {
|
|
64083
|
+
this.textureDiffuseURL = textureDiffuseURL;
|
|
64084
|
+
this.size.fromJSON(size);
|
|
64085
|
+
this.extra = extra;
|
|
64086
|
+
}
|
|
64087
|
+
|
|
64088
|
+
/**
|
|
64089
|
+
*
|
|
64090
|
+
* @param {string} url
|
|
64091
|
+
* @param {number} width
|
|
64092
|
+
* @param {number} height
|
|
64093
|
+
*/
|
|
64094
|
+
static from(url, width, height) {
|
|
64095
|
+
const r = new TerrainLayer();
|
|
64096
|
+
|
|
64097
|
+
r.textureDiffuseURL = url;
|
|
64098
|
+
r.size.set(width, height);
|
|
64099
|
+
|
|
64100
|
+
return r;
|
|
64101
|
+
}
|
|
64102
|
+
|
|
64103
|
+
/**
|
|
64104
|
+
*
|
|
64105
|
+
* @param {TerrainLayerDescription} d
|
|
64106
|
+
* @returns {TerrainLayer}
|
|
64107
|
+
*/
|
|
64108
|
+
static fromDescription(d) {
|
|
64109
|
+
return TerrainLayer.from(
|
|
64110
|
+
d.diffuse,
|
|
64111
|
+
d.size.x,
|
|
64112
|
+
d.size.y
|
|
64113
|
+
);
|
|
64114
|
+
}
|
|
64115
|
+
|
|
64116
|
+
/**
|
|
64117
|
+
*
|
|
64118
|
+
* @param {AssetManager} assetManager
|
|
64119
|
+
* @returns {Promise}
|
|
64120
|
+
*/
|
|
64121
|
+
loadTextureData(assetManager) {
|
|
64122
|
+
|
|
64123
|
+
const path = this.textureDiffuseURL;
|
|
64124
|
+
|
|
64125
|
+
/**
|
|
64126
|
+
*
|
|
64127
|
+
* @type {Sampler2D|null}
|
|
64128
|
+
*/
|
|
64129
|
+
const cached = cache$1.get(path);
|
|
64130
|
+
|
|
64131
|
+
if (cached !== null) {
|
|
64132
|
+
|
|
64133
|
+
console.log('Using cached terrain layer data for ', path);
|
|
64134
|
+
|
|
64135
|
+
this.diffuse.resize(cached.width, cached.height, false);
|
|
64136
|
+
|
|
64137
|
+
this.diffuse.data.set(cached.data);
|
|
64138
|
+
|
|
64139
|
+
this.onChanged.send0();
|
|
64140
|
+
|
|
64141
|
+
return Promise.resolve();
|
|
64142
|
+
|
|
64143
|
+
}
|
|
64144
|
+
|
|
64145
|
+
const assetPromise = assetManager.promise(path, GameAssetType.Image);
|
|
64146
|
+
|
|
64147
|
+
return assetPromise
|
|
64148
|
+
.then(assert => {
|
|
64149
|
+
const image = assert.create();
|
|
64150
|
+
|
|
64151
|
+
const source_item_size = image.itemSize;
|
|
64152
|
+
|
|
64153
|
+
const source_data = image.data;
|
|
64154
|
+
|
|
64155
|
+
// RGB
|
|
64156
|
+
const destination_item_size = 3;
|
|
64157
|
+
|
|
64158
|
+
if (this.diffuse === null || this.diffuse.width !== image.width || this.diffuse.height !== image.height) {
|
|
64159
|
+
// loaded image does not match the side of the layer
|
|
64160
|
+
this.diffuse = Sampler2D.uint8(destination_item_size, image.width, image.height);
|
|
64161
|
+
}
|
|
64162
|
+
|
|
64163
|
+
const source = new Sampler2D(source_data, source_item_size, image.width, image.height);
|
|
64164
|
+
|
|
64165
|
+
copy_Sampler2D_channel_data(source, this.diffuse);
|
|
64166
|
+
|
|
64167
|
+
this.onChanged.send0();
|
|
64168
|
+
|
|
64169
|
+
// write to cache
|
|
64170
|
+
const cacheCopy = Sampler2D.uint8(destination_item_size, image.width, image.height);
|
|
64171
|
+
|
|
64172
|
+
cacheCopy.data.set(this.diffuse.data);
|
|
64173
|
+
|
|
64174
|
+
cache$1.put(path, cacheCopy);
|
|
64175
|
+
|
|
64176
|
+
});
|
|
64177
|
+
}
|
|
64178
|
+
}
|
|
64179
|
+
|
|
64180
|
+
/**
|
|
64181
|
+
* @readonly
|
|
64182
|
+
* @type {boolean}
|
|
64183
|
+
*/
|
|
64184
|
+
TerrainLayer.prototype.isTerrainLayer = true;
|
|
64185
|
+
|
|
64179
64186
|
class ScaledTextureKey {
|
|
64180
64187
|
uri = '';
|
|
64181
64188
|
|
|
@@ -64430,6 +64437,7 @@ class TerrainLayers {
|
|
|
64430
64437
|
*/
|
|
64431
64438
|
addLayer(layer) {
|
|
64432
64439
|
assert.defined(layer);
|
|
64440
|
+
assert.equal(layer.isTerrainLayer, true, 'layer.isTerrainLayer !== true');
|
|
64433
64441
|
|
|
64434
64442
|
const index = this.layers.length;
|
|
64435
64443
|
|
|
@@ -88674,20 +88682,19 @@ class Graph {
|
|
|
88674
88682
|
* Contains serializers for various data types as well as data upgraders which enable support for serialization format changes
|
|
88675
88683
|
*/
|
|
88676
88684
|
class BinarySerializationRegistry {
|
|
88677
|
-
|
|
88678
|
-
|
|
88679
|
-
|
|
88680
|
-
|
|
88681
|
-
|
|
88682
|
-
|
|
88683
|
-
|
|
88684
|
-
|
|
88685
|
-
|
|
88686
|
-
|
|
88687
|
-
|
|
88688
|
-
|
|
88689
|
-
|
|
88690
|
-
}
|
|
88685
|
+
|
|
88686
|
+
/**
|
|
88687
|
+
* @readonly
|
|
88688
|
+
* @private
|
|
88689
|
+
* @type {Map<string, Graph<BinaryClassUpgrader>>}
|
|
88690
|
+
*/
|
|
88691
|
+
upgraders = new Map();
|
|
88692
|
+
/**
|
|
88693
|
+
* @readonly
|
|
88694
|
+
* @private
|
|
88695
|
+
* @type {Map<string, BinaryClassSerializationAdapter>}
|
|
88696
|
+
*/
|
|
88697
|
+
serializers = new Map();
|
|
88691
88698
|
|
|
88692
88699
|
/**
|
|
88693
88700
|
*
|
|
@@ -89506,6 +89513,30 @@ class MaterialManager {
|
|
|
89506
89513
|
}
|
|
89507
89514
|
|
|
89508
89515
|
class FrameBuffer {
|
|
89516
|
+
/**
|
|
89517
|
+
* is expected to be bound during initialization
|
|
89518
|
+
* @type {WebGLRenderTarget}
|
|
89519
|
+
*/
|
|
89520
|
+
renderTarget = null;
|
|
89521
|
+
|
|
89522
|
+
/**
|
|
89523
|
+
* Number of users of the frame buffer
|
|
89524
|
+
* @type {number}
|
|
89525
|
+
*/
|
|
89526
|
+
referenceCount = 0;
|
|
89527
|
+
|
|
89528
|
+
/**
|
|
89529
|
+
* Dependency frame buffers
|
|
89530
|
+
* @type {string[]}
|
|
89531
|
+
*/
|
|
89532
|
+
dependencies = [];
|
|
89533
|
+
|
|
89534
|
+
/**
|
|
89535
|
+
* Size of the frame buffer in pixels
|
|
89536
|
+
* @type {Vector2}
|
|
89537
|
+
*/
|
|
89538
|
+
size = new Vector2(0, 0);
|
|
89539
|
+
|
|
89509
89540
|
/**
|
|
89510
89541
|
*
|
|
89511
89542
|
* @param {string} id
|
|
@@ -89518,29 +89549,6 @@ class FrameBuffer {
|
|
|
89518
89549
|
*/
|
|
89519
89550
|
this.id = id;
|
|
89520
89551
|
|
|
89521
|
-
/**
|
|
89522
|
-
* is expected to be bound during initialization
|
|
89523
|
-
* @type {WebGLRenderTarget}
|
|
89524
|
-
*/
|
|
89525
|
-
this.renderTarget = null;
|
|
89526
|
-
|
|
89527
|
-
/**
|
|
89528
|
-
* Number of users of the frame buffer
|
|
89529
|
-
* @type {number}
|
|
89530
|
-
*/
|
|
89531
|
-
this.referenceCount = 0;
|
|
89532
|
-
|
|
89533
|
-
/**
|
|
89534
|
-
* Dependency frame buffers
|
|
89535
|
-
* @type {string[]}
|
|
89536
|
-
*/
|
|
89537
|
-
this.dependencies = [];
|
|
89538
|
-
|
|
89539
|
-
/**
|
|
89540
|
-
* Size of the frame buffer in pixels
|
|
89541
|
-
* @type {Vector2}
|
|
89542
|
-
*/
|
|
89543
|
-
this.size = new Vector2(0, 0);
|
|
89544
89552
|
|
|
89545
89553
|
}
|
|
89546
89554
|
|
|
@@ -100097,6 +100105,12 @@ ObjectPoolFactory.prototype.release = function (object) {
|
|
|
100097
100105
|
* @template Key, Value
|
|
100098
100106
|
*/
|
|
100099
100107
|
class ImmutableObjectPool {
|
|
100108
|
+
/**
|
|
100109
|
+
*
|
|
100110
|
+
* @type {Signal<Key,Value>}
|
|
100111
|
+
*/
|
|
100112
|
+
onRemoved = new Signal()
|
|
100113
|
+
|
|
100100
100114
|
constructor({ capacity = 100, perKeyCapacity = 10 } = {}) {
|
|
100101
100115
|
/**
|
|
100102
100116
|
*
|
|
@@ -100181,15 +100195,17 @@ class ImmutableObjectPool {
|
|
|
100181
100195
|
|
|
100182
100196
|
const elements = this.data.get(key);
|
|
100183
100197
|
|
|
100184
|
-
|
|
100185
|
-
this.data.delete(key);
|
|
100186
|
-
} else {
|
|
100187
|
-
const i = elements.indexOf(el);
|
|
100198
|
+
const i = elements.indexOf(el);
|
|
100188
100199
|
|
|
100189
|
-
|
|
100200
|
+
elements.splice(i, 1);
|
|
100201
|
+
|
|
100202
|
+
if (elements.length === 0) {
|
|
100203
|
+
this.data.delete(key);
|
|
100190
100204
|
}
|
|
100191
100205
|
|
|
100192
100206
|
this.size--;
|
|
100207
|
+
|
|
100208
|
+
this.onRemoved.send2(key, el.value);
|
|
100193
100209
|
}
|
|
100194
100210
|
|
|
100195
100211
|
add(key, value) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import LabelView from "../../../src/view/common/LabelView.js";
|
|
1
2
|
import EmptyView from "../../../src/view/elements/EmptyView.js";
|
|
3
|
+
import { createFieldEditor } from "./createFieldEditor.js";
|
|
2
4
|
import { FieldDescriptor } from "./FieldDescriptor.js";
|
|
3
5
|
import { FieldValueAdapter } from "./FieldValueAdapter.js";
|
|
4
|
-
import { createFieldEditor } from "./createFieldEditor.js";
|
|
5
6
|
import { findNearestRegisteredType } from "./findNearestRegisteredType.js";
|
|
6
|
-
import LabelView from "../../../src/view/common/LabelView.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @template T
|
package/package.json
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { CacheElement } from "../../cache/CacheElement.js";
|
|
2
2
|
import { HashMap } from "../../collection/map/HashMap.js";
|
|
3
|
+
import Signal from "../../events/signal/Signal.js";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* @template Key, Value
|
|
6
7
|
*/
|
|
7
8
|
export class ImmutableObjectPool {
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @type {Signal<Key,Value>}
|
|
12
|
+
*/
|
|
13
|
+
onRemoved = new Signal()
|
|
14
|
+
|
|
8
15
|
constructor({ capacity = 100, perKeyCapacity = 10 } = {}) {
|
|
9
16
|
/**
|
|
10
17
|
*
|
|
@@ -89,15 +96,17 @@ export class ImmutableObjectPool {
|
|
|
89
96
|
|
|
90
97
|
const elements = this.data.get(key);
|
|
91
98
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const i = elements.indexOf(el);
|
|
99
|
+
const i = elements.indexOf(el);
|
|
100
|
+
|
|
101
|
+
elements.splice(i, 1);
|
|
96
102
|
|
|
97
|
-
|
|
103
|
+
if (elements.length === 0) {
|
|
104
|
+
this.data.delete(key);
|
|
98
105
|
}
|
|
99
106
|
|
|
100
107
|
this.size--;
|
|
108
|
+
|
|
109
|
+
this.onRemoved.send2(key, el.value);
|
|
101
110
|
}
|
|
102
111
|
|
|
103
112
|
add(key, value) {
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
+
import { assert } from "../../../core/assert.js";
|
|
1
2
|
import Task from "../../../core/process/task/Task.js";
|
|
2
3
|
import { TaskSignal } from "../../../core/process/task/TaskSignal.js";
|
|
3
|
-
import {
|
|
4
|
+
import { emptyTask } from "../../../core/process/task/util/emptyTask.js";
|
|
4
5
|
import { BinaryCollectionDeSerializer } from "./binary/collection/BinaryCollectionDeSerializer.js";
|
|
5
6
|
import { BinaryObjectSerializationAdapter } from "./binary/object/BinaryObjectSerializationAdapter.js";
|
|
6
|
-
import { emptyTask } from "../../../core/process/task/util/emptyTask.js";
|
|
7
7
|
|
|
8
8
|
class BinaryBufferDeSerializer {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this.registry = null;
|
|
15
|
-
}
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @type {BinarySerializationRegistry}
|
|
12
|
+
*/
|
|
13
|
+
registry = null;
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
16
|
*
|