Backed out changeset: 3694176c26bf
This commit is contained in:
parent
f146593561
commit
936276f789
5 changed files with 1 additions and 56 deletions
|
@ -24,7 +24,6 @@ CSkySheet::CSkySheet()
|
||||||
Type = SKY;
|
Type = SKY;
|
||||||
WaterEnvMapCameraHeight = 0.f;
|
WaterEnvMapCameraHeight = 0.f;
|
||||||
WaterEnvMapAlpha = 255;
|
WaterEnvMapAlpha = 255;
|
||||||
SunClipZ = -1.0f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// *****************************************************************************************************
|
// *****************************************************************************************************
|
||||||
|
@ -54,8 +53,6 @@ void CSkySheet::build(const NLGEORGES::UFormElm &item, const std::string &prefix
|
||||||
item.getValueByName(FogColorBitmap, (prefix + "FogColorBitmap").c_str());
|
item.getValueByName(FogColorBitmap, (prefix + "FogColorBitmap").c_str());
|
||||||
item.getValueByName(WaterEnvMapCameraHeight, (prefix + "WaterEnvMapCameraHeight").c_str());
|
item.getValueByName(WaterEnvMapCameraHeight, (prefix + "WaterEnvMapCameraHeight").c_str());
|
||||||
item.getValueByName(WaterEnvMapAlpha, (prefix + "WaterEnvMapAlpha").c_str());
|
item.getValueByName(WaterEnvMapAlpha, (prefix + "WaterEnvMapAlpha").c_str());
|
||||||
item.getValueByName(SunSource, (prefix + "SunSource").c_str());
|
|
||||||
item.getValueByName(SunClipZ, (prefix + "SunClipZ").c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// *****************************************************************************************************
|
// *****************************************************************************************************
|
||||||
|
@ -70,8 +67,6 @@ void CSkySheet::serial(class NLMISC::IStream &f) throw(NLMISC::EStream)
|
||||||
f.serial(FogColorBitmap);
|
f.serial(FogColorBitmap);
|
||||||
f.serial(WaterEnvMapCameraHeight);
|
f.serial(WaterEnvMapCameraHeight);
|
||||||
f.serial(WaterEnvMapAlpha);
|
f.serial(WaterEnvMapAlpha);
|
||||||
f.serial(SunSource);
|
|
||||||
f.serial(SunClipZ);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// *****************************************************************************************************
|
// *****************************************************************************************************
|
||||||
|
|
|
@ -39,9 +39,6 @@ public:
|
||||||
// Water env map (computed from sky scene)
|
// Water env map (computed from sky scene)
|
||||||
float WaterEnvMapCameraHeight;
|
float WaterEnvMapCameraHeight;
|
||||||
uint8 WaterEnvMapAlpha;
|
uint8 WaterEnvMapAlpha;
|
||||||
// Sun direction override
|
|
||||||
std::string SunSource;
|
|
||||||
float SunClipZ;
|
|
||||||
public:
|
public:
|
||||||
// ctor
|
// ctor
|
||||||
CSkySheet();
|
CSkySheet();
|
||||||
|
|
|
@ -477,15 +477,7 @@ void CLightCycleManager::setDirLight(const CDirLightSetup &setup0, const CDirLig
|
||||||
scene.setSunAmbient (resultSetup.Ambiant);
|
scene.setSunAmbient (resultSetup.Ambiant);
|
||||||
scene.setSunDiffuse (resultSetup.Diffuse);
|
scene.setSunDiffuse (resultSetup.Diffuse);
|
||||||
scene.setSunSpecular (resultSetup.Specular);
|
scene.setSunSpecular (resultSetup.Specular);
|
||||||
CSky &sky = ContinentMngr.cur()->CurrentSky;
|
|
||||||
if (sky.overrideSunDirection())
|
|
||||||
{
|
|
||||||
scene.setSunDirection(sky.calculateSunDirection());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
scene.setSunDirection(resultSetup.Direction);
|
scene.setSunDirection(resultSetup.Direction);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
|
|
|
@ -48,8 +48,6 @@ CSky::CSky()
|
||||||
_FogColor = NULL;
|
_FogColor = NULL;
|
||||||
_WaterEnvMapCameraHeight = 0.f;
|
_WaterEnvMapCameraHeight = 0.f;
|
||||||
_WaterEnvMapAlpha = 255;
|
_WaterEnvMapAlpha = 255;
|
||||||
_SunSource = -1;
|
|
||||||
_SunClipZ = -1.0f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
|
@ -219,39 +217,6 @@ void CSky::init(UDriver *drv, const CSkySheet &sheet, bool forceFallbackVersion
|
||||||
_NumHourInDay = numHourInDay;
|
_NumHourInDay = numHourInDay;
|
||||||
_WaterEnvMapCameraHeight = sheet.WaterEnvMapCameraHeight;
|
_WaterEnvMapCameraHeight = sheet.WaterEnvMapCameraHeight;
|
||||||
_WaterEnvMapAlpha= sheet.WaterEnvMapAlpha;
|
_WaterEnvMapAlpha= sheet.WaterEnvMapAlpha;
|
||||||
//
|
|
||||||
// Find sun source
|
|
||||||
std::string sunSource = NLMISC::toLower(sheet.SunSource);
|
|
||||||
_SunSource = -1;
|
|
||||||
if (sunSource.size())
|
|
||||||
{
|
|
||||||
uint numObjects = (uint)_Objects.size();
|
|
||||||
for (uint k = 0; k < numObjects; ++k)
|
|
||||||
{
|
|
||||||
if (NLMISC::toLower(_Objects[k].Name) == sunSource)
|
|
||||||
{
|
|
||||||
nldebug("Found sun source: '%s'", sunSource.c_str());
|
|
||||||
_SunSource = k;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_SunClipZ = sheet.SunClipZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// *************************************************************************************************
|
|
||||||
bool CSky::overrideSunDirection() const
|
|
||||||
{
|
|
||||||
return (_SunSource >= 0)
|
|
||||||
&& (_Objects[_SunSource].Instance.getLastClippedState());
|
|
||||||
}
|
|
||||||
|
|
||||||
// *************************************************************************************************
|
|
||||||
NLMISC::CVector CSky::calculateSunDirection() const
|
|
||||||
{
|
|
||||||
CVector sunPos = _Objects[_SunSource].Instance.getLastWorldMatrixComputed().getPos();
|
|
||||||
CVector baseDir = (-sunPos).normed();
|
|
||||||
baseDir.z = std::max(_SunClipZ, baseDir.z);
|
|
||||||
return baseDir.normed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
|
|
|
@ -63,8 +63,6 @@ public:
|
||||||
NLMISC::CRGBA computeFogColor(const CClientDate &date, float weatherLevel) const;
|
NLMISC::CRGBA computeFogColor(const CClientDate &date, float weatherLevel) const;
|
||||||
float getWaterEnvMapCameraHeight() const { return _WaterEnvMapCameraHeight; }
|
float getWaterEnvMapCameraHeight() const { return _WaterEnvMapCameraHeight; }
|
||||||
uint8 getWaterEnvMapAlpha() const { return _WaterEnvMapAlpha; }
|
uint8 getWaterEnvMapAlpha() const { return _WaterEnvMapAlpha; }
|
||||||
bool overrideSunDirection() const;
|
|
||||||
NLMISC::CVector calculateSunDirection() const;
|
|
||||||
private:
|
private:
|
||||||
std::vector<CSkyObject> _Objects; // all the object in the sky
|
std::vector<CSkyObject> _Objects; // all the object in the sky
|
||||||
std::vector<NLMISC::CBitmap *> _Bitmaps; // all the bitmaps for the color lookups
|
std::vector<NLMISC::CBitmap *> _Bitmaps; // all the bitmaps for the color lookups
|
||||||
|
@ -82,8 +80,6 @@ private:
|
||||||
NLMISC::CBitmap *_FogColor;
|
NLMISC::CBitmap *_FogColor;
|
||||||
float _WaterEnvMapCameraHeight;
|
float _WaterEnvMapCameraHeight;
|
||||||
uint8 _WaterEnvMapAlpha;
|
uint8 _WaterEnvMapAlpha;
|
||||||
sint _SunSource;
|
|
||||||
float _SunClipZ;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue