Ejemplo n.º 1
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 Matrix4x4Node  Conditional(BooleanNode condition, Matrix4x4Node trueCase, Matrix4x4Node falseCase)
 {
     return(Function <Matrix4x4Node>(ExpressionNodeType.Conditional, condition, trueCase, falseCase));
 }
 public static Matrix4x4Node Scale(Matrix4x4Node val1, ScalarNode val2)
 {
     return(Function <Matrix4x4Node>(ExpressionNodeType.Scale, val1, val2));
 }
 public static Vector4Node Transform(Vector4Node val1, Matrix4x4Node val2)
 {
     return(Function <Vector4Node>(ExpressionNodeType.Transform, val1, val2));
 }
 public static Matrix4x4Node Inverse(Matrix4x4Node val)
 {
     return(Function <Matrix4x4Node>(ExpressionNodeType.Inverse, val));
 }