khadoran / ogre-paged

Automatically exported from code.google.com/p/ogre-paged
0 stars 0 forks source link

GrassLayer::setMaxSlope() doesn't work for a CrossQuad grass - BUGFIX #1

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi, 
I have found a bug. Setting a max slope for a grass rendered as a cross quad 
doesn't work correctly.

I have examined it and now I know that it's not working correctly because 
there's a typo in a code.
In a GrassLoader.cpp file, generateGrass_CROSSQUADS() function at 492line is 
code:

if (heightFunction)
{
  if (layer->getMaxSlope() < (Math::Abs(y1 - y2) / (halfScaleX * 2)))
  {
    //Degenerate the face
    x2 = x1;
    y2 = y1;
    z2 = z1;
  }

  y3 = heightFunction(x3, z3, heightFunctionUserData);
  y4 = heightFunction(x4, z4, heightFunctionUserData);
}

Instead of the x1 and x2 variables, there should be used x3 and x4, same with y 
and z variables.

Also, now there is only 1 quad discarded instead of 2 when the slope is too big 
for a grass. I have fixed it too.

I have attached a fixed GrassLoader.cpp from the newest PagedGeometry 1.1.1 
without this bug ;).

Thanks for the addon :).

Original issue reported on code.google.com by P.Stra...@gmail.com on 29 May 2011 at 2:25

Attachments:

GoogleCodeExporter commented 8 years ago
Tanks for Your feedback. I will check it and merge in repository.

Original comment by m2code...@rambler.ru on 7 Jun 2011 at 1:18