Пример #1
0
        public override void UpdateParameters(ColorTransformContext context)
        {
            // TODO This could be put as part

            double b = BlackPoint;
            double c = CrossOver;
            double w = WhitePoint;
            double t = Toe;
            double s = Shoulder;

            double k = ((1 - t) * (c - b)) / ((1 - s) * (w - c) + (1 - t) * (c - b));

            var toe = new Vector4(
                (float)((k * (1 - t))),
                (float)(-t),
                (float)(k * (1 - t) * (-b)),
                (float)(c - (1 - t) * b));

            var shoulder = new Vector4(
                (float)(((1 - k) + k * s)),
                (float)(s),
                (float)((1 - k) * (-c) + k * ((1 - s) * w - c)),
                (float)((1 - s) * w - c));

            // Don't call base, as we are rewriting all parameters for the shader
            Parameters.Set(ToneMapMikeDayOperatorShaderKeys.ToeCoeffs, toe);
            Parameters.Set(ToneMapMikeDayOperatorShaderKeys.ShoulderCoeffs, shoulder);
            Parameters.Set(ToneMapMikeDayOperatorShaderKeys.MiddleCrossOver, CrossOver);

            // Copy parameters to parent
            base.UpdateParameters(context);
        }
Пример #2
0
        /// <summary>
        /// Prepare copy operations for parameters.
        /// </summary>
        public virtual void PrepareParameters(ColorTransformContext context, ParameterCollection parentCollection, string keyRoot)
        {
            // Save Group aside
            Group = context.Group;

            // Compute associated layout ranges
            parameterCompositionCopier = new ParameterCollection.CompositionCopier();
            parameterCompositionCopier.Compile(parentCollection, Parameters, keyRoot);
        }
Пример #3
0
        public override void UpdateParameters(ColorTransformContext context)
        {
            Parameters.Set(VignettingShaderKeys.Amount, Amount);
            Parameters.Set(VignettingShaderKeys.RadiusBegin, Radius);
            Parameters.Set(VignettingShaderKeys.Color, Color.ToColorSpace(context.RenderContext.GraphicsDevice.ColorSpace));

            // Copy parameters to parent
            base.UpdateParameters(context);
        }
Пример #4
0
        /// <inheritdoc/>
        protected override void InitializeCore()
        {
            base.InitializeCore();

            transformGroupEffect = new ImageEffectShader(colorTransformGroupEffectName);
            // TODO GRAPHICS REFACTOR
            //transformGroupEffect.SharedParameterCollections.Add(Parameters);
            transformGroupEffect.Initialize(Context);
            Parameters = transformGroupEffect.Parameters;

            // we are adding parameter collections after as transform parameters should override previous parameters
            // TODO GRAPHICS REFACTOR
            //transformGroupEffect.ParameterCollections.Add(transformsParameters);

            this.transformContext = new ColorTransformContext(this, Context);
        }
Пример #5
0
        public override void UpdateParameters(ColorTransformContext context)
        {
            Parameters.Set(FilmGrainShaderKeys.Amount, Amount * 4 * 0.02f);
            Parameters.Set(FilmGrainShaderKeys.GrainSize, GrainSize);
            Parameters.Set(FilmGrainShaderKeys.LuminanceFactor, LuminanceFactor);
            if (Animate)
            {
                time += 0.1f;
                if (time > 100f)
                {
                    time = 1f;
                }
            }
            Parameters.Set(FilmGrainShaderKeys.Time, time);

            // Copy parameters to parent
            base.UpdateParameters(context);
        }
Пример #6
0
 /// <summary>
 /// Updates the parameters for this transformation.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <remarks>This method is called just before rendering the ColorTransformGroup that is holding this ColorTransformBase</remarks>
 public virtual void UpdateParameters(ColorTransformContext context)
 {
     parameterCompositionCopier.Copy(Parameters);
 }