mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-07-01 22:25:17 +02:00
Allow tuning bicubic sharpness
This commit is contained in:
parent
939b67f4fa
commit
a3e9316438
6 changed files with 18 additions and 2 deletions
|
@ -88,6 +88,14 @@
|
|||
// "smoothScaling": 0,
|
||||
|
||||
|
||||
// Sharpness when using Bicubic scaling.
|
||||
// A good starting range is 0 to 100,
|
||||
// but you may wish to go outside that range in either direction.
|
||||
// (default: 100)
|
||||
//
|
||||
// "bicubicSharpness": 100,
|
||||
|
||||
|
||||
// Replace the game's Bitmap files with external high-res files
|
||||
// provided in the "Hires" directory.
|
||||
// (You'll also need to set the below Scaling Factors.)
|
||||
|
|
|
@ -135,6 +135,7 @@ void Config::read(int argc, char *argv[]) {
|
|||
{"fullscreen", false},
|
||||
{"fixedAspectRatio", true},
|
||||
{"smoothScaling", 0},
|
||||
{"bicubicSharpness", 100},
|
||||
{"enableHires", false},
|
||||
{"textureScalingFactor", 1.},
|
||||
{"framebufferScalingFactor", 1.},
|
||||
|
@ -263,6 +264,7 @@ try { exp } catch (...) {}
|
|||
SET_OPT(fullscreen, boolean);
|
||||
SET_OPT(fixedAspectRatio, boolean);
|
||||
SET_OPT(smoothScaling, integer);
|
||||
SET_OPT(bicubicSharpness, integer);
|
||||
SET_OPT(enableHires, boolean);
|
||||
SET_OPT(textureScalingFactor, number);
|
||||
SET_OPT(framebufferScalingFactor, number);
|
||||
|
|
|
@ -44,6 +44,7 @@ struct Config {
|
|||
bool fullscreen;
|
||||
bool fixedAspectRatio;
|
||||
int smoothScaling;
|
||||
int bicubicSharpness;
|
||||
bool enableHires;
|
||||
double textureScalingFactor;
|
||||
double framebufferScalingFactor;
|
||||
|
|
|
@ -161,6 +161,7 @@ static void _blitBegin(FBO::ID fbo, const Vec2i &size)
|
|||
shader.applyViewportProj();
|
||||
shader.setTranslation(Vec2i());
|
||||
shader.setTexSize(Vec2i(size.x, size.y));
|
||||
shader.setSharpness(shState->config().bicubicSharpness);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -777,9 +777,11 @@ BicubicShader::BicubicShader()
|
|||
GET_U(texOffsetX);
|
||||
GET_U(sourceSize);
|
||||
GET_U(bc);
|
||||
}
|
||||
|
||||
// TODO: Maybe expose this as a setting?
|
||||
gl.Uniform2f(u_bc, 0.0, 0.5);
|
||||
void BicubicShader::setSharpness(int sharpness)
|
||||
{
|
||||
gl.Uniform2f(u_bc, 1.f - sharpness * 0.01f, sharpness * 0.005f);
|
||||
}
|
||||
|
||||
Lanczos3Shader::Lanczos3Shader()
|
||||
|
|
|
@ -346,6 +346,8 @@ class BicubicShader : public Lanczos3Shader
|
|||
public:
|
||||
BicubicShader();
|
||||
|
||||
void setSharpness(int sharpness);
|
||||
|
||||
protected:
|
||||
GLint u_bc;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue