private static Matrix4x4 CalculateObliqueMatrix(Matrix4x4 projection, Vector4 clipPlane)
        {
            Vector4 b      = projection.inverse * new Vector4(LuxWater_PlanarReflection.Sgn(clipPlane.x), LuxWater_PlanarReflection.Sgn(clipPlane.y), 1f, 1f);
            Vector4 vector = clipPlane * (2f / Vector4.Dot(clipPlane, b));

            projection[2]  = vector.x - projection[3];
            projection[6]  = vector.y - projection[7];
            projection[10] = vector.z - projection[11];
            projection[14] = vector.w - projection[15];
            return(projection);
        }
Esempio n. 2
0
        private static Matrix4x4 CalculateObliqueMatrix(
            Matrix4x4 projection,
            Vector4 clipPlane)
        {
            Vector4 vector4_1 = Matrix4x4.op_Multiply(((Matrix4x4) ref projection).get_inverse(), new Vector4(LuxWater_PlanarReflection.Sgn((float)clipPlane.x), LuxWater_PlanarReflection.Sgn((float)clipPlane.y), 1f, 1f));
            Vector4 vector4_2 = Vector4.op_Multiply(clipPlane, 2f / Vector4.Dot(clipPlane, vector4_1));

            ((Matrix4x4) ref projection).set_Item(2, (float)vector4_2.x - ((Matrix4x4) ref projection).get_Item(3));
            ((Matrix4x4) ref projection).set_Item(6, (float)vector4_2.y - ((Matrix4x4) ref projection).get_Item(7));
            ((Matrix4x4) ref projection).set_Item(10, (float)vector4_2.z - ((Matrix4x4) ref projection).get_Item(11));
            ((Matrix4x4) ref projection).set_Item(14, (float)vector4_2.w - ((Matrix4x4) ref projection).get_Item(15));
            return(projection);
        }