예제 #1
0
        private void MensureLuminance(GraphicDevice device, IShaderStage stage)
        {
            effect.Technique = HdrEffect.SampleAvgLum;

            RenderTexture2D dest   = _rtToneMap[Tonemaptextures - 1];
            RenderTexture2D source = _rtHdrScene;

            dest.SetTarget(device);
            source.SetTexture(0, device);

            stage.SetSampler(0, _linearSampler);

            device.Clear(ClearFlags.Target, Color4.Black, 1, 0);
            _quadRender.DrawQuad(effect);

            effect.Technique = HdrEffect.ResampleAvgLum;
            stage.SetSampler(0, _pointSampler);

            for (int i = Tonemaptextures - 2; i > 0; i--)
            {
                dest   = _rtToneMap[i];
                source = _rtToneMap[i + 1];

                dest.SetTarget(device);
                source.SetTexture(0, device);
                device.Clear(ClearFlags.Target, Color4.Black, 1, 0);
                _quadRender.DrawQuad(effect);
            }

            effect.Technique = HdrEffect.ResampleAvgLumExp;
            source           = _rtToneMap[1];
            dest             = _rtToneMap[0];

            dest.SetTarget(device);
            source.SetTexture(0, device);

            device.Clear(ClearFlags.Target, Color4.Black, 1, 0);
            _quadRender.DrawQuad(effect);
        }
예제 #2
0
 protected override void Set(SamplerState state)
 {
     stage.SetSampler(index, state);
 }