mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-15 09:34:18 +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
|
||||
x = y = 0;
|
||||
#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);
|
||||
Core::setTarget(screen, RT_LOAD_COLOR | RT_STORE_COLOR);
|
||||
Core::setTarget(screen, RT_LOAD_COLOR | RT_LOAD_DEPTH | RT_STORE_COLOR);
|
||||
#else
|
||||
Core::copyTarget(refract, 0, 0, x, y, Core::viewportDef.width, Core::viewportDef.height); // copy framebuffer into refraction texture
|
||||
#endif
|
||||
@@ -934,15 +934,11 @@ struct WaterCache {
|
||||
void blitTexture(Texture *tex) {
|
||||
ASSERT(tex);
|
||||
|
||||
Core::setDepthTest(false);
|
||||
Core::setBlendMode(bmNone);
|
||||
|
||||
game->setShader(Core::passGUI, Shader::DEFAULT);
|
||||
|
||||
Core::mView.identity();
|
||||
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);
|
||||
mat4 mProj = GAPI::ortho(0.0f, float(tex->origWidth), 0.0f, float(tex->origHeight), 0.0f, 1.0f);
|
||||
|
||||
Core::active.shader->setParam(uViewProj, mProj);
|
||||
Core::active.shader->setParam(uMaterial, vec4(1.0f));
|
||||
|
||||
tex->bind(0);
|
||||
@@ -964,6 +960,9 @@ struct WaterCache {
|
||||
vertices[2].texCoord = short4(32767, 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));
|
||||
|
||||
Core::setDepthTest(true);
|
||||
|
@@ -2011,7 +2011,7 @@ struct Level : IGame {
|
||||
Texture *screen = NULL;
|
||||
if (water) {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -2051,7 +2051,7 @@ struct Level : IGame {
|
||||
Core::Pass pass = Core::pass;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user