some rendering and effect fixes

This commit is contained in:
itsmattkc
2019-03-28 19:38:40 +11:00
parent 45ce93d601
commit 7f06330815
5 changed files with 33 additions and 31 deletions
+20 -6
View File
@@ -7,18 +7,32 @@ uniform float feather;
uniform mediump float amount_val;
vec4 process(vec4 col) {
float alpha = col.a;
float alpha = 1.0;
if (feather == 0.0) {
if (v_texcoord.x < (left*0.01) || v_texcoord.y < (top*0.01) || v_texcoord.x > (1.0-(right*0.01)) || v_texcoord.y > (1.0-(bottom*0.01))) {
alpha = 0.0;
}
} else {
float f = pow(2.0, 10.0-(feather*0.1));
if (left > 0.0) alpha = alpha * clamp(((v_texcoord.x+(0.5/f))-(left*0.01))*f, 0.0, 1.0); // left
if (top > 0.0) alpha = alpha * clamp(((v_texcoord.y+(0.5/f))-(top*0.01))*f, 0.0, 1.0); // top
if (right > 0.0) alpha = alpha * clamp((((1.0-v_texcoord.x)+(0.5/f))-(right*0.01))*f, 0.0, 1.0); // right
if (bottom > 0.0) alpha = alpha * clamp((((1.0-v_texcoord.y)+(0.5/f))-(bottom*0.01))*f, 0.0, 1.0); // bottom
if (left > 0.0) {
alpha = clamp(((v_texcoord.x+(0.5/f))-(left*0.01))*f, 0.0, 1.0); // left
}
if (top > 0.0) {
alpha = clamp(((v_texcoord.y+(0.5/f))-(top*0.01))*f, 0.0, 1.0); // top
}
if (right > 0.0) {
alpha = clamp((((1.0-v_texcoord.x)+(0.5/f))-(right*0.01))*f, 0.0, 1.0); // right
}
if (bottom > 0.0) {
alpha = clamp((((1.0-v_texcoord.y)+(0.5/f))-(bottom*0.01))*f, 0.0, 1.0); // bottom
}
}
return vec4(col.rgb*alpha, alpha);
return col * alpha;
}
+5 -14
View File
@@ -1,23 +1,14 @@
#version 110
uniform bool horiz;
uniform bool vert;
uniform sampler2D myTexture;
varying vec2 vTexCoord;
vec4 process(vec4 col) {
float x = v_texcoord.x;
float y = v_texcoord.y;
void main(void) {
float x = vTexCoord.x;
float y = vTexCoord.y;
if (!horiz && !vert) return col;
if (horiz) x = 1.0 - x;
if (vert) y = 1.0 - y;
vec4 textureColor = texture2D(myTexture, vec2(x, y));
gl_FragColor = vec4(
textureColor.r,
textureColor.g,
textureColor.b,
textureColor.a
);
return texture2D(texture, vec2(x, y));
}
-6
View File
@@ -1,11 +1,5 @@
#define M_PI 3.1415926535897932384626433832795
<<<<<<< HEAD
=======
uniform sampler2D image;
//uniform float radius;
>>>>>>> master
uniform float sigma;
uniform vec2 resolution;
uniform bool horiz_blur;
+7 -5
View File
@@ -573,16 +573,22 @@ GLuint olive::rendering::compose_sequence(ComposeSequenceParams &params) {
// use clip textures for nested sequences, otherwise use main frame buffers
GLuint back_buffer_1;
GLuint back_buffer_2;
GLuint backend_tex_1;
GLuint backend_tex_2;
GLuint comp_texture;
if (params.nests.size() > 0) {
back_buffer_1 = params.nests.last()->fbo[1].buffer();
back_buffer_2 = params.nests.last()->fbo[2].buffer();
backend_tex_1 = params.nests.last()->fbo[1].texture();
backend_tex_2 = params.nests.last()->fbo[2].texture();
comp_texture = params.nests.last()->fbo[0].texture();
} else {
back_buffer_1 = params.backend_buffer1->buffer();
back_buffer_2 = params.backend_buffer2->buffer();
backend_tex_1 = params.backend_buffer1->texture();
backend_tex_2 = params.backend_buffer2->texture();
comp_texture = params.main_buffer->texture();
}
// render a backbuffer
@@ -679,11 +685,7 @@ GLuint olive::rendering::compose_sequence(ComposeSequenceParams &params) {
// copy front buffer to back buffer (only if we're using a blending mode)
if (coords.blendmode >= 0) {
if (params.nests.size() > 0) {
draw_clip(params.ctx, params.pipeline, params.nests.last()->fbo[2].buffer(), params.nests.last()->fbo[0].texture(), true);
} else {
draw_clip(params.ctx, params.pipeline, params.backend_buffer2->buffer(), params.main_buffer->texture(), true);
}
draw_clip(params.ctx, params.pipeline, back_buffer_2, comp_texture, true);
}
+1
View File
@@ -255,6 +255,7 @@ void RenderThread::paint() {
// If we're not color managing, just blit normally
buffer.BindBuffer();
f->glClear(GL_COLOR_BUFFER_BIT);
composite_buffer.BindTexture();
olive::rendering::Blit(pipeline_program.get());
composite_buffer.ReleaseTexture();