@galacean/engine-core 1.2.0-beta.5 → 1.2.0-beta.7
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/dist/main.js +248 -157
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +248 -157
- package/dist/module.js +249 -158
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/2d/text/CharRenderInfo.d.ts +1 -0
- package/types/Camera.d.ts +7 -4
- package/types/DisorderedArray.d.ts +2 -2
- package/types/Entity.d.ts +4 -1
- package/types/RenderPipeline/BatchUtils.d.ts +1 -0
- package/types/RenderPipeline/BatcherManager.d.ts +1 -0
- package/types/RenderPipeline/DynamicGeometryData.d.ts +1 -0
- package/types/RenderPipeline/DynamicGeometryDataManager.d.ts +1 -0
- package/types/RenderPipeline/MaskManager.d.ts +1 -0
- package/types/RenderPipeline/PrimitiveChunk.d.ts +1 -0
- package/types/RenderPipeline/PrimitiveChunkManager.d.ts +1 -0
- package/types/RenderPipeline/RenderData2D.d.ts +14 -0
- package/types/RenderPipeline/SubPrimitiveChunk.d.ts +1 -0
- package/types/RenderPipeline/SubRenderElement.d.ts +22 -0
- package/types/RenderPipeline/VertexArea.d.ts +1 -0
- package/types/RenderPipeline/enums/ForceUploadShaderDataFlag.d.ts +15 -0
- package/types/RenderPipeline/enums/RenderDataUsage.d.ts +13 -0
- package/types/animation/AnimatorCondition.d.ts +13 -0
- package/types/animation/AnimatorControllerParameter.d.ts +10 -0
- package/types/animation/AnimatorStateTransition.d.ts +51 -0
- package/types/asset/ResourceManager.d.ts +3 -1
- package/types/enums/ReplacementFailureStrategy.d.ts +9 -0
- package/types/index.d.ts +1 -0
- package/types/input/pointer/PointerEvent.d.ts +4 -0
- package/types/input/pointer/PointerEventType.d.ts +7 -0
- package/types/postProcess/PostProcessManager.d.ts +1 -0
- package/types/postProcess/effects/BloomEffect.d.ts +94 -0
- package/types/postProcess/effects/TonemappingEffect.d.ts +35 -0
- package/types/postProcess/effects/index.d.ts +2 -0
- package/types/postProcess/index.d.ts +3 -0
- package/types/ui/Image.d.ts +38 -0
- package/types/ui/RedBlackTree.d.ts +2 -0
- package/types/ui/UICanvas.d.ts +55 -0
- package/types/ui/UIRenderer.d.ts +14 -0
- package/types/ui/UITransform.d.ts +20 -0
- package/types/ui/enums/BlockingObjects.d.ts +6 -0
- package/types/ui/enums/CanvasRenderMode.d.ts +8 -0
- package/types/ui/enums/ResolutionAdaptationStrategy.d.ts +10 -0
- package/types/ui/index.d.ts +6 -0
- package/types/utils/ClearableObjectPool.d.ts +16 -0
- package/types/utils/ObjectPool.d.ts +16 -0
- package/types/utils/Pool.d.ts +12 -0
- package/types/utils/ReturnableObjectPool.d.ts +16 -0
- package/types/utils/index.d.ts +3 -0
- package/types/Deprecated.d.ts +0 -101
- package/types/texture/enums/PixelFormat.d.ts +0 -73
- /package/types/{RenderPipeline/batcher/MeshBuffer.d.ts → 2d/assembler/ISpriteAssembler.d.ts} +0 -0
package/dist/miniprogram.js
CHANGED
|
@@ -3985,6 +3985,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
3985
3985
|
var program = this._glProgram;
|
|
3986
3986
|
var uniformInfos = this._getUniformInfos();
|
|
3987
3987
|
var attributeInfos = this._getAttributeInfos();
|
|
3988
|
+
var basicResources = this._engine._basicResources;
|
|
3988
3989
|
uniformInfos.forEach(function(param) {
|
|
3989
3990
|
var name = param.name, size = param.size, type = param.type;
|
|
3990
3991
|
var shaderUniform = new ShaderUniform(_this._engine);
|
|
@@ -4078,16 +4079,16 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
4078
4079
|
var defaultTexture;
|
|
4079
4080
|
switch(type){
|
|
4080
4081
|
case gl.SAMPLER_2D:
|
|
4081
|
-
defaultTexture =
|
|
4082
|
+
defaultTexture = basicResources.whiteTexture2D;
|
|
4082
4083
|
break;
|
|
4083
4084
|
case gl.SAMPLER_CUBE:
|
|
4084
|
-
defaultTexture =
|
|
4085
|
+
defaultTexture = basicResources.whiteTextureCube;
|
|
4085
4086
|
break;
|
|
4086
4087
|
case gl.UNSIGNED_INT_SAMPLER_2D:
|
|
4087
|
-
defaultTexture =
|
|
4088
|
+
defaultTexture = basicResources.uintWhiteTexture2D;
|
|
4088
4089
|
break;
|
|
4089
4090
|
case gl.SAMPLER_2D_ARRAY:
|
|
4090
|
-
defaultTexture =
|
|
4091
|
+
defaultTexture = basicResources.whiteTexture2DArray;
|
|
4091
4092
|
break;
|
|
4092
4093
|
case gl.SAMPLER_2D_SHADOW:
|
|
4093
4094
|
defaultTexture = _this._engine._depthTexture2D;
|
|
@@ -6417,14 +6418,15 @@ SlicedSpriteAssembler = __decorate([
|
|
|
6417
6418
|
}
|
|
6418
6419
|
this._endLoop(swapFn);
|
|
6419
6420
|
};
|
|
6420
|
-
_proto.forEachAndClean = function forEachAndClean(callbackFn) {
|
|
6421
|
+
_proto.forEachAndClean = function forEachAndClean(callbackFn, swapFn) {
|
|
6421
6422
|
this._startLoop();
|
|
6423
|
+
var preEnd = this.length;
|
|
6422
6424
|
var elements = this._elements;
|
|
6423
|
-
for(var i = 0, n =
|
|
6425
|
+
for(var i = 0, n = preEnd; i < n; i++){
|
|
6424
6426
|
var element = elements[i];
|
|
6425
6427
|
element && callbackFn(element);
|
|
6426
6428
|
}
|
|
6427
|
-
this.
|
|
6429
|
+
this._endLoopAndClean(preEnd, elements, swapFn);
|
|
6428
6430
|
};
|
|
6429
6431
|
_proto.sort = function sort(compareFn) {
|
|
6430
6432
|
Utils._quickSort(this._elements, 0, this.length, compareFn);
|
|
@@ -6457,9 +6459,17 @@ SlicedSpriteAssembler = __decorate([
|
|
|
6457
6459
|
this._blankCount = 0;
|
|
6458
6460
|
}
|
|
6459
6461
|
};
|
|
6460
|
-
_proto.
|
|
6462
|
+
_proto._endLoopAndClean = function _endLoopAndClean(preEnd, elements, swapFn) {
|
|
6463
|
+
var index = 0;
|
|
6464
|
+
for(var i = preEnd, n = this.length; i < n; i++){
|
|
6465
|
+
var element = elements[i];
|
|
6466
|
+
if (!element) continue;
|
|
6467
|
+
elements[index] = element;
|
|
6468
|
+
swapFn(element, index);
|
|
6469
|
+
index++;
|
|
6470
|
+
}
|
|
6461
6471
|
this._isLooping = false;
|
|
6462
|
-
this.length =
|
|
6472
|
+
this.length = index;
|
|
6463
6473
|
this._blankCount = 0;
|
|
6464
6474
|
};
|
|
6465
6475
|
return DisorderedArray;
|
|
@@ -10971,6 +10981,38 @@ var PrimitiveType;
|
|
|
10971
10981
|
PrimitiveMesh._spherePoleIdx = 0;
|
|
10972
10982
|
})();
|
|
10973
10983
|
|
|
10984
|
+
function _is_native_reflect_construct() {
|
|
10985
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
10986
|
+
if (Reflect.construct.sham) return false;
|
|
10987
|
+
if (typeof Proxy === "function") return true;
|
|
10988
|
+
|
|
10989
|
+
try {
|
|
10990
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
10991
|
+
|
|
10992
|
+
return true;
|
|
10993
|
+
} catch (e) {
|
|
10994
|
+
return false;
|
|
10995
|
+
}
|
|
10996
|
+
}
|
|
10997
|
+
|
|
10998
|
+
function _construct(Parent, args, Class) {
|
|
10999
|
+
if (_is_native_reflect_construct()) _construct = Reflect.construct;
|
|
11000
|
+
else {
|
|
11001
|
+
_construct = function construct(Parent, args, Class) {
|
|
11002
|
+
var a = [null];
|
|
11003
|
+
a.push.apply(a, args);
|
|
11004
|
+
var Constructor = Function.bind.apply(Parent, a);
|
|
11005
|
+
var instance = new Constructor();
|
|
11006
|
+
|
|
11007
|
+
if (Class) _set_prototype_of(instance, Class.prototype);
|
|
11008
|
+
|
|
11009
|
+
return instance;
|
|
11010
|
+
};
|
|
11011
|
+
}
|
|
11012
|
+
|
|
11013
|
+
return _construct.apply(null, arguments);
|
|
11014
|
+
}
|
|
11015
|
+
|
|
10974
11016
|
/**
|
|
10975
11017
|
* Layer, used for bit operations.
|
|
10976
11018
|
*/ exports.Layer = void 0;
|
|
@@ -11058,10 +11100,14 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
11058
11100
|
/**
|
|
11059
11101
|
* Add component based on the component type.
|
|
11060
11102
|
* @param type - The type of the component
|
|
11103
|
+
* @param args - The arguments of the component
|
|
11061
11104
|
* @returns The component which has been added
|
|
11062
11105
|
*/ _proto.addComponent = function addComponent(type) {
|
|
11106
|
+
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
11107
|
+
args[_key - 1] = arguments[_key];
|
|
11108
|
+
}
|
|
11063
11109
|
ComponentsDependencies._addCheck(this, type);
|
|
11064
|
-
var component =
|
|
11110
|
+
var component = _construct(type, [].concat(this, args));
|
|
11065
11111
|
this._components.push(component);
|
|
11066
11112
|
component._setActive(true, ActiveChangeFlag.All);
|
|
11067
11113
|
return component;
|
|
@@ -11230,7 +11276,7 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
11230
11276
|
* Clone this entity include children and components.
|
|
11231
11277
|
* @returns Cloned entity
|
|
11232
11278
|
*/ _proto.clone = function clone() {
|
|
11233
|
-
var cloneEntity = this._createCloneEntity(
|
|
11279
|
+
var cloneEntity = this._createCloneEntity();
|
|
11234
11280
|
this._parseCloneEntity(this, cloneEntity, this, cloneEntity, new Map());
|
|
11235
11281
|
return cloneEntity;
|
|
11236
11282
|
};
|
|
@@ -11240,23 +11286,23 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
11240
11286
|
this._isTemplate = true;
|
|
11241
11287
|
this._templateResource = templateResource;
|
|
11242
11288
|
};
|
|
11243
|
-
_proto._createCloneEntity = function _createCloneEntity(
|
|
11244
|
-
var cloneEntity = new Entity(
|
|
11289
|
+
_proto._createCloneEntity = function _createCloneEntity() {
|
|
11290
|
+
var cloneEntity = new Entity(this._engine, this.name);
|
|
11245
11291
|
var templateResource = this._templateResource;
|
|
11246
11292
|
if (templateResource) {
|
|
11247
11293
|
cloneEntity._templateResource = templateResource;
|
|
11248
11294
|
templateResource._addReferCount(1);
|
|
11249
11295
|
}
|
|
11250
|
-
cloneEntity.layer =
|
|
11251
|
-
cloneEntity._isActive =
|
|
11296
|
+
cloneEntity.layer = this.layer;
|
|
11297
|
+
cloneEntity._isActive = this._isActive;
|
|
11252
11298
|
var cloneTransform = cloneEntity.transform;
|
|
11253
|
-
var srcTransform =
|
|
11299
|
+
var _this = this, srcTransform = _this.transform;
|
|
11254
11300
|
cloneTransform.position = srcTransform.position;
|
|
11255
11301
|
cloneTransform.rotation = srcTransform.rotation;
|
|
11256
11302
|
cloneTransform.scale = srcTransform.scale;
|
|
11257
|
-
var
|
|
11258
|
-
for(var i = 0, n =
|
|
11259
|
-
cloneEntity.addChild(
|
|
11303
|
+
var srcChildren = this._children;
|
|
11304
|
+
for(var i = 0, n = srcChildren.length; i < n; i++){
|
|
11305
|
+
cloneEntity.addChild(srcChildren[i]._createCloneEntity());
|
|
11260
11306
|
}
|
|
11261
11307
|
return cloneEntity;
|
|
11262
11308
|
};
|
|
@@ -13467,7 +13513,7 @@ var /**
|
|
|
13467
13513
|
if (info) {
|
|
13468
13514
|
return info;
|
|
13469
13515
|
}
|
|
13470
|
-
info = TextUtils._measureFontOrChar(fontString);
|
|
13516
|
+
info = TextUtils._measureFontOrChar(fontString, TextUtils._measureString, false);
|
|
13471
13517
|
fontSizeInfoCache[fontString] = info;
|
|
13472
13518
|
return info;
|
|
13473
13519
|
};
|
|
@@ -13488,7 +13534,7 @@ var /**
|
|
|
13488
13534
|
return str;
|
|
13489
13535
|
};
|
|
13490
13536
|
TextUtils.measureChar = function measureChar(char, fontString) {
|
|
13491
|
-
return TextUtils._measureFontOrChar(fontString, char);
|
|
13537
|
+
return TextUtils._measureFontOrChar(fontString, char, true);
|
|
13492
13538
|
};
|
|
13493
13539
|
TextUtils.measureTextWithWrap = function measureTextWithWrap(renderer) {
|
|
13494
13540
|
var subFont = renderer._subFont;
|
|
@@ -13708,15 +13754,15 @@ var /**
|
|
|
13708
13754
|
/**
|
|
13709
13755
|
* @internal
|
|
13710
13756
|
* Use internal for CanvasRenderer plugin.
|
|
13711
|
-
*/ TextUtils._measureFontOrChar = function _measureFontOrChar(fontString,
|
|
13712
|
-
if (char === void 0) char = "";
|
|
13757
|
+
*/ TextUtils._measureFontOrChar = function _measureFontOrChar(fontString, measureString, isChar) {
|
|
13713
13758
|
var _TextUtils_textContext = TextUtils.textContext(), canvas = _TextUtils_textContext.canvas, context = _TextUtils_textContext.context;
|
|
13714
13759
|
context.font = fontString;
|
|
13715
|
-
var measureString = char || TextUtils._measureString;
|
|
13716
13760
|
// Safari gets data confusion through getImageData when the canvas width is not an integer.
|
|
13717
13761
|
// The measure text width of some special invisible characters may be 0, so make sure the width is at least 1.
|
|
13718
13762
|
// @todo: Text layout may vary from standard and not support emoji.
|
|
13719
|
-
var
|
|
13763
|
+
var textMetrics = context.measureText(measureString);
|
|
13764
|
+
// In some case (ex: " "), actualBoundingBoxRight and actualBoundingBoxLeft will be 0, so use width.
|
|
13765
|
+
var width = Math.max(1, Math.round(textMetrics.actualBoundingBoxRight - textMetrics.actualBoundingBoxLeft || textMetrics.width));
|
|
13720
13766
|
var baseline = Math.ceil(context.measureText(TextUtils._measureBaseline).width);
|
|
13721
13767
|
var height = baseline * TextUtils._heightMultiplier;
|
|
13722
13768
|
baseline = TextUtils._baselineMultiplier * baseline | 0;
|
|
@@ -13761,12 +13807,7 @@ var /**
|
|
|
13761
13807
|
descent = bottom - baseline + 1;
|
|
13762
13808
|
size = ascent + descent;
|
|
13763
13809
|
}
|
|
13764
|
-
|
|
13765
|
-
ascent: ascent,
|
|
13766
|
-
descent: descent,
|
|
13767
|
-
size: size
|
|
13768
|
-
};
|
|
13769
|
-
if (char) {
|
|
13810
|
+
if (isChar) {
|
|
13770
13811
|
var data = null;
|
|
13771
13812
|
if (size > 0) {
|
|
13772
13813
|
var lineIntegerW = integerW * 4;
|
|
@@ -13774,7 +13815,7 @@ var /**
|
|
|
13774
13815
|
data = new Uint8Array(colorData.buffer, top * lineIntegerW, size * lineIntegerW);
|
|
13775
13816
|
}
|
|
13776
13817
|
return {
|
|
13777
|
-
char:
|
|
13818
|
+
char: measureString,
|
|
13778
13819
|
x: 0,
|
|
13779
13820
|
y: 0,
|
|
13780
13821
|
w: width,
|
|
@@ -13794,7 +13835,11 @@ var /**
|
|
|
13794
13835
|
data: data
|
|
13795
13836
|
};
|
|
13796
13837
|
} else {
|
|
13797
|
-
return
|
|
13838
|
+
return {
|
|
13839
|
+
ascent: ascent,
|
|
13840
|
+
descent: descent,
|
|
13841
|
+
size: size
|
|
13842
|
+
};
|
|
13798
13843
|
}
|
|
13799
13844
|
};
|
|
13800
13845
|
/**
|
|
@@ -15861,6 +15906,26 @@ var BaseMaterial = /*#__PURE__*/ function(Material1) {
|
|
|
15861
15906
|
this.blitMesh = this._createBlitMesh(engine, vertices);
|
|
15862
15907
|
this.flipYBlitMesh = this._createBlitMesh(engine, flipYVertices);
|
|
15863
15908
|
this.blitMaterial = blitMaterial;
|
|
15909
|
+
// Create white and magenta textures
|
|
15910
|
+
var whitePixel = new Uint8Array([
|
|
15911
|
+
255,
|
|
15912
|
+
255,
|
|
15913
|
+
255,
|
|
15914
|
+
255
|
|
15915
|
+
]);
|
|
15916
|
+
this.whiteTexture2D = this._create1x1Texture(engine, 0, exports.TextureFormat.R8G8B8A8, whitePixel);
|
|
15917
|
+
this.whiteTextureCube = this._create1x1Texture(engine, 1, exports.TextureFormat.R8G8B8A8, whitePixel);
|
|
15918
|
+
var isWebGL2 = engine._hardwareRenderer.isWebGL2;
|
|
15919
|
+
if (isWebGL2) {
|
|
15920
|
+
this.whiteTexture2DArray = this._create1x1Texture(engine, 2, exports.TextureFormat.R8G8B8A8, whitePixel);
|
|
15921
|
+
var whitePixel32 = new Uint32Array([
|
|
15922
|
+
255,
|
|
15923
|
+
255,
|
|
15924
|
+
255,
|
|
15925
|
+
255
|
|
15926
|
+
]);
|
|
15927
|
+
this.uintWhiteTexture2D = this._create1x1Texture(engine, 0, exports.TextureFormat.R32G32B32A32_UInt, whitePixel32);
|
|
15928
|
+
}
|
|
15864
15929
|
}
|
|
15865
15930
|
var _proto = BasicResources.prototype;
|
|
15866
15931
|
_proto._createBlitMesh = function _createBlitMesh(engine, vertices) {
|
|
@@ -15873,8 +15938,63 @@ var BaseMaterial = /*#__PURE__*/ function(Material1) {
|
|
|
15873
15938
|
mesh.addSubMesh(0, 4, exports.MeshTopology.TriangleStrip);
|
|
15874
15939
|
return mesh;
|
|
15875
15940
|
};
|
|
15941
|
+
_proto._create1x1Texture = function _create1x1Texture(engine, type, format, pixel) {
|
|
15942
|
+
var texture;
|
|
15943
|
+
switch(type){
|
|
15944
|
+
case 0:
|
|
15945
|
+
var texture2D = new Texture2D(engine, 1, 1, format, false);
|
|
15946
|
+
texture2D.setPixelBuffer(pixel);
|
|
15947
|
+
texture = texture2D;
|
|
15948
|
+
break;
|
|
15949
|
+
case 2:
|
|
15950
|
+
var texture2DArray = new Texture2DArray(engine, 1, 1, 1, format, false);
|
|
15951
|
+
texture2DArray.setPixelBuffer(0, pixel);
|
|
15952
|
+
texture = texture2DArray;
|
|
15953
|
+
break;
|
|
15954
|
+
case 1:
|
|
15955
|
+
var textureCube = new TextureCube(engine, 1, format, false);
|
|
15956
|
+
for(var i = 0; i < 6; i++){
|
|
15957
|
+
textureCube.setPixelBuffer(exports.TextureCubeFace.PositiveX + i, pixel);
|
|
15958
|
+
}
|
|
15959
|
+
texture = textureCube;
|
|
15960
|
+
break;
|
|
15961
|
+
default:
|
|
15962
|
+
throw "Invalid texture type";
|
|
15963
|
+
}
|
|
15964
|
+
texture.isGCIgnored = true;
|
|
15965
|
+
engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
|
|
15966
|
+
_inherits(_class, ContentRestorer);
|
|
15967
|
+
function _class() {
|
|
15968
|
+
return ContentRestorer.call(this, texture);
|
|
15969
|
+
}
|
|
15970
|
+
var _proto = _class.prototype;
|
|
15971
|
+
_proto.restoreContent = function restoreContent() {
|
|
15972
|
+
switch(type){
|
|
15973
|
+
case 0:
|
|
15974
|
+
this.resource.setPixelBuffer(pixel);
|
|
15975
|
+
break;
|
|
15976
|
+
case 2:
|
|
15977
|
+
this.resource.setPixelBuffer(0, pixel);
|
|
15978
|
+
break;
|
|
15979
|
+
case 1:
|
|
15980
|
+
for(var i = 0; i < 6; i++){
|
|
15981
|
+
this.resource.setPixelBuffer(exports.TextureCubeFace.PositiveX + i, pixel);
|
|
15982
|
+
}
|
|
15983
|
+
break;
|
|
15984
|
+
}
|
|
15985
|
+
};
|
|
15986
|
+
return _class;
|
|
15987
|
+
}(ContentRestorer))());
|
|
15988
|
+
return texture;
|
|
15989
|
+
};
|
|
15876
15990
|
return BasicResources;
|
|
15877
15991
|
}();
|
|
15992
|
+
var TextureType;
|
|
15993
|
+
(function(TextureType) {
|
|
15994
|
+
TextureType[TextureType["Texture2D"] = 0] = "Texture2D";
|
|
15995
|
+
TextureType[TextureType["TextureCube"] = 1] = "TextureCube";
|
|
15996
|
+
TextureType[TextureType["Texture2DArray"] = 2] = "Texture2DArray";
|
|
15997
|
+
})(TextureType || (TextureType = {}));
|
|
15878
15998
|
|
|
15879
15999
|
/**
|
|
15880
16000
|
* @internal
|
|
@@ -16668,17 +16788,35 @@ var /** @internal */ PromiseState;
|
|
|
16668
16788
|
};
|
|
16669
16789
|
/**
|
|
16670
16790
|
* @internal
|
|
16671
|
-
*/ _proto._onSubAssetSuccess = function _onSubAssetSuccess(
|
|
16672
|
-
var
|
|
16673
|
-
(
|
|
16674
|
-
|
|
16791
|
+
*/ _proto._onSubAssetSuccess = function _onSubAssetSuccess(assetBaseURL, assetSubPath, value) {
|
|
16792
|
+
var _this__subAssetPromiseCallbacks_assetBaseURL;
|
|
16793
|
+
var subPromiseCallback = (_this__subAssetPromiseCallbacks_assetBaseURL = this._subAssetPromiseCallbacks[assetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_assetBaseURL[assetSubPath];
|
|
16794
|
+
if (subPromiseCallback) {
|
|
16795
|
+
// Already resolved
|
|
16796
|
+
subPromiseCallback.resolve(value);
|
|
16797
|
+
} else {
|
|
16798
|
+
var // Pending
|
|
16799
|
+
_this__subAssetPromiseCallbacks, _assetBaseURL;
|
|
16800
|
+
((_this__subAssetPromiseCallbacks = this._subAssetPromiseCallbacks)[_assetBaseURL = assetBaseURL] || (_this__subAssetPromiseCallbacks[_assetBaseURL] = {}))[assetSubPath] = {
|
|
16801
|
+
resolve: value
|
|
16802
|
+
};
|
|
16803
|
+
}
|
|
16675
16804
|
};
|
|
16676
16805
|
/**
|
|
16677
16806
|
* @internal
|
|
16678
|
-
*/ _proto._onSubAssetFail = function _onSubAssetFail(
|
|
16679
|
-
var
|
|
16680
|
-
(
|
|
16681
|
-
|
|
16807
|
+
*/ _proto._onSubAssetFail = function _onSubAssetFail(assetBaseURL, assetSubPath, value) {
|
|
16808
|
+
var _this__subAssetPromiseCallbacks_assetBaseURL;
|
|
16809
|
+
var subPromiseCallback = (_this__subAssetPromiseCallbacks_assetBaseURL = this._subAssetPromiseCallbacks[assetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_assetBaseURL[assetSubPath];
|
|
16810
|
+
if (subPromiseCallback) {
|
|
16811
|
+
// Already rejected
|
|
16812
|
+
subPromiseCallback.reject(value);
|
|
16813
|
+
} else {
|
|
16814
|
+
var // Pending
|
|
16815
|
+
_this__subAssetPromiseCallbacks, _assetBaseURL;
|
|
16816
|
+
((_this__subAssetPromiseCallbacks = this._subAssetPromiseCallbacks)[_assetBaseURL = assetBaseURL] || (_this__subAssetPromiseCallbacks[_assetBaseURL] = {}))[assetSubPath] = {
|
|
16817
|
+
reject: value
|
|
16818
|
+
};
|
|
16819
|
+
}
|
|
16682
16820
|
};
|
|
16683
16821
|
/**
|
|
16684
16822
|
* @internal
|
|
@@ -16823,8 +16961,21 @@ var /** @internal */ PromiseState;
|
|
|
16823
16961
|
if (!loader) {
|
|
16824
16962
|
throw "loader not found: " + item.type;
|
|
16825
16963
|
}
|
|
16826
|
-
//
|
|
16964
|
+
// Check sub asset
|
|
16965
|
+
if (queryPath) {
|
|
16966
|
+
// Check whether load main asset
|
|
16967
|
+
var mainPromise = loadingPromises[assetBaseURL] || this._loadMainAsset(loader, item, assetBaseURL);
|
|
16968
|
+
mainPromise.catch(function(e) {
|
|
16969
|
+
_this._onSubAssetFail(assetBaseURL, queryPath, e);
|
|
16970
|
+
});
|
|
16971
|
+
return this._createSubAssetPromiseCallback(assetBaseURL, assetURL, queryPath);
|
|
16972
|
+
}
|
|
16973
|
+
return this._loadMainAsset(loader, item, assetBaseURL);
|
|
16974
|
+
};
|
|
16975
|
+
_proto._loadMainAsset = function _loadMainAsset(loader, item, assetBaseURL) {
|
|
16976
|
+
var _this = this;
|
|
16827
16977
|
item.url = assetBaseURL;
|
|
16978
|
+
var loadingPromises = this._loadingPromises;
|
|
16828
16979
|
var promise = loader.load(item, this);
|
|
16829
16980
|
loadingPromises[assetBaseURL] = promise;
|
|
16830
16981
|
promise.then(function(resource) {
|
|
@@ -16832,32 +16983,46 @@ var /** @internal */ PromiseState;
|
|
|
16832
16983
|
_this._addAsset(assetBaseURL, resource);
|
|
16833
16984
|
}
|
|
16834
16985
|
delete loadingPromises[assetBaseURL];
|
|
16986
|
+
_this._releaseSubAssetPromiseCallback(assetBaseURL);
|
|
16835
16987
|
}, function() {
|
|
16836
|
-
|
|
16988
|
+
delete loadingPromises[assetBaseURL];
|
|
16989
|
+
_this._releaseSubAssetPromiseCallback(assetBaseURL);
|
|
16837
16990
|
});
|
|
16838
|
-
|
|
16839
|
-
|
|
16840
|
-
|
|
16841
|
-
|
|
16842
|
-
|
|
16843
|
-
|
|
16991
|
+
return promise;
|
|
16992
|
+
};
|
|
16993
|
+
_proto._createSubAssetPromiseCallback = function _createSubAssetPromiseCallback(assetBaseURL, assetURL, assetSubPath) {
|
|
16994
|
+
var _this = this;
|
|
16995
|
+
var _this__subAssetPromiseCallbacks_assetBaseURL, _subPromiseCallback, _subPromiseCallback1;
|
|
16996
|
+
var loadingPromises = this._loadingPromises;
|
|
16997
|
+
var subPromiseCallback = (_this__subAssetPromiseCallbacks_assetBaseURL = this._subAssetPromiseCallbacks[assetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_assetBaseURL[assetSubPath];
|
|
16998
|
+
var resolvedValue = (_subPromiseCallback = subPromiseCallback) == null ? void 0 : _subPromiseCallback.resolve;
|
|
16999
|
+
var rejectedValue = (_subPromiseCallback1 = subPromiseCallback) == null ? void 0 : _subPromiseCallback1.reject;
|
|
17000
|
+
var promise = new AssetPromise(function(resolve, reject) {
|
|
17001
|
+
if (resolvedValue) {
|
|
17002
|
+
// Already resolved
|
|
17003
|
+
resolve(resolvedValue);
|
|
17004
|
+
} else if (rejectedValue) {
|
|
17005
|
+
// Already rejected
|
|
17006
|
+
reject(rejectedValue);
|
|
17007
|
+
} else {
|
|
17008
|
+
var _this__subAssetPromiseCallbacks, _assetBaseURL;
|
|
17009
|
+
// Pending
|
|
17010
|
+
loadingPromises[assetURL] = promise;
|
|
17011
|
+
((_this__subAssetPromiseCallbacks = _this._subAssetPromiseCallbacks)[_assetBaseURL = assetBaseURL] || (_this__subAssetPromiseCallbacks[_assetBaseURL] = {}))[assetSubPath] = {
|
|
17012
|
+
resolve: resolve,
|
|
17013
|
+
reject: reject
|
|
17014
|
+
};
|
|
17015
|
+
}
|
|
17016
|
+
});
|
|
17017
|
+
if (!resolvedValue && !rejectedValue) {
|
|
17018
|
+
promise.then(function() {
|
|
16844
17019
|
delete loadingPromises[assetURL];
|
|
16845
17020
|
}, function() {
|
|
16846
17021
|
return delete loadingPromises[assetURL];
|
|
16847
17022
|
});
|
|
16848
|
-
promise.catch(function(e) {
|
|
16849
|
-
_this._onSubAssetFail(assetURL, e);
|
|
16850
|
-
});
|
|
16851
|
-
return subPromise;
|
|
16852
17023
|
}
|
|
16853
17024
|
return promise;
|
|
16854
17025
|
};
|
|
16855
|
-
_proto._pushSubAssetPromiseCallback = function _pushSubAssetPromiseCallback(assetURL, resolve, reject) {
|
|
16856
|
-
this._subAssetPromiseCallbacks[assetURL] = {
|
|
16857
|
-
resolve: resolve,
|
|
16858
|
-
reject: reject
|
|
16859
|
-
};
|
|
16860
|
-
};
|
|
16861
17026
|
_proto._gc = function _gc(forceDestroy) {
|
|
16862
17027
|
var objects = Utils.objectValues(this._referResourcePool);
|
|
16863
17028
|
for(var i = 0, n = objects.length; i < n; i++){
|
|
@@ -16914,6 +17079,9 @@ var /** @internal */ PromiseState;
|
|
|
16914
17079
|
});
|
|
16915
17080
|
return result;
|
|
16916
17081
|
};
|
|
17082
|
+
_proto._releaseSubAssetPromiseCallback = function _releaseSubAssetPromiseCallback(assetBaseURL) {
|
|
17083
|
+
delete this._subAssetPromiseCallbacks[assetBaseURL];
|
|
17084
|
+
};
|
|
16917
17085
|
/**
|
|
16918
17086
|
* @internal
|
|
16919
17087
|
* @beta Just for internal editor, not recommended for developers.
|
|
@@ -20407,7 +20575,6 @@ ShaderPool.init();
|
|
|
20407
20575
|
_this.xrManager = new XRManager();
|
|
20408
20576
|
_this.xrManager._initialize(_assert_this_initialized(_this), xrDevice);
|
|
20409
20577
|
}
|
|
20410
|
-
_this._initMagentaTextures(hardwareRenderer);
|
|
20411
20578
|
if (!hardwareRenderer.canIUse(exports.GLCapabilityType.depthTexture)) {
|
|
20412
20579
|
_this._macroCollection.enable(Engine._noDepthTextureMacro);
|
|
20413
20580
|
} else {
|
|
@@ -20643,99 +20810,6 @@ ShaderPool.init();
|
|
|
20643
20810
|
};
|
|
20644
20811
|
/**
|
|
20645
20812
|
* @internal
|
|
20646
|
-
* Standalone for CanvasRenderer plugin.
|
|
20647
|
-
*/ _proto._initMagentaTextures = function _initMagentaTextures(hardwareRenderer) {
|
|
20648
|
-
var whitePixel = new Uint8Array([
|
|
20649
|
-
255,
|
|
20650
|
-
255,
|
|
20651
|
-
255,
|
|
20652
|
-
255
|
|
20653
|
-
]);
|
|
20654
|
-
var whiteTexture2D = new Texture2D(this, 1, 1, exports.TextureFormat.R8G8B8A8, false);
|
|
20655
|
-
whiteTexture2D.setPixelBuffer(whitePixel);
|
|
20656
|
-
whiteTexture2D.isGCIgnored = true;
|
|
20657
|
-
var magentaPixel = new Uint8Array([
|
|
20658
|
-
255,
|
|
20659
|
-
0,
|
|
20660
|
-
255,
|
|
20661
|
-
255
|
|
20662
|
-
]);
|
|
20663
|
-
var magentaTexture2D = new Texture2D(this, 1, 1, exports.TextureFormat.R8G8B8A8, false);
|
|
20664
|
-
magentaTexture2D.setPixelBuffer(magentaPixel);
|
|
20665
|
-
magentaTexture2D.isGCIgnored = true;
|
|
20666
|
-
this.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
|
|
20667
|
-
_inherits(_class, ContentRestorer);
|
|
20668
|
-
function _class() {
|
|
20669
|
-
return ContentRestorer.call(this, magentaTexture2D);
|
|
20670
|
-
}
|
|
20671
|
-
var _proto = _class.prototype;
|
|
20672
|
-
_proto.restoreContent = function restoreContent() {
|
|
20673
|
-
this.resource.setPixelBuffer(magentaPixel);
|
|
20674
|
-
};
|
|
20675
|
-
return _class;
|
|
20676
|
-
}(ContentRestorer))());
|
|
20677
|
-
var magentaTextureCube = new TextureCube(this, 1, exports.TextureFormat.R8G8B8A8, false);
|
|
20678
|
-
for(var i = 0; i < 6; i++){
|
|
20679
|
-
magentaTextureCube.setPixelBuffer(exports.TextureCubeFace.PositiveX + i, magentaPixel);
|
|
20680
|
-
}
|
|
20681
|
-
magentaTextureCube.isGCIgnored = true;
|
|
20682
|
-
this.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
|
|
20683
|
-
_inherits(_class, ContentRestorer);
|
|
20684
|
-
function _class() {
|
|
20685
|
-
return ContentRestorer.call(this, magentaTextureCube);
|
|
20686
|
-
}
|
|
20687
|
-
var _proto = _class.prototype;
|
|
20688
|
-
_proto.restoreContent = function restoreContent() {
|
|
20689
|
-
for(var i = 0; i < 6; i++){
|
|
20690
|
-
this.resource.setPixelBuffer(exports.TextureCubeFace.PositiveX + i, magentaPixel);
|
|
20691
|
-
}
|
|
20692
|
-
};
|
|
20693
|
-
return _class;
|
|
20694
|
-
}(ContentRestorer))());
|
|
20695
|
-
this._whiteTexture2D = whiteTexture2D;
|
|
20696
|
-
this._magentaTexture2D = magentaTexture2D;
|
|
20697
|
-
this._magentaTextureCube = magentaTextureCube;
|
|
20698
|
-
if (hardwareRenderer.isWebGL2) {
|
|
20699
|
-
var magentaPixel32 = new Uint32Array([
|
|
20700
|
-
255,
|
|
20701
|
-
0,
|
|
20702
|
-
255,
|
|
20703
|
-
255
|
|
20704
|
-
]);
|
|
20705
|
-
var uintMagentaTexture2D = new Texture2D(this, 1, 1, exports.TextureFormat.R32G32B32A32_UInt, false);
|
|
20706
|
-
uintMagentaTexture2D.setPixelBuffer(magentaPixel32);
|
|
20707
|
-
uintMagentaTexture2D.isGCIgnored = true;
|
|
20708
|
-
this.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
|
|
20709
|
-
_inherits(_class, ContentRestorer);
|
|
20710
|
-
function _class() {
|
|
20711
|
-
return ContentRestorer.call(this, uintMagentaTexture2D);
|
|
20712
|
-
}
|
|
20713
|
-
var _proto = _class.prototype;
|
|
20714
|
-
_proto.restoreContent = function restoreContent() {
|
|
20715
|
-
this.resource.setPixelBuffer(magentaPixel32);
|
|
20716
|
-
};
|
|
20717
|
-
return _class;
|
|
20718
|
-
}(ContentRestorer))());
|
|
20719
|
-
var magentaTexture2DArray = new Texture2DArray(this, 1, 1, 1, exports.TextureFormat.R8G8B8A8, false);
|
|
20720
|
-
magentaTexture2DArray.setPixelBuffer(0, magentaPixel);
|
|
20721
|
-
magentaTexture2DArray.isGCIgnored = true;
|
|
20722
|
-
this.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
|
|
20723
|
-
_inherits(_class, ContentRestorer);
|
|
20724
|
-
function _class() {
|
|
20725
|
-
return ContentRestorer.call(this, magentaTexture2DArray);
|
|
20726
|
-
}
|
|
20727
|
-
var _proto = _class.prototype;
|
|
20728
|
-
_proto.restoreContent = function restoreContent() {
|
|
20729
|
-
this.resource.setPixelBuffer(0, magentaPixel);
|
|
20730
|
-
};
|
|
20731
|
-
return _class;
|
|
20732
|
-
}(ContentRestorer))());
|
|
20733
|
-
this._uintMagentaTexture2D = uintMagentaTexture2D;
|
|
20734
|
-
this._magentaTexture2DArray = magentaTexture2DArray;
|
|
20735
|
-
}
|
|
20736
|
-
};
|
|
20737
|
-
/**
|
|
20738
|
-
* @internal
|
|
20739
20813
|
*/ _proto._pendingGC = function _pendingGC() {
|
|
20740
20814
|
if (this._frameInProcess) {
|
|
20741
20815
|
this._waitingGC = true;
|
|
@@ -21375,6 +21449,8 @@ ShaderPool.init();
|
|
|
21375
21449
|
script._started = true;
|
|
21376
21450
|
_this.removeOnStartScript(script);
|
|
21377
21451
|
script.onStart();
|
|
21452
|
+
}, function(element, index) {
|
|
21453
|
+
element._onStartIndex = index;
|
|
21378
21454
|
});
|
|
21379
21455
|
}
|
|
21380
21456
|
};
|
|
@@ -22965,6 +23041,14 @@ __decorate([
|
|
|
22965
23041
|
DepthTextureMode[DepthTextureMode[/* Generate depth texture by pre-pass rendering. */ "PrePass"] = 1] = "PrePass";
|
|
22966
23042
|
})(exports.DepthTextureMode || (exports.DepthTextureMode = {}));
|
|
22967
23043
|
|
|
23044
|
+
/**
|
|
23045
|
+
* The strategy to use when a shader replacement fails.
|
|
23046
|
+
*/ exports.ReplacementFailureStrategy = void 0;
|
|
23047
|
+
(function(ReplacementFailureStrategy) {
|
|
23048
|
+
ReplacementFailureStrategy[ReplacementFailureStrategy[/** Keep the original shader. */ "KeepOriginalShader"] = 0] = "KeepOriginalShader";
|
|
23049
|
+
ReplacementFailureStrategy[ReplacementFailureStrategy[/** Do not render. */ "DoNotRender"] = 1] = "DoNotRender";
|
|
23050
|
+
})(exports.ReplacementFailureStrategy || (exports.ReplacementFailureStrategy = {}));
|
|
23051
|
+
|
|
22968
23052
|
/**
|
|
22969
23053
|
* PipelinePass is a base class for all pipeline passes.
|
|
22970
23054
|
*/ var PipelinePass = function PipelinePass(engine) {
|
|
@@ -24315,7 +24399,7 @@ var /**
|
|
|
24315
24399
|
depthOnlyPass.onConfig(camera);
|
|
24316
24400
|
depthOnlyPass.onRender(context, cullingResults);
|
|
24317
24401
|
} else {
|
|
24318
|
-
camera.shaderData.setTexture(exports.Camera._cameraDepthTextureProperty, engine.
|
|
24402
|
+
camera.shaderData.setTexture(exports.Camera._cameraDepthTextureProperty, engine._basicResources.whiteTexture2D);
|
|
24319
24403
|
}
|
|
24320
24404
|
// Check if need to create internal color texture
|
|
24321
24405
|
var independentCanvasEnabled = camera.independentCanvasEnabled;
|
|
@@ -24401,13 +24485,15 @@ var /**
|
|
|
24401
24485
|
var replacementSubShaders = replacementShader.subShaders;
|
|
24402
24486
|
var replacementTag = context.replacementTag;
|
|
24403
24487
|
if (replacementTag) {
|
|
24488
|
+
var materialSubShaderTagValue = materialSubShader.getTagValue(replacementTag);
|
|
24404
24489
|
for(var i = 0, n = replacementSubShaders.length; i < n; i++){
|
|
24405
24490
|
var subShader = replacementSubShaders[i];
|
|
24406
|
-
if (subShader.getTagValue(replacementTag) ===
|
|
24491
|
+
if (subShader.getTagValue(replacementTag) === materialSubShaderTagValue) {
|
|
24407
24492
|
this.pushRenderDataWithShader(context, data, subShader.passes, renderStates);
|
|
24408
|
-
|
|
24493
|
+
return;
|
|
24409
24494
|
}
|
|
24410
24495
|
}
|
|
24496
|
+
context.replacementFailureStrategy === exports.ReplacementFailureStrategy.KeepOriginalShader && this.pushRenderDataWithShader(context, data, materialSubShader.passes, renderStates);
|
|
24411
24497
|
} else {
|
|
24412
24498
|
this.pushRenderDataWithShader(context, data, replacementSubShaders[0].passes, renderStates);
|
|
24413
24499
|
}
|
|
@@ -24568,6 +24654,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
24568
24654
|
/** @internal */ _this._virtualCamera = new VirtualCamera();
|
|
24569
24655
|
/** @internal */ _this._replacementShader = null;
|
|
24570
24656
|
/** @internal */ _this._replacementSubShaderTag = null;
|
|
24657
|
+
/** @internal */ _this._replacementFailureStrategy = null;
|
|
24571
24658
|
/** @internal */ _this._cameraIndex = -1;
|
|
24572
24659
|
_this._priority = 0;
|
|
24573
24660
|
_this._shaderData = new ShaderData(ShaderDataGroup.Camera);
|
|
@@ -24745,6 +24832,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
24745
24832
|
context.virtualCamera = virtualCamera;
|
|
24746
24833
|
context.replacementShader = this._replacementShader;
|
|
24747
24834
|
context.replacementTag = this._replacementSubShaderTag;
|
|
24835
|
+
context.replacementFailureStrategy = this._replacementFailureStrategy;
|
|
24748
24836
|
// compute cull frustum.
|
|
24749
24837
|
if (this.enableFrustumCulling && this._frustumChangeFlag.flag) {
|
|
24750
24838
|
this._frustum.calculateFromMatrix(virtualCamera.viewProjectionMatrix);
|
|
@@ -24764,15 +24852,18 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
24764
24852
|
this._renderPipeline.render(context, cubeFace, mipLevel, clearMask);
|
|
24765
24853
|
this._engine._renderCount++;
|
|
24766
24854
|
};
|
|
24767
|
-
_proto.setReplacementShader = function setReplacementShader(shader, replacementTag) {
|
|
24855
|
+
_proto.setReplacementShader = function setReplacementShader(shader, replacementTag, failureStrategy) {
|
|
24856
|
+
if (failureStrategy === void 0) failureStrategy = exports.ReplacementFailureStrategy.KeepOriginalShader;
|
|
24768
24857
|
this._replacementShader = shader;
|
|
24769
24858
|
this._replacementSubShaderTag = typeof replacementTag === "string" ? ShaderTagKey.getByName(replacementTag) : replacementTag;
|
|
24859
|
+
this._replacementFailureStrategy = failureStrategy;
|
|
24770
24860
|
};
|
|
24771
24861
|
/**
|
|
24772
24862
|
* Reset and clear the replacement shader.
|
|
24773
24863
|
*/ _proto.resetReplacementShader = function resetReplacementShader() {
|
|
24774
24864
|
this._replacementShader = null;
|
|
24775
24865
|
this._replacementSubShaderTag = null;
|
|
24866
|
+
this._replacementFailureStrategy = null;
|
|
24776
24867
|
};
|
|
24777
24868
|
/**
|
|
24778
24869
|
* @inheritdoc
|