mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 09:33:51 +00:00
Reduce terrain texture seams
This commit is contained in:
parent
9f19d9fa1a
commit
a7c0b4320b
2 changed files with 40 additions and 11 deletions
|
|
@ -214,9 +214,11 @@ std::vector<TerrainVertex> TerrainMeshGenerator::generateVertices(const MapChunk
|
|||
vertex.normal[2] = 1.0f;
|
||||
}
|
||||
|
||||
// Texture coordinates (0-1 per chunk, tiles with GL_REPEAT)
|
||||
vertex.texCoord[0] = offsetX / 8.0f;
|
||||
vertex.texCoord[1] = offsetY / 8.0f;
|
||||
// Texture coordinates: world-aligned so patterns don't reset per chunk.
|
||||
// Keep one texture repeat per chunk (matches prior scale).
|
||||
constexpr float texScale = 1.0f / CHUNK_SIZE;
|
||||
vertex.texCoord[0] = -vertex.position[1] * texScale;
|
||||
vertex.texCoord[1] = -vertex.position[0] * texScale;
|
||||
|
||||
// Layer UV for alpha map sampling (0-1 range per chunk).
|
||||
// Sample at texel centers of the 64x64 alpha map to avoid edge seams.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue