mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01: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 >> gfx_skippipeline;
|
||||
}
|
||||
else if (token == "gfx.extraeffects")
|
||||
{
|
||||
Parser.getTokens(1);
|
||||
Parser >> gfx_extraeffects;
|
||||
}
|
||||
else if (token == "gfx.usegles")
|
||||
{
|
||||
Parser.getTokens(1);
|
||||
|
||||
@@ -219,6 +219,7 @@ struct global_settings {
|
||||
GLenum gfx_format_color = GL_RGB16F;
|
||||
GLenum gfx_format_depth = GL_DEPTH_COMPONENT32F;
|
||||
bool gfx_skippipeline = false;
|
||||
bool gfx_extraeffects = true;
|
||||
bool gfx_shadergamma = 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 MOTIONBLUR_ENABLED " + std::to_string((int)Global.gfx_postfx_motionblur_enabled) + "\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" +
|
||||
"const uint MAX_LIGHTS = " + std::to_string(MAX_LIGHTS) + "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)
|
||||
{
|
||||
#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 maxLayers = 32.0;
|
||||
float LayersWeight = 1.0;
|
||||
if (length(f_pos.xyz) > 20.0)
|
||||
LayersWeight = 1.0;
|
||||
else
|
||||
LayersWeight = (length(f_pos.xyz) / 20.0);
|
||||
float LayersWeight = pos_len / 20.0;
|
||||
vec2 currentTexCoords = f_coord;
|
||||
float currentDepthMapValue = texture(normalmap, currentTexCoords).b;
|
||||
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;
|
||||
#else
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user