2
-canSprint
-0
canJump
0
+canSprint
+0
worldShader_uniform_transform = get_uniform(worldShader, "transform");
worldShader_uniform_ortho = get_uniform(worldShader, "ortho");
worldShader_uniform_color = get_uniform(worldShader, "tex_color");
- worldShader_uniform_ambient = get_uniform(worldShader, "ambient");
+ worldShader_uniform_ambient = get_uniform(worldShader, "ambientLight");
worldShader_uniform_light = get_uniform(worldShader, "light");
worldShader_uniform_light_color = get_uniform(worldShader, "lightColor");
worldShader_uniform_light_impact = get_uniform(worldShader, "lightImpact");
glUniformMatrix4fv(worldShader_uniform_transform, 1, GL_FALSE, glm::value_ptr(glm::mat4(1.0f)));
glUniform4f(worldShader_uniform_color, 1.0, 1.0, 1.0, 1.0);
- glUniform1f(worldShader_uniform_ambient, 1.0);
+ glUniform4f(worldShader_uniform_ambient, 1.0, 1.0, 1.0, 1.0);
glUniform1i(worldShader_uniform_light_amt, 0);
glUniform1f(worldShader_uniform_light_impact, 1.0);
/**************************
varying vec2 texCoord;
varying vec4 color;
+varying vec3 fragCoord;
uniform vec4 ambientLight;
uniform vec4 light[128];
uniform float lightImpact;
uniform int lightSize;
+float b = .0005f;
+float minLight = .05f;
+float radius = sqrt(1.0f / (b * minLight));
+
void main()
{
-
vec4 pixTex = texture2D(texture, vec2(texCoord.x, 1-texCoord.y));
- if (pixTex.a < 0.1)
+ if (pixTex.a < 0.1f)
discard;
-
- if (lightSize > 0) {
-
+
+ vec4 shadeColor = vec4(0.0f, 0.0f, 0.0f, 0.0f);
+ for (int i = 0; i < lightSize; i++) {
+ vec2 loc = light[i].xy;
+ float dist = length(loc - fragCoord.xy);
+ float attenuation = clamp(1.0f - dist*dist/(radius*radius), 0.0f, 1.0f);
+ attenuation *= attenuation;
+
+ shadeColor += vec4(attenuation, attenuation, attenuation, 1.0f) * vec4(lightColor[i]);
}
-
- gl_FragColor = pixTex * color * pixTex.a;
+ shadeColor += ambientLight;
+
+ gl_FragColor = pixTex * color * shadeColor;
}
varying vec2 texCoord;
varying vec4 color;
+varying vec3 fragCoord;
void main(){
color = tex_color;
texCoord = tex_coord;
gl_Position = ortho * transform * vec4(coord2d.xyz, 1.0);
+ fragCoord = vec3(gl_Position.xyz);
}
glUseProgram(textShader);
glBindTexture(GL_TEXTURE_2D, Texture::genColor(Color(0.0f, 0.0f, 0.0f, t >= 0 ? 255 * t : 0)));
drawRect(vec2(r.end.x-(itemWide/2), r.end.y-(itemWide/2)),
- vec2(r.end.x-(itemWide/2)+itemWide,r.end.y-(itemWide/2)+itemWide), -6.1);
+ vec2(r.end.x-(itemWide/2)+itemWide,r.end.y-(itemWide/2)+itemWide), -6.0);
if (!Items.empty() && a < numSlot && Items[a].second) {
glBindTexture(GL_TEXTURE_2D, Items[a].first->tex->image[0]);//itemtex[items[a].id]);
case SDLK_F3:
debug ^= true;
break;
+ case SDLK_BACKSLASH:
+ dialogBoxExists = false;
+ break;
case SDLK_x:
m = currentWorld->getNearMob(*player);
if (m != nullptr)