main
Dominik Madarász 2024-03-26 19:31:03 +01:00
parent 5f31dd100c
commit dc5bbd32e9
5 changed files with 16 additions and 10 deletions

View File

@ -1,5 +1,5 @@
uniform sampler2D u_texture;
uniform float gamma; /// set:2.2
in vec2 vTexCoord;
in vec4 vColor;
@ -54,4 +54,5 @@ void main() {
vec4 texColor = texture_AA2(u_texture, vTexCoord);
if(texColor.a < 0.9) discard;
fragColor = vColor * texColor;
fragColor.rgb = pow(fragColor.rgb, vec3(gamma));
}

View File

@ -17,7 +17,7 @@ in vec3 v_position;
in vec3 v_position_ws;
#ifdef RIM
uniform mat4 M; // RIM
uniform vec3 u_rimcolor = vec3(0.2,0.2,0.2);
uniform vec3 u_rimcolor = vec3(0.05,0.05,0.05);
uniform vec3 u_rimrange = vec3(0.11,0.98,0.5);
uniform vec3 u_rimpivot = vec3(0,0,0);
uniform bool u_rimambient = true;
@ -445,7 +445,8 @@ void main() {
}
float rim = 1.0 - max(dot(v,n), 0.0);
vec3 col = u_rimcolor*(pow(smoothstep(1.0-u_rimrange.x,u_rimrange.y,rim), u_rimrange.z));
fragcolor += vec4(col, 1.0);}
fragcolor += vec4(col, 0.0);
}
#endif
}
#endif
@ -719,7 +720,8 @@ void main(void)
}
float rim = 1.0 - max(dot(v,n), 0.0);
vec3 col = u_rimcolor*(pow(smoothstep(1.0-u_rimrange.x,u_rimrange.y,rim), u_rimrange.z));
fragcolor += vec4(col, 1.0);}
fragcolor += vec4(col, 0.0);
}
#endif
}

View File

@ -372374,10 +372374,11 @@ int ui_postfx(postfx *fx, int pass) {
}
static __thread array(handle) last_fb;
static postfx gamma_fx;
bool postfx_begin(postfx *fx, int width, int height) {
// reset clear color: needed in case transparent window is being used (alpha != 0)
glClearColor(0,0,0,0); // @transparent
if (fx != &gamma_fx) glClearColor(0,0,0,0); // @transparent
width += !width;
height += !height;
@ -372504,7 +372505,7 @@ bool postfx_end(postfx *fx) {
return true;
}
static postfx fx, gamma_fx;
static postfx fx;
int fx_load_from_mem(const char *nameid, const char *content) {
do_once postfx_create(&fx, 0);
return postfx_load_from_mem(&fx, nameid, content);

View File

@ -2354,10 +2354,11 @@ int ui_postfx(postfx *fx, int pass) {
}
static __thread array(handle) last_fb;
static postfx gamma_fx;
bool postfx_begin(postfx *fx, int width, int height) {
// reset clear color: needed in case transparent window is being used (alpha != 0)
glClearColor(0,0,0,0); // @transparent
if (fx != &gamma_fx) glClearColor(0,0,0,0); // @transparent
width += !width;
height += !height;
@ -2484,7 +2485,7 @@ bool postfx_end(postfx *fx) {
return true;
}
static postfx fx, gamma_fx;
static postfx fx;
int fx_load_from_mem(const char *nameid, const char *content) {
do_once postfx_create(&fx, 0);
return postfx_load_from_mem(&fx, nameid, content);

View File

@ -19529,10 +19529,11 @@ int ui_postfx(postfx *fx, int pass) {
}
static __thread array(handle) last_fb;
static postfx gamma_fx;
bool postfx_begin(postfx *fx, int width, int height) {
// reset clear color: needed in case transparent window is being used (alpha != 0)
glClearColor(0,0,0,0); // @transparent
if (fx != &gamma_fx) glClearColor(0,0,0,0); // @transparent
width += !width;
height += !height;
@ -19659,7 +19660,7 @@ bool postfx_end(postfx *fx) {
return true;
}
static postfx fx, gamma_fx;
static postfx fx;
int fx_load_from_mem(const char *nameid, const char *content) {
do_once postfx_create(&fx, 0);
return postfx_load_from_mem(&fx, nameid, content);