static public VFXExpression TanH(VFXExpression input) { //(1-e^2x)/(1+e^2x) var two = TwoExpression[input.valueType]; var one = OneExpression[input.valueType]; var minusOne = MinusOneExpression[input.valueType]; var e = E_NapierConstantExpression[input.valueType]; var E_minusTwoX = new VFXExpressionPow(e, minusOne * two * input); return((one - E_minusTwoX) / (one + E_minusTwoX)); }
static public VFXExpression LinearToGamma(VFXExpression linear) { var components = ExtractComponents(linear).ToArray(); if (components.Length != 3 && components.Length != 4) { throw new ArgumentException("input expression must be a 3 or 4 components vector"); } VFXExpression exp = VFXValue.Constant(1.0f / 2.2f); for (int i = 0; i < 3; ++i) { components[i] = new VFXExpressionPow(components[i], exp); } return(new VFXExpressionCombine(components)); }