summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
bc31a90)
This is not correct, since tc can be changed by the fragment shader
_and_ by later vertex shaders. We need to do some rethinking here,
seemingly.
This reverts commit
2b4a7d868112b4995bf6699f5b3aa68e9ec2b308.
register_float("inner_radius", (float *)&inner_radius);
}
register_float("inner_radius", (float *)&inner_radius);
}
-std::string VignetteEffect::output_vertex_shader()
-{
- return read_file("vignette_effect.vert");
-}
-
std::string VignetteEffect::output_fragment_shader()
{
return read_file("vignette_effect.frag");
std::string VignetteEffect::output_fragment_shader()
{
return read_file("vignette_effect.frag");
// A simple, circular vignette, with a cosĀ² falloff.
uniform float PREFIX(inv_radius);
// A simple, circular vignette, with a cosĀ² falloff.
uniform float PREFIX(inv_radius);
-varying vec2 PREFIX(normalized_pos);
+uniform vec2 PREFIX(aspect_correction);
vec4 FUNCNAME(vec2 tc) {
vec4 x = LAST_INPUT(tc);
const float pihalf = 0.5 * 3.14159265358979324;
vec4 FUNCNAME(vec2 tc) {
vec4 x = LAST_INPUT(tc);
const float pihalf = 0.5 * 3.14159265358979324;
- float dist = (length(PREFIX(normalized_pos)) - PREFIX(inner_radius)) * PREFIX(inv_radius);
+ vec2 normalized_pos = (tc - PREFIX(center)) * PREFIX(aspect_correction);
+ float dist = (length(normalized_pos) - PREFIX(inner_radius)) * PREFIX(inv_radius);
float linear_falloff = clamp(dist, 0.0, 1.0) * pihalf;
float falloff = cos(linear_falloff) * cos(linear_falloff);
x.rgb *= vec3(falloff);
float linear_falloff = clamp(dist, 0.0, 1.0) * pihalf;
float falloff = cos(linear_falloff) * cos(linear_falloff);
x.rgb *= vec3(falloff);
class VignetteEffect : public Effect {
public:
VignetteEffect();
class VignetteEffect : public Effect {
public:
VignetteEffect();
- std::string output_vertex_shader();
std::string output_fragment_shader();
void set_uniforms(GLuint glsl_program_num, const std::string &prefix);
std::string output_fragment_shader();
void set_uniforms(GLuint glsl_program_num, const std::string &prefix);
+++ /dev/null
-uniform vec2 PREFIX(aspect_correction);
-varying vec2 PREFIX(normalized_pos);
-
-vec2 FUNCNAME()
-{
- vec2 temp = LAST_INPUT();
- PREFIX(normalized_pos) = (temp - PREFIX(center)) * PREFIX(aspect_correction);
- return temp;
-}