diff --git a/clsave/config.json b/clsave/config.json index 56d3a40..af12918 100644 --- a/clsave/config.json +++ b/clsave/config.json @@ -31,6 +31,7 @@ "gl_chunks_tesselated_per_frame": 4, "gl_shaders": true, "gl_frustum_cull": true, + "gl_flip_quads": false, "gl_vbo": true }, diff --git a/docs/setup_json.txt b/docs/setup_json.txt index 928157e..e3a805e 100644 --- a/docs/setup_json.txt +++ b/docs/setup_json.txt @@ -61,6 +61,10 @@ clsave/config.json: Set this to "false" if the artifacts are digging your head in, or if it somehow makes rendering *slower*. + "gl_flip_quads" changes the order in which quads are assembled. + Enable this if you have smooth lighting enabled and it looks like you have dark squares + at each of the corners. + "gl_vbo" enables vertex buffer objects (default: true) May fail on older computers. Enable for a faster FPS. It is recommended you disable these on old Intel integrated GPUs. diff --git a/include/common.h b/include/common.h index 9263497..c4d9dca 100644 --- a/include/common.h +++ b/include/common.h @@ -19,7 +19,7 @@ #define VERSION_X 1 #define VERSION_Y 0 #define VERSION_A 0 -#define VERSION_Z 4 +#define VERSION_Z 5 // Remember to bump "Z" basically every time you change the engine! // Remember to bump the version in Lua too! // Remember to document API changes in a new version! @@ -458,6 +458,7 @@ extern int screen_smooth_lighting; extern int gl_expand_textures; extern int gl_use_vbo; extern int gl_frustum_cull; +extern int gl_flip_quads; extern int gl_chunk_size; extern int gl_visible_chunks; extern int gl_chunks_tesselated_per_frame; diff --git a/pkg/base/version.lua b/pkg/base/version.lua index a6c9518..a3ad8e5 100644 --- a/pkg/base/version.lua +++ b/pkg/base/version.lua @@ -16,9 +16,9 @@ ]] VERSION_ENGINE = { - cmp={0,1,0,0,4}, - num=4194304+4, - str="0.1-4", + cmp={0,1,0,0,5}, + num=4194304+5, + str="0.1-5", } VERSION_BUGS = { @@ -92,5 +92,6 @@ VERSION_BUGS = { {intro=nil, fix=nil, msg="Sound distance attenuation affected by zoom (workaround implemented)"}, {intro=nil, fix=4194304+3, msg="[OpenGL] Frustum culling not supported"}, {intro=nil, fix=4194304+4, msg="[OpenGL] Ambient occlusion on sides not rendered equally"}, +{intro=4194304+4, fix=4194304+5, msg="[OpenGL] Ambient occlusion on sides rendered very unequally on very rare GPUs such as the Intel 3000HD"}, } diff --git a/src/gl/render.c b/src/gl/render.c index 91abe05..97067e3 100644 --- a/src/gl/render.c +++ b/src/gl/render.c @@ -779,7 +779,9 @@ void render_gl_cube_map(map_t *map, map_chunk_t *chunk, float x, float y, float } /* Check if the quad needs to be rotated (fix for ambient occlusion on sides) */ - if (average_light_vertex1 + average_light_vertex3 > average_light_vertex2 + average_light_vertex4) + if ((average_light_vertex1 + average_light_vertex3 > average_light_vertex2 + average_light_vertex4 + ? !gl_flip_quads + : gl_flip_quads)) { /* Quad 1 rotated */ diff --git a/src/lua.c b/src/lua.c index fe29ca4..98cfd02 100644 --- a/src/lua.c +++ b/src/lua.c @@ -376,6 +376,11 @@ int icelua_init(void) if(!lua_isnil(Lc, -1)) gl_use_vbo = v; lua_pop(Lc, 1); + lua_getfield(Lc, -1, "gl_flip_quads"); + v = lua_toboolean(Lc, -1); + if(!lua_isnil(Lc, -1)) gl_flip_quads = v; + lua_pop(Lc, 1); + lua_getfield(Lc, -1, "gl_frustum_cull"); v = lua_toboolean(Lc, -1); if(!lua_isnil(Lc, -1)) gl_frustum_cull = v; diff --git a/src/main.c b/src/main.c index 64d6069..6206b79 100644 --- a/src/main.c +++ b/src/main.c @@ -36,6 +36,7 @@ int gl_visible_chunks = 49; int gl_chunks_tesselated_per_frame = 2; int gl_use_vbo = 1; int gl_frustum_cull = 1; +int gl_flip_quads = 0; int force_redraw = 1;