浏览代码

Reversed y-dir of normals

Josh Yelon 19 年之前
父节点
当前提交
cd2049fc7b
共有 1 个文件被更改,包括 1 次插入4 次删除
  1. 1 4
      panda/src/grutil/heightfieldTesselator.cxx

+ 1 - 4
panda/src/grutil/heightfieldTesselator.cxx

@@ -124,13 +124,10 @@ get_vertex(int x, int y) {
   if (px >= _heightfield.get_x_size()) px--;
   if (px >= _heightfield.get_x_size()) px--;
   if (py >= _heightfield.get_y_size()) py--;
   if (py >= _heightfield.get_y_size()) py--;
   double drx = _heightfield.get_gray(px,y) - _heightfield.get_gray(nx,y);
   double drx = _heightfield.get_gray(px,y) - _heightfield.get_gray(nx,y);
-  double dry = _heightfield.get_gray(x,ny) - _heightfield.get_gray(x,py);
+  double dry = _heightfield.get_gray(x,py) - _heightfield.get_gray(x,ny);
   LVector3f normal(drx * _vertical_scale * 0.5, dry * _vertical_scale * 0.5, _horizontal_scale);
   LVector3f normal(drx * _vertical_scale * 0.5, dry * _vertical_scale * 0.5, _horizontal_scale);
   normal.normalize();
   normal.normalize();
   double z = _heightfield.get_gray(x,y);
   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);
   _normal_writer->add_data3f(normal);
   vtx = _next_index++;
   vtx = _next_index++;