Esempio n. 1
0
        protected override sealed VFXExpression[] BuildExpression(VFXExpression[] inputExpression)
        {
            VFXExpression sphereDelta       = (inputExpression[2] - inputExpression[0]);
            VFXExpression sphereDeltaLength = VFXOperatorUtility.Length(sphereDelta);
            VFXExpression sphereDistance    = (sphereDeltaLength - inputExpression[1]);

            VFXExpression pointOnSphere = (inputExpression[1] / sphereDeltaLength);

            pointOnSphere = (sphereDelta * VFXOperatorUtility.CastFloat(pointOnSphere, inputExpression[0].valueType) + inputExpression[0]);

            return(new VFXExpression[] { pointOnSphere, sphereDistance });
        }
        public void ProcessOperatorLength()
        {
            var a      = new Vector3(0.2f, 0.3f, 0.4f);
            var result = a.magnitude;

            var value_a = new VFXValue <Vector3>(a);

            var expression = VFXOperatorUtility.Length(value_a);

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

            Assert.AreEqual(result, resultExpression.Get <float>(), 0.001f);
        }
Esempio n. 3
0
 protected override sealed VFXExpression[] BuildExpression(VFXExpression[] inputExpression)
 {
     return(new[] { VFXOperatorUtility.Length(inputExpression[0]) });
 }