From 4b0734c4ad75b93d84c11942531cf2d2e070ba6e Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Tue, 24 Jul 2007 04:53:21 +0000 Subject: * Terrain Fracture Generator now produces more appropriate results. * Terrain Flatten Brush has been optimised, now affects an appropriate sized section of terrain. * Navier-Stokes handler bounds issue partially fixed. --- .../libTerrainBSD/Channel/Generators/Fracture.cs | 37 ++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators') diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs index b585caa..8427eab 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs @@ -79,6 +79,7 @@ namespace libTerrain throw new Exception("Out of bounds parameter (val)"); } + public void Fracture(int number, double scalemin, double scalemax) { Random rand = new Random(seed); @@ -90,6 +91,8 @@ namespace libTerrain a = RadialEdge256(rand.Next(1023)); // TODO: Broken b = RadialEdge256(rand.Next(1023)); // TODO: Broken double z = rand.NextDouble(); + double u = rand.NextDouble(); + double v = rand.NextDouble(); for (int x = 0; x < w; x++) { @@ -97,9 +100,39 @@ namespace libTerrain { double miny = Tools.linearInterpolate(a[1], b[1], (double)x / (double)w); - if (y > miny) + if (v >= 0.5) + { + if (u >= 0.5) + { + if (y > miny) + { + map[x, y] += Tools.linearInterpolate(scalemin, scalemax, z); + } + } + else + { + if (y < miny) + { + map[x, y] += Tools.linearInterpolate(scalemin, scalemax, z); + } + } + } + else { - map[x, y] += Tools.linearInterpolate(scalemin, scalemax, z); + if (u >= 0.5) + { + if (x > miny) + { + map[x, y] += Tools.linearInterpolate(scalemin, scalemax, z); + } + } + else + { + if (x < miny) + { + map[x, y] += Tools.linearInterpolate(scalemin, scalemax, z); + } + } } } } -- cgit v1.1