Fixed terrain paint brush 'smooth'
This commit is contained in:
parent
9b9ea22054
commit
4658db3cea
2 changed files with 4 additions and 50 deletions
|
@ -536,10 +536,10 @@ static double _applyBrushSmooth(TerrainHeightMap* heightmap, TerrainBrush* brush
|
||||||
UNUSED(data);
|
UNUSED(data);
|
||||||
|
|
||||||
double ideal, factor;
|
double ideal, factor;
|
||||||
ideal = terrainGetInterpolatedHeight(heightmap->terrain, x + brush->total_radius * 0.5, z, 0, 1);
|
ideal = terrainGetInterpolatedHeight(heightmap->terrain, (x + brush->total_radius * 0.5) * heightmap->terrain->scaling, z * heightmap->terrain->scaling, 0, 1);
|
||||||
ideal += terrainGetInterpolatedHeight(heightmap->terrain, x - brush->total_radius * 0.5, z, 0, 1);
|
ideal += terrainGetInterpolatedHeight(heightmap->terrain, (x - brush->total_radius * 0.5) * heightmap->terrain->scaling, z * heightmap->terrain->scaling, 0, 1);
|
||||||
ideal += terrainGetInterpolatedHeight(heightmap->terrain, x, z - brush->total_radius * 0.5, 0, 1);
|
ideal += terrainGetInterpolatedHeight(heightmap->terrain, x * heightmap->terrain->scaling, (z - brush->total_radius * 0.5) * heightmap->terrain->scaling, 0, 1);
|
||||||
ideal += terrainGetInterpolatedHeight(heightmap->terrain, x, z + brush->total_radius * 0.5, 0, 1);
|
ideal += terrainGetInterpolatedHeight(heightmap->terrain, x * heightmap->terrain->scaling, (z + brush->total_radius * 0.5) * heightmap->terrain->scaling, 0, 1);
|
||||||
ideal /= 4.0;
|
ideal /= 4.0;
|
||||||
factor = influence * force;
|
factor = influence * force;
|
||||||
if (factor > 1.0)
|
if (factor > 1.0)
|
||||||
|
|
|
@ -91,47 +91,6 @@ START_TEST(test_terrain_painting_grid)
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST(test_terrain_painting_brush_elevation)
|
|
||||||
{
|
|
||||||
/* Set up */
|
|
||||||
TerrainDefinition* terrain = _setUpDefinition();
|
|
||||||
|
|
||||||
/* Test */
|
|
||||||
/* TODO */
|
|
||||||
|
|
||||||
/* Tear down */
|
|
||||||
_tearDownDefinition(terrain);
|
|
||||||
}
|
|
||||||
END_TEST
|
|
||||||
|
|
||||||
START_TEST(test_terrain_painting_brush_noise)
|
|
||||||
{
|
|
||||||
/* Set up */
|
|
||||||
TerrainDefinition* terrain = _setUpDefinition();
|
|
||||||
|
|
||||||
/* Test */
|
|
||||||
/* TODO */
|
|
||||||
|
|
||||||
/* Tear down */
|
|
||||||
_tearDownDefinition(terrain);
|
|
||||||
}
|
|
||||||
|
|
||||||
END_TEST
|
|
||||||
|
|
||||||
START_TEST(test_terrain_painting_brush_smooth)
|
|
||||||
{
|
|
||||||
/* Set up */
|
|
||||||
TerrainDefinition* terrain = _setUpDefinition();
|
|
||||||
|
|
||||||
/* Test */
|
|
||||||
/* TODO */
|
|
||||||
|
|
||||||
/* Tear down */
|
|
||||||
_tearDownDefinition(terrain);
|
|
||||||
}
|
|
||||||
|
|
||||||
END_TEST
|
|
||||||
|
|
||||||
static void _checkBrushResultSides(TerrainDefinition* terrain, TerrainBrush* brush, double center, double midhard, double hard, double midsoft, double soft, double exter, double neg_midhard, double neg_hard, double neg_midsoft, double neg_soft, double neg_exter)
|
static void _checkBrushResultSides(TerrainDefinition* terrain, TerrainBrush* brush, double center, double midhard, double hard, double midsoft, double soft, double exter, double neg_midhard, double neg_hard, double neg_midsoft, double neg_soft, double neg_exter)
|
||||||
{
|
{
|
||||||
UNUSED(brush);
|
UNUSED(brush);
|
||||||
|
@ -151,7 +110,6 @@ static void _checkBrushResultSides(TerrainDefinition* terrain, TerrainBrush* bru
|
||||||
ck_assert_double_eq(terrainGetGridHeight(terrain, -5, 0, 1), neg_exter);
|
ck_assert_double_eq(terrainGetGridHeight(terrain, -5, 0, 1), neg_exter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void _checkBrushResult(TerrainDefinition* terrain, TerrainBrush* brush, double center, double midhard, double hard, double midsoft, double soft, double exter, int mirror)
|
static void _checkBrushResult(TerrainDefinition* terrain, TerrainBrush* brush, double center, double midhard, double hard, double midsoft, double soft, double exter, int mirror)
|
||||||
{
|
{
|
||||||
if (mirror)
|
if (mirror)
|
||||||
|
@ -206,7 +164,6 @@ START_TEST(test_terrain_painting_brush_flatten)
|
||||||
/* Tear down */
|
/* Tear down */
|
||||||
_tearDownDefinition(terrain);
|
_tearDownDefinition(terrain);
|
||||||
}
|
}
|
||||||
|
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
START_TEST(test_terrain_painting_brush_reset)
|
START_TEST(test_terrain_painting_brush_reset)
|
||||||
|
@ -275,9 +232,6 @@ END_TEST
|
||||||
|
|
||||||
TEST_CASE(terrain_painting,
|
TEST_CASE(terrain_painting,
|
||||||
test_terrain_painting_grid,
|
test_terrain_painting_grid,
|
||||||
test_terrain_painting_brush_elevation,
|
|
||||||
test_terrain_painting_brush_noise,
|
|
||||||
test_terrain_painting_brush_smooth,
|
|
||||||
test_terrain_painting_brush_flatten,
|
test_terrain_painting_brush_flatten,
|
||||||
test_terrain_painting_brush_reset)
|
test_terrain_painting_brush_reset)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue