Esempio n. 1
0
 public EffectController(ICharacterProvider charProvider,
                         IEffectProvider effectProvider,
                         IStatisticProvider statProvider,
                         GeneralOptions options)
 {
     _charProvider   = charProvider;
     _effectProvider = effectProvider;
     _statProvider   = statProvider;
     _options        = options;
 }
Esempio n. 2
0
        public static void ProcessFile(string inputFile, IEffectProvider effects, string outputFolder)
        {
            var audioFile = new AudioFileReader(inputFile);

            var stereoFile = convertToStereo(audioFile);

            var processedAudio = effects.SampleProvider(stereoFile);

            saveToMp3(Path.Combine(outputFolder, $"{Path.GetFileNameWithoutExtension(inputFile)}.mp3"),
                      processedAudio);
        }
Esempio n. 3
0
        /**
         * If you have one or two spare render targets of the same size as the
         * backbuffer, you may want to pass them in the 'storage' parameter.
         * You may pass one or the two, depending on what you have available.
         *
         * A RG buffer (at least) is expected for storing edges. Note that
         * this target _must_ have a D24S8 depth/stencil buffer.
         * A RGBA buffer is expected for the blending weights.
         *
         * By default, two render targets will be created for storing
         * intermediate calculations.
         *
         * AreaTexDX9.dds and SearchTex.dds from the SMAA distribution need
         * to be added to the content project and compiled as well (no mips,
         * no color key, no premultiplied alpha). `textureBaseName` will
         * be prepended to the search path for these textures in case
         * you don't want them in the root content folder.
         *
         * `effectBaseName` specifies the first part of the effect to be loaded.
         * the chosen `preset` will be appended.
         *
         * NOTE: The caller is responsible for ensuring that the effect exists
         * and can be accessed by the given content manager. This is because compiling
         * shaders at runtime is virtually impossible / very difficult to achieve in
         * XNA and the easiest way is to use the content pipeline to generate
         * all shader permutations upfront.
         */
        public SMAA(GraphicsDevice _device, int _width, int _height, Preset _preset,
                    ITextureProvider texProvider,
                    IEffectProvider effectProvider,
                    RenderTarget2D rt_rg   = null,
                    RenderTarget2D rt_rgba = null
                    )
        {
            Debug.Assert(_width > 0);
            Debug.Assert(_height > 0);
            Debug.Assert(effectProvider != null);
            Debug.Assert(texProvider != null);
            Debug.Assert(_device != null);

            effect = effectProvider.Get(_preset.ToString());

            device = _device;
            width  = _width;
            height = _height;

            threshold      = 0.05f;
            maxSearchSteps = 8;

            // If storage for the edges is not specified we will create it.
            if (rt_rg != null)
            {
                Debug.Assert(rt_rg.DepthStencilFormat == DepthFormat.Depth24Stencil8);

                edgeTex = rt_rg;
                releaseEdgeResources = false;
            }
            else
            {
                edgeTex = new RenderTarget2D(device, width, height, false,
                                             SurfaceFormat.Color,
                                             DepthFormat.Depth24Stencil8);

                releaseEdgeResources = true;
            }


            // If storage for the blend weights is not specified we will create it.
            if (rt_rgba != null)
            {
                blendTex = rt_rgba;
                releaseBlendResources = false;
            }
            else
            {
                blendTex = new RenderTarget2D(device, width, height, false,
                                              SurfaceFormat.Color,
                                              DepthFormat.None);

                releaseBlendResources = true;
            }


            // Load the precomputed textures.
            areaTex   = texProvider.Get("AreaTexDX9");
            searchTex = texProvider.Get("SearchTex");

            // Create some handles for techniques and variables.
            thresholdHandle              = effect.Parameters["threshold"];
            maxSearchStepsHandle         = effect.Parameters["maxSearchSteps"];
            areaTexHandle                = effect.Parameters["areaTex2D"];
            searchTexHandle              = effect.Parameters["searchTex2D"];
            colorTexHandle               = effect.Parameters["colorTex2D"];
            depthTexHandle               = effect.Parameters["depthTex2D"];
            edgesTexHandle               = effect.Parameters["edgesTex2D"];
            blendTexHandle               = effect.Parameters["blendTex2D"];
            pixelSizeHandle              = effect.Parameters["SMAA_PIXEL_SIZE"];
            lumaEdgeDetectionHandle      = effect.Techniques["LumaEdgeDetection"];
            colorEdgeDetectionHandle     = effect.Techniques["ColorEdgeDetection"];
            depthEdgeDetectionHandle     = effect.Techniques["DepthEdgeDetection"];
            blendWeightCalculationHandle = effect.Techniques["BlendWeightCalculation"];
            neighborhoodBlendingHandle   = effect.Techniques["NeighborhoodBlending"];
        }
