// // 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 Vector4Node Conditional(BooleanNode condition, Vector4Node trueCase, Vector4Node falseCase) { return(Function <Vector4Node>(ExpressionNodeType.Conditional, condition, trueCase, falseCase)); }
public static Vector4Node Scale(Vector4Node val1, ScalarNode val2) { return(Function <Vector4Node>(ExpressionNodeType.Scale, val1, val2)); }
public static Vector4Node Transform(Vector4Node val1, Matrix4x4Node val2) { return(Function <Vector4Node>(ExpressionNodeType.Transform, val1, val2)); }
public static Vector4Node Mod(Vector4Node val1, Vector4Node val2) { return(Function <Vector4Node>(ExpressionNodeType.Modulus, val1, val2)); }
public static Vector4Node Normalize(Vector4Node val) { return(Function <Vector4Node>(ExpressionNodeType.Normalize, val)); }
public static Vector4Node Lerp(Vector4Node val1, Vector4Node val2, ScalarNode progress) { return(Function <Vector4Node>(ExpressionNodeType.Lerp, val1, val2, progress)); }
public static ScalarNode LengthSquared(Vector4Node val) { return(Function <ScalarNode>(ExpressionNodeType.LengthSquared, val)); }
public static ScalarNode DistanceSquared(Vector4Node val1, Vector4Node val2) { return(Function <ScalarNode>(ExpressionNodeType.DistanceSquared, val1, val2)); }
public static Vector4Node Clamp(Vector4Node val, Vector4Node min, Vector4Node max) { return(Function <Vector4Node>(ExpressionNodeType.Clamp, val, min, max)); }
public static Vector4Node Abs(Vector4Node val) { return(Function <Vector4Node>(ExpressionNodeType.Absolute, val)); }