This commit is contained in:
Andrea Maggiordomo 2021-05-20 10:41:33 +02:00
parent 162e1766bd
commit a80ec564c6
2 changed files with 13 additions and 19 deletions

View File

@ -40,13 +40,11 @@
static const char *vs_text[] = {
"#version 410 core \n"
" \n"
"in vec2 position; \n"
"in vec2 texcoord; \n"
"in vec4 color; \n"
"out vec2 uv; \n"
"out vec4 fcolor; \n"
"attribute vec2 position; \n"
"attribute vec2 texcoord; \n"
"attribute vec4 color; \n"
"varying vec2 uv; \n"
"varying vec4 fcolor; \n"
" \n"
"void main(void) \n"
"{ \n"
@ -59,25 +57,21 @@ static const char *vs_text[] = {
};
static const char *fs_text[] = {
"#version 410 core \n"
" \n"
"uniform sampler2D img0; \n"
" \n"
"uniform vec2 texture_size; \n"
"uniform int render_mode; \n"
" \n"
"in vec2 uv; \n"
"in vec4 fcolor; \n"
" \n"
"out vec4 texelColor; \n"
"varying vec2 uv; \n"
"varying vec4 fcolor; \n"
" \n"
"void main(void) \n"
"{ \n"
" if (render_mode == 0) { \n"
" if (uv.s < 0) \n"
" texelColor = vec4(0, 1, 0, 1); \n"
" if (uv.s < float(0)) \n"
" gl_FragColor = vec4(0, 1, 0, 1); \n"
" else \n"
" texelColor = vec4(texture2D(img0, uv).rgb, 1); \n"
" gl_FragColor = vec4(texture2D(img0, uv).rgb, 1); \n"
" } else if (render_mode == 1) { \n"
" vec2 coord = uv * texture_size - vec2(0.5, 0.5); \n"
" vec2 idx = floor(coord); \n"
@ -99,9 +93,9 @@ static const char *fs_text[] = {
" vec4 tex11 = texture2D(img0, vec2(h1.x, h1.y) / texture_size);\n"
" tex00 = mix(tex00, tex01, g1.y); \n"
" tex10 = mix(tex10, tex11, g1.y); \n"
" texelColor = mix(tex00, tex10, g1.x); \n"
" gl_FragColor = mix(tex00, tex10, g1.x); \n"
" } else { \n"
" texelColor = fcolor; \n"
" gl_FragColor = fcolor; \n"
" } \n"
"} \n"
};

View File

@ -56,7 +56,7 @@ FilterTextureDefragPlugin::FilterTextureDefragPlugin()
for(ActionIDType tt: types())
actionList.push_back(new QAction(filterName(tt), this));
LOG_INIT(logging::Level::Warning);
LOG_INIT(logging::Level::Debug);
LOG_SET_THREAD_NAME("TextureDefrag");
}