master #6

Merged
BRNSystems merged 85 commits from Mirrorlandia_minetest/minetest:master into master 2024-01-09 17:53:52 +01:00
3 changed files with 72 additions and 55 deletions
Showing only changes of commit 00d9d96e48 - Show all commits

@ -4010,31 +4010,6 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
*/ */
client->getParticleManager()->step(dtime); client->getParticleManager()->step(dtime);
/*
Fog
*/
if (m_cache_enable_fog) {
driver->setFog(
sky->getBgColor(),
video::EFT_FOG_LINEAR,
runData.fog_range * sky->getFogStart(),
runData.fog_range * 1.0,
0.01,
false, // pixel fog
true // range fog
);
} else {
driver->setFog(
sky->getBgColor(),
video::EFT_FOG_LINEAR,
100000 * BS,
110000 * BS,
0.01f,
false, // pixel fog
false // range fog
);
}
/* /*
Damage camera tilt Damage camera tilt
*/ */
@ -4134,7 +4109,8 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
/* /*
==================== Drawing begins ==================== ==================== Drawing begins ====================
*/ */
drawScene(graph, stats); if (RenderingEngine::shouldRender())
drawScene(graph, stats);
/* /*
==================== End scene ==================== ==================== End scene ====================
*/ */
@ -4214,10 +4190,39 @@ void Game::updateShadows()
void Game::drawScene(ProfilerGraph *graph, RunStats *stats) void Game::drawScene(ProfilerGraph *graph, RunStats *stats)
{ {
const video::SColor skycolor = this->sky->getSkyColor(); const video::SColor bg_color = this->sky->getBgColor();
const video::SColor sky_color = this->sky->getSkyColor();
/*
Fog
*/
if (this->m_cache_enable_fog) {
this->driver->setFog(
bg_color,
video::EFT_FOG_LINEAR,
this->runData.fog_range * this->sky->getFogStart(),
this->runData.fog_range * 1.0f,
0.01f,
false, // pixel fog
true // range fog
);
} else {
this->driver->setFog(
bg_color,
video::EFT_FOG_LINEAR,
100000 * BS,
110000 * BS,
0.01f,
false, // pixel fog
false // range fog
);
}
/*
Drawing
*/
TimeTaker tt_draw("Draw scene", nullptr, PRECISION_MICRO); TimeTaker tt_draw("Draw scene", nullptr, PRECISION_MICRO);
this->driver->beginScene(true, true, skycolor); this->driver->beginScene(true, true, sky_color);
const LocalPlayer *player = this->client->getEnv().getLocalPlayer(); const LocalPlayer *player = this->client->getEnv().getLocalPlayer();
bool draw_wield_tool = (this->m_game_ui->m_flags.show_hud && bool draw_wield_tool = (this->m_game_ui->m_flags.show_hud &&
@ -4230,7 +4235,7 @@ void Game::drawScene(ProfilerGraph *graph, RunStats *stats)
if (this->isNoCrosshairAllowed()) if (this->isNoCrosshairAllowed())
draw_crosshair = false; draw_crosshair = false;
#endif #endif
this->m_rendering_engine->draw_scene(skycolor, this->m_game_ui->m_flags.show_hud, this->m_rendering_engine->draw_scene(sky_color, this->m_game_ui->m_flags.show_hud,
this->m_game_ui->m_flags.show_minimap, draw_wield_tool, draw_crosshair); this->m_game_ui->m_flags.show_minimap, draw_wield_tool, draw_crosshair);
/* /*

@ -138,6 +138,17 @@ public:
const irr::core::dimension2d<u32> initial_screen_size, const irr::core::dimension2d<u32> initial_screen_size,
const bool initial_window_maximized); const bool initial_window_maximized);
static bool shouldRender()
{
// On Android, pause rendering while the app is in background (generally not visible).
// Don't do this on desktop because windows can be partially visible.
#ifdef __ANDROID__
return get_raw_device()->isWindowActive();
#else
return true;
#endif
};
private: private:
v2u32 _getWindowSize() const; v2u32 _getWindowSize() const;

@ -265,35 +265,36 @@ void GUIEngine::run()
f32 dtime = 0.0f; f32 dtime = 0.0f;
while (m_rendering_engine->run() && (!m_startgame) && (!m_kill)) { while (m_rendering_engine->run() && (!m_startgame) && (!m_kill)) {
if (RenderingEngine::shouldRender()) {
// check if we need to update the "upper left corner"-text
if (text_height != g_fontengine->getTextHeight()) {
updateTopLeftTextSize();
text_height = g_fontengine->getTextHeight();
}
//check if we need to update the "upper left corner"-text driver->beginScene(true, true, RenderingEngine::MENU_SKY_COLOR);
if (text_height != g_fontengine->getTextHeight()) {
updateTopLeftTextSize(); if (m_clouds_enabled)
text_height = g_fontengine->getTextHeight(); {
cloudPreProcess();
drawOverlay(driver);
}
else
drawBackground(driver);
drawFooter(driver);
m_rendering_engine->get_gui_env()->drawAll();
// The header *must* be drawn after the menu because it uses
// GUIFormspecMenu::getAbsoluteRect().
// The header *can* be drawn after the menu because it never intersects
// the menu.
drawHeader(driver);
driver->endScene();
} }
driver->beginScene(true, true, RenderingEngine::MENU_SKY_COLOR);
if (m_clouds_enabled)
{
cloudPreProcess();
drawOverlay(driver);
}
else
drawBackground(driver);
drawFooter(driver);
m_rendering_engine->get_gui_env()->drawAll();
// The header *must* be drawn after the menu because it uses
// GUIFormspecMenu::getAbsoluteRect().
// The header *can* be drawn after the menu because it never intersects
// the menu.
drawHeader(driver);
driver->endScene();
IrrlichtDevice *device = m_rendering_engine->get_raw_device(); IrrlichtDevice *device = m_rendering_engine->get_raw_device();
u32 frametime_min = 1000 / (device->isWindowFocused() u32 frametime_min = 1000 / (device->isWindowFocused()