diff --git a/internal/asset/shader/world/lighting.frag b/internal/asset/shader/world/lighting.frag index 3f0d4b4..d310d8c 100644 --- a/internal/asset/shader/world/lighting.frag +++ b/internal/asset/shader/world/lighting.frag @@ -29,7 +29,7 @@ const float fogDensity = .00003; float light; -vec4 texpixel, color; +vec3 color = vec3(0); void lightSun(); float lightSunShadow(); void lightPoint(int i); @@ -60,14 +60,13 @@ void main() { lightSun(); - color += vec4(fragColor.rgb * light, 0.0f); - color.a = fragColor.a; + color += fragColor.rgb * light; //float z = gl_FragCoord.z / gl_FragCoord.w; //float fog = clamp(exp(-fogDensity * z * z), 0.2, 1); //outputColor = mix(fogColor, color, fog); - outputColor = color; + outputColor = vec4(color, 1); } void lightSun() { @@ -82,7 +81,7 @@ void lightSun() { float shadow = lightSunShadow(); light += diffuse * shadow; - color += vec4(vec3(specular), 0.0f) * shadow; + color += vec3(specular) * shadow; } float lightSunShadow() { diff --git a/internal/asset/shader/world/output.frag b/internal/asset/shader/world/output.frag index 69f156a..70d5b9c 100644 --- a/internal/asset/shader/world/output.frag +++ b/internal/asset/shader/world/output.frag @@ -7,9 +7,9 @@ in vec2 fragPosScreen; out vec4 outputColor; void main() { - vec4 texColor = texture(tex, fragPosScreen); + vec4 texColor = texture(tex, fragPosScreen); if (texColor.a < 1e-4) discard; - outputColor = vec4(pow(texColor.rgb / exposure, vec3(1.0/gamma)), 1.0f); + outputColor = vec4(pow(texColor.rgb * exposure, vec3(1.0/gamma)), 1.0f); } diff --git a/internal/asset/shader/world/water.frag b/internal/asset/shader/world/water.frag index fb08aea..3681ebf 100644 --- a/internal/asset/shader/world/water.frag +++ b/internal/asset/shader/world/water.frag @@ -26,7 +26,7 @@ const float fogDensity = .00003; float finalpha; float light; -vec4 texpixel, color; +vec3 color = vec3(0); void lightSun(); float lightSunShadow(); void lightPoint(int i); @@ -41,14 +41,12 @@ void main() { lightSun(); - color += vec4(fragColor.rgb * light, 0.0f); - color.a = fragColor.a; - color.rgb = color.rgb; + color += fragColor.rgb * light; - float z = gl_FragCoord.z / gl_FragCoord.w; - float fog = clamp(exp(-fogDensity * z * z), 0.2, 1); + //float z = gl_FragCoord.z / gl_FragCoord.w; + //float fog = clamp(exp(-fogDensity * z * z), 0.2, 1); - outputColor = mix(fogColor, color, fog) * finalpha; + outputColor = vec4(color, 1) * finalpha; } void lightSun() { @@ -63,7 +61,7 @@ void lightSun() { float shadow = lightSunShadow(); light += diffuse * shadow; - color += vec4(vec3(specular), 0.0f) * shadow; + color += vec3(specular) * shadow; if (specular*shadow > 1.0f) { finalpha = min(finalpha + specular - 1.0f, 1.0f); diff --git a/internal/game/imgui.go b/internal/game/imgui.go index bea0e13..3d2dd86 100644 --- a/internal/game/imgui.go +++ b/internal/game/imgui.go @@ -10,6 +10,7 @@ import ( "edgaru089.ml/go/gl01/internal/igwrap" "edgaru089.ml/go/gl01/internal/igwrap/backend" "edgaru089.ml/go/gl01/internal/io" + "edgaru089.ml/go/gl01/internal/util" "edgaru089.ml/go/gl01/internal/util/itype" "edgaru089.ml/go/gl01/internal/world" "github.com/go-gl/glfw/v3.3/glfw" @@ -22,6 +23,8 @@ type guiState struct { lastframeCgoCalls int64 + lastCountSec *util.Clock + loadChunkFile string loadChunkID [2]int32 @@ -56,6 +59,10 @@ func (g *Game) imgui() { io.Diagnostics.CgoCalls = runtime.NumCgoCall() - g.gui.lastframeCgoCalls g.gui.lastframeCgoCalls = runtime.NumCgoCall() + /*if g.gui.lastCountSec.Elapsed() >= time.Second { + g.gui.lastCountSec.Restart() + }*/ + if io.ShowDebugInfo { imgui.SetNextWindowPosV(imgui.Vec2{}, imgui.ConditionAlways, imgui.Vec2{}) imgui.SetNextWindowSize(imgui.Vec2{X: float32(io.DisplaySize[0]), Y: float32(io.DisplaySize[1])})