Exemple #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 ColorNode      Conditional(BooleanNode condition, ColorNode trueCase, ColorNode falseCase)
 {
     return(Function <ColorNode>(ExpressionNodeType.Conditional, condition, trueCase, falseCase));
 }
 /// <summary> Linearly interpolates between two colors in the RBG color space. </summary>
 /// <param name="val1">Color source value 1.</param>
 /// <param name="val2">Color source value 2.</param>
 /// <param name="progress">A value between 0 and 1.0 indicating the weight of val2.</param>
 public static ColorNode ColorLerpRgb(ColorNode val1, ColorNode val2, ScalarNode progress)
 {
     return(Function <ColorNode>(ExpressionNodeType.ColorLerpRgb, val1, val2, progress));
 }