提交 2c86988e 编写于 作者: Z zhaoy

improve performance of Vector3.(un)project, Matrix4.multiplyMatrices is more...

improve performance of Vector3.(un)project, Matrix4.multiplyMatrices is more expensive than Vector3.applyMatrix4
上级 9796f88f
......@@ -312,16 +312,9 @@ Object.assign( Vector3.prototype, {
},
project: function () {
project: function ( camera ) {
var matrix = new Matrix4();
return function project( camera ) {
matrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
return this.applyMatrix4( matrix );
};
return this.applyMatrix4( camera.matrixWorldInverse ).applyMatrix4( camera.projectionMatrix );
}(),
......@@ -331,8 +324,7 @@ Object.assign( Vector3.prototype, {
return function unproject( camera ) {
matrix.multiplyMatrices( camera.matrixWorld, matrix.getInverse( camera.projectionMatrix ) );
return this.applyMatrix4( matrix );
return this.applyMatrix4( matrix.getInverse( camera.projectionMatrix ) ).applyMatrix4( camera.matrixWorld );
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册