Merge branch 'master' of github.com:ancurio/mkxp

This commit is contained in:
Jonas Kulla 2017-05-11 12:53:12 +02:00
commit 91f042197b
1 changed files with 15 additions and 29 deletions

View File

@ -92,11 +92,9 @@ struct PingPong
{
screenW = width;
screenH = height;
for (int i = 0; i < 2; ++i)
{
TEX::bind(rt[i].tex);
TEX::allocEmpty(width, height);
}
TEXFBO::allocEmpty(rt[i], width, height);
}
void startRender()
@ -476,9 +474,7 @@ struct GraphicsPrivate
bool frozen;
TEXFBO frozenScene;
TEXFBO currentScene;
Quad screenQuad;
TEXFBO transBuffer;
/* Global list of all live Disposables
* (disposed on reset) */
@ -504,26 +500,15 @@ struct GraphicsPrivate
TEXFBO::allocEmpty(frozenScene, scRes.x, scRes.y);
TEXFBO::linkFBO(frozenScene);
TEXFBO::init(currentScene);
TEXFBO::allocEmpty(currentScene, scRes.x, scRes.y);
TEXFBO::linkFBO(currentScene);
FloatRect screenRect(0, 0, scRes.x, scRes.y);
screenQuad.setTexPosRect(screenRect, screenRect);
TEXFBO::init(transBuffer);
TEXFBO::allocEmpty(transBuffer, scRes.x, scRes.y);
TEXFBO::linkFBO(transBuffer);
fpsLimiter.resetFrameAdjust();
}
~GraphicsPrivate()
{
TEXFBO::fini(frozenScene);
TEXFBO::fini(currentScene);
TEXFBO::fini(transBuffer);
}
void updateScreenResoRatio(RGSSThreadData *rtData)
@ -729,8 +714,15 @@ void Graphics::transition(int duration,
setBrightness(255);
/* The PP frontbuffer will hold the current scene after the
* composition step. Since the backbuffer is unused during
* the transition, we can reuse it as the target buffer for
* the final rendered image. */
TEXFBO &currentScene = p->screen.getPP().frontBuffer();
TEXFBO &transBuffer = p->screen.getPP().backBuffer();
/* Capture new scene */
p->compositeToBuffer(p->currentScene);
p->screen.composite();
/* If no transition bitmap is provided,
* we can use a simplified shader */
@ -743,7 +735,7 @@ void Graphics::transition(int duration,
shader.bind();
shader.applyViewportProj();
shader.setFrozenScene(p->frozenScene.tex);
shader.setCurrentScene(p->currentScene.tex);
shader.setCurrentScene(currentScene.tex);
shader.setTransMap(transMap->getGLTypes().tex);
shader.setVague(vague / 256.0f);
shader.setTexSize(p->scRes);
@ -754,7 +746,7 @@ void Graphics::transition(int duration,
shader.bind();
shader.applyViewportProj();
shader.setFrozenScene(p->frozenScene.tex);
shader.setCurrentScene(p->currentScene.tex);
shader.setCurrentScene(currentScene.tex);
shader.setTexSize(p->scRes);
}
@ -798,7 +790,7 @@ void Graphics::transition(int duration,
/* Draw the composed frame to a buffer first
* (we need this because we're skipping PingPong) */
FBO::bind(p->transBuffer.fbo);
FBO::bind(transBuffer.fbo);
FBO::clear();
p->screenQuad.draw();
@ -809,7 +801,7 @@ void Graphics::transition(int duration,
FBO::clear();
GLMeta::blitBeginScreen(Vec2i(p->winSize));
GLMeta::blitSource(p->transBuffer);
GLMeta::blitSource(transBuffer);
p->metaBlitBufferFlippedScaled();
GLMeta::blitEnd();
@ -952,17 +944,11 @@ void Graphics::resizeScreen(int width, int height)
p->screen.setResolution(width, height);
TEX::bind(p->frozenScene.tex);
TEX::allocEmpty(width, height);
TEX::bind(p->currentScene.tex);
TEX::allocEmpty(width, height);
TEXFBO::allocEmpty(p->frozenScene, width, height);
FloatRect screenRect(0, 0, width, height);
p->screenQuad.setTexPosRect(screenRect, screenRect);
TEX::bind(p->transBuffer.tex);
TEX::allocEmpty(width, height);
shState->eThread().requestWindowResize(width, height);
}