Exemplo n.º 1
0
        public Vector3f Unproject(float mouseX, float mouseY)
        {
            Vector3f vec = new Vector3f();

            vec.x = -2f * (mouseX / width);
            vec.y = 2f * (mouseY / height);
            vec.z = 0f;

            vec.MultiplyStore(projMatrix.Invert());
            vec.MultiplyStore(viewMatrix.Invert());

            vec.SubtractStore(Translation);

            return(vec);
        }
Exemplo n.º 2
0
        /// <summary>Transform a Normal by the given Matrix</summary>
        /// <remarks>
        /// This calculates the inverse of the given matrix, use TransformNormalInverse if you
        /// already have the inverse to avoid this extra calculation
        /// </remarks>
        /// <param name="norm">The normal to transform</param>
        /// <param name="mat">The desired transformation</param>
        /// <param name="result">The transformed normal</param>
        public static void TransformNormal(ref Vector3d norm, ref Matrix4f mat, out Vector3d result)
        {
            Matrix4f Inverse = Matrix4f.Invert(mat);

            Vector3d.TransformNormalInverse(ref norm, ref Inverse, out result);
        }