mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
RenderView remove dependence of Root (#7034)
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
|
||||
import { Camera } from '../renderer/scene/camera';
|
||||
import { Root } from '../root';
|
||||
import { CAMERA_DEFAULT_MASK } from './define';
|
||||
import { RenderFlowTag } from './pipeline-serialization';
|
||||
import { RenderFlow } from './render-flow';
|
||||
@@ -117,13 +116,6 @@ export class RenderView {
|
||||
return this._flows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal usage
|
||||
*/
|
||||
public static registerCreateFunc (root: Root) {
|
||||
root._createViewFun = (_root: Root, _camera: Camera): RenderView => new RenderView(_camera);
|
||||
}
|
||||
|
||||
private _name: string = '';
|
||||
private _window: RenderWindow | null = null;
|
||||
private _priority: number = 0;
|
||||
@@ -135,10 +127,9 @@ export class RenderView {
|
||||
/**
|
||||
* @en The constructor
|
||||
* @zh 构造函数。
|
||||
* @param root
|
||||
* @param camera
|
||||
*/
|
||||
private constructor (camera: Camera) {
|
||||
public constructor (camera: Camera) {
|
||||
this._camera = camera;
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -175,7 +175,6 @@ export class Root {
|
||||
}
|
||||
|
||||
public _createSceneFun: (root: Root) => RenderScene = null!;
|
||||
public _createViewFun: (root: Root, camera: Camera) => RenderView = null!;
|
||||
public _createWindowFun: (root: Root) => RenderWindow = null!;
|
||||
|
||||
private _device: GFXDevice;
|
||||
@@ -208,7 +207,6 @@ export class Root {
|
||||
this._dataPoolMgr = new DataPoolManager(device);
|
||||
|
||||
RenderScene.registerCreateFunc(this);
|
||||
RenderView.registerCreateFunc(this);
|
||||
RenderWindow.registerCreateFunc(this);
|
||||
|
||||
this._cameraPool = new Pool(() => new Camera(this._device), 4);
|
||||
@@ -457,7 +455,7 @@ export class Root {
|
||||
* @param info 渲染视图描述信息
|
||||
*/
|
||||
public createView (info: IRenderViewInfo): RenderView {
|
||||
const view: RenderView = this._createViewFun(this, info.camera);
|
||||
const view: RenderView = new RenderView(info.camera);
|
||||
view.initialize(info);
|
||||
// view.camera.resize(cc.game.canvas.width, cc.game.canvas.height);
|
||||
this._views.push(view);
|
||||
|
||||
Reference in New Issue
Block a user