コード例 #1
0
 public void RemoveKey(PostProcessParamType paramType, float time)
 {
     using (PostProcessParamBase param = _animator.GetParam(paramType))
     {
         param.DeleteValue(time);
     }
 }
コード例 #2
0
        public void CreateKey(PostProcessParamType paramType, float time)
        {
            PostProcessParamBase param = _animator.GetParam(paramType);

            try
            {
                switch (paramType)
                {
                case PostProcessParamType.AddColor:
                case PostProcessParamType.BaseColor:
                    // 3 components
                    param.AddValue(time, 0.0f, 0);
                    param.AddValue(time, 0.0f, 1);
                    param.AddValue(time, 0.0f, 2);
                    break;

                case PostProcessParamType.GrayColor:
                    // 3+1 components
                    param.AddValue(time, 0.0f, 0);
                    param.AddValue(time, 0.0f, 1);
                    param.AddValue(time, 0.0f, 2);
                    param.Dispose();
                    param = _animator.GetParam(PostProcessParamType.GrayValue);
                    param.AddValue(time, 0.0f, 0);
                    break;

                case PostProcessParamType.DualityH:
                    param.AddValue(time, 0.44f, 0);
                    param.Dispose();
                    param = _animator.GetParam(PostProcessParamType.DualityV);
                    param.AddValue(time, 0.44f, 0);
                    // 2 components
                    break;

                case PostProcessParamType.NoiseIntensity:
                    param.AddValue(time, 0.33f, 0);
                    param.Dispose();
                    param = _animator.GetParam(PostProcessParamType.NoiseGrain);
                    param.AddValue(time, 0.11f, 0);
                    param.Dispose();
                    param = _animator.GetParam(PostProcessParamType.NoiseFps);
                    param.AddValue(time, 1.0f, 0);
                    break;

                case PostProcessParamType.Blur:
                case PostProcessParamType.ColorMappingInfluence:
                    // 1 component
                    param.AddValue(time, 0.33f, 0);
                    break;

                default:
                    throw new ArgumentException("Invalid param type.");
                }
            }
            finally
            {
                param.Dispose();
            }
        }
コード例 #3
0
        private void SafetyGetValue(PostProcessParamBase param, ref ColorF color, float time)
        {
            color.a = 0;

            SafetyGetValue(param, time, ref color.r, 0);
            SafetyGetValue(param, time, ref color.g, 1);
            SafetyGetValue(param, time, ref color.b, 2);
        }
コード例 #4
0
 private void SafetyGetValue(PostProcessParamBase param, float time, ref float value, int index)
 {
     try
     {
         param.GetValue(time, out value, index);
     }
     catch (AccessViolationException e)
     {
         ErrorOccuredEvent?.Invoke(e.Message);
     }
 }
コード例 #5
0
        public float GetBlur(int keyIndex)
        {
            float result = 0;

            using (PostProcessParamBase param = _animator.GetParam(PostProcessParamType.Blur))
            {
                float time = param.GetKeyTime(keyIndex);

                SafetyGetValue(param, time, ref result, 0);
            }
            return(result);
        }
コード例 #6
0
        public ColorF GetBaseColor(int keyIndex)
        {
            ColorF result = default(ColorF);

            using (PostProcessParamBase param = _animator.GetParam(PostProcessParamType.BaseColor))
            {
                float time = param.GetKeyTime(keyIndex);

                SafetyGetValue(param, ref result, time);
            }
            return(result);
        }
コード例 #7
0
        public float GetBlur(int keyIndex)
        {
            float result;
            float time;

            using (PostProcessParamBase param = animator.GetParam(PostProcessParamType.Blur))
            {
                time = param.GetKeyTime(keyIndex);
                param.GetValue(time, out result, 0);
            }
            return(result);
        }
コード例 #8
0
        public ColorMappingParams GetColorMapping(int keyIndex)
        {
            ColorMappingParams result = default(ColorMappingParams);

            using (PostProcessParamBase param = _animator.GetParam(PostProcessParamType.ColorMappingInfluence))
            {
                float time = param.GetKeyTime(keyIndex);

                SafetyGetValue(param, time, ref result.Influence, 0);
            }
            result.Texture = _animator.PPInfo.ColorMappingGradient1;
            return(result);
        }
コード例 #9
0
        public ColorMappingParams GetColorMapping(int keyIndex)
        {
            ColorMappingParams result;
            float time;

            using (PostProcessParamBase param = animator.GetParam(PostProcessParamType.ColorMappingInfluence))
            {
                time = param.GetKeyTime(keyIndex);
                param.GetValue(time, out result.Influence, 0);
            }
            result.Texture = animator.PPInfo.ColorMappingGradient1;
            return(result);
        }
コード例 #10
0
        public ColorF GetBaseColor(int keyIndex)
        {
            ColorF result;
            float  time;

            using (PostProcessParamBase param = animator.GetParam(PostProcessParamType.BaseColor))
            {
                time     = param.GetKeyTime(keyIndex);
                result.a = 0;
                param.GetValue(time, out result.r, 0);
                param.GetValue(time, out result.g, 1);
                param.GetValue(time, out result.b, 2);
            }
            return(result);
        }
コード例 #11
0
        public Vector2F GetDuality(int keyIndex)
        {
            Vector2F result;
            float    time;

            using (PostProcessParamBase param = animator.GetParam(PostProcessParamType.DualityH))
            {
                time = param.GetKeyTime(keyIndex);
                param.GetValue(time, out result.x, 0);
            }
            using (PostProcessParamBase param = animator.GetParam(PostProcessParamType.DualityV))
            {
                param.GetValue(time, out result.y, 0);
            }
            return(result);
        }
コード例 #12
0
        public Vector2F GetDuality(int keyIndex)
        {
            Vector2F result = default(Vector2F);

            float time;

            using (PostProcessParamBase param = _animator.GetParam(PostProcessParamType.DualityH))
            {
                time = param.GetKeyTime(keyIndex);
                SafetyGetValue(param, time, ref result.x, 0);
            }
            using (PostProcessParamBase param = _animator.GetParam(PostProcessParamType.DualityV))
            {
                SafetyGetValue(param, time, ref result.y, 0);
            }
            return(result);
        }
コード例 #13
0
        public NoiseParams GetNoise(int keyIndex)
        {
            NoiseParams result = default(NoiseParams);
            float       time;

            using (PostProcessParamBase param = _animator.GetParam(PostProcessParamType.NoiseIntensity))
            {
                time = param.GetKeyTime(keyIndex);
                SafetyGetValue(param, time, ref result.Intensity, 0);
            }
            using (PostProcessParamBase param = _animator.GetParam(PostProcessParamType.NoiseGrain))
            {
                SafetyGetValue(param, time, ref result.Grain, 0);
            }
            using (PostProcessParamBase param = _animator.GetParam(PostProcessParamType.NoiseFps))
            {
                SafetyGetValue(param, time, ref result.FPS, 0);
            }
            return(result);
        }
コード例 #14
0
        public NoiseParams GetNoise(int keyIndex)
        {
            NoiseParams result;
            float       time;

            using (PostProcessParamBase param = animator.GetParam(PostProcessParamType.NoiseIntensity))
            {
                time = param.GetKeyTime(keyIndex);
                param.GetValue(time, out result.Intensity, 0);
            }
            using (PostProcessParamBase param = animator.GetParam(PostProcessParamType.NoiseGrain))
            {
                param.GetValue(time, out result.Grain, 0);
            }
            using (PostProcessParamBase param = animator.GetParam(PostProcessParamType.NoiseFps))
            {
                param.GetValue(time, out result.FPS, 0);
            }
            return(result);
        }