mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 03:15:32 +00:00
improve hit calculation accuracy for texture editing
This commit is contained in:
parent
e8a9bff85c
commit
24977fcc0f
1 changed files with 14 additions and 2 deletions
|
@ -307,8 +307,20 @@ void CSVRender::TerrainTextureMode::editTerrainTextureGrid(const WorldspaceHitRe
|
|||
int cellY = cellCoordinates_pair.first.getY();
|
||||
|
||||
// The coordinates of hit in mCellId
|
||||
int xHitInCell ((hit.worldPos.x() - (cellX* cellSize)) * landTextureSize / cellSize);
|
||||
int yHitInCell ((hit.worldPos.y() - (cellY* cellSize)) * landTextureSize / cellSize);
|
||||
int xHitInCell (float(((hit.worldPos.x() - (cellX* cellSize)) * landTextureSize / cellSize) - 0.5));
|
||||
int yHitInCell (float(((hit.worldPos.y() - (cellY* cellSize)) * landTextureSize / cellSize) + 0.5));
|
||||
if (xHitInCell < 0)
|
||||
{
|
||||
xHitInCell = xHitInCell + landTextureSize;
|
||||
cellX = cellX - 1;
|
||||
}
|
||||
if (yHitInCell > 15)
|
||||
{
|
||||
yHitInCell = yHitInCell - landTextureSize;
|
||||
cellY = cellY + 1;
|
||||
}
|
||||
|
||||
mCellId = "#" + std::to_string(cellX) + " " + std::to_string(cellY);
|
||||
|
||||
std::string iteratedCellId;
|
||||
|
||||
|
|
Loading…
Reference in a new issue