fixed terrain rendering - visualized normals
[demo] / src / meshgen.cc
index ff7906d..9547cee 100644 (file)
@@ -129,7 +129,7 @@ static Vec3 hfield_vertex(float u, float v, float h, float xsz,
 {
        float x = u * xsz - xsz / 2.0;
        float y = h * height;
-       float z = v * ysz - ysz / 2.0;
+       float z = -(v * ysz - ysz / 2.0);
 
        return Vec3(x, y, z);
 }
@@ -202,7 +202,6 @@ void gen_heightfield(Mesh *mesh, float xsz, float ysz, float height, int usub,
                        int c = d + 1;
 
                        /* 1st triangle */
-
                        *iptr++ = a;
                        *iptr++ = b;
                        *iptr++ = c;