Пример #1
0
        public void InitializeShaders()
        {
            string[] shaderList = System.IO.Directory.GetFiles(compiledShadersDir, "*.ps");

            foreach (string curString in shaderList)
            {
                string            name            = System.IO.Path.GetFileName(curString);
                PixelShaderEffect newShaderEffect = new PixelShaderEffect(name);

                this.PixelShaders.Add(name, newShaderEffect);
            }
        }
Пример #2
0
        public MainWindow()
        {
            InitializeComponent();

            foreach (var kvp in ShaderManager.Instance.PixelShaders)
            {
                PixelShaderEffect effect = kvp.Value;

                effect.UpperLayerInput = new ImageBrush(this.UpperLayer.Source);
                effect.LowerLayerInput = new ImageBrush(this.LowerLayer.Source);

                this.EffectGrid.Effect     = kvp.Value as System.Windows.Media.Effects.ShaderEffect;
                this.ComboBox.SelectedItem = kvp.Key;
                ComboBoxItem item = new ComboBoxItem();
                item.Content   = kvp.Key;
                item.Selected += Item_Selected;
                this.ComboBox.Items.Add(item);
            }

            this.UpperLayer.Opacity = this.BlendModeSlider.Value;
            this.LowerLayer.Opacity = 1 - this.BlendModeSlider.Value;
        }