Esempio n. 1
0
 public override VFXExpressionMapper GetExpressionMapper(VFXDeviceTarget target)
 {
     if (target == VFXDeviceTarget.GPU)
     {
         var gpuMapper = VFXExpressionMapper.FromBlocks(activeChildrenWithImplicit);
         gpuMapper.AddExpressions(CollectGPUExpressions(GetExpressionsFromSlots(this)), -1);
         return(gpuMapper);
     }
     return(new VFXExpressionMapper());
 }
        public override VFXExpressionMapper GetExpressionMapper(VFXDeviceTarget target)
        {
            if (target == VFXDeviceTarget.CPU)
            {
                var mapper = VFXExpressionMapper.FromBlocks(activeFlattenedChildrenWithImplicit);

                var mapperFromContext = new VFXExpressionMapper();
                mapperFromContext.AddExpressionsFromSlotContainer(this, -1);

                if (loopDuration != LoopMode.Infinite)
                {
                    var expression = mapperFromContext.FromNameAndId("LoopDuration", -1);
                    if (loopDuration == LoopMode.Random)
                    {
                        expression = RandomFromVector2(expression);
                    }
                    mapper.AddExpression(expression, "LoopDuration", -1);
                }

                if (loopCount != LoopMode.Infinite)
                {
                    var expression = mapperFromContext.FromNameAndId("LoopCount", -1);
                    if (loopCount == LoopMode.Random)
                    {
                        expression = new VFXExpressionCastFloatToInt(RandomFromVector2(expression));
                    }
                    mapper.AddExpression(expression, "LoopCount", -1);
                }

                if (delayBeforeLoop != DelayMode.None)
                {
                    var expression = mapperFromContext.FromNameAndId("DelayBeforeLoop", -1);
                    if (delayBeforeLoop == DelayMode.Random)
                    {
                        expression = RandomFromVector2(expression);
                    }
                    mapper.AddExpression(expression, "DelayBeforeLoop", -1);
                }

                if (delayAfterLoop != DelayMode.None)
                {
                    var expression = mapperFromContext.FromNameAndId("DelayAfterLoop", -1);
                    if (delayAfterLoop == DelayMode.Random)
                    {
                        expression = RandomFromVector2(expression);
                    }
                    mapper.AddExpression(expression, "DelayAfterLoop", -1);
                }
                return(mapper);
            }

            return(null);
        }
Esempio n. 3
0
        public override VFXExpressionMapper GetExpressionMapper(VFXDeviceTarget target)
        {
            // GPU
            if (target == VFXDeviceTarget.GPU)
            {
                return(VFXExpressionMapper.FromBlocks(activeChildrenWithImplicit));
            }

            // CPU
            var cpuMapper = new VFXExpressionMapper();

            cpuMapper.AddExpressionFromSlotContainer(this, -1);
            return(cpuMapper);
        }
Esempio n. 4
0
 public override VFXExpressionMapper GetExpressionMapper(VFXDeviceTarget target)
 {
     if (target == VFXDeviceTarget.GPU)
     {
         var gpuMapper = VFXExpressionMapper.FromBlocks(activeFlattenedChildrenWithImplicit);
         gpuMapper.AddExpressions(CollectGPUExpressions(GetExpressionsFromSlots(this)), -1);
         if (generateMotionVector)
         {
             gpuMapper.AddExpression(VFXBuiltInExpression.FrameIndex, "currentFrameIndex", -1);
         }
         return(gpuMapper);
     }
     return(new VFXExpressionMapper());
 }
        public override VFXExpressionMapper GetExpressionMapper(VFXDeviceTarget target)
        {
            // GPU
            if (target == VFXDeviceTarget.GPU)
            {
                var gpuMapper = VFXExpressionMapper.FromBlocks(activeFlattenedChildrenWithImplicit);
                if (ownedType == VFXDataType.ParticleStrip)
                {
                    gpuMapper.AddExpressionsFromSlot(inputSlots[1], -1); // strip index
                }
                return(gpuMapper);
            }

            // CPU
            var cpuMapper = new VFXExpressionMapper();

            cpuMapper.AddExpressionsFromSlot(inputSlots[0], -1); // bounds
            return(cpuMapper);
        }
Esempio n. 6
0
        public override VFXExpressionMapper GetExpressionMapper(VFXDeviceTarget target)
        {
            var  particleData     = GetData() as VFXDataParticle;
            bool isRecordedBounds = particleData && particleData.boundsSettingMode == BoundsSettingMode.Recorded;

            // GPU
            if (target == VFXDeviceTarget.GPU)
            {
                var gpuMapper = VFXExpressionMapper.FromBlocks(activeFlattenedChildrenWithImplicit);
                if (ownedType == VFXDataType.ParticleStrip && !hasGPUSpawner)
                {
                    gpuMapper.AddExpressionsFromSlot(inputSlots[(isRecordedBounds ? 2 : 1)], -1); // strip index
                }
                return(gpuMapper);
            }

            // CPU
            var cpuMapper = new VFXExpressionMapper();

            if (particleData)
            {
                switch (particleData.boundsSettingMode)
                {
                case BoundsSettingMode.Manual:
                    cpuMapper.AddExpressionsFromSlot(inputSlots[0], -1);     // bounds
                    break;

                case BoundsSettingMode.Recorded:
                    cpuMapper.AddExpressionsFromSlot(inputSlots[0], -1);     // bounds
                    cpuMapper.AddExpressionsFromSlot(inputSlots[1], -1);     //bounds padding
                    break;

                case BoundsSettingMode.Automatic:
                    cpuMapper.AddExpressionsFromSlot(inputSlots[0], -1);     //bounds padding
                    break;
                }
            }

            return(cpuMapper);
        }