Esempio n. 1
0
    private void AddParameters <T>(PostProcessProfile profile) where T : PostProcessEffectSettings
    {
        foreach (var effect in profile.settings)
        {
            var effectName = effect.GetType().Name;
            var cast       = effect as T;

            if (cast != null)
            {
                foreach (var thisVar in cast.GetType().GetFields())
                {
                    UnityEngine.Rendering.PostProcessing.FloatParameter item = thisVar.GetValue(cast) as UnityEngine.Rendering.PostProcessing.FloatParameter;
                    if (item != null)
                    {
                        var row       = new GUIRow();
                        var parameter = new GUIFloat(effectName + "." + thisVar.Name,
                                                     0, 1, 0, delegate(float v)
                        {
                            item.value = v;
                        });
                        Parameters.Add(parameter);
                        row.Items.Add(parameter);
                        GUIRows.Add(row);
                    }
                }
                // add some spacing
                GUIRows.Add(new GUIRow());
            }
        }
    }
Esempio n. 2
0
        public static void Convert(this BIRPRendering.FloatParameter birpSource, ClampedFloatParameter target, float scale = 1f, bool enabledState = true)
        {
            if (target == null)
            {
                return;
            }

            target.value         = enabledState ? birpSource.value * scale : 0f;
            target.overrideState = birpSource.overrideState;
        }