more fixes to textured transparency
This commit is contained in:
parent
501037d84d
commit
1e74665abc
@ -1,6 +1,12 @@
|
||||
#version 330
|
||||
|
||||
uniform sampler2D tex;
|
||||
|
||||
in vec2 fragTexCoord;
|
||||
|
||||
void main() {
|
||||
if (texture(tex, fragTexCoord).a < 1e-3)
|
||||
discard;
|
||||
// gl_FragDepth = gl.FragCoord.z;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,10 @@ layout (location = 1) in vec3 normal;
|
||||
layout (location = 2) in vec2 vertTexCoord;
|
||||
layout (location = 3) in float light;
|
||||
|
||||
out vec2 fragTexCoord;
|
||||
|
||||
void main() {
|
||||
fragTexCoord = vertTexCoord;
|
||||
gl_Position = lightspace * model * vec4(vert, 1.0);
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user