From b42ad0f610e8d5567f076c20b6fe7acdfe87d362 Mon Sep 17 00:00:00 2001 From: bzzt Date: Wed, 20 Feb 2019 13:37:00 +0000 Subject: [PATCH] Inline certain terrain storage functions --- components/esmterrain/storage.cpp | 13 ------------- components/esmterrain/storage.hpp | 26 +++++++++++++++++--------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/components/esmterrain/storage.cpp b/components/esmterrain/storage.cpp index 6c7d6130e..3d6e521d1 100644 --- a/components/esmterrain/storage.cpp +++ b/components/esmterrain/storage.cpp @@ -46,19 +46,6 @@ namespace ESMTerrain { } - const ESM::Land::LandData *LandObject::getData(int flags) const - { - if ((mData.mDataLoaded & flags) != flags) - return nullptr; - return &mData; - } - - int LandObject::getPlugin() const - { - return mLand->mPlugin; - } - - const float defaultHeight = ESM::Land::DEFAULT_HEIGHT; Storage::Storage(const VFS::Manager *vfs, const std::string& normalMapPattern, const std::string& normalHeightMapPattern, bool autoUseNormalMaps, const std::string& specularMapPattern, bool autoUseSpecularMaps) diff --git a/components/esmterrain/storage.hpp b/components/esmterrain/storage.hpp index 58c937e89..27d6232eb 100644 --- a/components/esmterrain/storage.hpp +++ b/components/esmterrain/storage.hpp @@ -29,8 +29,17 @@ namespace ESMTerrain META_Object(ESMTerrain, LandObject) - const ESM::Land::LandData* getData(int flags) const; - int getPlugin() const; + inline const ESM::Land::LandData* getData(int flags) const + { + if ((mData.mDataLoaded & flags) != flags) + return nullptr; + return &mData; + } + + inline int getPlugin() const + { + return mLand->mPlugin; + } private: const ESM::Land* mLand; @@ -105,21 +114,20 @@ namespace ESMTerrain private: const VFS::Manager* mVFS; - void fixNormal (osg::Vec3f& normal, int cellX, int cellY, int col, int row, LandCache& cache); - void fixColour (osg::Vec4ub& colour, int cellX, int cellY, int col, int row, LandCache& cache); - void averageNormal (osg::Vec3f& normal, int cellX, int cellY, int col, int row, LandCache& cache); + inline void fixNormal (osg::Vec3f& normal, int cellX, int cellY, int col, int row, LandCache& cache); + inline void fixColour (osg::Vec4ub& colour, int cellX, int cellY, int col, int row, LandCache& cache); + inline void averageNormal (osg::Vec3f& normal, int cellX, int cellY, int col, int row, LandCache& cache); - float getVertexHeight (const ESM::Land::LandData* data, int x, int y); + inline float getVertexHeight (const ESM::Land::LandData* data, int x, int y); - const LandObject* getLand(int cellX, int cellY, LandCache& cache); + inline const LandObject* getLand(int cellX, int cellY, LandCache& cache); // Since plugins can define new texture palettes, we need to know the plugin index too // in order to retrieve the correct texture name. // pair typedef std::pair UniqueTextureId; - UniqueTextureId getVtexIndexAt(int cellX, int cellY, - int x, int y, LandCache&); + inline UniqueTextureId getVtexIndexAt(int cellX, int cellY, int x, int y, LandCache&); std::string getTextureName (UniqueTextureId id); std::map mLayerInfoMap;