From 9aa9ce48c9b24e5fa9365d8483bd3627c5bc45d7 Mon Sep 17 00:00:00 2001 From: elsid Date: Sat, 12 Aug 2023 13:59:39 +0200 Subject: [PATCH] Use proper naming style for ESM4::Land static variables --- components/esm/esmterrain.cpp | 8 ++++---- components/esm/util.cpp | 2 +- components/esm4/loadland.hpp | 18 +++++++++--------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/components/esm/esmterrain.cpp b/components/esm/esmterrain.cpp index 42b7a4b8b3..93aaf6e091 100644 --- a/components/esm/esmterrain.cpp +++ b/components/esm/esmterrain.cpp @@ -29,12 +29,12 @@ ESM::LandData::LandData(const ESM::Land& land, int loadFlags) ESM::LandData::LandData(const ESM4::Land& land, int /*loadFlags*/) : mLoadFlags(land.mDataTypes) // ESM4::Land is always fully loaded. TODO: implement lazy loading , mSize(Constants::ESM4CellSizeInUnits) - , mLandSize(ESM4::Land::VERTS_PER_SIDE) + , mLandSize(ESM4::Land::sVertsPerSide) { mMinHeight = std::numeric_limits::max(); mMaxHeight = std::numeric_limits::lowest(); - mHeights.resize(ESM4::Land::LAND_NUM_VERTS); + mHeights.resize(ESM4::Land::sLandNumVerts); mTextures.resize(ESM::Land::LAND_NUM_TEXTURES); std::fill(mTextures.begin(), mTextures.end(), 0); @@ -43,7 +43,7 @@ ESM::LandData::LandData(const ESM4::Land& land, int /*loadFlags*/) { row_offset += land.mHeightMap.gradientData[y * mLandSize]; - const float heightY = row_offset * ESM4::Land::HEIGHT_SCALE; + const float heightY = row_offset * ESM4::Land::sHeightScale; mHeights[y * mLandSize] = heightY; mMinHeight = std::min(mMinHeight, heightY); mMaxHeight = std::max(mMaxHeight, heightY); @@ -52,7 +52,7 @@ ESM::LandData::LandData(const ESM4::Land& land, int /*loadFlags*/) for (int x = 1; x < mLandSize; x++) { colOffset += land.mHeightMap.gradientData[y * mLandSize + x]; - const float heightX = colOffset * ESM4::Land::HEIGHT_SCALE; + const float heightX = colOffset * ESM4::Land::sHeightScale; mMinHeight = std::min(mMinHeight, heightX); mMaxHeight = std::max(mMaxHeight, heightX); mHeights[x + y * mLandSize] = heightX; diff --git a/components/esm/util.cpp b/components/esm/util.cpp index 9c7008ac53..0dc38d59aa 100644 --- a/components/esm/util.cpp +++ b/components/esm/util.cpp @@ -19,5 +19,5 @@ osg::Vec2 ESM::indexToPosition(const ESM::ExteriorCellLocation& cellIndex, bool int ESM::getLandSize(ESM::RefId worldspaceId) { - return isEsm4Ext(worldspaceId) ? ESM4::Land::VERTS_PER_SIDE : ESM::Land::LAND_SIZE; + return isEsm4Ext(worldspaceId) ? ESM4::Land::sVertsPerSide : ESM::Land::LAND_SIZE; } diff --git a/components/esm4/loadland.hpp b/components/esm4/loadland.hpp index 4ec70c0fea..eab57a189d 100644 --- a/components/esm4/loadland.hpp +++ b/components/esm4/loadland.hpp @@ -49,25 +49,25 @@ namespace ESM4 }; // number of vertices per side - static const int VERTS_PER_SIDE = 33; + static constexpr unsigned sVertsPerSide = 33; // cell terrain size in world coords - static const int REAL_SIZE = 4096; + static constexpr unsigned sRealSize = 4096; // total number of vertices - static const int LAND_NUM_VERTS = VERTS_PER_SIDE * VERTS_PER_SIDE; + static constexpr unsigned sLandNumVerts = sVertsPerSide * sVertsPerSide; - static const int HEIGHT_SCALE = 8; + static constexpr unsigned sHeightScale = 8; // number of textures per side of a land quadrant // (for TES4 - based on vanilla observations) - static const int QUAD_TEXTURE_PER_SIDE = 6; + static constexpr unsigned sQuadTexturePerSide = 6; #pragma pack(push, 1) struct VHGT { float heightOffset; - std::int8_t gradientData[VERTS_PER_SIDE * VERTS_PER_SIDE]; + std::int8_t gradientData[sVertsPerSide * sVertsPerSide]; std::uint16_t unknown1; std::uint8_t unknown2; }; @@ -117,10 +117,10 @@ namespace ESM4 // FIXME: lazy loading not yet implemented int mDataTypes; // which data types are loaded - float mHeights[VERTS_PER_SIDE * VERTS_PER_SIDE]; // Float value of compressed Heightmap + float mHeights[sVertsPerSide * sVertsPerSide]; // Float value of compressed Heightmap float mMinHeight, mMaxHeight; - std::int8_t mVertNorm[VERTS_PER_SIDE * VERTS_PER_SIDE * 3]; // from VNML subrecord - std::uint8_t mVertColr[VERTS_PER_SIDE * VERTS_PER_SIDE * 3]; // from VCLR subrecord + std::int8_t mVertNorm[sVertsPerSide * sVertsPerSide * 3]; // from VNML subrecord + std::uint8_t mVertColr[sVertsPerSide * sVertsPerSide * 3]; // from VCLR subrecord VHGT mHeightMap; Texture mTextures[4]; // 0 = bottom left, 1 = bottom right, 2 = top left, 3 = top right std::vector mIds; // land texture (LTEX) formids