diff --git a/internal/asset/shader/world/geometry.frag b/internal/asset/shader/world/geometry.frag index 324b423..a504424 100644 --- a/internal/asset/shader/world/geometry.frag +++ b/internal/asset/shader/world/geometry.frag @@ -17,12 +17,13 @@ const float gamma = 2.2; void main() { + outputColor = texture(tex, fragTexCoord); + if (outputColor.a < 1e-3) + discard; outputPosition.xyz = fragPosWorld; outputPosition.w = fragDepthView; outputNormal.xyz = fragNormal; outputNormal.w = fragPosLightspaceZ; - outputColor = texture(tex, fragTexCoord); - outputColor = vec4(outputColor.rgb, outputColor.a); } diff --git a/internal/asset/texture/world/glass.png b/internal/asset/texture/world/glass.png new file mode 100644 index 0000000..7270ac1 Binary files /dev/null and b/internal/asset/texture/world/glass.png differ diff --git a/internal/game/logic.go b/internal/game/logic.go index b9c1384..0a81f68 100644 --- a/internal/game/logic.go +++ b/internal/game/logic.go @@ -24,7 +24,7 @@ const ( PlayerPlaceCooldown = 200 * time.Millisecond ) -var placeId = [10]int{blocks.Stone, blocks.Dirt, blocks.Grass, blocks.LogOak, blocks.PlanksOak, blocks.LeavesOak, blocks.Debug, blocks.DebugDir, blocks.Bedrock, blocks.Water} +var placeId = [10]int{blocks.Stone, blocks.Dirt, blocks.Grass, blocks.LogOak, blocks.PlanksOak, blocks.LeavesOak, blocks.Glass, blocks.DebugDir, blocks.Bedrock, blocks.Water} var placei = 0 var logs string diff --git a/internal/game/render.go b/internal/game/render.go index febabf6..92392dc 100644 --- a/internal/game/render.go +++ b/internal/game/render.go @@ -129,6 +129,7 @@ func (g *Game) initRender() (err error) { r.texture.GenerateMipMap() gl.BindTexture(gl.TEXTURE_2D, r.texture.Handle()) gl.TexParameterf(gl.TEXTURE_2D, gl.TEXTURE_MAX_ANISOTROPY, maxaf) + r.depthmap.shader.SetUniformTexture("tex", r.texture) r.gbuffer.shader.SetUniformTexture("tex", r.texture) r.water.shader.SetUniformTexture("tex", r.texture) igwrap.SetTextureFlag(r.texture.Handle(), igwrap.TextureFlag_Linear, igwrap.TextureFlag_FlipY) diff --git a/internal/world/blocks/default.go b/internal/world/blocks/default.go index baff876..b6d95b7 100644 --- a/internal/world/blocks/default.go +++ b/internal/world/blocks/default.go @@ -20,6 +20,8 @@ const ( Water + Glass + Count ) @@ -35,13 +37,15 @@ func init() { world.RegisterBlockBehaviour(7, world.BlockBehaviourStatic(world.BlockAppearance{Name: "bedrock"})) world.RegisterBlockBehaviour(8, world.BlockBehaviourStatic(world.BlockAppearance{Name: "sand"})) world.RegisterBlockBehaviour(9, world.BlockBehaviourStatic(world.BlockAppearance{Name: "log_oak", RenderType: world.ThreeTexture})) - world.RegisterBlockBehaviour(10, world.BlockBehaviourStatic(world.BlockAppearance{Name: "leaves_oak"})) + world.RegisterBlockBehaviour(10, world.BlockBehaviourStatic(world.BlockAppearance{Name: "leaves_oak", Transparent: true})) world.RegisterBlockBehaviour(11, world.BlockBehaviourStatic(world.BlockAppearance{Name: "planks_oak"})) world.RegisterBlockBehaviour(12, WaterBehaviour{}) - if Count != 13 { + world.RegisterBlockBehaviour(13, world.BlockBehaviourStatic(world.BlockAppearance{Name: "glass", Transparent: true})) + + if Count != 14 { panic("world.DefaultBlocks: block count not correct (check for block numbering in default_blocks.go)") }