mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-25 08:18:43 -06:00
fix shader
This commit is contained in:
parent
62c3c2105e
commit
6cde878a50
|
@ -10,21 +10,17 @@ out vec4 color;
|
|||
uniform sampler2DArray tex;
|
||||
uniform bool discard_alpha;
|
||||
|
||||
// vec4 alpha_drop(vec4 b, vec4 a) {
|
||||
// if ((a.w < 1.) || (b.w < 1.)) {
|
||||
// return vec4(b.xyz, 0.);
|
||||
// }
|
||||
// return a;
|
||||
// }
|
||||
|
||||
void main() {
|
||||
// base color from texture
|
||||
color = texture(tex, vec3(v_uv, v_tex_index));
|
||||
// discard transparent pixels
|
||||
if (color.w < (discard_alpha ? 0.01 : 0.5)) discard;
|
||||
|
||||
// discard fully transparent pixels
|
||||
if (discard_alpha ? (color.w < 0.5) : (color.w == 0.)) discard;
|
||||
|
||||
//basic "lighting"
|
||||
float light = abs(v_normal.x) + .8 * abs(v_normal.y) + .6 * abs(v_normal.z);
|
||||
color *= vec4(vec3(light), 1.);
|
||||
|
||||
//discard alpha
|
||||
if (discard_alpha) color.w = 1.;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue