Use proper naming style for ESM4::Land static variables

macos_ci_fix
elsid 1 year ago
parent e4e857f51f
commit 9aa9ce48c9
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -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<float>::max();
mMaxHeight = std::numeric_limits<float>::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;

@ -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;
}

@ -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<ESM::FormId> mIds; // land texture (LTEX) formids

Loading…
Cancel
Save