add resize() to pipeline & window

This commit is contained in:
jerrywwl
2019-01-16 13:35:17 +08:00
parent 2117216179
commit 24bb8ea478
7 changed files with 40 additions and 2 deletions
+6
View File
@@ -110,6 +110,12 @@ export class Root {
}
}
public resize (width: number, height: number) {
for (const window of this._windows) {
window.resize(width, height);
}
}
public frameMove (deltaTime: number) {
this._frameTime = deltaTime;
+12
View File
@@ -172,6 +172,18 @@ export class WebGLGFXWindow extends GFXWindow {
this._status = GFXStatus.UNREADY;
}
public resize (width: number, height: number) {
if (this._framebuffer) {
this._framebuffer.destroy();
this._framebuffer.initialize({
renderPass: this._renderPass!,
// colorViews: [this._colorTexView],
// depthStencilView: this._depthStencilTexView,
isOffscreen: false,
});
}
}
public get webGLDevice (): WebGLGFXDevice {
return this._device as WebGLGFXDevice;
}
+2 -1
View File
@@ -60,5 +60,6 @@ export abstract class GFXWindow extends GFXObject {
}
public abstract initialize (info: IGFXWindowInfo): boolean;
public abstract destroy (): void;
public abstract destroy ();
public abstract resize (width: number, height: number);
}
+3
View File
@@ -37,6 +37,9 @@ export class ForwardStage extends RenderStage {
}
}
public resize (width: number, height: number) {
}
public render (view: RenderView) {
const cmdBuff = this._cmdBuff!;
+10 -1
View File
@@ -38,13 +38,22 @@ export abstract class RenderFlow {
public abstract initialize (info: IRenderFlowInfo): boolean;
public abstract destroy ();
public resize (width: number, height: number) {
for (const stage of this._stages) {
stage.resize(width, height);
}
}
public render (view: RenderView) {
for (const stage of this._stages) {
stage.render(view);
}
}
public createStage<T extends RenderStage> (clazz: new(flow: RenderFlow) => T, info: IRenderStageInfo): RenderStage | null {
public createStage<T extends RenderStage> (
clazz: new(flow: RenderFlow) => T,
info: IRenderStageInfo): RenderStage | null {
const stage: RenderStage = new clazz(this);
if (stage.initialize(info)) {
this._stages.push(stage);
+6
View File
@@ -121,6 +121,12 @@ export abstract class RenderPipeline {
public abstract initialize (): boolean;
public abstract destroy ();
public resize (width: number, height: number) {
for (const flow of this._flows) {
flow.resize(width, height);
}
}
public render (view: RenderView) {
view.camera.update();
+1
View File
@@ -60,6 +60,7 @@ export abstract class RenderStage {
public abstract initialize (info: IRenderStageInfo): boolean;
public abstract destroy ();
public abstract render (view: RenderView);
public abstract resize (width: number, height: number);
public setClearColor (color: IGFXColor) {
if (this._clearColors.length > 0) {