mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
add resize() to pipeline & window
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,9 @@ export class ForwardStage extends RenderStage {
|
||||
}
|
||||
}
|
||||
|
||||
public resize (width: number, height: number) {
|
||||
}
|
||||
|
||||
public render (view: RenderView) {
|
||||
|
||||
const cmdBuff = this._cmdBuff!;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user