mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-09 23:05:04 -06:00
1) Shader manager: Allow to override #defines programatically
when loading a shader file. 2) Conditional compilation of environmental mapping in gouraud.fs using 1)
This commit is contained in:
parent
b589b9ce9c
commit
8d644fbcb6
5 changed files with 47 additions and 17 deletions
|
@ -16,8 +16,10 @@ struct SlopeDetection
|
|||
uniform vec4 uniform_color;
|
||||
uniform SlopeDetection slope;
|
||||
|
||||
uniform sampler2D environment_tex;
|
||||
uniform bool use_environment_tex;
|
||||
#if ENABLE_ENVIRONMENT_MAP
|
||||
uniform sampler2D environment_tex;
|
||||
uniform bool use_environment_tex;
|
||||
#endif // ENABLE_ENVIRONMENT_MAP
|
||||
|
||||
varying vec3 clipping_planes_dots;
|
||||
|
||||
|
@ -42,8 +44,10 @@ void main()
|
|||
vec3 color = slope.actived ? slope_color() : uniform_color.rgb;
|
||||
// if the fragment is outside the print volume -> use darker color
|
||||
color = (any(lessThan(delta_box_min, ZERO)) || any(greaterThan(delta_box_max, ZERO))) ? mix(color, ZERO, 0.3333) : color;
|
||||
#if ENABLE_ENVIRONMENT_MAP
|
||||
if (use_environment_tex)
|
||||
gl_FragColor = vec4(0.45 * texture2D(environment_tex, normalize(eye_normal).xy * 0.5 + 0.5).xyz + 0.8 * color * intensity.x, uniform_color.a);
|
||||
else
|
||||
#endif
|
||||
gl_FragColor = vec4(vec3(intensity.y) + color * intensity.x, uniform_color.a);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue