Fix heightmap shadow rt and draw the light pos

This commit is contained in:
2019-01-10 22:21:44 +01:00
parent 9787175b13
commit 6ba29926ef
7 changed files with 40 additions and 22 deletions

View File

@@ -286,7 +286,6 @@ bool HeightmapPlane::create(float w, float h, const Image& img, float scale, flo
}
// generate indices
const glm::vec3 yscale(1, height, 1);
for (int y = 0; y < div; y++)
{
int i = y * (div + 1);
@@ -298,8 +297,8 @@ bool HeightmapPlane::create(float w, float h, const Image& img, float scale, flo
*pi++ = i;
*pi++ = i + div + 2;
*pi++ = i + 1;
auto n = glm::triangleNormal(xyz(vertices[i].pos) * yscale,
xyz(vertices[i + div + 1].pos) * yscale, xyz(vertices[i + 1].pos) * yscale);
auto n = glm::triangleNormal(xyz(vertices[i].pos),
xyz(vertices[i + div + 1].pos), xyz(vertices[i + 1].pos));
vertices[i].nor += n;
vertices[i + 1].nor += n;
vertices[i + div + 1].nor += n;