From f46d638fe7f5e092e66fe84af87e90458157bf9b Mon Sep 17 00:00:00 2001 From: XProger Date: Mon, 27 Aug 2018 08:43:56 +0300 Subject: [PATCH] fix visibility check for renderEnvironment --- src/cache.h | 14 +++++++------- src/level.h | 11 ++++------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/cache.h b/src/cache.h index c7d24ae..979137c 100644 --- a/src/cache.h +++ b/src/cache.h @@ -791,13 +791,13 @@ struct WaterCache { y = Core::viewportDef.y; } else x = y = 0; - #ifdef _OS_IOS - Core::setTarget(refract, RT_LOAD_DEPTH | RT_STORE_COLOR | RT_STORE_DEPTH); - blitTexture(screen); - 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 + + if (screen) { // only for iOS devices + Core::setTarget(refract, RT_LOAD_DEPTH | RT_STORE_COLOR | RT_STORE_DEPTH); + blitTexture(screen); + 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 } void simulate() { diff --git a/src/level.h b/src/level.h index 0e35327..8f43362 100644 --- a/src/level.h +++ b/src/level.h @@ -440,19 +440,16 @@ struct Level : IGame { Core::Pass tmpPass = Core::pass; Core::eye = 0.0f; - // TODO: fix for wrong room visibility checks, FIX IT! - int roomsCount = 0; - int roomsList[256]; - for (int i = 0; i < level.roomsCount; i++) - roomsList[roomsCount++] = i; - // ----- + int16 rIndex = roomIndex; + level.getSector(rIndex, pos); // fix room index for overlapped blocks + // render level into cube faces or texture images for (int i = 0; i < 6; i++) { setupCubeCamera(pos, i); Core::pass = pass; Texture *target = (targets[0]->opt & OPT_CUBEMAP) ? targets[0] : targets[i * stride]; Core::setTarget(target, RT_CLEAR_COLOR | RT_CLEAR_DEPTH | RT_STORE_COLOR, i); - renderView(roomIndex, false, false, roomsCount, roomsList); + renderView(rIndex, false, false); } Core::pass = tmpPass;