mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-31 07:06:45 +00:00
Precompute height cooridnates offsets
This commit is contained in:
parent
2c2a60b86c
commit
5fda4b3cfd
1 changed files with 6 additions and 5 deletions
|
@ -202,6 +202,10 @@ namespace ESMTerrain
|
||||||
normals.resize(numVerts * numVerts);
|
normals.resize(numVerts * numVerts);
|
||||||
colours.resize(numVerts * numVerts);
|
colours.resize(numVerts * numVerts);
|
||||||
|
|
||||||
|
// Only relevant for chunks smaller than (contained in) one cell
|
||||||
|
const int offsetX = (origin.x() - startCellX) * landSize;
|
||||||
|
const int offsetY = (origin.y() - startCellY) * landSize;
|
||||||
|
|
||||||
LandCache cache;
|
LandCache cache;
|
||||||
|
|
||||||
const bool alteration = useAlteration();
|
const bool alteration = useAlteration();
|
||||||
|
@ -226,8 +230,8 @@ namespace ESMTerrain
|
||||||
validHeightDataExists = true;
|
validHeightDataExists = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rowStart = 0;
|
int rowStart = offsetX;
|
||||||
int colStart = 0;
|
int colStart = offsetY;
|
||||||
// Skip the first row / column unless we're at a chunk edge,
|
// Skip the first row / column unless we're at a chunk edge,
|
||||||
// since this row / column is already contained in a previous cell
|
// since this row / column is already contained in a previous cell
|
||||||
// This is only relevant if we're creating a chunk spanning multiple cells
|
// This is only relevant if we're creating a chunk spanning multiple cells
|
||||||
|
@ -236,9 +240,6 @@ namespace ESMTerrain
|
||||||
if (baseVertX != 0)
|
if (baseVertX != 0)
|
||||||
rowStart += increment;
|
rowStart += increment;
|
||||||
|
|
||||||
// Only relevant for chunks smaller than (contained in) one cell
|
|
||||||
rowStart += (origin.x() - startCellX) * landSize;
|
|
||||||
colStart += (origin.y() - startCellY) * landSize;
|
|
||||||
const int rowEnd = std::min(
|
const int rowEnd = std::min(
|
||||||
static_cast<int>(rowStart + std::min(1.f, size) * (landSize - 1) + 1), static_cast<int>(landSize));
|
static_cast<int>(rowStart + std::min(1.f, size) * (landSize - 1) + 1), static_cast<int>(landSize));
|
||||||
const int colEnd = std::min(
|
const int colEnd = std::min(
|
||||||
|
|
Loading…
Reference in a new issue