Multiply() public méthode

public Multiply ( Matrix2 matrix ) : Matrix4
matrix Matrix2
Résultat Matrix4
Exemple #1
0
 public void ApplyOrthographicCentered()
 {
     ViewMatrix = Matrix4.View(Position, LookAtPosition, UpPosition-Position);
     ProjectionMatrix = Matrix4.OrthographicCentered(ViewPort.Size.Width, ViewPort.Size.Height, Near, Far);
     TransformMatrix = ViewMatrix.Multiply(ProjectionMatrix);
     TransformInverseMatrix = TransformMatrix.Invert();
 }
Exemple #2
0
 public void Apply()
 {
     ViewMatrix = Matrix4.View(Position, LookAtPosition, UpPosition-Position);
     ProjectionMatrix = Matrix4.Perspective(Fov, float.IsNaN(Aspect) ? ViewPort.AspectRatio : Aspect, Near, Far);
     TransformMatrix = ViewMatrix.Multiply(ProjectionMatrix);
     TransformInverseMatrix = TransformMatrix.Invert();
 }
Exemple #3
0
        public static void UnProject(ref Vector4 vector, ref Matrix4 projectionMatrix, ref Matrix4 viewMatrix, int viewX, int viewY, int viewWidth, int viewHeight, out Vector4 result)
        {
            var viewProjInverse = viewMatrix.Multiply(projectionMatrix).Invert();

            result   = vector;
            result.X = (result.X - viewX) / viewWidth;
            result.Y = (result.Y - viewY) / viewHeight;
            result   = (result * 2) - 1;

            result = result.Transform(viewProjInverse);
            float wDelta = 1 / result.W;

            result.X *= wDelta;
            result.Y *= wDelta;
            result.Z *= wDelta;
        }
Exemple #4
0
        public Vector4 UnProject(Matrix4 projectionMatrix, Matrix4 viewMatrix, int viewX, int viewY, int viewWidth, int viewHeight)
        {
            var viewProjInverse = viewMatrix.Multiply(projectionMatrix).Invert();

            var result = this;

            result.X = (result.X - viewX) / viewWidth;
            result.Y = (result.Y - viewY) / viewHeight;
            result   = (result * 2) - 1;

            result = result.Transform(viewProjInverse);
            float wDelta = 1 / result.W;

            result.X *= wDelta;
            result.Y *= wDelta;
            result.Z *= wDelta;

            return(result);
        }
Exemple #5
0
        public Vector4 UnProject(Matrix4 projectionMatrix, Matrix4 viewMatrix, int viewX, int viewY, int viewWidth, int viewHeight)
        {
            var viewProjInverse = viewMatrix.Multiply(projectionMatrix).Invert();

            var result = this;
            result.X = (result.X - viewX) / viewWidth;
            result.Y = (result.Y - viewY) / viewHeight;
            result = (result * 2) - 1;

            result = result.Transform(viewProjInverse);
            float wDelta = 1 / result.W;
            result.X *= wDelta;
            result.Y *= wDelta;
            result.Z *= wDelta;

            return result;
        }
Exemple #6
0
        public static void UnProject(ref Vector4 vector, ref Matrix4 projectionMatrix, ref Matrix4 viewMatrix, int viewX, int viewY, int viewWidth, int viewHeight, out Vector4 result)
        {
            var viewProjInverse = viewMatrix.Multiply(projectionMatrix).Invert();

            result = vector;
            result.X = (result.X - viewX) / viewWidth;
            result.Y = (result.Y - viewY) / viewHeight;
            result = (result * 2) - 1;

            result = result.Transform(viewProjInverse);
            float wDelta = 1 / result.W;
            result.X *= wDelta;
            result.Y *= wDelta;
            result.Z *= wDelta;
        }