-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
framebuffer.ts
110 lines (95 loc) · 2.07 KB
/
framebuffer.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/**
* @category gfx
*/
import { GFXObject, GFXObjectType } from './define';
import { GFXDevice } from './device';
import { GFXRenderPass } from './render-pass';
import { GFXTextureView } from './texture-view';
/**
* @zh
* GFX帧缓冲描述信息。
*/
export interface IGFXFramebufferInfo {
renderPass: GFXRenderPass;
colorViews: GFXTextureView[];
depthStencilView: GFXTextureView | null;
isOffscreen?: boolean;
}
/**
* @zh
* GFX帧缓冲。
*/
export abstract class GFXFramebuffer extends GFXObject {
/**
* @zh
* GFX渲染过程。
*/
public get renderPass (): GFXRenderPass | null {
return this._renderPass;
}
/**
* @zh
* 颜色纹理视图数组。
*/
public get colorViews (): GFXTextureView[] {
return this._colorViews;
}
/**
* @zh
* 深度模板纹理视图。
*/
public get depthStencilView (): GFXTextureView | null {
return this._depthStencilView;
}
/**
* @zh
* 是否是离屏的。
*/
public get isOffscreen (): boolean {
return this._isOffscreen;
}
/**
* @zh
* GFX设备。
*/
protected _device: GFXDevice;
/**
* @zh
* GFX渲染过程。
*/
protected _renderPass: GFXRenderPass | null = null;
/**
* @zh
* 颜色纹理视图数组。
*/
protected _colorViews: GFXTextureView[] = [];
/**
* @zh
* 深度模板纹理视图。
*/
protected _depthStencilView: GFXTextureView | null = null;
/**
* @zh
* 是否是离屏的。
*/
protected _isOffscreen: boolean = true;
/**
* 构造函数。
* @param device GFX设备。
*/
constructor (device: GFXDevice) {
super(GFXObjectType.FRAMEBUFFER);
this._device = device;
}
/**
* @zh
* 初始化函数。
* @param info GFX帧缓冲描述信息。
*/
public abstract initialize (info: IGFXFramebufferInfo): boolean;
/**
* @zh
* 销毁函数。
*/
public abstract destroy (): void;
}