diff --git a/cocos/core/root.ts b/cocos/core/root.ts index 9649d82e3f..2882840121 100644 --- a/cocos/core/root.ts +++ b/cocos/core/root.ts @@ -1,6 +1,6 @@ import { GFXWindow, GFXWindowInfo } from "../gfx/window"; import { GFXDevice } from "../gfx/device"; -import { RenderView, RenderViewInfo, RenderViewPriority } from "../pipeline/render-view"; +import { RenderView, RenderViewInfo } from "../pipeline/render-view"; import { RenderPipeline } from "../pipeline/render-pipeline"; import { ForwardPipeline } from "../pipeline/forward/forward-pipeline"; import { RenderScene, RenderSceneInfo } from "../renderer/scene/render-scene"; @@ -50,7 +50,7 @@ export class Root { for (let i = 0; i < this._views.length; ++i) { let view = this._views[i]; - if(view.isEnable() && view.isAttached) { + if (view.isEnable() && view.isAttached) { (this._pipeline).render(view); } } @@ -89,7 +89,7 @@ export class Root { public createScene(info: RenderSceneInfo): RenderScene | null { let scene = new RenderScene; - if(scene.initialize(info)) { + if (scene.initialize(info)) { this._scenes.push(scene); return scene; } else { diff --git a/cocos/gfx/gfx-define.ts b/cocos/gfx/gfx-define.ts index 61c41f70c6..d5848a3e2d 100644 --- a/cocos/gfx/gfx-define.ts +++ b/cocos/gfx/gfx-define.ts @@ -697,25 +697,25 @@ export function GFXGetTypeSize(type: GFXType): number { export function GFXGetAttributeBinding(name: string) : number { if (name === GFX_ATTRIBUTE_POSITION) { - return 20; + return 6; } else if (name === GFX_ATTRIBUTE_COLOR) { - return 21; + return 7; } else if (name === GFX_ATTRIBUTE_COLOR1) { - return 22; + return 8; } else if (name === GFX_ATTRIBUTE_NORMAL) { - return 23; + return 9; } else if (name === GFX_ATTRIBUTE_TANGENT) { - return 24; + return 10; } else if (name === GFX_ATTRIBUTE_BINORMAL) { - return 25; + return 11; } else if (name === GFX_ATTRIBUTE_TEXCOORD) { - return 26; + return 12; } else if (name === GFX_ATTRIBUTE_TEXCOORD1) { - return 27; + return 13; } else if (name === GFX_ATTRIBUTE_JOINTS) { - return 28; + return 14; } else if (name === GFX_ATTRIBUTE_WEIGHTS) { - return 29; + return 15; } else { return -1; } diff --git a/cocos/gfx/webgl/webgl-device.ts b/cocos/gfx/webgl/webgl-device.ts index 9b58cd1393..dbca7d8dd8 100644 --- a/cocos/gfx/webgl/webgl-device.ts +++ b/cocos/gfx/webgl/webgl-device.ts @@ -31,7 +31,7 @@ import { WebGLGFXFramebuffer } from './webgl-framebuffer'; import { WebGLGFXInputAssembler } from './webgl-input-assembler'; import { GFXWindow, GFXWindowInfo } from '../window'; import { WebGLGFXWindow } from './webgl-window'; -import { GFXBindingType, GFXFilter, GFXAddress, GFXTextureType, GFXTextureFlagBit, GFXTextureViewType, GFXBufferUsageBit } from '../gfx-define'; +import { GFXBindingType, GFXFilter, GFXAddress, GFXTextureType, GFXTextureFlagBit, GFXTextureViewType, GFXBufferUsageBit, GFXQueueType } from '../gfx-define'; import { WebGLGFXBindingLayout } from './webgl-binding-layout'; const WebGLPrimitives: GLenum[] = [ @@ -145,6 +145,8 @@ export class WebGLGFXDevice extends GFXDevice { this._OES_element_index_uint = this._webGLRC.getExtension("OES_element_index_uint"); this._ANGLE_instanced_arrays = this._webGLRC.getExtension("ANGLE_instanced_arrays"); + this._queue = this.createQueue({ type: GFXQueueType.GRAPHICS }); + // create primary window this._mainWindow = this.createWindow({ title: this._webGLRC.canvas.title, @@ -171,6 +173,11 @@ export class WebGLGFXDevice extends GFXDevice { this._cmdAllocator = null; } + if (this._queue) { + this._queue.destroy(); + this._queue = null; + } + this._webGLRC = null; } @@ -476,8 +483,8 @@ export class WebGLGFXDevice extends GFXDevice { public emitCmdCreateGPURenderPass(info: GFXRenderPassInfo): WebGLGPURenderPass { let gpuRenderPass: WebGLGPURenderPass = { objType: WebGLGPUObjectType.RENDER_PASS, - colorAttachments: info.colorAttachment? info.colorAttachment : [], - depthStencilAttachment: info.depthStencilAttachment? info.depthStencilAttachment : null, + colorAttachments: info.colorAttachment ? info.colorAttachment : [], + depthStencilAttachment: info.depthStencilAttachment ? info.depthStencilAttachment : null, } return gpuRenderPass; @@ -585,7 +592,7 @@ export class WebGLGFXDevice extends GFXDevice { gpuStages[i] = { type: stage.type, source: stage.source, - macros: stage.macros? stage.macros : [], + macros: stage.macros ? stage.macros : [], glShader: 0, }; } diff --git a/cocos/renderer/scene/render-scene.ts b/cocos/renderer/scene/render-scene.ts index 28d018c9a1..5f27e1de57 100644 --- a/cocos/renderer/scene/render-scene.ts +++ b/cocos/renderer/scene/render-scene.ts @@ -151,6 +151,10 @@ export class RenderScene { return this._cameras; } + public get mainCamera(): Camera | null { + return this._mainCamera; + } + public get lights(): Light[] { return this._lights; }