public void ProcessOperatorNegate()
        {
            var a       = -1.5f;
            var b       = 0.2f;
            var resultA = -a;
            var resultB = -b;

            var value_a = new VFXValue <float>(a);
            var value_b = new VFXValue <float>(b);

            var expressionA = VFXOperatorUtility.Negate(value_a);
            var expressionB = VFXOperatorUtility.Negate(value_b);

            var context           = new VFXExpression.Context(VFXExpressionContextOption.CPUEvaluation);
            var resultExpressionA = context.Compile(expressionA);
            var resultExpressionB = context.Compile(expressionB);

            Assert.AreEqual(resultA, resultExpressionA.Get <float>());
            Assert.AreEqual(resultB, resultExpressionB.Get <float>());
        }
Пример #2
0
        protected override VFXExpression[] BuildExpression(VFXExpression[] inputExpression)
        {
            var type = inputExpression[0].valueType;

            VFXExpression input;

            if (Clamp)
            {
                input = VFXOperatorUtility.Saturate(inputExpression[0]);
            }
            else
            {
                input = inputExpression[0];
            }

            return(new[] { VFXOperatorUtility.Mad(input, VFXOperatorUtility.TwoExpression[type], VFXOperatorUtility.Negate(VFXOperatorUtility.OneExpression[type])) });
        }