1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-22 12:53:22 +02:00

iOS copy framebuffer

This commit is contained in:
Timur Gagiev
2018-08-26 20:59:22 +03:00
parent 7d59a6d777
commit 0fd4f75cbc
2 changed files with 13 additions and 8 deletions

View File

@@ -791,8 +791,13 @@ struct WaterCache {
y = Core::viewportDef.y;
} else
x = y = 0;
#ifdef _OS_IOS
Core::setTarget(refract, RT_CLEAR_COLOR | RT_CLEAR_DEPTH | RT_STORE_COLOR);
blitTexture(screen);
Core::setTarget(screen, RT_LOAD_COLOR | RT_STORE_COLOR);
#else
Core::copyTarget(refract, 0, 0, x, y, Core::viewportDef.width, Core::viewportDef.height); // copy framebuffer into refraction texture
#endif
}
void simulate() {
@@ -926,8 +931,8 @@ struct WaterCache {
dropCount = 0;
}
void blitScreen() {
ASSERT(screen);
void blitTexture(Texture *tex) {
ASSERT(tex);
Core::setDepthTest(false);
Core::setBlendMode(bmNone);
@@ -935,14 +940,14 @@ struct WaterCache {
game->setShader(Core::passGUI, Shader::DEFAULT);
Core::mView.identity();
Core::mProj = GAPI::ortho(0.0f, float(screen->origWidth), 0.0f, float(screen->origHeight), 0.0f, 1.0f);
Core::mProj = GAPI::ortho(0.0f, float(tex->origWidth), 0.0f, float(tex->origHeight), 0.0f, 1.0f);
Core::setViewProj(Core::mView, Core::mProj);
Core::active.shader->setParam(uViewProj, Core::mViewProj);
Core::active.shader->setParam(uMaterial, vec4(1.0f));
screen->bind(0);
int w = screen->width;
int h = screen->height;
tex->bind(0);
int w = tex->width;
int h = tex->height;
Index indices[6] = { 0, 1, 2, 0, 2, 3 };
Vertex vertices[4];

View File

@@ -2052,7 +2052,7 @@ struct Level : IGame {
if (water && waterCache && waterCache->visible && screen) {
Core::setTarget(NULL, RT_CLEAR_COLOR | RT_CLEAR_DEPTH | RT_STORE_COLOR);
waterCache->blitScreen();
waterCache->blitTexture(screen);
}
if (showUI)