From 87c7e59646fda3bf5383163239d94b06c72c6397 Mon Sep 17 00:00:00 2001 From: Josh Yelon Date: Mon, 31 Jul 2006 16:24:44 +0000 Subject: [PATCH] Reversed Y-coordinate, to reflect usual orientation of images --- panda/src/grutil/heightfieldTesselator.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/panda/src/grutil/heightfieldTesselator.cxx b/panda/src/grutil/heightfieldTesselator.cxx index 848a8b43ef..3aace46d5e 100644 --- a/panda/src/grutil/heightfieldTesselator.cxx +++ b/panda/src/grutil/heightfieldTesselator.cxx @@ -88,14 +88,14 @@ get_vertex(int x, int y) { if (px >= _heightfield.get_x_size()) px--; if (py >= _heightfield.get_y_size()) py--; double drx = _heightfield.get_gray(px,y) - _heightfield.get_gray(nx,y); - double dry = _heightfield.get_gray(x,py) - _heightfield.get_gray(x,ny); + double dry = _heightfield.get_gray(x,ny) - _heightfield.get_gray(x,py); LVector3f normal(drx * _vertical_scale * 0.5, dry * _vertical_scale * 0.5, _horizontal_scale); normal.normalize(); double z = _heightfield.get_gray(x,y); if (z > 2.0) { cerr << "What the heck?"; } - _vertex_writer->add_data3f(x*_horizontal_scale,y*_horizontal_scale,z*_vertical_scale); + _vertex_writer->add_data3f(x*_horizontal_scale,-y*_horizontal_scale,z*_vertical_scale); _normal_writer->add_data3f(normal); vtx = _next_index++; _dirty_vertices[vtx] = x+y*xsize;