more fixes to textured transparency

This commit is contained in:
2022-02-25 21:10:38 +08:00
parent 501037d84d
commit 1e74665abc
3 changed files with 12 additions and 0 deletions

View File

@ -351,6 +351,7 @@ func (g *Game) Render(win *glfw.Window) {
gl.Viewport(0, 0, int32(ShadowmapSize[0]), int32(ShadowmapSize[1]))
gl.BindFramebuffer(gl.FRAMEBUFFER, g.render.depthmap.fbo)
gl.Clear(gl.DEPTH_BUFFER_BIT)
gl.Disable(gl.CULL_FACE)
lightPos := g.view.EyePos.Add(normalSun.Multiply(50))
lightView := mgl32.LookAt(lightPos[0], lightPos[1], lightPos[2], g.view.EyePos[0], g.view.EyePos[1], g.view.EyePos[2], 0, 1, 0)
@ -361,6 +362,7 @@ func (g *Game) Render(win *glfw.Window) {
io.RenderDir = g.view.EyePos.Add(lightPos.Negative()).ToFloat64()
g.render.depthmap.shader.UseProgram()
g.render.depthmap.shader.BindTextures()
g.render.depthmap.shader.SetUniformMat4("lightspace", lightspace)
g.world.Render()
@ -377,6 +379,7 @@ func (g *Game) Render(win *glfw.Window) {
gl.BindFramebuffer(gl.FRAMEBUFFER, g.render.gbuffer.fbo)
gl.ClearColor(0, 0, 0, 1)
gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
gl.Enable(gl.CULL_FACE)
gl.Disable(gl.BLEND)
g.render.gbuffer.shader.UseProgram()