public virtual void Init() { Program.Settings.GetLightRange(out float near, out float far); Program.Window.GetSize(out int windowWidth, out int windowHeight); Program.Window.OnButton += OnButton; Program.Window.OnMouseButton += OnMouseButton; DefaultShader = ShaderRepository.GetShader("Default/default"); DefaultShader.SetFloat("material.shininess", 32.0f); DefaultShader.SetFloat("lightNearPlane", near); DefaultShader.SetFloat("lightFarPlane", far); _lightingShaderOrtho = ShaderRepository.GetShader("Lighting/lightingShader", "Lighting/lightingShaderOrtho"); _lightingShaderPersp = ShaderRepository.GetShader("Lighting/lightingShader", "Lighting/lightingShaderPersp"); _lightingShaderPersp.SetFloat("farPlane", far); _lightingShaderOrtho.LightingShader = true; _lightingShaderPersp.LightingShader = true; _lightingFrameBuffer = new FrameBuffer(); _lightingFrameBuffer.Use(); Gl.DrawBuffer(DrawBufferMode.None); Gl.ReadBuffer(ReadBufferMode.None); FrameBuffer.UseDefault(); CurrentCamera = new Camera(); Entities.Add(CurrentCamera); UI = new UILayer(); }
public Shader AddPostProcessShader(string fragmentPath) { Shader shader = ShaderRepository.GetShader("PostProcess/postPro", "PostProcess/" + fragmentPath); shader.SetInt("screen", 0); postProcessShaders.Add(shader); return(shader); }
public PostProcessManager() { System.Drawing.Size windowSize = Program.Window.GetSize(); texture1 = new Texture((uint)windowSize.Width, (uint)windowSize.Height); texture2 = new Texture((uint)windowSize.Width, (uint)windowSize.Height); postProBuffer = new FrameBuffer(); defaultShader = ShaderRepository.GetShader("PostProcess/postPro", "PostProcess/postProDefault"); defaultShader.SetInt("screen", 0); }
public Renderer() { Pipeline = ImmutableList <IRenderable> .Empty; Program.Window.GetSize(out int windowWidth, out int windowHeight); RenderFrameBuffer = new FrameBuffer(windowWidth, windowHeight); RenderFrameBuffer.CreateRenderBuffer((uint)windowWidth, (uint)windowHeight); Program.Window.OnResize += OnResize; _finalShader = ShaderRepository.GetShader("PostProcess/postPro", "PostProcess/postProDefault"); }