Render initial game view during loading screen, to begin loading assets and eliminate ugly terrain blending artifacts. Refs #1663

This was SVN commit r13181.
This commit is contained in:
historic_bruno 2013-02-22 07:32:22 +00:00
parent 1e3bdc439b
commit a87019ea5a
3 changed files with 20 additions and 15 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2012 Wildfire Games.
/* Copyright (C) 2013 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -199,6 +199,18 @@ PSRETURN CGame::ReallyStartGame()
m_Simulation2->InitGame(settings);
}
// We need to do an initial Interpolate call to set up all the models etc,
// because Update might never interpolate (e.g. if the game starts paused)
// and we could end up rendering before having set up any models (so they'd
// all be invisible)
Interpolate(0, 0);
m_GameStarted=true;
// Render a frame to begin loading assets
if (CRenderer::IsInitialised())
Render();
// Call the reallyStartGame GUI function, but only if it exists
if (g_GUI && g_GUI->HasPages())
{
@ -212,14 +224,7 @@ PSRETURN CGame::ReallyStartGame()
if (g_NetClient)
g_NetClient->LoadFinished();
// We need to do an initial Interpolate call to set up all the models etc,
// because Update might never interpolate (e.g. if the game starts paused)
// and we could end up rendering before having set up any models (so they'd
// all be invisible)
Interpolate(0, 0);
debug_printf(L"GAME STARTED, ALL INIT COMPLETE\n");
m_GameStarted=true;
// The call tree we've built for pregame probably isn't useful in-game.
if (CProfileManager::IsInitialised())

View File

@ -201,12 +201,6 @@ void Render()
ogl_WarnIfError();
CStr skystring = "255 0 255";
CFG_GET_VAL("skycolor", String, skystring);
CColor skycol;
GUI<CColor>::ParseString(skystring.FromUTF8(), skycol);
g_Renderer.SetClearColor(skycol.AsSColor4ub());
// prepare before starting the renderer frame
if (g_Game && g_Game->IsGameStarted())
g_Game->GetView()->BeginFrame();

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2012 Wildfire Games.
/* Copyright (C) 2013 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -451,6 +451,12 @@ CRenderer::CRenderer()
CFG_GET_VAL("smoothlos", Bool, m_Options.m_SmoothLOS);
CFG_GET_VAL("postproc", Bool, m_Options.m_Postproc);
CStr skystring = "0 0 0";
CColor skycolor;
CFG_GET_VAL("skycolor", String, skystring);
if (skycolor.ParseString(skystring, 255.f))
SetClearColor(skycolor.AsSColor4ub());
#if CONFIG2_GLES
// Override config option since GLES only supports GLSL
m_Options.m_PreferGLSL = true;