-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddColor.glsl
25 lines (23 loc) · 933 Bytes
/
AddColor.glsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Author: ?
// Version: 1.0p
//@implements: sampler2D
struct AddColor {
sampler2D sampler;
//@ label: "Mix[%]", editor: range, min: 0, max: 1, range_min: 0, range_max: 255, range_default: 0
float mix;
//@ label: "Red", editor: range, min: 0, max: 1, range_min: 0, range_max: 255, range_default: 0
float reds;
//@ label: "Green", editor: range, min: 0, max: 1, range_min: 0, range_max: 255, range_default: 0
float green;
//@ label: "Blue", editor: range, min: 0, max: 1, range_min: 0, range_max: 255, range_default: 0
float blue;
//@ label: "Alpha", editor: range, min: 0, max: 1, range_min: 0, range_max: 100, range_default: 0
float alpha;
};
vec4 texture(AddColor s, vec2 tex_coords) {
vec4 orig = texture(s.sampler, tex_coords);
vec4 color = texture(s.sampler, tex_coords) + vec4(s.reds, s.green, s.blue, s.alpha);
color = mix(orig, color, s.mix);
color.a = clamp(color.a, 0, 1);
return color;
}