//Vector3 eye, Vector3 sunVector, float groundLevel, float rayleighPhase, float rayleighBrightness, float miePhase, float mieBrightness, float scatterAbsorb, Vector3 Kr, Vector3 sunLight, float skyPrecalcBoundary public void Render(SkyRenderParams p) { Action<ShaderProgram> uniforms = (sp) => { sp.SetUniform("eye", p.eye); sp.SetUniform("sunVector", p.sunVector); sp.SetUniform("groundLevel", p.groundLevel); sp.SetUniform("rayleighBrightness", p.rayleighBrightness); sp.SetUniform("mieBrightness", p.mieBrightness); sp.SetUniform("rayleighPhase", p.rayleighPhase); sp.SetUniform("miePhase", p.miePhase); sp.SetUniform("scatterAbsorb", p.scatterAbsorb); sp.SetUniform("Kr", p.Kr); sp.SetUniform("sunLight", p.sunLight); sp.SetUniform("skyPrecalcBoundary", p.skyPrecalcBoundary); }; RenderFace(SkyCubeTexture, TextureTarget.TextureCubeMapPositiveX, Vector3.UnitX, -Vector3.UnitZ, -Vector3.UnitY, uniforms); RenderFace(SkyCubeTexture, TextureTarget.TextureCubeMapPositiveY, Vector3.UnitY, Vector3.UnitX, Vector3.UnitZ, uniforms); RenderFace(SkyCubeTexture, TextureTarget.TextureCubeMapPositiveZ, Vector3.UnitZ, Vector3.UnitX, -Vector3.UnitY, uniforms); RenderFace(SkyCubeTexture, TextureTarget.TextureCubeMapNegativeX, -Vector3.UnitX, Vector3.UnitZ, -Vector3.UnitY, uniforms); RenderFace(SkyCubeTexture, TextureTarget.TextureCubeMapNegativeY, -Vector3.UnitY, Vector3.UnitX, -Vector3.UnitZ, uniforms); RenderFace(SkyCubeTexture, TextureTarget.TextureCubeMapNegativeZ, -Vector3.UnitZ, -Vector3.UnitX, -Vector3.UnitY, uniforms); GL.Enable(EnableCap.TextureCubeMap); SkyCubeTexture.Bind(); GL.GenerateMipmap(GenerateMipmapTarget.TextureCubeMap); }
public void Render(SkyRenderParams p) { gb.Render( () => { }, (sp) => { sp.SetUniform("eye", p.eye); sp.SetUniform("sunVector", p.sunVector); sp.SetUniform("groundLevel", p.groundLevel); sp.SetUniform("rayleighBrightness", p.rayleighBrightness); sp.SetUniform("rayleighPhase", p.rayleighPhase); //sp.SetUniform("mieBrightness", 0.0f); //sp.SetUniform("miePhase", 0.8f); sp.SetUniform("mieBrightness", p.mieBrightness); sp.SetUniform("miePhase", p.miePhase); sp.SetUniform("scatterAbsorb", p.scatterAbsorb); sp.SetUniform("Kr", p.Kr); sp.SetUniform("sunLight", p.sunLight); sp.SetUniform("skyPrecalcBoundary", p.skyPrecalcBoundary); } ); blur1.Render(this.SkylightTexture); blur2.Render(this.SkylightTexture2); }