コード例 #1
0
ファイル: Blur.cs プロジェクト: dzamkov/L2D
 /// <summary>
 /// Applies a blur effect to the source texture. This requires a temporary texture and an active frame buffer. The source and destination buffers can be the same.
 /// </summary>
 public void Apply(Texture Source, Texture Temp, Texture Dest, int Width, int Height)
 {
     GL.Viewport(0, 0, Width, Height);
     GL.FramebufferTexture2D(FramebufferTarget.FramebufferExt, FramebufferAttachment.ColorAttachment0Ext, TextureTarget.Texture2D, Temp.ID, 0);
     this._BlurHorizontal.Call();
     Source.SetUnit(TextureTarget.Texture2D, TextureUnit.Texture0);
     this._BlurHorizontal.SetUniform("Source", TextureUnit.Texture0);
     this._BlurHorizontal.SetUniform("PixelSpacing", 1.0f / (float)Width);
     this._BlurHorizontal.DrawFull();
     GL.FramebufferTexture2D(FramebufferTarget.FramebufferExt, FramebufferAttachment.ColorAttachment0Ext, TextureTarget.Texture2D, Dest.ID, 0);
     this._BlurVertical.Call();
     Temp.SetUnit(TextureTarget.Texture2D, TextureUnit.Texture0);
     this._BlurVertical.SetUniform("Source", TextureUnit.Texture0);
     this._BlurVertical.SetUniform("PixelSpacing", 1.0f / (float)Height);
     this._BlurVertical.DrawFull();
 }
コード例 #2
0
ファイル: HDR.cs プロジェクト: dzamkov/L2D
        public HDR(int Width, int Height, HDRShaders Shaders)
        {
            this._Width = Width;
            this._Height = Height;

            GL.GenFramebuffers(1, out this._FBO);
            this._HDRTexture = Texture.Initialize2D(Width, Height, Texture.RGB16Float);
            this._HDRTexture.SetInterpolation2D(TextureMinFilter.Nearest, TextureMagFilter.Nearest);
            this._Shaders = Shaders;

            this._Levels = new List<_BlurLevel>();
            int b = 0;
            int nw, nh;
            while(_NextLevel(Width, Height, out nw, out nh) && b < 8)
            {
                Width = nw;
                Height = nh;
                this._Levels.Add(new _BlurLevel(Width, Height));
                b++;
            }
        }
コード例 #3
0
ファイル: ModelComponent.cs プロジェクト: dzamkov/L2D
 public ModelComponent(Model Model, ITransform Transform, Texture Texture)
 {
     this.Transform = Transform;
     this.Model = Model;
     this.Texture = Texture;
 }
コード例 #4
0
ファイル: HDR.cs プロジェクト: dzamkov/L2D
 public _BlurLevel(int Width, int Height)
 {
     this.Width = Width;
     this.Height = Height;
     this.Main = Texture.Initialize2D(Width, Height, Texture.RGB16Float);
     this.Temp = Texture.Initialize2D(Width, Height, Texture.RGB16Float);
 }