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

Updated builds.

上级 b8fa3944
......@@ -816,11 +816,13 @@ THREE.Color.prototype = {
},
fromArray: function ( array ) {
fromArray: function ( array, offset ) {
this.r = array[ 0 ];
this.g = array[ 1 ];
this.b = array[ 2 ];
if ( offset === undefined ) offset = 0;
this.r = array[ offset ];
this.g = array[ offset + 1 ];
this.b = array[ offset + 2 ];
return this;
......@@ -8424,7 +8426,9 @@ THREE.Object3D.prototype = {
if ( this.name !== '' ) object.name = this.name;
if ( JSON.stringify( this.userData ) !== '{}' ) object.userData = this.userData;
if ( this.visible !== true ) object.visible = this.visible;
if ( this.castShadow === true ) object.castShadow = true;
if ( this.receiveShadow === true ) object.receiveShadow = true;
if ( this.visible === false ) object.visible = false;
object.matrix = this.matrix.toArray();
......@@ -9315,7 +9319,6 @@ THREE.Geometry = function () {
this.faceVertexUvs = [ [] ];
this.morphTargets = [];
this.morphColors = [];
this.morphNormals = [];
this.skinWeights = [];
......@@ -14124,11 +14127,140 @@ THREE.Light = function ( color ) {
this.color = new THREE.Color( color );
this.receiveShadow = undefined;
};
THREE.Light.prototype = Object.create( THREE.Object3D.prototype );
THREE.Light.prototype.constructor = THREE.Light;
Object.defineProperties( THREE.Light.prototype, {
onlyShadow: {
set: function ( value ) {
console.warn( 'THREE.Light: .onlyShadow has been removed.' );
}
},
shadowCamera: {
get: function () {
return this.shadow.camera;
}
},
shadowCameraFov: {
get: function () {
return this.shadow.camera.fov;
},
set: function ( value ) {
this.shadow.camera.fov = value;
}
},
shadowCameraLeft: {
get: function () {
return this.shadow.camera.left;
},
set: function ( value ) {
this.shadow.camera.left = value;
}
},
shadowCameraRight: {
get: function () {
return this.shadow.camera.right;
},
set: function ( value ) {
this.shadow.camera.right = value;
}
},
shadowCameraTop: {
get: function () {
return this.shadow.camera.top;
},
set: function ( value ) {
this.shadow.camera.top = value;
}
},
shadowCameraBottom: {
get: function () {
return this.shadow.camera.bottom;
},
set: function ( value ) {
this.shadow.camera.bottom = value;
}
},
shadowCameraNear: {
get: function () {
return this.shadow.camera.near;
},
set: function ( value ) {
this.shadow.camera.near = value;
}
},
shadowCameraFar: {
get: function () {
return this.shadow.camera.far;
},
set: function ( value ) {
this.shadow.camera.far = value;
}
},
shadowCameraVisible: {
set: function ( value ) {
console.warn( 'THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow ) instead.' );
}
},
shadowBias: {
get: function () {
return this.shadow.bias;
},
set: function ( value ) {
this.shadow.bias = value;
}
},
shadowDarkness: {
get: function () {
return this.shadow.darkness;
},
set: function ( value ) {
this.shadow.darkness = value;
}
},
shadowMap: {
get: function () {
return this.shadow.map;
},
set: function ( value ) {
this.shadow.map = value;
}
},
shadowMapSize: {
get: function () {
return this.shadow.mapSize;
}
},
shadowMapWidth: {
get: function () {
return this.shadow.mapSize.x;
},
set: function ( value ) {
this.shadow.mapSize.x = value;
}
},
shadowMapHeight: {
get: function () {
return this.shadow.mapSize.y;
},
set: function ( value ) {
this.shadow.mapSize.y = value;
}
},
shadowMatrix: {
get: function () {
return this.shadow.matrix;
},
set: function ( value ) {
this.shadow.matrix = value;
}
}
} );
THREE.Light.prototype.copy = function ( source ) {
THREE.Object3D.prototype.copy.call( this, source );
......@@ -14156,6 +14288,49 @@ THREE.Light.prototype.toJSON = function ( meta ) {
};
// File:src/lights/LightShadow.js
/**
* @author mrdoob / http://mrdoob.com/
*/
THREE.LightShadow = function ( camera ) {
this.camera = camera;
this.bias = 0;
this.darkness = 0.5;
this.mapSize = new THREE.Vector2( 512, 512 );
this.map = null;
this.matrix = null;
};
THREE.LightShadow.prototype = {
constructor: THREE.LightShadow,
copy: function ( source ) {
this.camera = source.camera.clone();
this.bias = source.bias;
this.darkness = source.darkness;
this.mapSize.copy( source.mapSize );
},
clone: function () {
return new this.constructor().copy( this );
}
};
// File:src/lights/AmbientLight.js
/**
......@@ -14193,29 +14368,7 @@ THREE.DirectionalLight = function ( color, intensity ) {
this.intensity = ( intensity !== undefined ) ? intensity : 1;
this.castShadow = false;
this.onlyShadow = false;
this.shadowCameraNear = 50;
this.shadowCameraFar = 5000;
this.shadowCameraLeft = - 500;
this.shadowCameraRight = 500;
this.shadowCameraTop = 500;
this.shadowCameraBottom = - 500;
this.shadowCameraVisible = false;
this.shadowBias = 0;
this.shadowDarkness = 0.5;
this.shadowMapWidth = 512;
this.shadowMapHeight = 512;
this.shadowMap = null;
this.shadowMapSize = null;
this.shadowCamera = null;
this.shadowMatrix = null;
this.shadow = new THREE.LightShadow( new THREE.OrthographicCamera( - 500, 500, 500, - 500, 50, 5000 ) );
};
......@@ -14229,24 +14382,7 @@ THREE.DirectionalLight.prototype.copy = function ( source ) {
this.intensity = source.intensity;
this.target = source.target.clone();
this.castShadow = source.castShadow;
this.onlyShadow = source.onlyShadow;
this.shadowCameraNear = source.shadowCameraNear;
this.shadowCameraFar = source.shadowCameraFar;
this.shadowCameraLeft = source.shadowCameraLeft;
this.shadowCameraRight = source.shadowCameraRight;
this.shadowCameraTop = source.shadowCameraTop;
this.shadowCameraBottom = source.shadowCameraBottom;
this.shadowCameraVisible = source.shadowCameraVisible;
this.shadowBias = source.shadowBias;
this.shadowDarkness = source.shadowDarkness;
this.shadowMapWidth = source.shadowMapWidth;
this.shadowMapHeight = source.shadowMapHeight;
this.shadow = source.shadow.clone();
return this;
......@@ -14303,29 +14439,7 @@ THREE.PointLight = function ( color, intensity, distance, decay ) {
this.distance = ( distance !== undefined ) ? distance : 0;
this.decay = ( decay !== undefined ) ? decay : 1; // for physically correct lights, should be 2.
this.castShadow = false;
this.onlyShadow = false;
//
this.shadowCameraNear = 1;
this.shadowCameraFar = 500;
this.shadowCameraFov = 90;
this.shadowCameraVisible = false;
this.shadowBias = 0;
this.shadowDarkness = 0.5;
this.shadowMapWidth = 512;
this.shadowMapHeight = 512;
//
this.shadowMap = null;
this.shadowMapSize = null;
this.shadowCamera = null;
this.shadowMatrix = null;
this.shadow = new THREE.LightShadow( new THREE.PerspectiveCamera( 90, 1, 1, 500 ) );
};
......@@ -14340,20 +14454,7 @@ THREE.PointLight.prototype.copy = function ( source ) {
this.distance = source.distance;
this.decay = source.decay;
this.castShadow = source.castShadow;
this.onlyShadow = source.onlyShadow;
this.shadowCameraNear = source.shadowCameraNear;
this.shadowCameraFar = source.shadowCameraFar;
this.shadowCameraFov = source.shadowCameraFov;
this.shadowCameraVisible = source.shadowCameraVisible;
this.shadowBias = source.shadowBias;
this.shadowDarkness = source.shadowDarkness;
this.shadowMapWidth = source.shadowMapWidth;
this.shadowMapHeight = source.shadowMapHeight;
this.shadow = source.shadow.clone();
return this;
......@@ -14382,25 +14483,7 @@ THREE.SpotLight = function ( color, intensity, distance, angle, exponent, decay
this.exponent = ( exponent !== undefined ) ? exponent : 10;
this.decay = ( decay !== undefined ) ? decay : 1; // for physically correct lights, should be 2.
this.castShadow = false;
this.onlyShadow = false;
this.shadowCameraNear = 50;
this.shadowCameraFar = 5000;
this.shadowCameraFov = 50;
this.shadowCameraVisible = false;
this.shadowBias = 0;
this.shadowDarkness = 0.5;
this.shadowMapWidth = 512;
this.shadowMapHeight = 512;
this.shadowMap = null;
this.shadowMapSize = null;
this.shadowCamera = null;
this.shadowMatrix = null;
this.shadow = new THREE.LightShadow( new THREE.PerspectiveCamera( 50, 1, 50, 5000 ) );
};
......@@ -14419,20 +14502,7 @@ THREE.SpotLight.prototype.copy = function ( source ) {
this.target = source.target.clone();
this.castShadow = source.castShadow;
this.onlyShadow = source.onlyShadow;
this.shadowCameraNear = source.shadowCameraNear;
this.shadowCameraFar = source.shadowCameraFar;
this.shadowCameraFov = source.shadowCameraFov;
this.shadowCameraVisible = source.shadowCameraVisible;
this.shadowBias = source.shadowBias;
this.shadowDarkness = source.shadowDarkness;
this.shadowMapWidth = source.shadowMapWidth;
this.shadowMapHeight = source.shadowMapHeight;
this.shadow = source.shadow.clone();
return this;
......@@ -15531,18 +15601,16 @@ THREE.JSONLoader.prototype = {
if ( json.morphTargets !== undefined ) {
var i, l, v, vl, dstVertices, srcVertices;
for ( i = 0, l = json.morphTargets.length; i < l; i ++ ) {
for ( var i = 0, l = json.morphTargets.length; i < l; i ++ ) {
geometry.morphTargets[ i ] = {};
geometry.morphTargets[ i ].name = json.morphTargets[ i ].name;
geometry.morphTargets[ i ].vertices = [];
dstVertices = geometry.morphTargets[ i ].vertices;
srcVertices = json.morphTargets[ i ].vertices;
var dstVertices = geometry.morphTargets[ i ].vertices;
var srcVertices = json.morphTargets[ i ].vertices;
for ( v = 0, vl = srcVertices.length; v < vl; v += 3 ) {
for ( var v = 0, vl = srcVertices.length; v < vl; v += 3 ) {
var vertex = new THREE.Vector3();
vertex.x = srcVertices[ v ] * scale;
......@@ -15557,31 +15625,22 @@ THREE.JSONLoader.prototype = {
}
if ( json.morphColors !== undefined ) {
var i, l, c, cl, dstColors, srcColors, color;
for ( i = 0, l = json.morphColors.length; i < l; i ++ ) {
if ( json.morphColors !== undefined && json.morphColors.length > 0 ) {
geometry.morphColors[ i ] = {};
geometry.morphColors[ i ].name = json.morphColors[ i ].name;
geometry.morphColors[ i ].colors = [];
console.warn( 'THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.' );
dstColors = geometry.morphColors[ i ].colors;
srcColors = json.morphColors[ i ].colors;
var faces = geometry.faces;
var morphColors = json.morphColors[ 0 ].colors;
for ( c = 0, cl = srcColors.length; c < cl; c += 3 ) {
for ( var i = 0, l = faces.length; i < l; i ++ ) {
color = new THREE.Color( 0xffaa00 );
color.setRGB( srcColors[ c ], srcColors[ c + 1 ], srcColors[ c + 2 ] );
dstColors.push( color );
faces[ i ].color.fromArray( morphColors, i * 3 );
}
}
}
}
function parseAnimations() {
......@@ -19012,170 +19071,164 @@ THREE.Mesh.prototype.raycast = ( function () {
}
return function raycast( raycaster, intersects ) {
var geometry = this.geometry;
var material = this.material;
function checkIntersection( object, raycaster, ray, pA, pB, pC, point ){
if ( material === undefined ) return;
// Checking boundingSphere distance to ray
var intersect;
var material = object.material;
if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();
if ( material.side === THREE.BackSide ) {
sphere.copy( geometry.boundingSphere );
sphere.applyMatrix4( this.matrixWorld );
intersect = ray.intersectTriangle( pC, pB, pA, true, point );
if ( raycaster.ray.isIntersectionSphere( sphere ) === false ) {
} else {
return;
intersect = ray.intersectTriangle( pA, pB, pC, material.side !== THREE.DoubleSide, point );
}
// Check boundingBox before continuing
if ( intersect === null ) return null;
inverseMatrix.getInverse( this.matrixWorld );
ray.copy( raycaster.ray ).applyMatrix4( inverseMatrix );
intersectionPointWorld.copy( point );
intersectionPointWorld.applyMatrix4( object.matrixWorld );
if ( geometry.boundingBox !== null ) {
var distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );
if ( ray.isIntersectionBox( geometry.boundingBox ) === false ) {
if ( distance < raycaster.near || distance > raycaster.far ) return null;
return;
return {
distance: distance,
point: intersectionPointWorld.clone(),
object: object
};
}
}
function checkBufferGeometryIntersection( object, raycaster, ray, positions, uvs, a, b, c ) {
var a, b, c;
vA.fromArray( positions, a * 3 );
vB.fromArray( positions, b * 3 );
vC.fromArray( positions, c * 3 );
if ( geometry instanceof THREE.BufferGeometry ) {
var intersection = checkIntersection( object, raycaster, ray, vA, vB, vC, intersectionPoint );
var index = geometry.index;
var attributes = geometry.attributes;
if ( intersection ) {
if ( index !== null ) {
if ( uvs ) {
var indices = index.array;
var positions = attributes.position.array;
uvA.fromArray( uvs, a * 2 );
uvB.fromArray( uvs, b * 2 );
uvC.fromArray( uvs, c * 2 );
for ( var i = 0, l = indices.length; i < l; i += 3 ) {
intersection.uv = uvIntersection( intersectionPoint, vA, vB, vC, uvA, uvB, uvC );
a = indices[ i ];
b = indices[ i + 1 ];
c = indices[ i + 2 ];
}
vA.fromArray( positions, a * 3 );
vB.fromArray( positions, b * 3 );
vC.fromArray( positions, c * 3 );
intersection.face = new THREE.Face3( a, b, c, THREE.Triangle.normal( vA, vB, vC ) );
intersection.faceIndex = a;
if ( material.side === THREE.BackSide ) {
}
if ( ray.intersectTriangle( vC, vB, vA, true, intersectionPoint ) === null ) continue;
return intersection;
} else {
}
if ( ray.intersectTriangle( vA, vB, vC, material.side !== THREE.DoubleSide, intersectionPoint ) === null ) continue;
return function raycast( raycaster, intersects ) {
}
var geometry = this.geometry;
var material = this.material;
intersectionPointWorld.copy( intersectionPoint );
intersectionPointWorld.applyMatrix4( this.matrixWorld );
if ( material === undefined ) return;
var distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );
// Checking boundingSphere distance to ray
if ( distance < raycaster.near || distance > raycaster.far ) continue;
if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();
var uv;
var matrixWorld = this.matrixWorld;
if ( attributes.uv !== undefined ) {
sphere.copy( geometry.boundingSphere );
sphere.applyMatrix4( matrixWorld );
var uvs = attributes.uv.array;
uvA.fromArray( uvs, a * 2 );
uvB.fromArray( uvs, b * 2 );
uvC.fromArray( uvs, c * 2 );
uv = uvIntersection( intersectionPoint, vA, vB, vC, uvA, uvB, uvC );
if ( raycaster.ray.isIntersectionSphere( sphere ) === false ) return;
}
// Check boundingBox before continuing
intersects.push( {
inverseMatrix.getInverse( matrixWorld );
ray.copy( raycaster.ray ).applyMatrix4( inverseMatrix );
distance: distance,
point: intersectionPointWorld.clone(),
uv: uv,
face: new THREE.Face3( a, b, c, THREE.Triangle.normal( vA, vB, vC ) ),
faceIndex: Math.floor( i / 3 ), // triangle number in indices buffer semantics
object: this
if ( geometry.boundingBox !== null ) {
} );
if ( ray.isIntersectionBox( geometry.boundingBox ) === false ) return;
}
} else {
var uvs, intersection;
if ( geometry instanceof THREE.BufferGeometry ) {
var a, b, c;
var index = geometry.index;
var attributes = geometry.attributes;
var positions = attributes.position.array;
for ( var i = 0, l = positions.length; i < l; i += 9 ) {
if ( attributes.uv !== undefined ){
vA.fromArray( positions, i );
vB.fromArray( positions, i + 3 );
vC.fromArray( positions, i + 6 );
uvs = attributes.uv.array;
if ( material.side === THREE.BackSide ) {
}
if ( index !== null ) {
if ( ray.intersectTriangle( vC, vB, vA, true, intersectionPoint ) === null ) continue;
var indices = index.array;
} else {
for ( var i = 0, l = indices.length; i < l; i += 3 ) {
a = indices[ i ];
b = indices[ i + 1 ];
c = indices[ i + 2 ];
intersection = checkBufferGeometryIntersection( this, raycaster, ray, positions, uvs, a, b, c );
if ( intersection ) {
if ( ray.intersectTriangle( vA, vB, vC, material.side !== THREE.DoubleSide, intersectionPoint ) === null ) continue;
intersection.faceIndex = Math.floor( i / 3 ); // triangle number in indices buffer semantics
intersects.push( intersection );
}
intersectionPointWorld.copy( intersectionPoint );
intersectionPointWorld.applyMatrix4( this.matrixWorld );
}
var distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );
} else {
if ( distance < raycaster.near || distance > raycaster.far ) continue;
for ( var i = 0, l = positions.length; i < l; i += 9 ) {
a = i / 3;
b = a + 1;
c = a + 2;
var uv;
intersection = checkBufferGeometryIntersection( this, raycaster, ray, positions, uvs, a, b, c );
if ( attributes.uv !== undefined ) {
if ( intersection ) {
var uvs = attributes.uv.array;
uvA.fromArray( uvs, a * 2 );
uvB.fromArray( uvs, b * 2 );
uvC.fromArray( uvs, c * 2 );
uv = uvIntersection( intersectionPoint, vA, vB, vC, uvA, uvB, uvC );
intersection.index = a; // triangle number in positions buffer semantics
intersects.push( intersection );
}
intersects.push( {
distance: distance,
point: intersectionPointWorld.clone(),
uv: uv,
face: new THREE.Face3( a, b, c, THREE.Triangle.normal( vA, vB, vC ) ),
index: a, // triangle number in positions buffer semantics
object: this
} );
}
}
} else if ( geometry instanceof THREE.Geometry ) {
var fvA, fvB, fvC;
var isFaceMaterial = material instanceof THREE.MeshFaceMaterial;
var materials = isFaceMaterial === true ? material.materials : null;
var vertices = geometry.vertices;
var faces = geometry.faces;
var faceVertexUvs = geometry.faceVertexUvs[ 0 ];
if ( faceVertexUvs.length > 0 ) uvs = faceVertexUvs;
for ( var f = 0, fl = faces.length; f < fl; f ++ ) {
......@@ -19184,9 +19237,9 @@ THREE.Mesh.prototype.raycast = ( function () {
if ( faceMaterial === undefined ) continue;
a = vertices[ face.a ];
b = vertices[ face.b ];
c = vertices[ face.c ];
fvA = vertices[ face.a ];
fvB = vertices[ face.b ];
fvC = vertices[ face.c ];
if ( faceMaterial.morphTargets === true ) {
......@@ -19205,61 +19258,42 @@ THREE.Mesh.prototype.raycast = ( function () {
var targets = morphTargets[ t ].vertices;
vA.addScaledVector( tempA.subVectors( targets[ face.a ], a ), influence );
vB.addScaledVector( tempB.subVectors( targets[ face.b ], b ), influence );
vC.addScaledVector( tempC.subVectors( targets[ face.c ], c ), influence );
vA.addScaledVector( tempA.subVectors( targets[ face.a ], fvA ), influence );
vB.addScaledVector( tempB.subVectors( targets[ face.b ], fvB ), influence );
vC.addScaledVector( tempC.subVectors( targets[ face.c ], fvC ), influence );
}
vA.add( a );
vB.add( b );
vC.add( c );
vA.add( fvA );
vB.add( fvB );
vC.add( fvC );
a = vA;
b = vB;
c = vC;
fvA = vA;
fvB = vB;
fvC = vC;
}
if ( faceMaterial.side === THREE.BackSide ) {
intersection = checkIntersection( this, raycaster, ray, fvA, fvB, fvC, intersectionPoint );
if ( ray.intersectTriangle( c, b, a, true, intersectionPoint ) === null ) continue;
if ( intersection ) {
} else {
if ( uvs ) {
if ( ray.intersectTriangle( a, b, c, faceMaterial.side !== THREE.DoubleSide, intersectionPoint ) === null ) continue;
var uvs_f = uvs[ f ];
uvA.copy( uvs_f[ 0 ] );
uvB.copy( uvs_f[ 1 ] );
uvC.copy( uvs_f[ 2 ] );
}
intersectionPointWorld.copy( intersectionPoint );
intersectionPointWorld.applyMatrix4( this.matrixWorld );
var distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );
if ( distance < raycaster.near || distance > raycaster.far ) continue;
var uv;
if ( geometry.faceVertexUvs[ 0 ].length > 0 ) {
var uvs = geometry.faceVertexUvs[ 0 ][ f ];
uvA.copy( uvs[ 0 ] );
uvB.copy( uvs[ 1 ] );
uvC.copy( uvs[ 2 ] );
uv = uvIntersection( intersectionPoint, a, b, c, uvA, uvB, uvC );
intersection.uv = uvIntersection( intersectionPoint, fvA, fvB, fvC, uvA, uvB, uvC );
}
intersects.push( {
intersection.face = face;
intersection.faceIndex = f;
intersects.push( intersection );
distance: distance,
point: intersectionPointWorld.clone(),
uv: uv,
face: face,
faceIndex: f,
object: this
} );
}
}
......@@ -22265,22 +22299,35 @@ THREE.WebGLRenderer = function ( parameters ) {
}
var drawStart = geometry.drawRange.start;
var drawCount = geometry.drawRange.count;
//
if ( drawCount === Infinity ) {
var dataStart = 0;
var dataCount = Infinity;
drawCount = index !== null ? index.count : position.count;
if ( index !== null ) {
}
dataCount = index.count
if ( group !== null ) {
} else if ( position !== undefined ) {
drawStart = Math.max( drawStart, group.start );
drawCount = Math.min( drawCount, group.count );
dataCount = position.count;
}
var rangeStart = geometry.drawRange.start;
var rangeCount = geometry.drawRange.count;
var groupStart = group !== null ? group.start : 0;
var groupCount = group !== null ? group.count : Infinity;
var drawStart = Math.max( dataStart, rangeStart, groupStart );
var drawEnd = Math.min( dataStart + dataCount, rangeStart + rangeCount, groupStart + groupCount ) - 1;
var drawCount = drawEnd - drawStart + 1;
//
if ( object instanceof THREE.Mesh ) {
if ( material.wireframe === true ) {
......@@ -23909,8 +23956,6 @@ THREE.WebGLRenderer = function ( parameters ) {
light = lights[ l ];
if ( light.onlyShadow ) continue;
color = light.color;
intensity = light.intensity;
distance = light.distance;
......@@ -26407,7 +26452,7 @@ THREE.WebGLPrograms = function ( renderer, capabilities ) {
var light = lights[ l ];
if ( light.onlyShadow || light.visible === false ) continue;
if ( light.visible === false ) continue;
if ( light instanceof THREE.DirectionalLight ) dirLights ++;
if ( light instanceof THREE.PointLight ) pointLights ++;
......@@ -26885,42 +26930,28 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
var pars = { minFilter: shadowFilter, magFilter: shadowFilter, format: THREE.RGBAFormat };
light.shadowMap = new THREE.WebGLRenderTarget( light.shadowMapWidth, light.shadowMapHeight, pars );
light.shadowMapSize = new THREE.Vector2( light.shadowMapWidth, light.shadowMapHeight );
light.shadowMap = new THREE.WebGLRenderTarget( light.shadow.mapSize.x, light.shadow.mapSize.y, pars );
light.shadowMatrix = new THREE.Matrix4();
}
if ( ! light.shadowCamera ) {
if ( light.shadowCamera.parent === null ) {
if ( light instanceof THREE.SpotLight ) {
light.shadowCamera = new THREE.PerspectiveCamera( light.shadowCameraFov, light.shadowMapWidth / light.shadowMapHeight, light.shadowCameraNear, light.shadowCameraFar );
} else if ( light instanceof THREE.DirectionalLight ) {
light.shadowCamera = new THREE.OrthographicCamera( light.shadowCameraLeft, light.shadowCameraRight, light.shadowCameraTop, light.shadowCameraBottom, light.shadowCameraNear, light.shadowCameraFar );
} else {
light.shadowCamera = new THREE.PerspectiveCamera( light.shadowCameraFov, 1.0, light.shadowCameraNear, light.shadowCameraFar );
light.shadowCamera.aspect = light.shadow.mapSize.x / light.shadow.mapSize.y;
}
light.shadowCamera.updateProjectionMatrix();
scene.add( light.shadowCamera );
if ( scene.autoUpdate === true ) scene.updateMatrixWorld();
}
if ( light.shadowCameraVisible && ! light.cameraHelper ) {
light.cameraHelper = new THREE.CameraHelper( light.shadowCamera );
scene.add( light.cameraHelper );
}
var shadowMap = light.shadowMap;
var shadowMatrix = light.shadowMatrix;
var shadowCamera = light.shadowCamera;
......@@ -26955,9 +26986,6 @@ THREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {
shadowCamera.updateMatrixWorld();
shadowCamera.matrixWorldInverse.getInverse( shadowCamera.matrixWorld );
if ( light.cameraHelper ) light.cameraHelper.visible = light.shadowCameraVisible;
if ( light.shadowCameraVisible ) light.cameraHelper.update();
// compute shadow matrix
shadowMatrix.set(
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册