예제 #1
0
        private void CheckFlattenedIndex(VFXExpressionGraph graph, VFXSlot slot)
        {
            int index = graph.GetFlattenedIndex(graph.GPUExpressionsToReduced[slot.GetExpression()]);

            Assert.Greater(graph.FlattenedExpressions.Count, index);
            Assert.Less(-1, index);
        }
        public bool CanGetEvaluatedContent(VFXSlot slot)
        {
            if (m_ExpressionContext == null)
            {
                return(false);
            }
            if (slot.GetExpression() == null)
            {
                return(false);
            }
            Profiler.BeginSample("CanGetEvaluatedContent");
            var reduced = m_ExpressionContext.GetReduced(slot.GetExpression());
            var result  = reduced != null && reduced.Is(VFXExpression.Flags.Value);

            Profiler.EndSample();
            return(result);
        }
예제 #3
0
        private void CheckExpressionValue <T>(VFXExpressionGraph graph, VFXSlot slot, T value)
        {
            var exp = slot.GetExpression();

            Assert.IsTrue(graph.GPUExpressionsToReduced.ContainsKey(exp));
            var expression = graph.GPUExpressionsToReduced[exp];

            Assert.IsTrue(expression.Is(VFXExpression.Flags.Value));
            Assert.AreEqual(value, expression.Get <T>());
        }
예제 #4
0
        public void CheckExpression()
        {
            VFXSlot sphereSlot = VFXSlot.Create(new VFXProperty(typeof(Sphere), "sphere"), VFXSlot.Direction.kInput);
            VFXSlot floatSlot  = VFXSlot.Create(new VFXProperty(typeof(float), "float"), VFXSlot.Direction.kOutput);

            sphereSlot[0][0].Link(floatSlot);
            sphereSlot[1].Link(floatSlot);

            var expr = sphereSlot[0][0].GetExpression();

            Assert.IsInstanceOf <VFXExpressionExtractComponent>(expr);
            Assert.AreEqual(floatSlot.GetExpression(), expr.parents[0].parents[0]);
            Assert.AreEqual(floatSlot.GetExpression(), sphereSlot[1].GetExpression());

            floatSlot.UnlinkAll();
            expr = sphereSlot[0][0].GetExpression();
            Assert.IsInstanceOf <VFXExpressionExtractComponent>(expr);
            Assert.AreNotEqual(floatSlot.GetExpression(), expr.parents[0].parents[0]);
            Assert.AreNotEqual(floatSlot.GetExpression(), sphereSlot[1].GetExpression());
        }
        public object GetEvaluatedContent(VFXSlot slot)
        {
            if (!CanGetEvaluatedContent(slot))
            {
                return(null);
            }
            var reduced = m_ExpressionContext.GetReduced(slot.GetExpression());
            var result  = reduced.GetContent();

            return(result);
        }
예제 #6
0
        private void CheckVectorSlotCreation(Type type, VFXSlot.Direction direction, int expectionChildrenNb)
        {
            VFXSlot slot = VFXSlot.Create(new VFXProperty(type, "test"), direction);

            Assert.IsNotNull(slot);
            Assert.AreEqual(expectionChildrenNb, slot.GetNbChildren());
            Assert.IsInstanceOf <VFXExpressionCombine>(slot.GetExpression());

            foreach (var child in slot.children)
            {
                Assert.IsNotNull(child);
                Assert.AreEqual(0, child.GetNbChildren());
                Assert.IsInstanceOf <VFXExpressionExtractComponent>(child.GetExpression());
            }
        }