-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMultiplyColor.glsl
24 lines (22 loc) · 914 Bytes
/
MultiplyColor.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
// Author: ?
// Version: 1.0p
//@implements: sampler2D
struct MultiplyColor {
sampler2D sampler;
//@ label: "Mix[%]", editor: range, min: 0, max: 1, range_min: 0, range_max: 100, range_default: 0
float mix;
//@ label: "Red", editor: range, min: 0, max: 2, range_min: 0, range_max: 2, range_default: 1
float red;
//@ label: "Green", editor: range, min: 0, max: 2, range_min: 0, range_max: 2, range_default: 1
float green;
//@ label: "Blue", editor: range, min: 0, max: 2, range_min: 0, range_max: 2, range_default: 1
float blue;
//@ label: "Alpha", editor: range, min: 0, max: 1, range_min: 0, range_max: 1, range_default: 1
float alpha;
};
vec4 texture(MultiplyColor s, vec2 tex_coords) {
vec4 orig = texture(s.sampler, tex_coords);
vec4 color = texture(s.sampler, tex_coords) * vec4(s.red, s.green, s.blue, s.alpha);
color.a = clamp(color.a, 0, 1);
return mix(orig,color,s.mix);
}