From 986e4c5f641ef35c08bb275e2c0e28744a018a6d Mon Sep 17 00:00:00 2001 From: zxg0622 <247274249@qq.com> Date: Thu, 21 Mar 2019 16:55:27 +0800 Subject: [PATCH] modify flows in view (#4078) --- cocos/3d/framework/editor-camera-component.ts | 2 +- cocos/pipeline/render-pipeline.ts | 6 ++--- cocos/pipeline/render-view.ts | 23 +++++++++++-------- cocos/renderer/scene/camera.ts | 4 ++-- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/cocos/3d/framework/editor-camera-component.ts b/cocos/3d/framework/editor-camera-component.ts index e058eb9fa0..0fe280a886 100644 --- a/cocos/3d/framework/editor-camera-component.ts +++ b/cocos/3d/framework/editor-camera-component.ts @@ -129,7 +129,7 @@ export class EditorCameraComponent extends CameraComponent { targetDisplay: this._targetDisplay, priority: this._priority, isUI: true, - stages: ['UIFlow'], + flows: ['UIFlow'], }); this._uiEditorCamera!.viewport = this._camera.viewport; this._uiEditorCamera!.fov = this._camera.fov; diff --git a/cocos/pipeline/render-pipeline.ts b/cocos/pipeline/render-pipeline.ts index 5661a0da5a..c6d07c5ac8 100644 --- a/cocos/pipeline/render-pipeline.ts +++ b/cocos/pipeline/render-pipeline.ts @@ -190,10 +190,8 @@ export abstract class RenderPipeline { this.updateUBOs(view); - for (const flow of this._flows) { - if (view.stages.indexOf(flow.name) !== -1) { - flow.render(view); - } + for (const flow of view.flows) { + flow.render(view); } } diff --git a/cocos/pipeline/render-view.ts b/cocos/pipeline/render-view.ts index fec9cd2a39..c95265d93e 100644 --- a/cocos/pipeline/render-view.ts +++ b/cocos/pipeline/render-view.ts @@ -6,6 +6,7 @@ import { GFXTexture } from '../gfx/texture'; import { GFXTextureView } from '../gfx/texture-view'; import { GFXWindow } from '../gfx/window'; import { Camera } from '../renderer/scene/camera'; +import { RenderFlow } from './render-flow'; export enum RenderViewPriority { GENERAL = 100, @@ -16,7 +17,7 @@ export interface IRenderViewInfo { name: string; priority: number; isUI: boolean; - stages?: string[]; + flows?: string[]; } export interface IRenderTargetInfo { @@ -72,8 +73,8 @@ export class RenderView { return this._isUI; } - public get stages (): string[] { - return this._stages; + public get flows (): RenderFlow[] { + return this._flows; } public set isOffscreen (isOffscreen: boolean) { @@ -100,7 +101,7 @@ export class RenderView { private _camera: Camera; private _isEnable: boolean = true; private _isUI: boolean = false; - private _stages: string[] = []; + private _flows: RenderFlow[] = []; private _isOffscreen: boolean = false; // For offscreen @@ -121,12 +122,14 @@ export class RenderView { this._name = info.name; this._isUI = info.isUI; this.priority = info.priority; - if (info.stages) { - this._stages.push(...info.stages); - } else { - this._stages.push('ForwardFlow'); - this._stages.push('ToneMapFlow'); - this._stages.push('SMAAFlow'); + if (!info.flows) { + info.flows = ['ForwardFlow', 'ToneMapFlow', 'SMAAFlow']; + } + const pipelineFlows = cc.director.root.pipeline.flows; + for (const f of pipelineFlows) { + if (info.flows.indexOf(f.name) !== -1) { + this.flows.push(f); + } } return true; diff --git a/cocos/renderer/scene/camera.ts b/cocos/renderer/scene/camera.ts index 829b5a1c9f..7e7e73c6c4 100644 --- a/cocos/renderer/scene/camera.ts +++ b/cocos/renderer/scene/camera.ts @@ -73,7 +73,7 @@ export interface ICameraInfo { priority: number; pipeline?: string; isUI?: boolean; - stages?: string[]; + flows?: string[]; } const v_a = cc.v3(); @@ -139,7 +139,7 @@ export class Camera { name: this._name, priority: this._priority, isUI, - stages: info.stages, + flows: info.flows, }); this.changeTargetDisplay(info.targetDisplay);