Skip to content

Commit d3e318a

Browse files
committed
Added projectViewMatrix and unprojectViewMatrix.
1 parent 40a808c commit d3e318a

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

src/math/Vector3.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,38 @@ var Vector3 = new Class({
854854
return this;
855855
},
856856

857+
/**
858+
* Multiplies this Vector3 by the given view and projection matrices.
859+
*
860+
* @method Phaser.Math.Vector3#projectViewMatrix
861+
* @since 3.50.0
862+
*
863+
* @param {Phaser.Math.Matrix4} viewMatrix - A View Matrix.
864+
* @param {Phaser.Math.Matrix4} projectionMatrix - A Projection Matrix.
865+
*
866+
* @return {Phaser.Math.Vector3} This Vector3.
867+
*/
868+
projectViewMatrix: function (viewMatrix, projectionMatrix)
869+
{
870+
return this.applyMatrix4(viewMatrix).applyMatrix4(projectionMatrix);
871+
},
872+
873+
/**
874+
* Multiplies this Vector3 by the given inversed projection matrix and world matrix.
875+
*
876+
* @method Phaser.Math.Vector3#unprojectViewMatrix
877+
* @since 3.50.0
878+
*
879+
* @param {Phaser.Math.Matrix4} projectionMatrix - An inversed Projection Matrix.
880+
* @param {Phaser.Math.Matrix4} worldMatrix - A World View Matrix.
881+
*
882+
* @return {Phaser.Math.Vector3} This Vector3.
883+
*/
884+
unprojectViewMatrix: function (projectionMatrix, worldMatrix)
885+
{
886+
return this.applyMatrix4(projectionMatrix).applyMatrix4(worldMatrix);
887+
},
888+
857889
/**
858890
* Unproject this point from 2D space to 3D space.
859891
* The point should have its x and y properties set to

0 commit comments

Comments
 (0)