Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/modes/shaders/paint_weight_frag.glsl
- This file was added.
| in vec2 weight_interp; /* [weight, alert] */ | |||||
| out vec4 fragColor; | |||||
| uniform float opacity = 1.0; | |||||
| uniform sampler1D colorramp; | |||||
| uniform vec3 alert_colors[2]; | |||||
| void main() | |||||
| { | |||||
| float alert = weight_interp.y; | |||||
| vec3 color; | |||||
| /* Missing vertex group alert color */ | |||||
| if (alert > 1.0) { | |||||
| color = alert_colors[1]; | |||||
| } | |||||
| /* Weights are available */ | |||||
| else { | |||||
| float weight = weight_interp.x; | |||||
| vec3 weight_color = texture(colorramp, weight, 0).rgb; | |||||
| /* Zero weight alert color */ | |||||
| color = mix(weight_color, alert_colors[0], alert); | |||||
| } | |||||
| /* See gpu_shader_multiply_and_blend_preprocessing.glsl */ | |||||
| fragColor = vec4(color * opacity + (1 - opacity), 1.0); | |||||
| } | |||||