Beispiel #1
0
        public void ProcessExpressionSign()
        {
            var a       = -1.5f;
            var b       = 0.0f;
            var c       = 0.2f;
            var resultA = Mathf.Sign(a);
            var resultB = Mathf.Sign(b);
            var resultC = Mathf.Sign(c);

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

            var absExpressionA = new VFXExpressionSign(value_a);
            var absExpressionB = new VFXExpressionSign(value_b);
            var absExpressionC = new VFXExpressionSign(value_c);

            var context     = new VFXExpression.Context(VFXExpressionContextOption.CPUEvaluation);
            var expressionA = context.Compile(absExpressionA);
            var expressionB = context.Compile(absExpressionB);
            var expressionC = context.Compile(absExpressionC);

            Assert.AreEqual(resultA, expressionA.Get <float>());
            Assert.AreEqual(resultB, expressionB.Get <float>());
            Assert.AreEqual(resultC, expressionC.Get <float>());
        }
        public void ProcessOperatorSign([ValueSource("ProcessOperatorAbs_a")] float a)
        {
            var r       = Mathf.Sign(a);
            var value_a = new VFXValue <float>(a);

            var expression       = new VFXExpressionSign(value_a);
            var context          = new VFXExpression.Context(VFXExpressionContextOption.CPUEvaluation);
            var resultExpression = context.Compile(expression);

            Assert.AreEqual(r, resultExpression.Get <float>());
        }