mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-04-21 21:52:04 +02:00
Merge pull request #105 from Splendide-Imaginarius/mkxp-z-lanczos-enum
Fold `lanczos3Scaling` config into `smoothScaling`
This commit is contained in:
commit
52c932b9a0
8 changed files with 40 additions and 26 deletions
|
@ -368,7 +368,7 @@ DEF_GRA_PROP_B(ShowCursor)
|
||||||
DEF_GRA_PROP_F(Scale)
|
DEF_GRA_PROP_F(Scale)
|
||||||
DEF_GRA_PROP_B(Frameskip)
|
DEF_GRA_PROP_B(Frameskip)
|
||||||
DEF_GRA_PROP_B(FixedAspectRatio)
|
DEF_GRA_PROP_B(FixedAspectRatio)
|
||||||
DEF_GRA_PROP_B(SmoothScaling)
|
DEF_GRA_PROP_I(SmoothScaling)
|
||||||
DEF_GRA_PROP_B(IntegerScaling)
|
DEF_GRA_PROP_B(IntegerScaling)
|
||||||
DEF_GRA_PROP_B(LastMileScaling)
|
DEF_GRA_PROP_B(LastMileScaling)
|
||||||
DEF_GRA_PROP_B(Threadsafe)
|
DEF_GRA_PROP_B(Threadsafe)
|
||||||
|
|
17
mkxp.json
17
mkxp.json
|
@ -77,18 +77,15 @@
|
||||||
// "fixedAspectRatio": true,
|
// "fixedAspectRatio": true,
|
||||||
|
|
||||||
|
|
||||||
// Apply linear interpolation when game screen
|
// Apply smooth interpolation when game screen
|
||||||
// is upscaled
|
// is upscaled
|
||||||
// (default: disabled)
|
// 0: Nearest-Neighbor
|
||||||
|
// 1: Bilinear
|
||||||
|
// 2: (Reserved)
|
||||||
|
// 3: Lanczos3
|
||||||
|
// (default: 0)
|
||||||
//
|
//
|
||||||
// "smoothScaling": false,
|
// "smoothScaling": 0,
|
||||||
|
|
||||||
|
|
||||||
// Apply Lanczos3 interpolation when game screen
|
|
||||||
// is upscaled (typically higher quality than linear)
|
|
||||||
// (default: disabled)
|
|
||||||
//
|
|
||||||
// "lanczos3Scaling": false,
|
|
||||||
|
|
||||||
|
|
||||||
// Replace the game's Bitmap files with external high-res files
|
// Replace the game's Bitmap files with external high-res files
|
||||||
|
|
|
@ -134,8 +134,7 @@ void Config::read(int argc, char *argv[]) {
|
||||||
{"winResizable", true},
|
{"winResizable", true},
|
||||||
{"fullscreen", false},
|
{"fullscreen", false},
|
||||||
{"fixedAspectRatio", true},
|
{"fixedAspectRatio", true},
|
||||||
{"smoothScaling", false},
|
{"smoothScaling", 0},
|
||||||
{"lanczos3Scaling", false},
|
|
||||||
{"enableHires", false},
|
{"enableHires", false},
|
||||||
{"textureScalingFactor", 1.},
|
{"textureScalingFactor", 1.},
|
||||||
{"framebufferScalingFactor", 1.},
|
{"framebufferScalingFactor", 1.},
|
||||||
|
@ -263,8 +262,7 @@ try { exp } catch (...) {}
|
||||||
SET_OPT(printFPS, boolean);
|
SET_OPT(printFPS, boolean);
|
||||||
SET_OPT(fullscreen, boolean);
|
SET_OPT(fullscreen, boolean);
|
||||||
SET_OPT(fixedAspectRatio, boolean);
|
SET_OPT(fixedAspectRatio, boolean);
|
||||||
SET_OPT(smoothScaling, boolean);
|
SET_OPT(smoothScaling, integer);
|
||||||
SET_OPT(lanczos3Scaling, boolean);
|
|
||||||
SET_OPT(enableHires, boolean);
|
SET_OPT(enableHires, boolean);
|
||||||
SET_OPT(textureScalingFactor, number);
|
SET_OPT(textureScalingFactor, number);
|
||||||
SET_OPT(framebufferScalingFactor, number);
|
SET_OPT(framebufferScalingFactor, number);
|
||||||
|
|
|
@ -43,8 +43,7 @@ struct Config {
|
||||||
bool winResizable;
|
bool winResizable;
|
||||||
bool fullscreen;
|
bool fullscreen;
|
||||||
bool fixedAspectRatio;
|
bool fixedAspectRatio;
|
||||||
bool smoothScaling;
|
int smoothScaling;
|
||||||
bool lanczos3Scaling;
|
|
||||||
bool enableHires;
|
bool enableHires;
|
||||||
double textureScalingFactor;
|
double textureScalingFactor;
|
||||||
double framebufferScalingFactor;
|
double framebufferScalingFactor;
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "glstate.h"
|
#include "glstate.h"
|
||||||
#include "quad.h"
|
#include "quad.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "etc.h"
|
||||||
|
|
||||||
namespace FBO
|
namespace FBO
|
||||||
{
|
{
|
||||||
|
@ -151,7 +152,9 @@ static void _blitBegin(FBO::ID fbo, const Vec2i &size)
|
||||||
FBO::bind(fbo);
|
FBO::bind(fbo);
|
||||||
glState.viewport.pushSet(IntRect(0, 0, size.x, size.y));
|
glState.viewport.pushSet(IntRect(0, 0, size.x, size.y));
|
||||||
|
|
||||||
if (shState->config().lanczos3Scaling)
|
switch (shState->config().smoothScaling)
|
||||||
|
{
|
||||||
|
case Lanczos3:
|
||||||
{
|
{
|
||||||
Lanczos3Shader &shader = shState->shaders().lanczos3;
|
Lanczos3Shader &shader = shState->shaders().lanczos3;
|
||||||
shader.bind();
|
shader.bind();
|
||||||
|
@ -159,7 +162,9 @@ static void _blitBegin(FBO::ID fbo, const Vec2i &size)
|
||||||
shader.setTranslation(Vec2i());
|
shader.setTranslation(Vec2i());
|
||||||
shader.setTexSize(Vec2i(size.x, size.y));
|
shader.setTexSize(Vec2i(size.x, size.y));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
{
|
{
|
||||||
SimpleShader &shader = shState->shaders().simple;
|
SimpleShader &shader = shState->shaders().simple;
|
||||||
shader.bind();
|
shader.bind();
|
||||||
|
@ -167,6 +172,7 @@ static void _blitBegin(FBO::ID fbo, const Vec2i &size)
|
||||||
shader.setTranslation(Vec2i());
|
shader.setTranslation(Vec2i());
|
||||||
shader.setTexSize(Vec2i(size.x, size.y));
|
shader.setTexSize(Vec2i(size.x, size.y));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,18 +232,23 @@ void blitSource(TEXFBO &source)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (shState->config().lanczos3Scaling)
|
switch (shState->config().smoothScaling)
|
||||||
|
{
|
||||||
|
case Lanczos3:
|
||||||
{
|
{
|
||||||
Lanczos3Shader &shader = shState->shaders().lanczos3;
|
Lanczos3Shader &shader = shState->shaders().lanczos3;
|
||||||
shader.bind();
|
shader.bind();
|
||||||
shader.setTexSize(Vec2i(blitSrcWidthHires, blitSrcHeightHires));
|
shader.setTexSize(Vec2i(blitSrcWidthHires, blitSrcHeightHires));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
{
|
{
|
||||||
SimpleShader &shader = shState->shaders().simple;
|
SimpleShader &shader = shState->shaders().simple;
|
||||||
shader.bind();
|
shader.bind();
|
||||||
shader.setTexSize(Vec2i(blitSrcWidthHires, blitSrcHeightHires));
|
shader.setTexSize(Vec2i(blitSrcWidthHires, blitSrcHeightHires));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (source.selfHires != nullptr) {
|
if (source.selfHires != nullptr) {
|
||||||
TEX::bind(source.selfHires->tex);
|
TEX::bind(source.selfHires->tex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "debugwriter.h"
|
#include "debugwriter.h"
|
||||||
#include "disposable.h"
|
#include "disposable.h"
|
||||||
|
#include "etc.h"
|
||||||
#include "etc-internal.h"
|
#include "etc-internal.h"
|
||||||
#include "eventthread.h"
|
#include "eventthread.h"
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
|
@ -1020,13 +1021,13 @@ struct GraphicsPrivate {
|
||||||
(scSize.y + scOffset.y),
|
(scSize.y + scOffset.y),
|
||||||
scSize.x,
|
scSize.x,
|
||||||
-scSize.y),
|
-scSize.y),
|
||||||
threadData->config.smoothScaling);
|
threadData->config.smoothScaling == Bilinear);
|
||||||
}
|
}
|
||||||
|
|
||||||
void metaBlitBufferFlippedScaled(const Vec2i &sourceSize, bool forceNearestNeighbor=false) {
|
void metaBlitBufferFlippedScaled(const Vec2i &sourceSize, bool forceNearestNeighbor=false) {
|
||||||
GLMeta::blitRectangle(IntRect(0, 0, sourceSize.x, sourceSize.y),
|
GLMeta::blitRectangle(IntRect(0, 0, sourceSize.x, sourceSize.y),
|
||||||
IntRect(scOffset.x, scSize.y+scOffset.y, scSize.x, -scSize.y),
|
IntRect(scOffset.x, scSize.y+scOffset.y, scSize.x, -scSize.y),
|
||||||
!forceNearestNeighbor && threadData->config.smoothScaling);
|
!forceNearestNeighbor && threadData->config.smoothScaling == Bilinear);
|
||||||
}
|
}
|
||||||
|
|
||||||
void redrawScreen() {
|
void redrawScreen() {
|
||||||
|
@ -1613,13 +1614,13 @@ void Graphics::setFixedAspectRatio(bool value)
|
||||||
p->updateScreenResoRatio(p->threadData);
|
p->updateScreenResoRatio(p->threadData);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Graphics::getSmoothScaling() const
|
int Graphics::getSmoothScaling() const
|
||||||
{
|
{
|
||||||
// Same deal as with fixed aspect ratio
|
// Same deal as with fixed aspect ratio
|
||||||
return shState->config().smoothScaling;
|
return shState->config().smoothScaling;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graphics::setSmoothScaling(bool value)
|
void Graphics::setSmoothScaling(int value)
|
||||||
{
|
{
|
||||||
shState->config().smoothScaling = value;
|
shState->config().smoothScaling = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ public:
|
||||||
DECL_ATTR( Scale, double )
|
DECL_ATTR( Scale, double )
|
||||||
DECL_ATTR( Frameskip, bool )
|
DECL_ATTR( Frameskip, bool )
|
||||||
DECL_ATTR( FixedAspectRatio, bool )
|
DECL_ATTR( FixedAspectRatio, bool )
|
||||||
DECL_ATTR( SmoothScaling, bool )
|
DECL_ATTR( SmoothScaling, int )
|
||||||
DECL_ATTR( IntegerScaling, bool )
|
DECL_ATTR( IntegerScaling, bool )
|
||||||
DECL_ATTR( LastMileScaling, bool )
|
DECL_ATTR( LastMileScaling, bool )
|
||||||
DECL_ATTR( Threadsafe, bool )
|
DECL_ATTR( Threadsafe, bool )
|
||||||
|
|
|
@ -200,6 +200,14 @@ struct Rect : public Serializable
|
||||||
sigslot::signal<> valueChanged;
|
sigslot::signal<> valueChanged;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum InterpolationMethod
|
||||||
|
{
|
||||||
|
NearestNeighbor = 0,
|
||||||
|
Bilinear = 1,
|
||||||
|
// Reserving 2 for Bicubic
|
||||||
|
Lanczos3 = 3,
|
||||||
|
};
|
||||||
|
|
||||||
/* For internal use.
|
/* For internal use.
|
||||||
* All drawable classes have properties of one or more of the above
|
* All drawable classes have properties of one or more of the above
|
||||||
* types, which in an interpreted environment act as independent
|
* types, which in an interpreted environment act as independent
|
||||||
|
|
Loading…
Add table
Reference in a new issue