예제 #1
0
        //--------------------------------------------------------------
        #region Creation & Cleanup
        //--------------------------------------------------------------

        /// <summary>
        /// Initializes a new instance of the <see cref="GodRayFilter"/> class.
        /// </summary>
        /// <param name="graphicsService">The graphics service.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="graphicsService"/> is <see langword="null"/>.
        /// </exception>
        public GodRayFilter(IGraphicsService graphicsService)
            : base(graphicsService)
        {
            Effect effect = GraphicsService.Content.Load <Effect>("DigitalRune/PostProcessing/GodRayFilter");

            _viewportSizeParameter    = effect.Parameters["ViewportSize"];
            _parameters0Parameter     = effect.Parameters["Parameters0"];
            _parameters1Parameter     = effect.Parameters["Parameters1"];
            _intensityParameter       = effect.Parameters["Intensity"];
            _numberOfSamplesParameter = effect.Parameters["NumberOfSamples"];
            _sourceTextureParameter   = effect.Parameters["SourceTexture"];
            _gBuffer0Parameter        = effect.Parameters["GBuffer0"];
            _rayTextureParameter      = effect.Parameters["RayTexture"];
            _createMaskPass           = effect.CurrentTechnique.Passes["CreateMask"];
            _blurPass    = effect.CurrentTechnique.Passes["Blur"];
            _combinePass = effect.CurrentTechnique.Passes["Combine"];

            _downsampleFilter = graphicsService.GetDownsampleFilter();

            Scale            = 1;
            LightDirection   = new Vector3F(0, -1, 0);
            LightRadius      = 0.2f;
            Intensity        = new Vector3F(1, 1, 1);
            DownsampleFactor = 4;
            NumberOfSamples  = 8;
            NumberOfPasses   = 2;
            Softness         = 1;
        }
예제 #2
0
        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="GodRayFilter"/> class.
        /// </summary>
        /// <param name="graphicsService">The graphics service.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="graphicsService"/> is <see langword="null"/>.
        /// </exception>
        public GodRayFilter(IGraphicsService graphicsService)
            : base(graphicsService)
        {
            Effect effect = GraphicsService.Content.Load<Effect>("DigitalRune/PostProcessing/GodRayFilter");
              _viewportSizeParameter = effect.Parameters["ViewportSize"];
              _parameters0Parameter = effect.Parameters["Parameters0"];
              _parameters1Parameter = effect.Parameters["Parameters1"];
              _intensityParameter = effect.Parameters["Intensity"];
              _numberOfSamplesParameter = effect.Parameters["NumberOfSamples"];
              _sourceTextureParameter = effect.Parameters["SourceTexture"];
              _gBuffer0Parameter = effect.Parameters["GBuffer0"];
              _rayTextureParameter = effect.Parameters["RayTexture"];
              _createMaskPass = effect.CurrentTechnique.Passes["CreateMask"];
              _blurPass = effect.CurrentTechnique.Passes["Blur"];
              _combinePass = effect.CurrentTechnique.Passes["Combine"];

              _downsampleFilter = graphicsService.GetDownsampleFilter();

              Scale = 1;
              LightDirection = new Vector3F(0, -1, 0);
              LightRadius = 0.2f;
              Intensity = new Vector3F(1, 1, 1);
              DownsampleFactor = 4;
              NumberOfSamples = 8;
              NumberOfPasses = 2;
              Softness = 1;
        }