Remove ESM::LandObject dependency on ESM::Land

macos_ci_fix
elsid 1 year ago
parent 8a88a2d61f
commit e6f35373b5
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -6,6 +6,7 @@ ESM::LandData::LandData(const ESM::Land& land, int loadFlags)
: mLoadFlags(loadFlags) : mLoadFlags(loadFlags)
, mSize(Constants::CellSizeInUnits) , mSize(Constants::CellSizeInUnits)
, mLandSize(ESM::Land::LAND_SIZE) , mLandSize(ESM::Land::LAND_SIZE)
, mPlugin(land.getPlugin())
{ {
ESM::Land::LandData data; ESM::Land::LandData data;
land.loadData(loadFlags, &data); land.loadData(loadFlags, &data);

@ -27,6 +27,7 @@ namespace ESM
float getMaxHeight() const { return mMaxHeight; } float getMaxHeight() const { return mMaxHeight; }
int getLandSize() const { return mLandSize; } int getLandSize() const { return mLandSize; }
int getLoadFlags() const { return mLoadFlags; } int getLoadFlags() const { return mLoadFlags; }
int getPlugin() const { return mPlugin; }
private: private:
int mLoadFlags = 0; int mLoadFlags = 0;
@ -34,6 +35,7 @@ namespace ESM
float mMaxHeight = 0.f; float mMaxHeight = 0.f;
float mSize = 0.f; float mSize = 0.f;
int mLandSize = 0; int mLandSize = 0;
int mPlugin = 0;
std::vector<float> mHeights; std::vector<float> mHeights;
std::vector<std::int8_t> mNormals; std::vector<std::int8_t> mNormals;
std::vector<std::uint8_t> mColors; std::vector<std::uint8_t> mColors;

@ -46,30 +46,21 @@ namespace ESMTerrain
Map mMap; Map mMap;
}; };
LandObject::LandObject()
: mLand(nullptr)
{
}
LandObject::LandObject(const ESM4::Land* land, int loadFlags) LandObject::LandObject(const ESM4::Land* land, int loadFlags)
: mLand(nullptr) : mData(*land, loadFlags)
, mData(*land, loadFlags)
{ {
} }
LandObject::LandObject(const ESM::Land* land, int loadFlags) LandObject::LandObject(const ESM::Land* land, int loadFlags)
: mLand(land) : mData(*land, loadFlags)
, mData(*land, loadFlags)
{ {
} }
LandObject::LandObject(const LandObject& copy, const osg::CopyOp& copyop) LandObject::LandObject(const LandObject& /*copy*/, const osg::CopyOp& /*copyOp*/)
: mLand(nullptr)
{ {
throw std::logic_error("LandObject copy constructor is not implemented");
} }
LandObject::~LandObject() {}
const float defaultHeight = ESM::Land::DEFAULT_HEIGHT; const float defaultHeight = ESM::Land::DEFAULT_HEIGHT;
Storage::Storage(const VFS::Manager* vfs, const std::string& normalMapPattern, Storage::Storage(const VFS::Manager* vfs, const std::string& normalMapPattern,

@ -36,30 +36,26 @@ namespace ESMTerrain
class LandObject : public osg::Object class LandObject : public osg::Object
{ {
public: public:
LandObject(); LandObject() = default;
LandObject(const ESM::Land* land, int loadFlags); LandObject(const ESM::Land* land, int loadFlags);
LandObject(const ESM4::Land* land, int loadFlags); LandObject(const ESM4::Land* land, int loadFlags);
LandObject(const LandObject& copy, const osg::CopyOp& copyop);
virtual ~LandObject();
META_Object(ESMTerrain, LandObject) META_Object(ESMTerrain, LandObject)
inline const ESM::LandData* getData(int flags) const const ESM::LandData* getData(int flags) const
{ {
if ((mData.getLoadFlags() & flags) != flags) if ((mData.getLoadFlags() & flags) != flags)
return nullptr; return nullptr;
return &mData; return &mData;
} }
inline int getPlugin() const { return mLand->getPlugin(); }
inline int getLandSize() const { return mData.getLandSize(); }
inline int getRealSize() const { return mData.getSize(); }
private: int getPlugin() const { return mData.getPlugin(); }
const ESM::Land* mLand;
private:
ESM::LandData mData; ESM::LandData mData;
LandObject(const LandObject& copy, const osg::CopyOp& copyOp);
}; };
// Since plugins can define new texture palettes, we need to know the plugin index too // Since plugins can define new texture palettes, we need to know the plugin index too

Loading…
Cancel
Save