/// <summary> Creates a 4x4 matrix from a 3x2 matrix. </summary>
 public static Matrix4x4Node Matrix4x4(Matrix3x2Node val)
 {
     return(Function <Matrix4x4Node>(ExpressionNodeType.Matrix4x4,
                                     val._11, val._12, (ScalarNode)0, (ScalarNode)0,
                                     val._21, val._22, (ScalarNode)0, (ScalarNode)0,
                                     (ScalarNode)0, (ScalarNode)0, (ScalarNode)1, (ScalarNode)0,
                                     val._31, val._32, (ScalarNode)0, (ScalarNode)1));
 }
Beispiel #2
0
        //
        // Helper functions
        //

        internal static T CreateExpressionNode <T>() where T : class
        {
            T newNode;

            if (typeof(T) == typeof(BooleanNode))
            {
                newNode = new BooleanNode() as T;
            }
            else if (typeof(T) == typeof(ScalarNode))
            {
                newNode = new ScalarNode() as T;
            }
            else if (typeof(T) == typeof(Vector2Node))
            {
                newNode = new Vector2Node() as T;
            }
            else if (typeof(T) == typeof(Vector3Node))
            {
                newNode = new Vector3Node() as T;
            }
            else if (typeof(T) == typeof(Vector4Node))
            {
                newNode = new Vector4Node() as T;
            }
            else if (typeof(T) == typeof(ColorNode))
            {
                newNode = new ColorNode() as T;
            }
            else if (typeof(T) == typeof(QuaternionNode))
            {
                newNode = new QuaternionNode() as T;
            }
            else if (typeof(T) == typeof(Matrix3x2Node))
            {
                newNode = new Matrix3x2Node() as T;
            }
            else if (typeof(T) == typeof(Matrix4x4Node))
            {
                newNode = new Matrix4x4Node() as T;
            }
            else
            {
                throw new Exception("unexpected type");
            }

            return(newNode);
        }
 public static Matrix3x2Node  Conditional(BooleanNode condition, Matrix3x2Node trueCase, Matrix3x2Node falseCase)
 {
     return(Function <Matrix3x2Node>(ExpressionNodeType.Conditional, condition, trueCase, falseCase));
 }
 /// <summary> Transforms a vector by the specified matrix. </summary>
 /// <param name="val1">Vector to be transformed.</param>
 /// <param name="val2">The transformation matrix.</param>
 public static Vector2Node Transform(Vector2Node val1, Matrix3x2Node val2)
 {
     return(Function <Vector2Node>(ExpressionNodeType.Transform, val1, val2));
 }
 public static Matrix3x2Node Scale(Matrix3x2Node val1, ScalarNode val2)
 {
     return(Function <Matrix3x2Node>(ExpressionNodeType.Scale, val1, val2));
 }
 /// <summary> Returns the inverse of the specified matrix. </summary>
 /// <param name="val">The matrix to invert.</param>
 public static Matrix3x2Node Inverse(Matrix3x2Node val)
 {
     return(Function <Matrix3x2Node>(ExpressionNodeType.Inverse, val));
 }