未验证 提交 51d288b2 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #15457 from Mugen87/dev11

Lensflare: Perform early out if the lensflare is behind the camera
...@@ -14,6 +14,7 @@ THREE.Lensflare = function () { ...@@ -14,6 +14,7 @@ THREE.Lensflare = function () {
// //
var positionScreen = new THREE.Vector3(); var positionScreen = new THREE.Vector3();
var positionView = new THREE.Vector3();
// textures // textures
...@@ -175,10 +176,12 @@ THREE.Lensflare = function () { ...@@ -175,10 +176,12 @@ THREE.Lensflare = function () {
// calculate position in screen space // calculate position in screen space
positionScreen.setFromMatrixPosition( this.matrixWorld ); positionView.setFromMatrixPosition( this.matrixWorld );
positionView.applyMatrix4( camera.matrixWorldInverse );
positionScreen.applyMatrix4( camera.matrixWorldInverse ); if ( positionView.z > 0 ) return; // lensflare is behind the camera
positionScreen.applyMatrix4( camera.projectionMatrix );
positionScreen.copy( positionView ).applyMatrix4( camera.projectionMatrix );
// horizontal and vertical coordinate of the lower left corner of the pixels to copy // horizontal and vertical coordinate of the lower left corner of the pixels to copy
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册