io: make ClearColor and FogColor Vec4f instead of 3
This commit is contained in:
parent
444697b205
commit
25872b257d
@ -52,7 +52,8 @@ func main() {
|
||||
game := game.NewGame()
|
||||
game.Init(win)
|
||||
|
||||
gio.ClearColor = itype.Vec3f{0.6, 0.8, 1.0}
|
||||
gio.ClearColor = itype.Vec4f{0.6, 0.8, 1.0, 1.0}
|
||||
gio.FogColor = itype.Vec4f{0.6, 0.8, 1.0, 1.0}
|
||||
gl.ClearColor(0.6, 0.8, 1.0, 1)
|
||||
gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
|
||||
win.SwapBuffers()
|
||||
|
@ -5,7 +5,8 @@ import "edgaru089.ml/go/gl01/internal/util/itype"
|
||||
var (
|
||||
DisplaySize itype.Vec2i // Size of the window viewport in pixels.
|
||||
|
||||
ClearColor itype.Vec3f // Clear color of the renderer.
|
||||
ClearColor itype.Vec4f // Clear color of the renderer.
|
||||
FogColor itype.Vec4f // Color of the fog. Changes if the player is e.g. under water
|
||||
|
||||
// Directions are not always normalized.
|
||||
ViewPos, ViewDir itype.Vec3d // Position and Direction of the player view.
|
||||
|
@ -252,14 +252,14 @@ func (r *WorldRenderer) Render(world *world.World, view *View) {
|
||||
|
||||
// 3. Render the actual output with deferred lighting
|
||||
gl.BindFramebuffer(gl.FRAMEBUFFER, r.output.fbo)
|
||||
gl.ClearColor(io.ClearColor[0], io.ClearColor[1], io.ClearColor[2], 1)
|
||||
gl.ClearColor(io.ClearColor[0], io.ClearColor[1], io.ClearColor[2], io.ClearColor[3])
|
||||
gl.Clear(gl.COLOR_BUFFER_BIT)
|
||||
gl.Disable(gl.DEPTH_TEST)
|
||||
r.lighting.shader.UseProgram()
|
||||
r.lighting.shader.BindTextures()
|
||||
r.lighting.shader.SetUniformMat4("lightspace", lightspace)
|
||||
r.lighting.shader.SetUniformVec3f("viewPos", view.EyePos)
|
||||
r.lighting.shader.SetUniformVec4f("fogColor", itype.Vec4f{0.6, 0.8, 1.0, 1.0})
|
||||
r.lighting.shader.SetUniformVec4f("fogColor", io.FogColor)
|
||||
r.lighting.shader.SetUniformVec3f("sun", normalSun)
|
||||
|
||||
DrawScreenQuad()
|
||||
@ -278,7 +278,7 @@ func (r *WorldRenderer) Render(world *world.World, view *View) {
|
||||
r.water.shader.SetUniformMat4("view", view.View())
|
||||
r.water.shader.SetUniformMat4("projection", view.Perspective())
|
||||
r.water.shader.SetUniformVec3f("viewPos", view.EyePos)
|
||||
r.water.shader.SetUniformVec4f("fogColor", itype.Vec4f{0.6, 0.8, 1.0, 1.0})
|
||||
r.water.shader.SetUniformVec4f("fogColor", io.FogColor)
|
||||
r.water.shader.SetUniformVec3f("sun", normalSun)
|
||||
r.water.shader.SetUniformFloat("alpha", alpha)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user