提交 79c14c8f 编写于 作者: M Mr.doob

WebGLShadowMap context lost support and clean up.

上级 9ad5d8a9
......@@ -309,7 +309,7 @@ function WebGLRenderer( parameters ) {
// shadow map
var shadowMap = new WebGLShadowMap( _this, shadowsArray, objects, capabilities.maxTextureSize );
var shadowMap = new WebGLShadowMap( _this, objects, capabilities.maxTextureSize );
this.shadowMap = shadowMap;
......@@ -1131,7 +1131,7 @@ function WebGLRenderer( parameters ) {
if ( _clippingEnabled ) _clipping.beginShadows();
shadowMap.render( scene, camera );
shadowMap.render( shadowsArray, scene, camera );
lights.setup( lightsArray, shadowsArray, camera );
......
......@@ -16,7 +16,7 @@ import { Vector2 } from '../../math/Vector2';
import { Matrix4 } from '../../math/Matrix4';
import { Frustum } from '../../math/Frustum';
function WebGLShadowMap( _renderer, _shadows, _objects, maxTextureSize ) {
function WebGLShadowMap( _renderer, _objects, maxTextureSize ) {
var _gl = _renderer.context,
_state = _renderer.state,
......@@ -99,12 +99,12 @@ function WebGLShadowMap( _renderer, _shadows, _objects, maxTextureSize ) {
this.renderReverseSided = true;
this.renderSingleSided = true;
this.render = function ( scene, camera ) {
this.render = function ( lights, scene, camera ) {
if ( scope.enabled === false ) return;
if ( scope.autoUpdate === false && scope.needsUpdate === false ) return;
if ( _shadows.length === 0 ) return;
if ( lights.length === 0 ) return;
// Set GL state for depth map.
_state.disable( _gl.BLEND );
......@@ -116,9 +116,9 @@ function WebGLShadowMap( _renderer, _shadows, _objects, maxTextureSize ) {
var faceCount;
for ( var i = 0, il = _shadows.length; i < il; i ++ ) {
for ( var i = 0, il = lights.length; i < il; i ++ ) {
var light = _shadows[ i ];
var light = lights[ i ];
var shadow = light.shadow;
var isPointLight = light && light.isPointLight;
......@@ -258,11 +258,6 @@ function WebGLShadowMap( _renderer, _shadows, _objects, maxTextureSize ) {
}
// Restore GL state.
var clearColor = _renderer.getClearColor();
var clearAlpha = _renderer.getClearAlpha();
_renderer.setClearColor( clearColor, clearAlpha );
scope.needsUpdate = false;
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册