mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-22 21:03:19 +02:00
iOS copy framebuffer
This commit is contained in:
19
src/cache.h
19
src/cache.h
@@ -791,8 +791,13 @@ struct WaterCache {
|
|||||||
y = Core::viewportDef.y;
|
y = Core::viewportDef.y;
|
||||||
} else
|
} else
|
||||||
x = y = 0;
|
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
|
Core::copyTarget(refract, 0, 0, x, y, Core::viewportDef.width, Core::viewportDef.height); // copy framebuffer into refraction texture
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void simulate() {
|
void simulate() {
|
||||||
@@ -926,8 +931,8 @@ struct WaterCache {
|
|||||||
dropCount = 0;
|
dropCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void blitScreen() {
|
void blitTexture(Texture *tex) {
|
||||||
ASSERT(screen);
|
ASSERT(tex);
|
||||||
|
|
||||||
Core::setDepthTest(false);
|
Core::setDepthTest(false);
|
||||||
Core::setBlendMode(bmNone);
|
Core::setBlendMode(bmNone);
|
||||||
@@ -935,14 +940,14 @@ struct WaterCache {
|
|||||||
game->setShader(Core::passGUI, Shader::DEFAULT);
|
game->setShader(Core::passGUI, Shader::DEFAULT);
|
||||||
|
|
||||||
Core::mView.identity();
|
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::setViewProj(Core::mView, Core::mProj);
|
||||||
Core::active.shader->setParam(uViewProj, Core::mViewProj);
|
Core::active.shader->setParam(uViewProj, Core::mViewProj);
|
||||||
Core::active.shader->setParam(uMaterial, vec4(1.0f));
|
Core::active.shader->setParam(uMaterial, vec4(1.0f));
|
||||||
|
|
||||||
screen->bind(0);
|
tex->bind(0);
|
||||||
int w = screen->width;
|
int w = tex->width;
|
||||||
int h = screen->height;
|
int h = tex->height;
|
||||||
|
|
||||||
Index indices[6] = { 0, 1, 2, 0, 2, 3 };
|
Index indices[6] = { 0, 1, 2, 0, 2, 3 };
|
||||||
Vertex vertices[4];
|
Vertex vertices[4];
|
||||||
|
@@ -2052,7 +2052,7 @@ struct Level : IGame {
|
|||||||
|
|
||||||
if (water && waterCache && waterCache->visible && screen) {
|
if (water && waterCache && waterCache->visible && screen) {
|
||||||
Core::setTarget(NULL, RT_CLEAR_COLOR | RT_CLEAR_DEPTH | RT_STORE_COLOR);
|
Core::setTarget(NULL, RT_CLEAR_COLOR | RT_CLEAR_DEPTH | RT_STORE_COLOR);
|
||||||
waterCache->blitScreen();
|
waterCache->blitTexture(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showUI)
|
if (showUI)
|
||||||
|
Reference in New Issue
Block a user