|
@@ -22788,8 +22788,21 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
if ( ! light.visible ) continue;
|
|
|
|
|
|
+ _direction.copy( light.matrixWorld.getPosition() );
|
|
|
+ _direction.subSelf( light.target.matrixWorld.getPosition() );
|
|
|
+ _direction.normalize();
|
|
|
+
|
|
|
+ // skip lights with undefined direction
|
|
|
+ // these create troubles in OpenGL (making pixel black)
|
|
|
+
|
|
|
+ if ( _direction.x === 0 && _direction.y === 0 && _direction.z === 0 ) continue;
|
|
|
+
|
|
|
dirOffset = dirLength * 3;
|
|
|
|
|
|
+ dirPositions[ dirOffset ] = _direction.x;
|
|
|
+ dirPositions[ dirOffset + 1 ] = _direction.y;
|
|
|
+ dirPositions[ dirOffset + 2 ] = _direction.z;
|
|
|
+
|
|
|
if ( _this.gammaInput ) {
|
|
|
|
|
|
setColorGamma( dirColors, dirOffset, color, intensity * intensity );
|
|
@@ -22800,14 +22813,6 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- _direction.copy( light.matrixWorld.getPosition() );
|
|
|
- _direction.subSelf( light.target.matrixWorld.getPosition() );
|
|
|
- _direction.normalize();
|
|
|
-
|
|
|
- dirPositions[ dirOffset ] = _direction.x;
|
|
|
- dirPositions[ dirOffset + 1 ] = _direction.y;
|
|
|
- dirPositions[ dirOffset + 2 ] = _direction.z;
|
|
|
-
|
|
|
dirLength += 1;
|
|
|
|
|
|
} else if ( light instanceof THREE.PointLight ) {
|
|
@@ -22883,11 +22888,23 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
if ( ! light.visible ) continue;
|
|
|
|
|
|
- skyColor = light.color;
|
|
|
- groundColor = light.groundColor;
|
|
|
+ _direction.copy( light.matrixWorld.getPosition() );
|
|
|
+ _direction.normalize();
|
|
|
+
|
|
|
+ // skip lights with undefined direction
|
|
|
+ // these create troubles in OpenGL (making pixel black)
|
|
|
+
|
|
|
+ if ( _direction.x === 0 && _direction.y === 0 && _direction.z === 0 ) continue;
|
|
|
|
|
|
hemiOffset = hemiLength * 3;
|
|
|
|
|
|
+ hemiPositions[ hemiOffset ] = _direction.x;
|
|
|
+ hemiPositions[ hemiOffset + 1 ] = _direction.y;
|
|
|
+ hemiPositions[ hemiOffset + 2 ] = _direction.z;
|
|
|
+
|
|
|
+ skyColor = light.color;
|
|
|
+ groundColor = light.groundColor;
|
|
|
+
|
|
|
if ( _this.gammaInput ) {
|
|
|
|
|
|
intensitySq = intensity * intensity;
|
|
@@ -22902,13 +22919,6 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- _direction.copy( light.matrixWorld.getPosition() );
|
|
|
- _direction.normalize();
|
|
|
-
|
|
|
- hemiPositions[ hemiOffset ] = _direction.x;
|
|
|
- hemiPositions[ hemiOffset + 1 ] = _direction.y;
|
|
|
- hemiPositions[ hemiOffset + 2 ] = _direction.z;
|
|
|
-
|
|
|
hemiLength += 1;
|
|
|
|
|
|
}
|
|
@@ -22919,22 +22929,10 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
// (this is to avoid if in shader)
|
|
|
|
|
|
for ( l = dirLength * 3, ll = Math.max( dirColors.length, dirCount * 3 ); l < ll; l ++ ) dirColors[ l ] = 0.0;
|
|
|
- for ( l = dirLength * 3, ll = Math.max( dirPositions.length, dirCount * 3 ); l < ll; l ++ ) dirPositions[ l ] = 0.0;
|
|
|
-
|
|
|
for ( l = pointLength * 3, ll = Math.max( pointColors.length, pointCount * 3 ); l < ll; l ++ ) pointColors[ l ] = 0.0;
|
|
|
- for ( l = pointLength * 3, ll = Math.max( pointPositions.length, pointCount * 3 ); l < ll; l ++ ) pointPositions[ l ] = 0.0;
|
|
|
- for ( l = pointLength, ll = Math.max( pointDistances.length, pointCount ); l < ll; l ++ ) pointDistances[ l ] = 0.0;
|
|
|
-
|
|
|
for ( l = spotLength * 3, ll = Math.max( spotColors.length, spotCount * 3 ); l < ll; l ++ ) spotColors[ l ] = 0.0;
|
|
|
- for ( l = spotLength * 3, ll = Math.max( spotPositions.length, spotCount * 3 ); l < ll; l ++ ) spotPositions[ l ] = 0.0;
|
|
|
- for ( l = spotLength * 3, ll = Math.max( spotDirections.length, spotCount * 3 ); l < ll; l ++ ) spotDirections[ l ] = 0.0;
|
|
|
- for ( l = spotLength, ll = Math.max( spotAnglesCos.length, spotCount ); l < ll; l ++ ) spotAnglesCos[ l ] = 0.0;
|
|
|
- for ( l = spotLength, ll = Math.max( spotExponents.length, spotCount ); l < ll; l ++ ) spotExponents[ l ] = 0.0;
|
|
|
- for ( l = spotLength, ll = Math.max( spotDistances.length, spotCount ); l < ll; l ++ ) spotDistances[ l ] = 0.0;
|
|
|
-
|
|
|
for ( l = hemiLength * 3, ll = Math.max( hemiSkyColors.length, hemiCount * 3 ); l < ll; l ++ ) hemiSkyColors[ l ] = 0.0;
|
|
|
for ( l = hemiLength * 3, ll = Math.max( hemiGroundColors.length, hemiCount * 3 ); l < ll; l ++ ) hemiGroundColors[ l ] = 0.0;
|
|
|
- for ( l = hemiLength * 3, ll = Math.max( hemiPositions.length, hemiCount * 3 ); l < ll; l ++ ) hemiPositions[ l ] = 0.0;
|
|
|
|
|
|
zlights.directional.length = dirLength;
|
|
|
zlights.point.length = pointLength;
|