FnSetSky: open Graphics.ocg before re-loading sky (#1827)

Needed to load shader slices in C4Sky::Init.
directional-lights
Armin Burgmeier 2016-10-16 10:03:46 -07:00
parent 8f61918219
commit 2362a73e60
1 changed files with 13 additions and 1 deletions

View File

@ -46,6 +46,7 @@
#include "landscape/C4Landscape.h"
#include "landscape/C4Sky.h"
#include "landscape/C4Particles.h"
#include "graphics/C4GraphicsResource.h"
C4Effect ** FnGetEffectsFor(C4PropList * pTarget)
{
@ -1671,8 +1672,19 @@ static bool FnSetSky(C4PropList * _this, C4String * name)
{
if (!name) return false;
auto& sky = ::Landscape.GetSky();
// Open Graphics.ocg -- we might need to fetch some shader (slices)
// from there when reloading the sky.
if (!::GraphicsResource.RegisterGlobalGraphics()) return false;
if (!::GraphicsResource.RegisterMainGroups()) return false;
sky.Clear();
return sky.Init(false, name->GetCStr());
const bool result = sky.Init(false, name->GetCStr());
// close Graphics.ocg again
::GraphicsResource.CloseFiles();
return result;
}
static bool FnSetSkyAdjust(C4PropList * _this, long dwAdjust, long dwBackClr)