diff --git a/cocos/pipeline/forward/forward-pipeline.ts b/cocos/pipeline/forward/forward-pipeline.ts index 7cd34621a0..beb296e2b7 100644 --- a/cocos/pipeline/forward/forward-pipeline.ts +++ b/cocos/pipeline/forward/forward-pipeline.ts @@ -56,6 +56,8 @@ export class ForwardPipeline extends RenderPipeline { return false; } + this._name = 'ForwardPipeline'; + if (!this._globalBindings.get(UBOForwardLight.BLOCK.name)) { const lightsUBO = this._root.device.createBuffer({ usage: GFXBufferUsageBit.UNIFORM | GFXBufferUsageBit.TRANSFER_DST, diff --git a/cocos/pipeline/render-pipeline.ts b/cocos/pipeline/render-pipeline.ts index 0571010d5f..b14e802c64 100644 --- a/cocos/pipeline/render-pipeline.ts +++ b/cocos/pipeline/render-pipeline.ts @@ -51,6 +51,10 @@ export abstract class RenderPipeline { return this._device; } + public get name (): string { + return this._name; + } + public get renderObjects (): IRenderObject[] { return this._renderObjects; } @@ -157,6 +161,7 @@ export abstract class RenderPipeline { protected _root: Root; protected _device: GFXDevice; + protected _name: string = 'BasePipeline'; protected _renderObjects: IRenderObject[] = []; protected _renderPasses: Map = new Map(); protected _flows: RenderFlow[] = []; diff --git a/cocos/renderer/scene/model.ts b/cocos/renderer/scene/model.ts index e7b84d9ee4..9b8f49ac1e 100644 --- a/cocos/renderer/scene/model.ts +++ b/cocos/renderer/scene/model.ts @@ -323,7 +323,7 @@ export class Model { break; } } - if (hasForwardLight && cc.director.root.pipeline.constructor.name === 'ForwardPipeline') { + if (hasForwardLight && cc.director.root.pipeline.name === 'ForwardPipeline') { if (!this._localBindings.has(UBOForwardLight.BLOCK.name)) { this._localBindings.set(UBOForwardLight.BLOCK.name, { type: GFXBindingType.UNIFORM_BUFFER,