예제 #1
0
        public override VFXExpressionMapper GetExpressionMapper(VFXDeviceTarget target)
        {
            if (!m_encapsulatedOutput)
            {
                throw new NullReferenceException("Unexpected call of GetExpressionMapper with a null m_encapsulatedOutput");
            }

            var expressionMapper = m_encapsulatedOutput.GetExpressionMapper(target);

            if (target == VFXDeviceTarget.GPU)
            {
                var currentFrameIndex = expressionMapper.FromNameAndId("currentFrameIndex", -1);
                if (currentFrameIndex == null)
                {
                    Debug.LogError("CurrentFrameIndex isn't reachable in encapsulatedOutput for motionVector");
                }

                //Since it's a compute shader without renderer associated, these entries aren't automatically sent
                expressionMapper.AddExpression(VFXBuiltInExpression.LocalToWorld, "unity_ObjectToWorld", -1);
                expressionMapper.AddExpression(VFXBuiltInExpression.WorldToLocal, "unity_WorldToObject", -1);
            }
            return(expressionMapper);
        }