fix uninitialized shader variable
This commit is contained in:
parent
4a9afb4246
commit
203b77c32f
@ -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() {
|
||||
|
@ -11,5 +11,5 @@ void main() {
|
||||
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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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])})
|
||||
|
Loading…
Reference in New Issue
Block a user