diff --git a/examples/27-terrain/terrain.cpp b/examples/27-terrain/terrain.cpp index e9ee604c0..82a6012ae 100644 --- a/examples/27-terrain/terrain.cpp +++ b/examples/27-terrain/terrain.cpp @@ -197,8 +197,8 @@ public: vert->m_x = (float)x; vert->m_y = m_terrain.m_heightMap[(y * s_terrainSize) + x]; vert->m_z = (float)y; - vert->m_u = (float)x / (float)s_terrainSize; - vert->m_v = (float)y / (float)s_terrainSize; + vert->m_u = (x + 0.5f) / s_terrainSize; + vert->m_v = (y + 0.5f) / s_terrainSize; m_terrain.m_vertexCount++; } @@ -298,14 +298,14 @@ public: { int32_t brush_x = _x + area_x; if (brush_x < 0 - || brush_x > (int32_t)s_terrainSize) + || brush_x >= (int32_t)s_terrainSize) { continue; } int32_t brush_y = _y + area_y; if (brush_y < 0 - || brush_y > (int32_t)s_terrainSize) + || brush_y >= (int32_t)s_terrainSize) { continue; } @@ -365,9 +365,9 @@ public: bx::vec3Add(pos, pos, ray_dir); if (pos[0] < 0 - || pos[0] > s_terrainSize + || pos[0] >= s_terrainSize || pos[2] < 0 - || pos[2] > s_terrainSize) + || pos[2] >= s_terrainSize) { continue; }