@galacean/engine-core 1.5.0-alpha.0 → 1.5.0-alpha.1
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 +129 -139
- package/dist/main.js.map +1 -1
- package/dist/module.js +129 -139
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/Camera.d.ts +6 -12
package/dist/main.js
CHANGED
|
@@ -4269,75 +4269,6 @@ function dependentComponents(componentOrComponents, dependentMode) {
|
|
|
4269
4269
|
return Layer;
|
|
4270
4270
|
}({});
|
|
4271
4271
|
|
|
4272
|
-
/**
|
|
4273
|
-
* @internal
|
|
4274
|
-
*/ var PipelineUtils = /*#__PURE__*/ function() {
|
|
4275
|
-
function PipelineUtils() {}
|
|
4276
|
-
/**
|
|
4277
|
-
* Recreate texture if needed.
|
|
4278
|
-
* @param engine - Engine
|
|
4279
|
-
* @param currentTexture - Current texture
|
|
4280
|
-
* @param width - Need texture width
|
|
4281
|
-
* @param height - Need texture height
|
|
4282
|
-
* @param format - Need texture format
|
|
4283
|
-
* @param mipmap - Need texture mipmap
|
|
4284
|
-
* @param isSRGBColorSpace - Whether to use sRGB color space
|
|
4285
|
-
* @param textureWrapMode - Texture wrap mode
|
|
4286
|
-
* @param textureFilterMode - Texture filter mode
|
|
4287
|
-
* @returns Texture
|
|
4288
|
-
*/ PipelineUtils.recreateTextureIfNeeded = function recreateTextureIfNeeded(engine, currentTexture, width, height, format, mipmap, isSRGBColorSpace, textureWrapMode, textureFilterMode) {
|
|
4289
|
-
if (currentTexture) {
|
|
4290
|
-
if (currentTexture.width !== width || currentTexture.height !== height || currentTexture.format !== format || currentTexture.isSRGBColorSpace !== isSRGBColorSpace || currentTexture.mipmapCount > 1 !== mipmap) {
|
|
4291
|
-
currentTexture.destroy(true);
|
|
4292
|
-
currentTexture = new Texture2D(engine, width, height, format, mipmap, isSRGBColorSpace);
|
|
4293
|
-
currentTexture.isGCIgnored = true;
|
|
4294
|
-
}
|
|
4295
|
-
} else {
|
|
4296
|
-
currentTexture = new Texture2D(engine, width, height, format, mipmap, isSRGBColorSpace);
|
|
4297
|
-
currentTexture.isGCIgnored = true;
|
|
4298
|
-
}
|
|
4299
|
-
currentTexture.wrapModeU = currentTexture.wrapModeV = textureWrapMode;
|
|
4300
|
-
currentTexture.filterMode = textureFilterMode;
|
|
4301
|
-
return currentTexture;
|
|
4302
|
-
};
|
|
4303
|
-
/**
|
|
4304
|
-
* Recreate render target if needed.
|
|
4305
|
-
* @param engine - Engine
|
|
4306
|
-
* @param currentRenderTarget - Current render target
|
|
4307
|
-
* @param width - Need render target width
|
|
4308
|
-
* @param height - Need render target height
|
|
4309
|
-
* @param colorFormat - Need render target color format
|
|
4310
|
-
* @param depthFormat - Need render target depth format
|
|
4311
|
-
* @param mipmap - Need render target mipmap
|
|
4312
|
-
* @param isSRGBColorSpace - Whether to use sRGB color space
|
|
4313
|
-
* @param antiAliasing - Need render target anti aliasing
|
|
4314
|
-
* @param textureWrapMode - Texture wrap mode
|
|
4315
|
-
* @param textureFilterMode - Texture filter mode
|
|
4316
|
-
* @returns Render target
|
|
4317
|
-
*/ PipelineUtils.recreateRenderTargetIfNeeded = function recreateRenderTargetIfNeeded(engine, currentRenderTarget, width, height, colorFormat, depthFormat, needDepthTexture, mipmap, isSRGBColorSpace, antiAliasing, textureWrapMode, textureFilterMode) {
|
|
4318
|
-
var currentColorTexture = currentRenderTarget == null ? void 0 : currentRenderTarget.getColorTexture(0);
|
|
4319
|
-
var colorTexture = colorFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentColorTexture, width, height, colorFormat, mipmap, isSRGBColorSpace, textureWrapMode, textureFilterMode) : null;
|
|
4320
|
-
if (needDepthTexture) {
|
|
4321
|
-
var currentDepthTexture = currentRenderTarget == null ? void 0 : currentRenderTarget.depthTexture;
|
|
4322
|
-
var _$needDepthTexture = depthFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentDepthTexture, width, height, depthFormat, mipmap, isSRGBColorSpace, textureWrapMode, textureFilterMode) : null;
|
|
4323
|
-
if (currentColorTexture !== colorTexture || currentDepthTexture !== _$needDepthTexture) {
|
|
4324
|
-
currentRenderTarget == null ? void 0 : currentRenderTarget.destroy(true);
|
|
4325
|
-
currentRenderTarget = new RenderTarget(engine, width, height, colorTexture, _$needDepthTexture, antiAliasing);
|
|
4326
|
-
currentRenderTarget.isGCIgnored = true;
|
|
4327
|
-
}
|
|
4328
|
-
} else {
|
|
4329
|
-
if (currentColorTexture !== colorTexture || (currentRenderTarget == null ? void 0 : currentRenderTarget._depthFormat) !== depthFormat || currentRenderTarget.antiAliasing !== antiAliasing) {
|
|
4330
|
-
currentRenderTarget == null ? void 0 : currentRenderTarget.destroy(true);
|
|
4331
|
-
currentRenderTarget = new RenderTarget(engine, width, height, colorTexture, depthFormat, antiAliasing);
|
|
4332
|
-
currentRenderTarget.isGCIgnored = true;
|
|
4333
|
-
}
|
|
4334
|
-
}
|
|
4335
|
-
return currentRenderTarget;
|
|
4336
|
-
};
|
|
4337
|
-
return PipelineUtils;
|
|
4338
|
-
}();
|
|
4339
|
-
PipelineUtils.defaultViewport = new engineMath.Vector4(0, 0, 1, 1);
|
|
4340
|
-
|
|
4341
4272
|
/**
|
|
4342
4273
|
* Used to update tags.
|
|
4343
4274
|
*/ var UpdateFlag = /*#__PURE__*/ function() {
|
|
@@ -5231,7 +5162,7 @@ __decorate([
|
|
|
5231
5162
|
* The anti-aliasing mode.
|
|
5232
5163
|
*/ var AntiAliasing = /*#__PURE__*/ function(AntiAliasing) {
|
|
5233
5164
|
/* Disable anti-aliasing. */ AntiAliasing[AntiAliasing["None"] = 0] = "None";
|
|
5234
|
-
/* Fast approximate anti-aliasing. */ AntiAliasing[AntiAliasing["FXAA"] = 1] = "FXAA";
|
|
5165
|
+
/* Fast approximate anti-aliasing, it detects and smooths jagged edges based on luminance contrast in the final rendered image. */ AntiAliasing[AntiAliasing["FXAA"] = 1] = "FXAA";
|
|
5235
5166
|
return AntiAliasing;
|
|
5236
5167
|
}({});
|
|
5237
5168
|
|
|
@@ -5850,11 +5781,14 @@ exports.Camera = /*#__PURE__*/ function(Component) {
|
|
|
5850
5781
|
*
|
|
5851
5782
|
* @defaultValue `Downsampling.TwoX`
|
|
5852
5783
|
*/ _this.opaqueTextureDownsampling = Downsampling.TwoX, /**
|
|
5853
|
-
*
|
|
5784
|
+
* The number of samples used for hardware multisample anti-aliasing (MSAA) to smooth geometry edges during rasterization.
|
|
5785
|
+
* Higher sample counts (e.g., 2x, 4x, 8x) produce smoother edges.
|
|
5786
|
+
*
|
|
5787
|
+
* @defaultValue `MSAASamples.FourX`
|
|
5788
|
+
*/ _this.msaaSamples = MSAASamples.FourX, /**
|
|
5789
|
+
* The screen-space anti-aliasing mode applied after the camera renders the final image.
|
|
5790
|
+
* Unlike MSAA, it can smooth all pixels, including by shader-generated specular, alpha-cutoff edge, low resolution texture.
|
|
5854
5791
|
*
|
|
5855
|
-
* @remarks It will take effect when `independentCanvasEnabled` property is `true`, otherwise it will be invalid.
|
|
5856
|
-
*/ _this.msaaSamples = MSAASamples.None, /**
|
|
5857
|
-
* Anti-aliasing mode.
|
|
5858
5792
|
* @defaultValue `AntiAliasing.None`
|
|
5859
5793
|
*/ _this.antiAliasing = AntiAliasing.None, /** @internal */ _this._cameraType = CameraType.Normal, /** @internal */ _this._globalShaderMacro = new ShaderMacroCollection(), /** @internal */ _this._frustum = new engineMath.BoundingFrustum(), /** @internal */ _this._virtualCamera = new VirtualCamera(), /** @internal */ _this._replacementShader = null, /** @internal */ _this._replacementSubShaderTag = null, /** @internal */ _this._replacementFailureStrategy = null, /** @internal */ _this._cameraIndex = -1, _this._priority = 0, _this._shaderData = new ShaderData(ShaderDataGroup.Camera), _this._isCustomViewMatrix = false, _this._isCustomProjectionMatrix = false, _this._fieldOfView = 45, _this._orthographicSize = 10, _this._isProjectionDirty = true, _this._isInvProjMatDirty = true, _this._customAspectRatio = undefined, _this._renderTarget = null, _this._depthBufferParams = new engineMath.Vector4(), _this._opaqueTextureEnabled = false, _this._enableHDR = false, _this._enablePostProcess = false, _this._viewport = new engineMath.Vector4(0, 0, 1, 1), _this._pixelViewport = new engineMath.Rect(0, 0, 0, 0), _this._inverseProjectionMatrix = new engineMath.Matrix(), _this._invViewProjMat = new engineMath.Matrix();
|
|
5860
5794
|
_this._isViewMatrixDirty = entity.registerWorldChangeFlag();
|
|
@@ -6031,7 +5965,7 @@ exports.Camera = /*#__PURE__*/ function(Component) {
|
|
|
6031
5965
|
Logger.error("mipLevel only take effect in WebGL2.0");
|
|
6032
5966
|
}
|
|
6033
5967
|
var ignoreClearFlags;
|
|
6034
|
-
if (this._cameraType !== CameraType.Normal && !this._renderTarget && !this.
|
|
5968
|
+
if (this._cameraType !== CameraType.Normal && !this._renderTarget && !this._isIndependentCanvasEnabled()) {
|
|
6035
5969
|
ignoreClearFlags = engine.xrManager._getCameraIgnoreClearFlags(this._cameraType);
|
|
6036
5970
|
}
|
|
6037
5971
|
this._renderPipeline.render(context, cubeFace, mipLevel, ignoreClearFlags);
|
|
@@ -6065,6 +5999,31 @@ exports.Camera = /*#__PURE__*/ function(Component) {
|
|
|
6065
5999
|
};
|
|
6066
6000
|
/**
|
|
6067
6001
|
* @internal
|
|
6002
|
+
* Whether independent canvas is enabled.
|
|
6003
|
+
*/ _proto._isIndependentCanvasEnabled = function _isIndependentCanvasEnabled() {
|
|
6004
|
+
// Uber pass need internal RT
|
|
6005
|
+
if (this.enablePostProcess && this.scene.postProcessManager._isValid()) {
|
|
6006
|
+
return true;
|
|
6007
|
+
}
|
|
6008
|
+
// Final pass should sRGB conversion and FXAA
|
|
6009
|
+
if (this._needFinalPass()) {
|
|
6010
|
+
return true;
|
|
6011
|
+
}
|
|
6012
|
+
var renderTarget = this._renderTarget;
|
|
6013
|
+
// Need HDR and opaque texture
|
|
6014
|
+
if (this.enableHDR || this.opaqueTextureEnabled) {
|
|
6015
|
+
if (renderTarget) {
|
|
6016
|
+
// If camera is HDR and format is same with renderTarget can reuse renderTarget if renderTarget is same HDR format
|
|
6017
|
+
// If camera is LDR and opaqueTextureEnabled is true, can reuse renderTarget if renderTarget is LDR format(Only R8G8B8A8)
|
|
6018
|
+
return this._getInternalColorTextureFormat() !== renderTarget.getColorTexture(0).format;
|
|
6019
|
+
} else {
|
|
6020
|
+
return true;
|
|
6021
|
+
}
|
|
6022
|
+
}
|
|
6023
|
+
return false;
|
|
6024
|
+
};
|
|
6025
|
+
/**
|
|
6026
|
+
* @internal
|
|
6068
6027
|
*/ _proto._getInternalColorTextureFormat = function _getInternalColorTextureFormat() {
|
|
6069
6028
|
return this._enableHDR ? this.engine._hardwareRenderer.isWebGL2 ? TextureFormat.R11G11B10_UFloat : TextureFormat.R16G16B16A16 : TextureFormat.R8G8B8A8;
|
|
6070
6029
|
};
|
|
@@ -6190,12 +6149,6 @@ exports.Camera = /*#__PURE__*/ function(Component) {
|
|
|
6190
6149
|
this._updatePixelViewport();
|
|
6191
6150
|
var _this__customAspectRatio;
|
|
6192
6151
|
(_this__customAspectRatio = this._customAspectRatio) != null ? _this__customAspectRatio : this._projectionMatrixChange();
|
|
6193
|
-
this._checkMainCanvasAntialiasWaste();
|
|
6194
|
-
};
|
|
6195
|
-
_proto._checkMainCanvasAntialiasWaste = function _checkMainCanvasAntialiasWaste() {
|
|
6196
|
-
if (this._phasedActiveInScene && this.independentCanvasEnabled && engineMath.Vector4.equals(this._viewport, PipelineUtils.defaultViewport)) {
|
|
6197
|
-
Logger.warn("Camera use independent canvas and viewport cover the whole screen, it is recommended to disable antialias, depth and stencil to save memory when create engine.");
|
|
6198
|
-
}
|
|
6199
6152
|
};
|
|
6200
6153
|
_proto._dispatchModify = function _dispatchModify(flag) {
|
|
6201
6154
|
var _this__updateFlagManager;
|
|
@@ -6209,43 +6162,11 @@ exports.Camera = /*#__PURE__*/ function(Component) {
|
|
|
6209
6162
|
* If enabled, the opaque texture can be accessed in the shader using `camera_OpaqueTexture`.
|
|
6210
6163
|
*
|
|
6211
6164
|
* @defaultValue `false`
|
|
6212
|
-
* @remarks If enabled, the `independentCanvasEnabled` property will be forced to be true.
|
|
6213
6165
|
*/ function get() {
|
|
6214
6166
|
return this._opaqueTextureEnabled;
|
|
6215
6167
|
},
|
|
6216
6168
|
set: function set(value) {
|
|
6217
|
-
|
|
6218
|
-
this._opaqueTextureEnabled = value;
|
|
6219
|
-
this._checkMainCanvasAntialiasWaste();
|
|
6220
|
-
}
|
|
6221
|
-
}
|
|
6222
|
-
},
|
|
6223
|
-
{
|
|
6224
|
-
key: "independentCanvasEnabled",
|
|
6225
|
-
get: /**
|
|
6226
|
-
* Whether independent canvas is enabled.
|
|
6227
|
-
* @remarks If true, the msaa in viewport can turn or off independently by `msaaSamples` property.
|
|
6228
|
-
*/ function get() {
|
|
6229
|
-
// Uber pass need internal RT
|
|
6230
|
-
if (this.enablePostProcess && this.scene.postProcessManager._isValid()) {
|
|
6231
|
-
return true;
|
|
6232
|
-
}
|
|
6233
|
-
// Final pass should sRGB conversion and FXAA
|
|
6234
|
-
if (this._needFinalPass()) {
|
|
6235
|
-
return true;
|
|
6236
|
-
}
|
|
6237
|
-
var renderTarget = this._renderTarget;
|
|
6238
|
-
// Need HDR and opaque texture
|
|
6239
|
-
if (this.enableHDR || this.opaqueTextureEnabled) {
|
|
6240
|
-
if (renderTarget) {
|
|
6241
|
-
// If camera is HDR and format is same with renderTarget can reuse renderTarget if renderTarget is same HDR format
|
|
6242
|
-
// If camera is LDR and opaqueTextureEnabled is true, can reuse renderTarget if renderTarget is LDR format(Only R8G8B8A8)
|
|
6243
|
-
return this._getInternalColorTextureFormat() !== renderTarget.getColorTexture(0).format;
|
|
6244
|
-
} else {
|
|
6245
|
-
return true;
|
|
6246
|
-
}
|
|
6247
|
-
}
|
|
6248
|
-
return false;
|
|
6169
|
+
this._opaqueTextureEnabled = value;
|
|
6249
6170
|
}
|
|
6250
6171
|
},
|
|
6251
6172
|
{
|
|
@@ -6442,7 +6363,6 @@ exports.Camera = /*#__PURE__*/ function(Component) {
|
|
|
6442
6363
|
get: /**
|
|
6443
6364
|
* Whether to enable HDR.
|
|
6444
6365
|
* @defaultValue `false`
|
|
6445
|
-
* @remarks If enabled, the `independentCanvasEnabled` property will be forced to be true.
|
|
6446
6366
|
*/ function get() {
|
|
6447
6367
|
return this._enableHDR;
|
|
6448
6368
|
},
|
|
@@ -6455,7 +6375,6 @@ exports.Camera = /*#__PURE__*/ function(Component) {
|
|
|
6455
6375
|
return;
|
|
6456
6376
|
}
|
|
6457
6377
|
this._enableHDR = value;
|
|
6458
|
-
this._checkMainCanvasAntialiasWaste();
|
|
6459
6378
|
}
|
|
6460
6379
|
}
|
|
6461
6380
|
},
|
|
@@ -6464,14 +6383,12 @@ exports.Camera = /*#__PURE__*/ function(Component) {
|
|
|
6464
6383
|
get: /**
|
|
6465
6384
|
* Whether to enable post process.
|
|
6466
6385
|
* @defaultValue `false`
|
|
6467
|
-
* @remarks If enabled, the `independentCanvasEnabled` property will be forced to be true.
|
|
6468
6386
|
*/ function get() {
|
|
6469
6387
|
return this._enablePostProcess;
|
|
6470
6388
|
},
|
|
6471
6389
|
set: function set(value) {
|
|
6472
6390
|
if (this._enablePostProcess !== value) {
|
|
6473
6391
|
this._enablePostProcess = value;
|
|
6474
|
-
this._checkMainCanvasAntialiasWaste();
|
|
6475
6392
|
}
|
|
6476
6393
|
}
|
|
6477
6394
|
},
|
|
@@ -9255,6 +9172,75 @@ __decorate([
|
|
|
9255
9172
|
deepClone
|
|
9256
9173
|
], PostProcess.prototype, "_effects", void 0);
|
|
9257
9174
|
|
|
9175
|
+
/**
|
|
9176
|
+
* @internal
|
|
9177
|
+
*/ var PipelineUtils = /*#__PURE__*/ function() {
|
|
9178
|
+
function PipelineUtils() {}
|
|
9179
|
+
/**
|
|
9180
|
+
* Recreate texture if needed.
|
|
9181
|
+
* @param engine - Engine
|
|
9182
|
+
* @param currentTexture - Current texture
|
|
9183
|
+
* @param width - Need texture width
|
|
9184
|
+
* @param height - Need texture height
|
|
9185
|
+
* @param format - Need texture format
|
|
9186
|
+
* @param mipmap - Need texture mipmap
|
|
9187
|
+
* @param isSRGBColorSpace - Whether to use sRGB color space
|
|
9188
|
+
* @param textureWrapMode - Texture wrap mode
|
|
9189
|
+
* @param textureFilterMode - Texture filter mode
|
|
9190
|
+
* @returns Texture
|
|
9191
|
+
*/ PipelineUtils.recreateTextureIfNeeded = function recreateTextureIfNeeded(engine, currentTexture, width, height, format, mipmap, isSRGBColorSpace, textureWrapMode, textureFilterMode) {
|
|
9192
|
+
if (currentTexture) {
|
|
9193
|
+
if (currentTexture.width !== width || currentTexture.height !== height || currentTexture.format !== format || currentTexture.isSRGBColorSpace !== isSRGBColorSpace || currentTexture.mipmapCount > 1 !== mipmap) {
|
|
9194
|
+
currentTexture.destroy(true);
|
|
9195
|
+
currentTexture = new Texture2D(engine, width, height, format, mipmap, isSRGBColorSpace);
|
|
9196
|
+
currentTexture.isGCIgnored = true;
|
|
9197
|
+
}
|
|
9198
|
+
} else {
|
|
9199
|
+
currentTexture = new Texture2D(engine, width, height, format, mipmap, isSRGBColorSpace);
|
|
9200
|
+
currentTexture.isGCIgnored = true;
|
|
9201
|
+
}
|
|
9202
|
+
currentTexture.wrapModeU = currentTexture.wrapModeV = textureWrapMode;
|
|
9203
|
+
currentTexture.filterMode = textureFilterMode;
|
|
9204
|
+
return currentTexture;
|
|
9205
|
+
};
|
|
9206
|
+
/**
|
|
9207
|
+
* Recreate render target if needed.
|
|
9208
|
+
* @param engine - Engine
|
|
9209
|
+
* @param currentRenderTarget - Current render target
|
|
9210
|
+
* @param width - Need render target width
|
|
9211
|
+
* @param height - Need render target height
|
|
9212
|
+
* @param colorFormat - Need render target color format
|
|
9213
|
+
* @param depthFormat - Need render target depth format
|
|
9214
|
+
* @param mipmap - Need render target mipmap
|
|
9215
|
+
* @param isSRGBColorSpace - Whether to use sRGB color space
|
|
9216
|
+
* @param antiAliasing - Need render target anti aliasing
|
|
9217
|
+
* @param textureWrapMode - Texture wrap mode
|
|
9218
|
+
* @param textureFilterMode - Texture filter mode
|
|
9219
|
+
* @returns Render target
|
|
9220
|
+
*/ PipelineUtils.recreateRenderTargetIfNeeded = function recreateRenderTargetIfNeeded(engine, currentRenderTarget, width, height, colorFormat, depthFormat, needDepthTexture, mipmap, isSRGBColorSpace, antiAliasing, textureWrapMode, textureFilterMode) {
|
|
9221
|
+
var currentColorTexture = currentRenderTarget == null ? void 0 : currentRenderTarget.getColorTexture(0);
|
|
9222
|
+
var colorTexture = colorFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentColorTexture, width, height, colorFormat, mipmap, isSRGBColorSpace, textureWrapMode, textureFilterMode) : null;
|
|
9223
|
+
if (needDepthTexture) {
|
|
9224
|
+
var currentDepthTexture = currentRenderTarget == null ? void 0 : currentRenderTarget.depthTexture;
|
|
9225
|
+
var _$needDepthTexture = depthFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentDepthTexture, width, height, depthFormat, mipmap, isSRGBColorSpace, textureWrapMode, textureFilterMode) : null;
|
|
9226
|
+
if (currentColorTexture !== colorTexture || currentDepthTexture !== _$needDepthTexture) {
|
|
9227
|
+
currentRenderTarget == null ? void 0 : currentRenderTarget.destroy(true);
|
|
9228
|
+
currentRenderTarget = new RenderTarget(engine, width, height, colorTexture, _$needDepthTexture, antiAliasing);
|
|
9229
|
+
currentRenderTarget.isGCIgnored = true;
|
|
9230
|
+
}
|
|
9231
|
+
} else {
|
|
9232
|
+
if (currentColorTexture !== colorTexture || (currentRenderTarget == null ? void 0 : currentRenderTarget._depthFormat) !== depthFormat || currentRenderTarget.antiAliasing !== antiAliasing) {
|
|
9233
|
+
currentRenderTarget == null ? void 0 : currentRenderTarget.destroy(true);
|
|
9234
|
+
currentRenderTarget = new RenderTarget(engine, width, height, colorTexture, depthFormat, antiAliasing);
|
|
9235
|
+
currentRenderTarget.isGCIgnored = true;
|
|
9236
|
+
}
|
|
9237
|
+
}
|
|
9238
|
+
return currentRenderTarget;
|
|
9239
|
+
};
|
|
9240
|
+
return PipelineUtils;
|
|
9241
|
+
}();
|
|
9242
|
+
PipelineUtils.defaultViewport = new engineMath.Vector4(0, 0, 1, 1);
|
|
9243
|
+
|
|
9258
9244
|
exports.Collider = /*#__PURE__*/ function(Component) {
|
|
9259
9245
|
_inherits(Collider, Component);
|
|
9260
9246
|
function Collider(entity) {
|
|
@@ -14889,7 +14875,8 @@ CascadedShadowCasterPass._tempMatrix0 = new engineMath.Matrix();
|
|
|
14889
14875
|
*/ _proto.render = function render(context, cubeFace, mipLevel, ignoreClear) {
|
|
14890
14876
|
context.rendererUpdateFlag = ContextRendererUpdateFlag.All;
|
|
14891
14877
|
var camera = this._camera;
|
|
14892
|
-
var scene = camera.scene, engine = camera.engine, renderTarget = camera.renderTarget
|
|
14878
|
+
var scene = camera.scene, engine = camera.engine, renderTarget = camera.renderTarget;
|
|
14879
|
+
var independentCanvasEnabled = camera._isIndependentCanvasEnabled();
|
|
14893
14880
|
var rhi = engine._hardwareRenderer;
|
|
14894
14881
|
var cullingResults = this._cullingResults;
|
|
14895
14882
|
var sunlight = scene._lightManager._sunlight;
|
|
@@ -14897,10 +14884,12 @@ CascadedShadowCasterPass._tempMatrix0 = new engineMath.Matrix();
|
|
|
14897
14884
|
var depthPassEnabled = camera.depthTextureMode === DepthTextureMode.PrePass && depthOnlyPass._supportDepthTexture;
|
|
14898
14885
|
var finalClearFlags = camera.clearFlags & ~(ignoreClear != null ? ignoreClear : CameraClearFlags.None);
|
|
14899
14886
|
var msaaSamples = renderTarget ? renderTarget.antiAliasing : camera.msaaSamples;
|
|
14887
|
+
// Check whether can use `blitFramebuffer` to blit internal render target, source maybe screen canvas or camera's render target
|
|
14888
|
+
// Our screen canvas's anti-aliasing is always disable, so blit source and dest is always same by below rules:
|
|
14900
14889
|
// 1. Only support blitFramebuffer in webgl2 context
|
|
14901
14890
|
// 2. Can't blit normal FBO to MSAA FBO
|
|
14902
14891
|
// 3. Can't blit screen MSAA FBO to normal FBO in mac safari platform and mobile, but mac chrome and firfox is OK
|
|
14903
|
-
this._canUseBlitFrameBuffer = rhi.isWebGL2 && msaaSamples === 1
|
|
14892
|
+
this._canUseBlitFrameBuffer = rhi.isWebGL2 && msaaSamples === 1;
|
|
14904
14893
|
// Because internal render target is linear color space, so we should convert srgb background color to linear color space
|
|
14905
14894
|
var isSRGBBackground = !renderTarget || renderTarget.getColorTexture(0).isSRGBColorSpace;
|
|
14906
14895
|
this._shouldCopyBackgroundColor = independentCanvasEnabled && !(finalClearFlags & CameraClearFlags.Color) && (!this._canUseBlitFrameBuffer || isSRGBBackground);
|
|
@@ -14928,11 +14917,11 @@ CascadedShadowCasterPass._tempMatrix0 = new engineMath.Matrix();
|
|
|
14928
14917
|
var depthFormat;
|
|
14929
14918
|
if (camera.renderTarget) {
|
|
14930
14919
|
depthFormat = camera.renderTarget._depthFormat;
|
|
14931
|
-
} else if (rhi.
|
|
14920
|
+
} else if (rhi._options.depth && rhi._options.stencil) {
|
|
14932
14921
|
depthFormat = TextureFormat.Depth24Stencil8;
|
|
14933
|
-
} else if (rhi.
|
|
14922
|
+
} else if (rhi._options.depth) {
|
|
14934
14923
|
depthFormat = TextureFormat.Depth24;
|
|
14935
|
-
} else if (rhi.
|
|
14924
|
+
} else if (rhi._options.stencil) {
|
|
14936
14925
|
depthFormat = TextureFormat.Stencil;
|
|
14937
14926
|
} else {
|
|
14938
14927
|
depthFormat = null;
|
|
@@ -14982,23 +14971,24 @@ CascadedShadowCasterPass._tempMatrix0 = new engineMath.Matrix();
|
|
|
14982
14971
|
// If color target is null, hardware will not convert linear color space to sRGB
|
|
14983
14972
|
var color = colorTarget ? background._linearSolidColor : background.solidColor;
|
|
14984
14973
|
finalClearFlags !== CameraClearFlags.None && rhi.clearRenderTarget(engine, finalClearFlags, color);
|
|
14985
|
-
if (internalColorTarget
|
|
14986
|
-
//
|
|
14987
|
-
|
|
14988
|
-
|
|
14989
|
-
rhi.
|
|
14990
|
-
}
|
|
14991
|
-
|
|
14992
|
-
|
|
14974
|
+
if (internalColorTarget) {
|
|
14975
|
+
// Force clear internal color target depth and stencil buffer, because it already missed due to post process, HDR, sRGB covert, etc.
|
|
14976
|
+
var keepDSFlags = ~finalClearFlags & CameraClearFlags.DepthStencil;
|
|
14977
|
+
if (keepDSFlags) {
|
|
14978
|
+
rhi.clearRenderTarget(engine, keepDSFlags);
|
|
14979
|
+
}
|
|
14980
|
+
var keepColorFlag = ~finalClearFlags & CameraClearFlags.Color;
|
|
14981
|
+
if (keepColorFlag) {
|
|
14982
|
+
if (this._shouldCopyBackgroundColor) {
|
|
14983
|
+
// Copy RT's color buffer to grab texture
|
|
14984
|
+
rhi.copyRenderTargetToSubTexture(camera.renderTarget, this._copyBackgroundTexture, camera.viewport);
|
|
14985
|
+
// Then blit grab texture to internal RT's color buffer
|
|
14986
|
+
Blitter.blitTexture(engine, this._copyBackgroundTexture, internalColorTarget, 0, undefined, camera.renderTarget ? undefined : engine._basicResources.blitScreenMaterial);
|
|
14987
|
+
} else {
|
|
14988
|
+
// Only blit color buffer from back buffer
|
|
14989
|
+
var ignoreFlags = CameraClearFlags.DepthStencil;
|
|
14990
|
+
rhi.blitInternalRTByBlitFrameBuffer(camera.renderTarget, internalColorTarget, ignoreFlags, camera.viewport);
|
|
14993
14991
|
}
|
|
14994
|
-
// We must clear depth/stencil buffer manually if current context don't support `blitFramebuffer` API
|
|
14995
|
-
rhi.clearRenderTarget(engine, CameraClearFlags.DepthStencil);
|
|
14996
|
-
}
|
|
14997
|
-
if (this._shouldCopyBackgroundColor) {
|
|
14998
|
-
// Copy RT's color buffer to grab texture
|
|
14999
|
-
rhi.copyRenderTargetToSubTexture(camera.renderTarget, this._copyBackgroundTexture, camera.viewport);
|
|
15000
|
-
// Then blit grab texture to internal RT's color buffer
|
|
15001
|
-
Blitter.blitTexture(engine, this._copyBackgroundTexture, internalColorTarget, 0, undefined, camera.renderTarget ? undefined : engine._basicResources.blitScreenMaterial);
|
|
15002
14992
|
}
|
|
15003
14993
|
context.setRenderTarget(colorTarget, colorViewport, mipLevel, cubeFace);
|
|
15004
14994
|
}
|