/
scenerenderpass.ts
64 lines (50 loc) · 1.48 KB
/
scenerenderpass.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
import { Context } from '../context';
import { Initializable } from '../initializable';
import { SceneNode } from './scenenode';
/**
* This is the base class for all render passes that render scenes.
* A `SceneNode` must be given, which is the root node that will be rendered.
* All children of this node will be rendered recursively.
*/
export abstract class SceneRenderPass extends Initializable {
/**
* Context, used to get context information and WebGL API access.
*/
protected _context: Context;
/** @see {@link scene} */
protected _scene: SceneNode | undefined;
/**
* This method is called after a new scene is registered in a SceneRenderPass.
* It can be used to preprocess the scene hierarchy to allow preprocessing tasks
* that will speedup the rendering later on.
*/
protected abstract preprocessScene(): void;
/**
* @todo comment
*/
abstract update(): void;
/**
* @todo comment
*/
abstract prepare(): void;
/**
* @todo comment
*/
abstract frame(): void;
/**
* Setter for the scene of this render pass.
* @param scene - Scene to be rendered
*/
set scene(scene: SceneNode | undefined) {
this._scene = scene;
if (this._scene !== undefined) {
this.preprocessScene();
}
}
/**
* The scene which will be rendered by this pass.
*/
get scene(): SceneNode | undefined {
return this._scene;
}
}