last srgb change
parent
dc5bbd32e9
commit
bd19dba3a3
|
@ -1,8 +1,8 @@
|
||||||
uniform float gamma; /// set:2.2
|
uniform float u_gamma;
|
||||||
out vec4 color;
|
out vec4 color;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
vec2 uv = TEXCOORD.st;
|
vec2 uv = TEXCOORD.st;
|
||||||
vec4 src = texture2D(iChannel0, uv);
|
vec4 src = texture2D(iChannel0, uv);
|
||||||
color = vec4( pow(src.xyz, vec3(1.0 / gamma)), src.a); // gamma correction
|
color = vec4( pow(src.xyz, vec3(u_gamma)), src.a); // gamma correction
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
uniform sampler2D u_texture;
|
uniform sampler2D u_texture;
|
||||||
uniform float gamma; /// set:2.2
|
uniform float u_gamma; /// set:2.2
|
||||||
|
|
||||||
in vec2 vTexCoord;
|
in vec2 vTexCoord;
|
||||||
in vec4 vColor;
|
in vec4 vColor;
|
||||||
|
@ -54,5 +54,5 @@ void main() {
|
||||||
vec4 texColor = texture_AA2(u_texture, vTexCoord);
|
vec4 texColor = texture_AA2(u_texture, vTexCoord);
|
||||||
if(texColor.a < 0.9) discard;
|
if(texColor.a < 0.9) discard;
|
||||||
fragColor = vColor * texColor;
|
fragColor = vColor * texColor;
|
||||||
fragColor.rgb = pow(fragColor.rgb, vec3(gamma));
|
fragColor.rgb = pow(fragColor.rgb, vec3(u_gamma));
|
||||||
}
|
}
|
|
@ -8,7 +8,7 @@ uniform float uMieScattering;
|
||||||
uniform float uRayleighScaleHeight;
|
uniform float uRayleighScaleHeight;
|
||||||
uniform float uMieScaleHeight;
|
uniform float uMieScaleHeight;
|
||||||
uniform float uMiePreferredDirection;
|
uniform float uMiePreferredDirection;
|
||||||
uniform float gamma; /// set:2.2
|
uniform float u_gamma; /// set:2.2
|
||||||
|
|
||||||
in vec3 v_direction;
|
in vec3 v_direction;
|
||||||
out vec4 fragcolor;
|
out vec4 fragcolor;
|
||||||
|
@ -36,7 +36,7 @@ void main() {
|
||||||
color = 1.0 - exp(-1.0 * color);
|
color = 1.0 - exp(-1.0 * color);
|
||||||
|
|
||||||
fragcolor = vec4(color, 1);
|
fragcolor = vec4(color, 1);
|
||||||
fragcolor.rgb = pow(fragcolor.rgb, vec3(gamma));
|
fragcolor.rgb = pow(fragcolor.rgb, vec3(u_gamma));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ in float color_index;
|
||||||
uniform sampler2D sampler_font;
|
uniform sampler2D sampler_font;
|
||||||
uniform sampler1D sampler_colors;
|
uniform sampler1D sampler_colors;
|
||||||
uniform float num_colors;
|
uniform float num_colors;
|
||||||
uniform float gamma; /// set:2.2
|
uniform float u_gamma; /// set:2.2
|
||||||
|
|
||||||
out vec4 outColor;
|
out vec4 outColor;
|
||||||
|
|
||||||
|
@ -12,5 +12,5 @@ void main() {
|
||||||
vec4 col = texture(sampler_colors, (color_index+0.5)/num_colors);
|
vec4 col = texture(sampler_colors, (color_index+0.5)/num_colors);
|
||||||
float s = texture(sampler_font, uv).r;
|
float s = texture(sampler_font, uv).r;
|
||||||
outColor = vec4(col.rgb, s*col.a);
|
outColor = vec4(col.rgb, s*col.a);
|
||||||
outColor.rgb = pow(outColor.rgb, vec3(gamma));
|
outColor.rgb = pow(outColor.rgb, vec3(u_gamma));
|
||||||
}
|
}
|
||||||
|
|
|
@ -363504,7 +363504,7 @@ void font_draw_cmd(font_t *f, const float *glyph_data, int glyph_idx, float fact
|
||||||
glUniform1f(glGetUniformLocation(f->program, "scale_factor"), factor);
|
glUniform1f(glGetUniformLocation(f->program, "scale_factor"), factor);
|
||||||
glUniform2fv(glGetUniformLocation(f->program, "string_offset"), 1, &offset.x);
|
glUniform2fv(glGetUniformLocation(f->program, "string_offset"), 1, &offset.x);
|
||||||
glUniform1f(glGetUniformLocation(f->program, "offset_firstline"), f->ascent*f->factor);
|
glUniform1f(glGetUniformLocation(f->program, "offset_firstline"), f->ascent*f->factor);
|
||||||
glUniform1f(glGetUniformLocation(f->program, "gamma"), (window_get_gamma() + !window_get_gamma()));
|
glUniform1f(glGetUniformLocation(f->program, "u_gamma"), (window_get_gamma() + !window_get_gamma()));
|
||||||
|
|
||||||
GLint dims[4] = {0};
|
GLint dims[4] = {0};
|
||||||
glGetIntegerv(GL_VIEWPORT, dims);
|
glGetIntegerv(GL_VIEWPORT, dims);
|
||||||
|
@ -371882,6 +371882,8 @@ int skybox_push_state(skybox_t *sky, mat44 proj, mat44 view) {
|
||||||
shader_mat44("u_mvp", mvp);
|
shader_mat44("u_mvp", mvp);
|
||||||
if( sky->flags ) {
|
if( sky->flags ) {
|
||||||
shader_cubemap("u_cubemap", sky->cubemap.id);
|
shader_cubemap("u_cubemap", sky->cubemap.id);
|
||||||
|
} else {
|
||||||
|
shader_float("u_gamma", window_get_gamma() + !window_get_gamma());
|
||||||
}
|
}
|
||||||
return 0; // @fixme: return sortable hash here?
|
return 0; // @fixme: return sortable hash here?
|
||||||
}
|
}
|
||||||
|
@ -374096,7 +374098,7 @@ void ddraw_flush_projview(mat44 proj, mat44 view) {
|
||||||
|
|
||||||
glUseProgram(dd_program);
|
glUseProgram(dd_program);
|
||||||
glUniformMatrix4fv(glGetUniformLocation(dd_program, "u_MVP"), 1, GL_FALSE, mvp);
|
glUniformMatrix4fv(glGetUniformLocation(dd_program, "u_MVP"), 1, GL_FALSE, mvp);
|
||||||
glUniform1f(glGetUniformLocation(dd_program, "gamma"), (window_get_gamma() + !window_get_gamma()));
|
glUniform1f(glGetUniformLocation(dd_program, "u_gamma"), (window_get_gamma() + !window_get_gamma()));
|
||||||
|
|
||||||
static GLuint vao, vbo;
|
static GLuint vao, vbo;
|
||||||
if(!vao) glGenVertexArrays(1, &vao); glBindVertexArray(vao);
|
if(!vao) glGenVertexArrays(1, &vao); glBindVertexArray(vao);
|
||||||
|
@ -375860,6 +375862,7 @@ static void sprite_render_meshes_group(batch_group_t* sprites, int alpha_key, in
|
||||||
}
|
}
|
||||||
shader_bind(sprite_program);
|
shader_bind(sprite_program);
|
||||||
shader_mat44("u_mvp", mvp);
|
shader_mat44("u_mvp", mvp);
|
||||||
|
shader_float("u_gamma", window_get_gamma() + !window_get_gamma());
|
||||||
|
|
||||||
// set (unit 0) in the uniform texture sampler, and render batch
|
// set (unit 0) in the uniform texture sampler, and render batch
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
@ -380014,7 +380017,7 @@ void window_color(unsigned color) {
|
||||||
void window_gamma(float _gamma) {
|
void window_gamma(float _gamma) {
|
||||||
gamma = _gamma;
|
gamma = _gamma;
|
||||||
shader_bind(gamma_fx.pass[postfx_find(&gamma_fx, "fxGamma.fs")].program);
|
shader_bind(gamma_fx.pass[postfx_find(&gamma_fx, "fxGamma.fs")].program);
|
||||||
shader_float("gamma", gamma);
|
shader_float("u_gamma", 1.0f / gamma);
|
||||||
}
|
}
|
||||||
float window_get_gamma() {
|
float window_get_gamma() {
|
||||||
return gamma;
|
return gamma;
|
||||||
|
|
|
@ -1957,7 +1957,7 @@ void font_draw_cmd(font_t *f, const float *glyph_data, int glyph_idx, float fact
|
||||||
glUniform1f(glGetUniformLocation(f->program, "scale_factor"), factor);
|
glUniform1f(glGetUniformLocation(f->program, "scale_factor"), factor);
|
||||||
glUniform2fv(glGetUniformLocation(f->program, "string_offset"), 1, &offset.x);
|
glUniform2fv(glGetUniformLocation(f->program, "string_offset"), 1, &offset.x);
|
||||||
glUniform1f(glGetUniformLocation(f->program, "offset_firstline"), f->ascent*f->factor);
|
glUniform1f(glGetUniformLocation(f->program, "offset_firstline"), f->ascent*f->factor);
|
||||||
glUniform1f(glGetUniformLocation(f->program, "gamma"), (window_get_gamma() + !window_get_gamma()));
|
glUniform1f(glGetUniformLocation(f->program, "u_gamma"), (window_get_gamma() + !window_get_gamma()));
|
||||||
|
|
||||||
GLint dims[4] = {0};
|
GLint dims[4] = {0};
|
||||||
glGetIntegerv(GL_VIEWPORT, dims);
|
glGetIntegerv(GL_VIEWPORT, dims);
|
||||||
|
|
|
@ -1862,6 +1862,8 @@ int skybox_push_state(skybox_t *sky, mat44 proj, mat44 view) {
|
||||||
shader_mat44("u_mvp", mvp);
|
shader_mat44("u_mvp", mvp);
|
||||||
if( sky->flags ) {
|
if( sky->flags ) {
|
||||||
shader_cubemap("u_cubemap", sky->cubemap.id);
|
shader_cubemap("u_cubemap", sky->cubemap.id);
|
||||||
|
} else {
|
||||||
|
shader_float("u_gamma", window_get_gamma() + !window_get_gamma());
|
||||||
}
|
}
|
||||||
return 0; // @fixme: return sortable hash here?
|
return 0; // @fixme: return sortable hash here?
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ void ddraw_flush_projview(mat44 proj, mat44 view) {
|
||||||
|
|
||||||
glUseProgram(dd_program);
|
glUseProgram(dd_program);
|
||||||
glUniformMatrix4fv(glGetUniformLocation(dd_program, "u_MVP"), 1, GL_FALSE, mvp);
|
glUniformMatrix4fv(glGetUniformLocation(dd_program, "u_MVP"), 1, GL_FALSE, mvp);
|
||||||
glUniform1f(glGetUniformLocation(dd_program, "gamma"), (window_get_gamma() + !window_get_gamma()));
|
glUniform1f(glGetUniformLocation(dd_program, "u_gamma"), (window_get_gamma() + !window_get_gamma()));
|
||||||
|
|
||||||
static GLuint vao, vbo;
|
static GLuint vao, vbo;
|
||||||
if(!vao) glGenVertexArrays(1, &vao); glBindVertexArray(vao);
|
if(!vao) glGenVertexArrays(1, &vao); glBindVertexArray(vao);
|
||||||
|
|
|
@ -280,6 +280,7 @@ static void sprite_render_meshes_group(batch_group_t* sprites, int alpha_key, in
|
||||||
}
|
}
|
||||||
shader_bind(sprite_program);
|
shader_bind(sprite_program);
|
||||||
shader_mat44("u_mvp", mvp);
|
shader_mat44("u_mvp", mvp);
|
||||||
|
shader_float("u_gamma", window_get_gamma() + !window_get_gamma());
|
||||||
|
|
||||||
// set (unit 0) in the uniform texture sampler, and render batch
|
// set (unit 0) in the uniform texture sampler, and render batch
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
|
|
@ -793,7 +793,7 @@ void window_color(unsigned color) {
|
||||||
void window_gamma(float _gamma) {
|
void window_gamma(float _gamma) {
|
||||||
gamma = _gamma;
|
gamma = _gamma;
|
||||||
shader_bind(gamma_fx.pass[postfx_find(&gamma_fx, "fxGamma.fs")].program);
|
shader_bind(gamma_fx.pass[postfx_find(&gamma_fx, "fxGamma.fs")].program);
|
||||||
shader_float("gamma", gamma);
|
shader_float("u_gamma", 1.0f / gamma);
|
||||||
}
|
}
|
||||||
float window_get_gamma() {
|
float window_get_gamma() {
|
||||||
return gamma;
|
return gamma;
|
||||||
|
|
|
@ -10659,7 +10659,7 @@ void font_draw_cmd(font_t *f, const float *glyph_data, int glyph_idx, float fact
|
||||||
glUniform1f(glGetUniformLocation(f->program, "scale_factor"), factor);
|
glUniform1f(glGetUniformLocation(f->program, "scale_factor"), factor);
|
||||||
glUniform2fv(glGetUniformLocation(f->program, "string_offset"), 1, &offset.x);
|
glUniform2fv(glGetUniformLocation(f->program, "string_offset"), 1, &offset.x);
|
||||||
glUniform1f(glGetUniformLocation(f->program, "offset_firstline"), f->ascent*f->factor);
|
glUniform1f(glGetUniformLocation(f->program, "offset_firstline"), f->ascent*f->factor);
|
||||||
glUniform1f(glGetUniformLocation(f->program, "gamma"), (window_get_gamma() + !window_get_gamma()));
|
glUniform1f(glGetUniformLocation(f->program, "u_gamma"), (window_get_gamma() + !window_get_gamma()));
|
||||||
|
|
||||||
GLint dims[4] = {0};
|
GLint dims[4] = {0};
|
||||||
glGetIntegerv(GL_VIEWPORT, dims);
|
glGetIntegerv(GL_VIEWPORT, dims);
|
||||||
|
@ -19037,6 +19037,8 @@ int skybox_push_state(skybox_t *sky, mat44 proj, mat44 view) {
|
||||||
shader_mat44("u_mvp", mvp);
|
shader_mat44("u_mvp", mvp);
|
||||||
if( sky->flags ) {
|
if( sky->flags ) {
|
||||||
shader_cubemap("u_cubemap", sky->cubemap.id);
|
shader_cubemap("u_cubemap", sky->cubemap.id);
|
||||||
|
} else {
|
||||||
|
shader_float("u_gamma", window_get_gamma() + !window_get_gamma());
|
||||||
}
|
}
|
||||||
return 0; // @fixme: return sortable hash here?
|
return 0; // @fixme: return sortable hash here?
|
||||||
}
|
}
|
||||||
|
@ -21251,7 +21253,7 @@ void ddraw_flush_projview(mat44 proj, mat44 view) {
|
||||||
|
|
||||||
glUseProgram(dd_program);
|
glUseProgram(dd_program);
|
||||||
glUniformMatrix4fv(glGetUniformLocation(dd_program, "u_MVP"), 1, GL_FALSE, mvp);
|
glUniformMatrix4fv(glGetUniformLocation(dd_program, "u_MVP"), 1, GL_FALSE, mvp);
|
||||||
glUniform1f(glGetUniformLocation(dd_program, "gamma"), (window_get_gamma() + !window_get_gamma()));
|
glUniform1f(glGetUniformLocation(dd_program, "u_gamma"), (window_get_gamma() + !window_get_gamma()));
|
||||||
|
|
||||||
static GLuint vao, vbo;
|
static GLuint vao, vbo;
|
||||||
if(!vao) glGenVertexArrays(1, &vao); glBindVertexArray(vao);
|
if(!vao) glGenVertexArrays(1, &vao); glBindVertexArray(vao);
|
||||||
|
@ -23015,6 +23017,7 @@ static void sprite_render_meshes_group(batch_group_t* sprites, int alpha_key, in
|
||||||
}
|
}
|
||||||
shader_bind(sprite_program);
|
shader_bind(sprite_program);
|
||||||
shader_mat44("u_mvp", mvp);
|
shader_mat44("u_mvp", mvp);
|
||||||
|
shader_float("u_gamma", window_get_gamma() + !window_get_gamma());
|
||||||
|
|
||||||
// set (unit 0) in the uniform texture sampler, and render batch
|
// set (unit 0) in the uniform texture sampler, and render batch
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
@ -27169,7 +27172,7 @@ void window_color(unsigned color) {
|
||||||
void window_gamma(float _gamma) {
|
void window_gamma(float _gamma) {
|
||||||
gamma = _gamma;
|
gamma = _gamma;
|
||||||
shader_bind(gamma_fx.pass[postfx_find(&gamma_fx, "fxGamma.fs")].program);
|
shader_bind(gamma_fx.pass[postfx_find(&gamma_fx, "fxGamma.fs")].program);
|
||||||
shader_float("gamma", gamma);
|
shader_float("u_gamma", 1.0f / gamma);
|
||||||
}
|
}
|
||||||
float window_get_gamma() {
|
float window_get_gamma() {
|
||||||
return gamma;
|
return gamma;
|
||||||
|
|
Loading…
Reference in New Issue