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

WebGLRenderer: Update materials when light setup changes.

上级 c1c62995
......@@ -2563,9 +2563,16 @@ THREE.WebGLRenderer = function ( parameters ) {
viewMatrix = camera.matrixWorldInverse,
directionalCurrent = _lights.directional.length;
directionalLength = 0,
pointCurrent = _lights.point.length;
pointLength = 0,
spotCurrent = _lights.spot.length;
spotLength = 0,
hemiCurrent = _lights.hemi.length;
hemiLength = 0;
for ( l = 0, ll = lights.length; l < ll; l ++ ) {
......@@ -2685,6 +2692,17 @@ THREE.WebGLRenderer = function ( parameters ) {
_lights.ambient[ 1 ] = g;
_lights.ambient[ 2 ] = b;
// Reset materials if light setup changes
if ( directionalCurrent !== directionalLength ||
pointCurrent !== pointLength ||
spotCurrent !== spotLength ||
hemiCurrent !== hemiLength ) {
materialsCache.clear();
}
_lights.directional.length = directionalLength;
_lights.point.length = pointLength;
_lights.spot.length = spotLength;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册