paysages : Small fixes.
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@401 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
0ab0bd9475
commit
42daf819df
1 changed files with 42 additions and 6 deletions
|
@ -121,11 +121,31 @@ double heightmapGetValue(HeightMap* heightmap, double x, double z)
|
|||
{
|
||||
int xmax = heightmap->resolution_x - 1;
|
||||
int zmax = heightmap->resolution_z - 1;
|
||||
int xlow = floor(x * xmax);
|
||||
int zlow = floor(z * zmax);
|
||||
int xlow;
|
||||
int zlow;
|
||||
double stencil[16];
|
||||
int ix, iz, cx, cz;
|
||||
|
||||
if (x < 0.0)
|
||||
{
|
||||
x = 0.0;
|
||||
}
|
||||
else if (x > 1.0)
|
||||
{
|
||||
x = 1.0;
|
||||
}
|
||||
if (z < 0.0)
|
||||
{
|
||||
z = 0.0;
|
||||
}
|
||||
else if (z > 1.0)
|
||||
{
|
||||
z = 1.0;
|
||||
}
|
||||
|
||||
xlow = floor(x * xmax);
|
||||
zlow = floor(z * zmax);
|
||||
|
||||
for (ix = xlow - 1; ix <= xlow + 2; ix++)
|
||||
{
|
||||
for (iz = zlow - 1; iz <= zlow + 2; iz++)
|
||||
|
@ -156,18 +176,34 @@ static inline void _getBrushBoundaries(HeightMapBrush* brush, int rx, int rz, in
|
|||
{
|
||||
*x1 = 0;
|
||||
}
|
||||
if (*x1 > rx)
|
||||
else if (*x1 > rx)
|
||||
{
|
||||
*x1 = rx;
|
||||
}
|
||||
if (*x2 < 0)
|
||||
{
|
||||
*x2 = 0;
|
||||
}
|
||||
else if (*x2 > rx)
|
||||
{
|
||||
*x2 = rx;
|
||||
}
|
||||
if (*z1 < 0)
|
||||
{
|
||||
*z1 = 0;
|
||||
}
|
||||
if (*z1 > rz)
|
||||
else if (*z1 > rz)
|
||||
{
|
||||
*z1 = rz;
|
||||
}
|
||||
if (*z2 < 0)
|
||||
{
|
||||
*z2 = 0;
|
||||
}
|
||||
else if (*z2 > rz)
|
||||
{
|
||||
*z2 = rz;
|
||||
}
|
||||
}
|
||||
|
||||
typedef double (*BrushCallback)(HeightMap* heightmap, HeightMapBrush* brush, double x, double z, double basevalue, double influence, double force, void* data);
|
||||
|
|
Loading…
Reference in a new issue