diff --git a/stb_voxel_render.h b/stb_voxel_render.h index 7ee3681..db5399e 100644 --- a/stb_voxel_render.h +++ b/stb_voxel_render.h @@ -861,6 +861,7 @@ static char *stbvox_fragment_program = " uint tex2_id = facedata.y;\n" " uint texprojid = facedata.w & 31u;\n" " uint color_id = facedata.z;\n" + // @TODO: could use a separate lookup table keyed on tex2 to determine this; maybe another field of texscale? " bool texblend_mode = ((facedata.w & 128u) != 0u);\n" #ifndef STBVOX_CONFIG_PREFER_TEXBUFFER @@ -899,17 +900,15 @@ static char *stbvox_fragment_program = " tex2.a *= texlerp;\n" #endif - // @TODO: could use a separate lookup table keyed on tex2 to determine this " if (texblend_mode)\n" " albedo = tex2.xyz * rlerp(tex2.a, 2.0*tex1.xyz, vec3(1.0,1.0,1.0));\n" " else {\n" #ifdef STBVOX_CONFIG_PREMULTIPLIED_ALPHA " albedo = (1.0-tex2.a)*tex1.xyz + tex2.xyz;\n" - " fragment_alpha = tex1.a;\n" #else " albedo = rlerp(tex2.a, tex1.xyz, tex2.xyz);\n" - " fragment_alpha = tex1.a*(1-tex2.a)+tex2.a;\n" #endif + " fragment_alpha = tex1.a*(1-tex2.a)+tex2.a;\n" " }\n" " fragment_alpha = tex1.a;\n" @@ -1050,16 +1049,8 @@ static char *stbvox_fragment_program_alpha_only = " tex2.a *= texlerp;\n" - // @TODO: could use a separate lookup table keyed on tex2 to determine this - " if (texblend_mode)\n" - " ;\n" - " else {\n" - #ifdef STBVOX_CONFIG_PREMULTIPLIED_ALPHA - " fragment_alpha = tex1.a;\n" - #else + " if (!texblend_mode)\n" " fragment_alpha = tex1.a*(1-tex2.a)+tex2.a;\n" - #endif - " }\n" #else // UNTEXTURED " vec4 color;" diff --git a/tests/caveview/cave_mesher.c b/tests/caveview/cave_mesher.c index f9b7048..dae1beb 100644 --- a/tests/caveview/cave_mesher.c +++ b/tests/caveview/cave_mesher.c @@ -21,7 +21,7 @@ #define STBVOX_CONFIG_PREFER_TEXBUFFER //#define STBVOX_CONFIG_LIGHTING_SIMPLE #define STBVOX_CONFIG_FOG_SMOOTHSTEP -#define STBVOX_CONFIG_PREMULTIPLIED_ALPHA // use this even though it doesn't really work for alpha test without next #define +//#define STBVOX_CONFIG_PREMULTIPLIED_ALPHA // use this even though it doesn't really work for alpha test without next #define //#define STBVOX_CONFIG_UNPREMULTIPLY // slower, makes windows & fancy leaves look better #define STBVOX_ROTATION_IN_LIGHTING