Esempio n. 4
0
        /**
         * If you have one or two spare render targets of the same size as the
         * backbuffer, you may want to pass them in the 'storage' parameter.
         * You may pass one or the two, depending on what you have available.
         *
         * A RG buffer (at least) is expected for storing edges. Note that
         * this target _must_ have a D24S8 depth/stencil buffer.
         * A RGBA buffer is expected for the blending weights.
         *
         * By default, two render targets will be created for storing
         * intermediate calculations.
         *
         * AreaTexDX9.dds and SearchTex.dds from the SMAA distribution need
         * to be added to the content project and compiled as well (no mips,
         * no color key, no premultiplied alpha). `textureBaseName` will
         * be prepended to the search path for these textures in case
         * you don't want them in the root content folder.
         *
         * `effectBaseName` specifies the first part of the effect to be loaded.
         * the chosen `preset` will be appended.
         *
         * NOTE: The caller is responsible for ensuring that the effect exists
         * and can be accessed by the given content manager. This is because compiling
         * shaders at runtime is virtually impossible / very difficult to achieve in
         * XNA and the easiest way is to use the content pipeline to generate
         * all shader permutations upfront.
         */
        public SMAA(GraphicsDevice _device, int _width, int _height, Preset _preset,
            ITextureProvider texProvider,
            IEffectProvider effectProvider,
            RenderTarget2D rt_rg = null,
            RenderTarget2D rt_rgba = null
            )
        {
            Debug.Assert(_width > 0);
            Debug.Assert(_height > 0);
            Debug.Assert(effectProvider != null);
            Debug.Assert(texProvider != null);
            Debug.Assert(_device != null);

            effect = effectProvider.Get(_preset.ToString());

            device = _device;
            width = _width;
            height = _height;

            threshold = 0.05f;
            maxSearchSteps = 8;

            // If storage for the edges is not specified we will create it.
            if (rt_rg != null)
            {
                Debug.Assert(rt_rg.DepthStencilFormat == DepthFormat.Depth24Stencil8);

                edgeTex = rt_rg;
                releaseEdgeResources = false;
            }
            else
            {
                edgeTex = new RenderTarget2D(device, width, height, false,
                    SurfaceFormat.Color,
                    DepthFormat.Depth24Stencil8);

                releaseEdgeResources = true;
            }

            // If storage for the blend weights is not specified we will create it.
            if (rt_rgba != null)
            {
                blendTex = rt_rgba;
                releaseBlendResources = false;
            }
            else
            {
                blendTex = new RenderTarget2D(device, width, height, false,
                    SurfaceFormat.Color,
                    DepthFormat.None);

                releaseBlendResources = true;
            }

            // Load the precomputed textures.
            areaTex = texProvider.Get("AreaTexDX9");
            searchTex = texProvider.Get("SearchTex");

            // Create some handles for techniques and variables.
            thresholdHandle = effect.Parameters["threshold"];
            maxSearchStepsHandle = effect.Parameters["maxSearchSteps"];
            areaTexHandle = effect.Parameters["areaTex2D"];
            searchTexHandle = effect.Parameters["searchTex2D"];
            colorTexHandle = effect.Parameters["colorTex2D"];
            depthTexHandle = effect.Parameters["depthTex2D"];
            edgesTexHandle = effect.Parameters["edgesTex2D"];
            blendTexHandle = effect.Parameters["blendTex2D"];
            pixelSizeHandle = effect.Parameters["SMAA_PIXEL_SIZE"];
            lumaEdgeDetectionHandle = effect.Techniques["LumaEdgeDetection"];
            colorEdgeDetectionHandle = effect.Techniques["ColorEdgeDetection"];
            depthEdgeDetectionHandle = effect.Techniques["DepthEdgeDetection"];
            blendWeightCalculationHandle = effect.Techniques["BlendWeightCalculation"];
            neighborhoodBlendingHandle = effect.Techniques["NeighborhoodBlending"];
        }