mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-05 11:02:40 +08:00
23455e75c6
* when checking useSystemFont, the fontFamily should appear (#12684) Co-authored-by: zhangmingzhen <mingzhen.zhang@cocos.com> * remove rebundant useLocalData (#12640) (cherry picked from commit 7cca98171d765a32e8732ad01b994bc10e861314) Co-authored-by: zhangmingzhen <mingzhen.zhang@cocos.com> * Modify version number (#12726) Co-authored-by: liuyi <liuyi@cocos.com> * fix builtin asset hot-reload (#12736) * improve: move xr init to infrastructure (#12765) * improve: move xr init to infrastructure * fix: move initxr, before gfx * fix: format warning * [Feature] build template add config file (#12701) * part of build template add config json for creating build templates and version checks for each platform * update default template version * add RenderQueue custom ability to classic pipeline (#12760) * Wgpu 3.6.2 WGPU_CI_ON (#12731) * fix okhttp onClosing not call close (#12783) * fix transparency, emissive and specularfactor with dcc effects (#12798) * reverse occlusion parameter in effects (#12795) * [native] Fix getting wrong value of globals.ambient.skyLightingColor (#12810) * refine: remove unneeded code (#12808) * feat: update meta files (#12807) * middleware2d components rendering in native mode (#12788) * middleware2d components rendering in native mode * support spine/dragonbones set enable batch * support spine rendering in batching mode * get batcher2d instance from root * process about with type conversion * fix some code style * use material hash to merge draw batch * deal with fill z * fix dragonbones fill z * remove some code no used any more * refactoring some code * modify some code * add free memory * fix clang-tidy * delete mesh-buffer-layout in destructor * byte alignment * [ci skip][AUTO]: Automated code generating update: 88c3a7ffdd8f95cd2c7776d6d3d6a8e36862d0bf (#12788) (#12818) Co-authored-by: cocos-robot <cocos-robot@cocos.com> * simplify (#12782) * [code] move decode32 to unpack.chunk (#12823) * [Optimize] Cache current time for audio player in minigame. (#12814) * Cache current time for minigames * Save current time as private member * Make cache time changed in callback * update cache time to abort middle state for seek * LogRemote upgrade configuration protocol (#12833) * update config * Update LogRemote.cpp * update default_skybox and sun direction (#12811) * fix submeshes have different instancing options (#12786) * [ci skip][AUTO]: Automated code generating update: 3200403d155bbfbdef67440c48febc087ac1f0e5 (#12786) (#12871) Co-authored-by: cocos-robot <cocos-robot@cocos.com> * spine/dragonbones support batch mode in web platform (#12847) * spine/dragonbones support batch mode in web platform * set data hash 0 in commitMiddleware * optimizate merge draw batch for middleware * keep commitIA in batcher2d * modify deprecated about commitIA * feat: support webgpu on build-engine (#12627) * feat: support webgpu * build-engine-feat: support building external asset * update * Publish @cocos/build-engine@4.4.0-webgpu.0 * fix tiled merge draw call with sprite (#12877) * fix:CC_ASSERT(!_currentApp.expired()); (#12844) application has destroyed when WebSocketServer process callback in game thread * [Bug fix] remove the player of the audio source when its clip is set to null (#12865) * remove player when the audio source's clip is set to null * fix binary format spine load crash (#12894) * wgpu: remove reinit on same object (#12799) * add i18n for skybox (#12899) * 3.6.2 fix android orientation crash (#12885) * do not cache argument in global space * add doc * add a comment for readAttachment (#12902) * If it is preview, replace overrideUuid directly (#12905) * sort the attributes (#12904) Co-authored-by: zhangmingzhen <mingzhen.zhang@cocos.com> * add i18n for shadow (#12906) * update default-skybox and sun direction (#12917) * fix:WebSocket connection to 'ws://XXXX/' failed: A server must not mask any frames that it sends to the client. (#12882) * remove USE_BATCHING (#12892) * fix a native middleware blend problem (#12914) * migrated remove USE_BATCHING (#12895) * [feature] support output bullet.wasm on runtime based platform which the using of wasm api is more similar with weixin (#12881) * V3.6.2 fix particle crash (#12913) * fix native crash * revert to pointer * revert * do not use reference * if PREVIEW load cce scripts before loadProjectBundles (#12916) * If it is preview, replace overrideUuid directly * load cce scripts before loadProjectBundles * Update game.ts * Update game.ts * Update game.ts * Update game.ts * fix download url request not encode space (#12826) * Export texture info for wgpu WGPU_CI_ON (#12926) * export texture info for wgpu * missing js file * update external config Co-authored-by: Zeqiang Li <zeqiang-li@outlook.com.com> * fix: build-engine (#12929) * richtext addChild optimization (#12928) * 1. remove rebundant invoking 2. ttf canvas texture resizes to width and height as (1,1) * remove start() and move it to onLoad() Co-authored-by: zhangmingzhen <mingzhen.zhang@cocos.com> * fix animation asset on inspector preview bug (#12900) * optimize label component editing * fix animation asset on inspector preview bug * optimize i18n break words * update node-executable by env (#12930) * Fix: toDataURL is not supported for this content on iPhone 7p (#12830) * Fix: toDataURL is not supported for this content on iPhone 7p * Add srgb transform. (#12873) * add localCfg.cmake (#12932) * _loadCCEScripts will be browser-preview only (#12925) * _loadCCEScripts will be browser-preview only * add comment * a compatible way of data copy & default buffer size for uniform buffer (#12935) * a compatible way of data copy & default buffer size for uniform buffer * update external config * [fix] default scene ambient and dirlight color (#12955) * sync readme for wgpu (#12966) * [fix] specularIntensity is invalid with builtin-standard (#12971) * [native] type2writer:add FLOAT3 to Color case for compatiblity (#12962) * V3.6.2 format return null error fix (#12973) * add i18n for model (#12985) * fix potential mem leak (#12995) * [fix] camera clear flag is skybox but skybox is disabled #13589 (#12964) * [fix] shader compilation error with CC_DEVICE_SUPPORT_FLOAT_TEXTURE=0 (#13015) * fix import * sync tojs to swig about middleware and 2d module (#4) * sync tojs to swig about scene module (#5) * remove Model::getInstancedAttributeBlock Co-authored-by: Zhang mingzhen <32831993+Zhmz@users.noreply.github.com> Co-authored-by: zhangmingzhen <mingzhen.zhang@cocos.com> Co-authored-by: LIUYIa <102024185+LIUYIa@users.noreply.github.com> Co-authored-by: liuyi <liuyi@cocos.com> Co-authored-by: fqamic <fqamic@vip.qq.com> Co-authored-by: minggo <nudtzxm@gmail.com> Co-authored-by: changhua <39176194+changhua0118@users.noreply.github.com> Co-authored-by: hyde zhou <zlzhou.sh@outlook.com> Co-authored-by: Zeqiang Li <zeqiang-li@outlook.com> Co-authored-by: mmyduckx <308303735@qq.com> Co-authored-by: 徐兵 <49358166+xubing0906@users.noreply.github.com> Co-authored-by: James Chen <dumganhar@gmail.com> Co-authored-by: bofeng-song <bofeng.song@chukong-inc.com> Co-authored-by: 袁炜海 <35713518+dogodo-cc@users.noreply.github.com> Co-authored-by: zhakesi <liqiao@cocos.com> Co-authored-by: Cocos Robot <48829427+cocos-robot@users.noreply.github.com> Co-authored-by: cocos-robot <cocos-robot@cocos.com> Co-authored-by: 江战 <40414978+PatriceJiang@users.noreply.github.com> Co-authored-by: jk20012001 <jkregister@163.com> Co-authored-by: timlyeee <43355299+timlyeee@users.noreply.github.com> Co-authored-by: PP <chinese1236@qq.com> Co-authored-by: oahc09 <oahc09@gmail.com> Co-authored-by: zhangxin <59186205+chichinohaha@users.noreply.github.com> Co-authored-by: troublemaker52025 <troublemaker52025@outlook.com> Co-authored-by: CC9701 <73738313+CC9701@users.noreply.github.com> Co-authored-by: zxx43 <zxx43@hotmail.com> Co-authored-by: Zeqiang Li <zeqiang-li@outlook.com.com> Co-authored-by: 黄森斌 <arsen2010@126.com> Co-authored-by: ycg <1670543365@qq.com> Co-authored-by: AFeiYA <386665678@qq.com> Co-authored-by: zhakesi <zhakesi@foxmail.com>
332 lines
14 KiB
TypeScript
332 lines
14 KiB
TypeScript
/*
|
|
Copyright (c) 2020 Xiamen Yaji Software Co., Ltd.
|
|
|
|
https://www.cocos.com/
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated engine source code (the "Software"), a limited,
|
|
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
|
to use Cocos Creator solely to develop games on your target platforms. You shall
|
|
not use Cocos Creator software for developing other software or tools that's
|
|
used for developing games. You are not granted to publish, distribute,
|
|
sublicense, and/or sell copies of Cocos Creator.
|
|
|
|
The software or tools in this License Agreement are licensed, not sold.
|
|
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
THE SOFTWARE.
|
|
*/
|
|
|
|
import { ccclass } from 'cc.decorator';
|
|
import { PIPELINE_FLOW_SHADOW, supportsR32FloatTexture, UBOCamera, UBOCSM, UBOGlobal, UBOShadow } from '../define';
|
|
import { IRenderFlowInfo, RenderFlow } from '../render-flow';
|
|
import { ForwardFlowPriority } from '../enum';
|
|
import { ShadowStage } from './shadow-stage';
|
|
import { RenderPass, LoadOp, StoreOp,
|
|
Format, Texture, TextureType, TextureUsageBit, ColorAttachment,
|
|
DepthStencilAttachment, RenderPassInfo, TextureInfo, FramebufferInfo, Swapchain,
|
|
Framebuffer, DescriptorSet, API } from '../../gfx';
|
|
import { RenderFlowTag } from '../pipeline-serialization';
|
|
import { ForwardPipeline } from '../forward/forward-pipeline';
|
|
import { RenderPipeline } from '..';
|
|
import { PCFType, ShadowType } from '../../render-scene/scene/shadows';
|
|
import { Light, LightType } from '../../render-scene/scene/light';
|
|
import { Camera } from '../../render-scene/scene';
|
|
import { SpotLight } from '../../render-scene/scene/spot-light';
|
|
|
|
const _validLights: Light[] = [];
|
|
|
|
/**
|
|
* @en Shadow map render flow
|
|
* @zh 阴影贴图绘制流程
|
|
*/
|
|
@ccclass('ShadowFlow')
|
|
export class ShadowFlow extends RenderFlow {
|
|
/**
|
|
* @en A common initialization info for shadow map render flow
|
|
* @zh 一个通用的 ShadowFlow 的初始化信息对象
|
|
*/
|
|
public static initInfo: IRenderFlowInfo = {
|
|
name: PIPELINE_FLOW_SHADOW,
|
|
priority: ForwardFlowPriority.SHADOW,
|
|
tag: RenderFlowTag.SCENE,
|
|
stages: [],
|
|
};
|
|
|
|
private _shadowRenderPass: RenderPass|null = null;
|
|
|
|
public initialize (info: IRenderFlowInfo): boolean {
|
|
super.initialize(info);
|
|
if (this._stages.length === 0) {
|
|
// add shadowMap-stages
|
|
const shadowMapStage = new ShadowStage();
|
|
shadowMapStage.initialize(ShadowStage.initInfo);
|
|
this._stages.push(shadowMapStage);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public activate (pipeline: RenderPipeline) {
|
|
super.activate(pipeline);
|
|
|
|
// 0: SHADOWMAP_FLOAT, 1: SHADOWMAP_RGBE.
|
|
const isRGBE = supportsR32FloatTexture(pipeline.device) ? 0 : 1;
|
|
pipeline.macros.CC_SHADOWMAP_FORMAT = isRGBE;
|
|
|
|
// 0: SHADOWMAP_LINER_DEPTH_OFF, 1: SHADOWMAP_LINER_DEPTH_ON.
|
|
const isLinear = pipeline.device.gfxAPI === API.WEBGL ? 1 : 0;
|
|
pipeline.macros.CC_SHADOWMAP_USE_LINEAR_DEPTH = isLinear;
|
|
|
|
// 0: UNIFORM_VECTORS_LESS_EQUAL_64, 1: UNIFORM_VECTORS_GREATER_EQUAL_125.
|
|
pipeline.pipelineSceneData.csmSupported = pipeline.device.capabilities.maxFragmentUniformVectors
|
|
>= (UBOGlobal.COUNT + UBOCamera.COUNT + UBOShadow.COUNT + UBOCSM.COUNT) / 4;
|
|
pipeline.macros.CC_SUPPORT_CASCADED_SHADOW_MAP = pipeline.pipelineSceneData.csmSupported;
|
|
|
|
// 0: CC_SHADOW_NONE, 1: CC_SHADOW_PLANAR, 2: CC_SHADOW_MAP
|
|
pipeline.macros.CC_SHADOW_TYPE = 0;
|
|
|
|
// 0: PCFType.HARD, 1: PCFType.SOFT, 2: PCFType.SOFT_2X, 3: PCFType.SOFT_4X
|
|
pipeline.macros.CC_DIR_SHADOW_PCF_TYPE = PCFType.HARD;
|
|
|
|
// 0: CC_DIR_LIGHT_SHADOW_NONE, 1: CC_DIR_LIGHT_SHADOW_UNIFORM, 2: CC_DIR_LIGHT_SHADOW_CASCADED, 3: CC_DIR_LIGHT_SHADOW_VARIANCE
|
|
pipeline.macros.CC_DIR_LIGHT_SHADOW_TYPE = 0;
|
|
|
|
pipeline.onGlobalPipelineStateChanged();
|
|
}
|
|
|
|
public render (camera: Camera) {
|
|
const pipeline = this._pipeline as ForwardPipeline;
|
|
const shadowInfo = pipeline.pipelineSceneData.shadows;
|
|
const csmLayers = pipeline.pipelineSceneData.csmLayers;
|
|
const shadowFrameBufferMap = pipeline.pipelineSceneData.shadowFrameBufferMap;
|
|
const castShadowObjects = csmLayers.castShadowObjects;
|
|
const validPunctualLights = this._pipeline.pipelineSceneData.validPunctualLights;
|
|
if (!shadowInfo.enabled || shadowInfo.type !== ShadowType.ShadowMap) { return; }
|
|
|
|
let n = 0;
|
|
let m = 0;
|
|
for (;n < shadowInfo.maxReceived && m < validPunctualLights.length;) {
|
|
const light = validPunctualLights[m];
|
|
if (light.type === LightType.SPOT) {
|
|
const spotLight = light as SpotLight;
|
|
if (spotLight.shadowEnabled) {
|
|
_validLights.push(light);
|
|
n++;
|
|
}
|
|
}
|
|
m++;
|
|
}
|
|
|
|
if (castShadowObjects.length === 0) {
|
|
this.clearShadowMap(_validLights, camera);
|
|
return;
|
|
}
|
|
|
|
if (shadowInfo.shadowMapDirty) { this.resizeShadowMap(); }
|
|
|
|
const { mainLight } = camera.scene!;
|
|
if (mainLight && mainLight.shadowEnabled) {
|
|
const globalDS = pipeline.descriptorSet;
|
|
if (!shadowFrameBufferMap.has(mainLight)) {
|
|
this._initShadowFrameBuffer(pipeline, mainLight, camera.window.swapchain);
|
|
}
|
|
|
|
const shadowFrameBuffer = shadowFrameBufferMap.get(mainLight);
|
|
if (mainLight.shadowFixedArea) {
|
|
this._renderStage(camera, mainLight, shadowFrameBuffer!, globalDS);
|
|
} else {
|
|
const csmLevel = pipeline.pipelineSceneData.csmSupported ? mainLight.csmLevel : 1;
|
|
for (let i = 0; i < csmLevel; i++) {
|
|
this._renderStage(camera, mainLight, shadowFrameBuffer!, globalDS, i);
|
|
}
|
|
}
|
|
}
|
|
|
|
for (let l = 0; l < _validLights.length; l++) {
|
|
const light = _validLights[l];
|
|
const ds = pipeline.globalDSManager.getOrCreateDescriptorSet(light)!;
|
|
|
|
if (!shadowFrameBufferMap.has(light)) {
|
|
this._initShadowFrameBuffer(pipeline, light, camera.window.swapchain);
|
|
}
|
|
|
|
const shadowFrameBuffer = shadowFrameBufferMap.get(light);
|
|
this._renderStage(camera, light, shadowFrameBuffer!, ds);
|
|
}
|
|
|
|
_validLights.length = 0;
|
|
}
|
|
|
|
public destroy () {
|
|
super.destroy();
|
|
if (this._pipeline) {
|
|
const shadowFrameBufferMap = this._pipeline.pipelineSceneData.shadowFrameBufferMap;
|
|
const shadowFrameBuffers = Array.from(shadowFrameBufferMap.values());
|
|
for (let i = 0; i < shadowFrameBuffers.length; i++) {
|
|
const frameBuffer = shadowFrameBuffers[i];
|
|
|
|
if (!frameBuffer) { continue; }
|
|
const renderTargets = frameBuffer.colorTextures;
|
|
for (let j = 0; j < renderTargets.length; j++) {
|
|
const renderTarget = renderTargets[j];
|
|
if (renderTarget) { renderTarget.destroy(); }
|
|
}
|
|
renderTargets.length = 0;
|
|
|
|
const depth = frameBuffer.depthStencilTexture;
|
|
if (depth) { depth.destroy(); }
|
|
|
|
frameBuffer.destroy();
|
|
}
|
|
|
|
shadowFrameBufferMap.clear();
|
|
}
|
|
|
|
if (this._shadowRenderPass) { this._shadowRenderPass.destroy(); }
|
|
}
|
|
|
|
/**
|
|
* @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
|
|
*/
|
|
public _initShadowFrameBuffer (pipeline: RenderPipeline, light: Light, swapchain: Swapchain) {
|
|
const { device } = pipeline;
|
|
const shadows = pipeline.pipelineSceneData.shadows;
|
|
const shadowMapSize = shadows.size;
|
|
const shadowFrameBufferMap = pipeline.pipelineSceneData.shadowFrameBufferMap;
|
|
const format = supportsR32FloatTexture(device) ? Format.R32F : Format.RGBA8;
|
|
|
|
if (!this._shadowRenderPass) {
|
|
const colorAttachment = new ColorAttachment();
|
|
colorAttachment.format = format;
|
|
colorAttachment.loadOp = LoadOp.CLEAR; // should clear color attachment
|
|
colorAttachment.storeOp = StoreOp.STORE;
|
|
colorAttachment.sampleCount = 1;
|
|
|
|
const depthStencilAttachment = new DepthStencilAttachment();
|
|
depthStencilAttachment.format = Format.DEPTH_STENCIL;
|
|
depthStencilAttachment.depthLoadOp = LoadOp.CLEAR;
|
|
depthStencilAttachment.depthStoreOp = StoreOp.DISCARD;
|
|
depthStencilAttachment.stencilLoadOp = LoadOp.CLEAR;
|
|
depthStencilAttachment.stencilStoreOp = StoreOp.DISCARD;
|
|
depthStencilAttachment.sampleCount = 1;
|
|
|
|
const renderPassInfo = new RenderPassInfo([colorAttachment], depthStencilAttachment);
|
|
this._shadowRenderPass = device.createRenderPass(renderPassInfo);
|
|
}
|
|
|
|
const shadowRenderTargets: Texture[] = [];
|
|
shadowRenderTargets.push(device.createTexture(new TextureInfo(
|
|
TextureType.TEX2D,
|
|
TextureUsageBit.COLOR_ATTACHMENT | TextureUsageBit.SAMPLED,
|
|
format,
|
|
shadowMapSize.x,
|
|
shadowMapSize.y,
|
|
)));
|
|
|
|
const depth = device.createTexture(new TextureInfo(
|
|
TextureType.TEX2D,
|
|
TextureUsageBit.DEPTH_STENCIL_ATTACHMENT,
|
|
Format.DEPTH_STENCIL,
|
|
shadowMapSize.x,
|
|
shadowMapSize.y,
|
|
));
|
|
|
|
const shadowFrameBuffer = device.createFramebuffer(new FramebufferInfo(
|
|
this._shadowRenderPass,
|
|
shadowRenderTargets,
|
|
depth,
|
|
));
|
|
|
|
// Cache frameBuffer
|
|
shadowFrameBufferMap.set(light, shadowFrameBuffer);
|
|
}
|
|
|
|
private _renderStage (camera: Camera, light: Light, shadowFrameBuffer: Framebuffer, globalDS: DescriptorSet, level = 0) {
|
|
for (let i = 0; i < this._stages.length; i++) {
|
|
const shadowStage = this._stages[i] as ShadowStage;
|
|
shadowStage.setUsage(globalDS, light, shadowFrameBuffer, level);
|
|
shadowStage.render(camera);
|
|
}
|
|
}
|
|
|
|
private clearShadowMap (validLights: Light[], camera: Camera) {
|
|
const pipeline = this._pipeline;
|
|
const scene = pipeline.pipelineSceneData;
|
|
|
|
const { mainLight } = camera.scene!;
|
|
if (mainLight) {
|
|
const globalDS = this._pipeline.descriptorSet;
|
|
if (!scene.shadowFrameBufferMap.has(mainLight)) {
|
|
this._initShadowFrameBuffer(this._pipeline, mainLight, camera.window.swapchain);
|
|
}
|
|
|
|
const shadowFrameBuffer = scene.shadowFrameBufferMap.get(mainLight);
|
|
for (let i = 0; i < this._stages.length; i++) {
|
|
const shadowStage = this._stages[i] as ShadowStage;
|
|
shadowStage.setUsage(globalDS, mainLight, shadowFrameBuffer!);
|
|
shadowStage.clearFramebuffer(camera);
|
|
}
|
|
}
|
|
|
|
for (let l = 0; l < validLights.length; l++) {
|
|
const light = validLights[l];
|
|
const ds = pipeline.globalDSManager.getOrCreateDescriptorSet(light)!;
|
|
if (!scene.shadowFrameBufferMap.has(light)) {
|
|
this._initShadowFrameBuffer(this._pipeline, light, camera.window.swapchain);
|
|
}
|
|
|
|
const shadowFrameBuffer = scene.shadowFrameBufferMap.get(light);
|
|
for (let i = 0; i < this._stages.length; i++) {
|
|
const shadowStage = this._stages[i] as ShadowStage;
|
|
shadowStage.setUsage(ds, light, shadowFrameBuffer!);
|
|
shadowStage.clearFramebuffer(camera);
|
|
}
|
|
}
|
|
}
|
|
|
|
private resizeShadowMap () {
|
|
const shadows = this._pipeline.pipelineSceneData.shadows;
|
|
const shadowMapSize = shadows.size;
|
|
const pipeline = this._pipeline;
|
|
const device = pipeline.device;
|
|
const shadowFrameBufferMap = pipeline.pipelineSceneData.shadowFrameBufferMap;
|
|
const format = supportsR32FloatTexture(device) ? Format.R32F : Format.RGBA8;
|
|
|
|
for (const key of shadowFrameBufferMap.keys()) {
|
|
const frameBuffer = shadowFrameBufferMap.get(key);
|
|
if (!frameBuffer) {
|
|
continue;
|
|
}
|
|
|
|
const renderTargets: Texture[] = [];
|
|
renderTargets.push(pipeline.device.createTexture(new TextureInfo(
|
|
TextureType.TEX2D,
|
|
TextureUsageBit.COLOR_ATTACHMENT | TextureUsageBit.SAMPLED,
|
|
format,
|
|
shadowMapSize.x,
|
|
shadowMapSize.y,
|
|
)));
|
|
|
|
const depth = frameBuffer.depthStencilTexture;
|
|
if (depth) { depth.resize(shadowMapSize.x, shadowMapSize.y); }
|
|
|
|
const shadowRenderPass = frameBuffer.renderPass;
|
|
frameBuffer.destroy();
|
|
const newFrameBuffer = device.createFramebuffer(new FramebufferInfo(
|
|
shadowRenderPass,
|
|
renderTargets,
|
|
depth,
|
|
));
|
|
shadowFrameBufferMap.set(key, newFrameBuffer);
|
|
}
|
|
|
|
shadows.shadowMapDirty = false;
|
|
}
|
|
}
|