mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 10:29:19 +02:00
gfx.extraeffects setting, parallax shader changes
This commit is contained in:
@@ -827,6 +827,11 @@ global_settings::ConfigParse(cParser &Parser) {
|
|||||||
Parser.getTokens(1);
|
Parser.getTokens(1);
|
||||||
Parser >> gfx_skippipeline;
|
Parser >> gfx_skippipeline;
|
||||||
}
|
}
|
||||||
|
else if (token == "gfx.extraeffects")
|
||||||
|
{
|
||||||
|
Parser.getTokens(1);
|
||||||
|
Parser >> gfx_extraeffects;
|
||||||
|
}
|
||||||
else if (token == "gfx.usegles")
|
else if (token == "gfx.usegles")
|
||||||
{
|
{
|
||||||
Parser.getTokens(1);
|
Parser.getTokens(1);
|
||||||
|
|||||||
@@ -219,6 +219,7 @@ struct global_settings {
|
|||||||
GLenum gfx_format_color = GL_RGB16F;
|
GLenum gfx_format_color = GL_RGB16F;
|
||||||
GLenum gfx_format_depth = GL_DEPTH_COMPONENT32F;
|
GLenum gfx_format_depth = GL_DEPTH_COMPONENT32F;
|
||||||
bool gfx_skippipeline = false;
|
bool gfx_skippipeline = false;
|
||||||
|
bool gfx_extraeffects = true;
|
||||||
bool gfx_shadergamma = false;
|
bool gfx_shadergamma = false;
|
||||||
bool gfx_usegles = false;
|
bool gfx_usegles = false;
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ void gl::glsl_common_setup()
|
|||||||
"#define ENVMAP_ENABLED " + std::to_string((int)Global.gfx_envmap_enabled) + "\n" +
|
"#define ENVMAP_ENABLED " + std::to_string((int)Global.gfx_envmap_enabled) + "\n" +
|
||||||
"#define MOTIONBLUR_ENABLED " + std::to_string((int)Global.gfx_postfx_motionblur_enabled) + "\n" +
|
"#define MOTIONBLUR_ENABLED " + std::to_string((int)Global.gfx_postfx_motionblur_enabled) + "\n" +
|
||||||
"#define POSTFX_ENABLED " + std::to_string((int)!Global.gfx_skippipeline) + "\n" +
|
"#define POSTFX_ENABLED " + std::to_string((int)!Global.gfx_skippipeline) + "\n" +
|
||||||
|
"#define EXTRAEFFECTS_ENABLED " + std::to_string((int)Global.gfx_extraeffects) + "\n" +
|
||||||
"#define USE_GLES " + std::to_string((int)Global.gfx_usegles) + "\n" +
|
"#define USE_GLES " + std::to_string((int)Global.gfx_usegles) + "\n" +
|
||||||
"const uint MAX_LIGHTS = " + std::to_string(MAX_LIGHTS) + "U;\n" +
|
"const uint MAX_LIGHTS = " + std::to_string(MAX_LIGHTS) + "U;\n" +
|
||||||
"const uint MAX_PARAMS = " + std::to_string(MAX_PARAMS) + "U;\n" +
|
"const uint MAX_PARAMS = " + std::to_string(MAX_PARAMS) + "U;\n" +
|
||||||
|
|||||||
@@ -104,14 +104,16 @@ void main()
|
|||||||
}
|
}
|
||||||
vec2 ParallaxMapping(vec2 f_coord, vec3 viewDir)
|
vec2 ParallaxMapping(vec2 f_coord, vec3 viewDir)
|
||||||
{
|
{
|
||||||
#if ENVMAP_ENABLED
|
float pos_len = length(f_pos.xyz);
|
||||||
|
|
||||||
|
if (pos_len > 100.0) {
|
||||||
|
return f_coord;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if EXTRAEFFECTS_ENABLED
|
||||||
const float minLayers = 8.0;
|
const float minLayers = 8.0;
|
||||||
const float maxLayers = 32.0;
|
const float maxLayers = 32.0;
|
||||||
float LayersWeight = 1.0;
|
float LayersWeight = pos_len / 20.0;
|
||||||
if (length(f_pos.xyz) > 20.0)
|
|
||||||
LayersWeight = 1.0;
|
|
||||||
else
|
|
||||||
LayersWeight = (length(f_pos.xyz) / 20.0);
|
|
||||||
vec2 currentTexCoords = f_coord;
|
vec2 currentTexCoords = f_coord;
|
||||||
float currentDepthMapValue = texture(normalmap, currentTexCoords).b;
|
float currentDepthMapValue = texture(normalmap, currentTexCoords).b;
|
||||||
LayersWeight = min(abs(dot(vec3(0.0, 0.0, 1.0), viewDir)),LayersWeight);
|
LayersWeight = min(abs(dot(vec3(0.0, 0.0, 1.0), viewDir)),LayersWeight);
|
||||||
@@ -140,7 +142,7 @@ vec2 ParallaxMapping(vec2 f_coord, vec3 viewDir)
|
|||||||
return finalTexCoords;
|
return finalTexCoords;
|
||||||
#else
|
#else
|
||||||
float height = texture(normalmap, f_coord).b;
|
float height = texture(normalmap, f_coord).b;
|
||||||
vec2 p = viewDir.xy / viewDir.z * (height * param[2].y - param[2].z);
|
vec2 p = viewDir.xy / viewDir.z * (height * (param[2].y - param[2].z) * 0.2);
|
||||||
return f_coord - p;
|
return f_coord - p;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user