// // 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 QuaternionNode Conditional(BooleanNode condition, QuaternionNode trueCase, QuaternionNode falseCase) { return(Function <QuaternionNode>(ExpressionNodeType.Conditional, condition, trueCase, falseCase)); }
/// <summary> Spherically interpolates between two quaternions. </summary> /// <param name="val1">Quaternion source value 1.</param> /// <param name="val2">Quaternion source value 2.</param> /// <param name="progress">A value between 0 and 1.0 indicating the weight of val2.</param> public static QuaternionNode Slerp(QuaternionNode val1, QuaternionNode val2, ScalarNode progress) { return(Function <QuaternionNode>(ExpressionNodeType.Slerp, val1, val2, progress)); }
public static QuaternionNode Normalize(QuaternionNode val) { return(Function <QuaternionNode>(ExpressionNodeType.Normalize, val)); }
public static ScalarNode LengthSquared(QuaternionNode val) { return(Function <ScalarNode>(ExpressionNodeType.LengthSquared, val)); }
/// <summary> Concatenates two Quaternions; the result represents the first rotation followed by the second rotation. </summary> /// <param name="val1">The first quaternion rotation in the series.</param> /// <param name="val2">The second quaternion rotation in the series.</param> public static QuaternionNode Concatenate(QuaternionNode val1, QuaternionNode val2) { return(Function <QuaternionNode>(ExpressionNodeType.Concatenate, val1, val2)); }