You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/renderers/common/RenderContexts.js
+24-14Lines changed: 24 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,11 @@
1
1
importChainMapfrom'./ChainMap.js';
2
2
importRenderContextfrom'./RenderContext.js';
3
+
import{Scene}from'../../scenes/Scene.js';
4
+
import{Camera}from'../../cameras/Camera.js';
3
5
4
6
const_chainKeys=[];
7
+
const_defaultScene=/*@__PURE__*/newScene();
8
+
const_defaultCamera=/*@__PURE__*/newCamera();
5
9
6
10
/**
7
11
* This module manages the render contexts of the renderer.
@@ -28,22 +32,15 @@ class RenderContexts {
28
32
/**
29
33
* Returns a render context for the given scene, camera and render target.
30
34
*
31
-
* @param {Scene?} [scene=null] - The scene. The parameter can become `null` e.g. when the renderer clears a render target.
32
-
* @param {Camera?} [camera=null] - The camera that is used to render the scene. The parameter can become `null` e.g. when the renderer clears a render target.
35
+
* @param {Scene} scene - The scene.
36
+
* @param {Camera} camera - The camera that is used to render the scene.
33
37
* @param {RenderTarget?} [renderTarget=null] - The active render target.
34
38
* @return {RenderContext} The render context.
35
39
*/
36
-
get(scene=null,camera=null,renderTarget=null){
37
-
38
-
if(scene!==null)_chainKeys.push(scene);
39
-
if(camera!==null)_chainKeys.push(camera);
40
-
41
-
if(_chainKeys.length===0){
42
-
43
-
_chainKeys.push({id: 'default'});
44
-
45
-
}
40
+
get(scene,camera,renderTarget=null){
46
41
42
+
_chainKeys[0]=scene;
43
+
_chainKeys[1]=camera;
47
44
48
45
letattachmentState;
49
46
@@ -60,7 +57,7 @@ class RenderContexts {
60
57
61
58
}
62
59
63
-
constchainMap=this.getChainMap(attachmentState);
60
+
constchainMap=this._getChainMap(attachmentState);
64
61
65
62
letrenderState=chainMap.get(_chainKeys);
66
63
@@ -80,13 +77,26 @@ class RenderContexts {
80
77
81
78
}
82
79
80
+
/**
81
+
* Returns a render context intended for clear operations.
82
+
*
83
+
* @param {RenderTarget?} [renderTarget=null] - The active render target.
0 commit comments