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)
, mSize(Constants::CellSizeInUnits)
, mLandSize(ESM::Land::LAND_SIZE)
, mPlugin(land.getPlugin())
{
ESM::Land::LandData data;
land.loadData(loadFlags, &data);

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

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

@ -36,30 +36,26 @@ namespace ESMTerrain
class LandObject : public osg::Object
{
public:
LandObject();
LandObject() = default;
LandObject(const ESM::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)
inline const ESM::LandData* getData(int flags) const
const ESM::LandData* getData(int flags) const
{
if ((mData.getLoadFlags() & flags) != flags)
return nullptr;
return &mData;
}
inline int getPlugin() const { return mLand->getPlugin(); }
inline int getLandSize() const { return mData.getLandSize(); }
inline int getRealSize() const { return mData.getSize(); }
private:
const ESM::Land* mLand;
int getPlugin() const { return mData.getPlugin(); }
private:
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

Loading…
Cancel
Save