mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-17 10:30:47 +02:00
fix RT flags for iOS
This commit is contained in:
17
src/cache.h
17
src/cache.h
@@ -792,9 +792,9 @@ struct WaterCache {
|
|||||||
} else
|
} else
|
||||||
x = y = 0;
|
x = y = 0;
|
||||||
#ifdef _OS_IOS
|
#ifdef _OS_IOS
|
||||||
Core::setTarget(refract, RT_CLEAR_COLOR | RT_CLEAR_DEPTH | RT_STORE_COLOR);
|
Core::setTarget(refract, RT_LOAD_DEPTH | RT_STORE_COLOR | RT_STORE_DEPTH);
|
||||||
blitTexture(screen);
|
blitTexture(screen);
|
||||||
Core::setTarget(screen, RT_LOAD_COLOR | RT_STORE_COLOR);
|
Core::setTarget(screen, RT_LOAD_COLOR | RT_LOAD_DEPTH | RT_STORE_COLOR);
|
||||||
#else
|
#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
|
#endif
|
||||||
@@ -934,15 +934,11 @@ struct WaterCache {
|
|||||||
void blitTexture(Texture *tex) {
|
void blitTexture(Texture *tex) {
|
||||||
ASSERT(tex);
|
ASSERT(tex);
|
||||||
|
|
||||||
Core::setDepthTest(false);
|
|
||||||
Core::setBlendMode(bmNone);
|
|
||||||
|
|
||||||
game->setShader(Core::passGUI, Shader::DEFAULT);
|
game->setShader(Core::passGUI, Shader::DEFAULT);
|
||||||
|
|
||||||
Core::mView.identity();
|
mat4 mProj = GAPI::ortho(0.0f, float(tex->origWidth), 0.0f, float(tex->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, mProj);
|
||||||
Core::active.shader->setParam(uViewProj, Core::mViewProj);
|
|
||||||
Core::active.shader->setParam(uMaterial, vec4(1.0f));
|
Core::active.shader->setParam(uMaterial, vec4(1.0f));
|
||||||
|
|
||||||
tex->bind(0);
|
tex->bind(0);
|
||||||
@@ -964,6 +960,9 @@ struct WaterCache {
|
|||||||
vertices[2].texCoord = short4(32767, 0, 0, 0);
|
vertices[2].texCoord = short4(32767, 0, 0, 0);
|
||||||
vertices[3].texCoord = short4( 0, 0, 0, 0);
|
vertices[3].texCoord = short4( 0, 0, 0, 0);
|
||||||
|
|
||||||
|
Core::setDepthTest(false);
|
||||||
|
Core::setBlendMode(bmNone);
|
||||||
|
|
||||||
game->getMesh()->renderBuffer(indices, COUNT(indices), vertices, COUNT(vertices));
|
game->getMesh()->renderBuffer(indices, COUNT(indices), vertices, COUNT(vertices));
|
||||||
|
|
||||||
Core::setDepthTest(true);
|
Core::setDepthTest(true);
|
||||||
|
@@ -2011,7 +2011,7 @@ struct Level : IGame {
|
|||||||
Texture *screen = NULL;
|
Texture *screen = NULL;
|
||||||
if (water) {
|
if (water) {
|
||||||
screen = (waterCache && waterCache->visible) ? waterCache->getScreenTex() : NULL;
|
screen = (waterCache && waterCache->visible) ? waterCache->getScreenTex() : NULL;
|
||||||
Core::setTarget(screen, RT_CLEAR_COLOR | RT_CLEAR_DEPTH | RT_STORE_COLOR); // render to screen texture (FUCK YOU iOS!) or back buffer
|
Core::setTarget(screen, RT_CLEAR_COLOR | RT_CLEAR_DEPTH | RT_STORE_COLOR | (screen ? RT_STORE_DEPTH : 0)); // render to screen texture (FUCK YOU iOS!) or back buffer
|
||||||
setupBinding();
|
setupBinding();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2051,7 +2051,7 @@ struct Level : IGame {
|
|||||||
Core::Pass pass = Core::pass;
|
Core::Pass pass = Core::pass;
|
||||||
|
|
||||||
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_STORE_COLOR);
|
||||||
waterCache->blitTexture(screen);
|
waterCache->blitTexture(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user