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