@@ -1160,14 +1160,25 @@ THREE.WebGLRenderer = function ( parameters ) {
1160
1160
1161
1161
//
1162
1162
1163
- var needsClear = this . autoClear || forceClear ;
1164
1163
var background = scene . background ;
1165
1164
1166
1165
if ( background === null ) {
1167
1166
1168
1167
glClearColor ( _clearColor . r , _clearColor . g , _clearColor . b , _clearAlpha ) ;
1169
1168
1170
- } else if ( background instanceof THREE . CubeTexture ) {
1169
+ } else if ( background instanceof THREE . Color ) {
1170
+
1171
+ glClearColor ( background . r , background . g , background . b , 1 ) ;
1172
+
1173
+ }
1174
+
1175
+ if ( this . autoClear || forceClear ) {
1176
+
1177
+ this . clear ( this . autoClearColor , this . autoClearDepth , this . autoClearStencil ) ;
1178
+
1179
+ }
1180
+
1181
+ if ( background instanceof THREE . CubeTexture ) {
1171
1182
1172
1183
backgroundCamera2 . projectionMatrix . copy ( camera . projectionMatrix ) ;
1173
1184
@@ -1179,28 +1190,12 @@ THREE.WebGLRenderer = function ( parameters ) {
1179
1190
1180
1191
_this . renderBufferDirect ( backgroundCamera2 , null , backgroundBoxMesh . geometry , backgroundBoxMesh . material , backgroundBoxMesh , null ) ;
1181
1192
1182
- needsClear = false ;
1183
-
1184
1193
} else if ( background instanceof THREE . Texture ) {
1185
1194
1186
1195
backgroundPlaneMesh . material . map = background ;
1187
1196
1188
1197
_this . renderBufferDirect ( backgroundCamera , null , backgroundPlaneMesh . geometry , backgroundPlaneMesh . material , backgroundPlaneMesh , null ) ;
1189
1198
1190
- needsClear = false ;
1191
-
1192
- } else if ( background instanceof THREE . Color ) {
1193
-
1194
- glClearColor ( background . r , background . g , background . b , 1 ) ;
1195
-
1196
- needsClear = true ;
1197
-
1198
- }
1199
-
1200
- if ( needsClear ) {
1201
-
1202
- this . clear ( this . autoClearColor , this . autoClearDepth , this . autoClearStencil ) ;
1203
-
1204
1199
}
1205
1200
1206
1201
//
0 commit comments