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