示例#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 QuaternionNode Conditional(BooleanNode condition, QuaternionNode trueCase, QuaternionNode falseCase)
 {
     return(Function <QuaternionNode>(ExpressionNodeType.Conditional, condition, trueCase, falseCase));
 }
 public static ColorNode      Conditional(BooleanNode condition, ColorNode trueCase, ColorNode falseCase)
 {
     return(Function <ColorNode>(ExpressionNodeType.Conditional, condition, trueCase, falseCase));
 }
 public static Vector4Node    Conditional(BooleanNode condition, Vector4Node trueCase, Vector4Node falseCase)
 {
     return(Function <Vector4Node>(ExpressionNodeType.Conditional, condition, trueCase, falseCase));
 }
 /// <summary> Performs a logical NOT operation on a specified boolean value as: !val. </summary>
 public static BooleanNode Not(BooleanNode val)
 {
     return(Function <BooleanNode>(ExpressionNodeType.Not, val));
 }
 /// <summary> Performs a logical OR operation on two boolean values as: val1 || val2. </summary>
 public static BooleanNode Or(BooleanNode val1, BooleanNode val2)
 {
     return(Function <BooleanNode>(ExpressionNodeType.Or, val1, val2));
 }