mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-30 07:21:12 +00:00
Cache cell description
It should not change over time and it's relatively small enough to trade some CPU time for some memory.
This commit is contained in:
parent
d2f16774d9
commit
385dab3df3
@ -22,13 +22,15 @@ namespace MWWorld
|
||||
, mRegion(ESM::RefId()) // Unimplemented for now
|
||||
, mId(cell.mId)
|
||||
, mParent(cell.mParent)
|
||||
,mMood{
|
||||
, mWaterHeight(cell.mWaterHeight)
|
||||
, mDescription(cell.mEditorId)
|
||||
, mMood{
|
||||
.mAmbiantColor = cell.mLighting.ambient,
|
||||
.mDirectionalColor = cell.mLighting.directional,
|
||||
.mFogColor = cell.mLighting.fogColor,
|
||||
// TODO: use ESM4::Lighting fog parameters
|
||||
.mFogDensity = 1.f,}
|
||||
,mWaterHeight(cell.mWaterHeight)
|
||||
.mFogDensity = 1.f,
|
||||
}
|
||||
{
|
||||
if (isExterior())
|
||||
{
|
||||
@ -50,26 +52,19 @@ namespace MWWorld
|
||||
, mRegion(cell.mRegion)
|
||||
, mId(cell.mId)
|
||||
, mParent(ESM::Cell::sDefaultWorldspaceId)
|
||||
, mWaterHeight(cell.mWater)
|
||||
, mDescription(cell.getDescription())
|
||||
, mMood{
|
||||
.mAmbiantColor = cell.mAmbi.mAmbient,
|
||||
.mDirectionalColor = cell.mAmbi.mSunlight,
|
||||
.mFogColor = cell.mAmbi.mFog,
|
||||
.mFogDensity = cell.mAmbi.mFogDensity,
|
||||
}
|
||||
,mWaterHeight(cell.mWater)
|
||||
{
|
||||
if (isExterior())
|
||||
mWaterHeight = -1.f;
|
||||
}
|
||||
|
||||
std::string Cell::getDescription() const
|
||||
{
|
||||
return ESM::visit(ESM::VisitOverload{
|
||||
[&](const ESM::Cell& cell) { return cell.getDescription(); },
|
||||
[&](const ESM4::Cell& cell) { return cell.mEditorId; },
|
||||
},
|
||||
*this);
|
||||
}
|
||||
ESM::RefId Cell::getWorldSpace() const
|
||||
{
|
||||
if (isExterior())
|
||||
|
@ -44,7 +44,7 @@ namespace MWWorld
|
||||
const ESM::RefId& getRegion() const { return mRegion; }
|
||||
std::string_view getNameId() const { return mNameID; }
|
||||
std::string_view getDisplayName() const { return mDisplayname; }
|
||||
std::string getDescription() const;
|
||||
std::string_view getDescription() const { return mDescription; }
|
||||
const MoodData& getMood() const { return mMood; }
|
||||
float getWaterHeight() const { return mWaterHeight; }
|
||||
const ESM::RefId& getId() const { return mId; }
|
||||
@ -63,9 +63,9 @@ namespace MWWorld
|
||||
ESM::RefId mRegion;
|
||||
ESM::RefId mId;
|
||||
ESM::RefId mParent;
|
||||
MoodData mMood;
|
||||
|
||||
float mWaterHeight;
|
||||
std::string mDescription;
|
||||
MoodData mMood;
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user