Fix ore veins being too small. (Thanks MarsBarsFood)

This commit is contained in:
UnknownShadow200 2016-02-11 13:08:34 +11:00
parent 05336ee5ca
commit ce2274dc05
2 changed files with 10 additions and 7 deletions

View File

@ -10,11 +10,14 @@ namespace ClassicalSharp.Generator {
// TODO: figure out how noise functions differ, probably based on rnd.
public sealed partial class NotchyGenerator {
void FillOblateSpheroid( int x, int y, int z, int radius, byte block ) {
int xStart = Math.Max( x - radius, 0 ), xEnd = Math.Min( x + radius, width - 1 );
int yStart = Math.Max( y - radius, 0 ), yEnd = Math.Min( y + radius, height - 1 );
int zStart = Math.Max( z - radius, 0 ), zEnd = Math.Min( z + radius, length - 1 );
int radiusSq = radius * radius;
void FillOblateSpheroid( int x, int y, int z, float radius, byte block ) {
int xStart = Utils.Floor( Math.Max( x - radius, 0 ) );
int xEnd = Utils.Floor( Math.Min( x + radius, width - 1 ) );
int yStart = Utils.Floor( Math.Max( y - radius, 0 ) );
int yEnd = Utils.Floor( Math.Min( y + radius, height - 1 ) );
int zStart = Utils.Floor( Math.Max( z - radius, 0 ) );
int zEnd = Utils.Floor( Math.Min( z + radius, length - 1 ) );
float radiusSq = radius * radius;
for( int yy = yStart; yy <= yEnd; yy++ )
for( int zz = zStart; zz <= zEnd; zz++ )

View File

@ -132,7 +132,7 @@ namespace ClassicalSharp.Generator {
double radius = (height - cenY) / (double)height;
radius = 1.2 + (radius * 3.5 + 1) * caveRadius;
radius = radius + Math.Sin( j * Math.PI / caveLen );
FillOblateSpheroid( cenX, cenY, cenZ, (int)radius, (byte)Block.Air );
FillOblateSpheroid( cenX, cenY, cenZ, (float)radius, (byte)Block.Air );
}
}
}
@ -161,7 +161,7 @@ namespace ClassicalSharp.Generator {
phi = phi / 2 + deltaPhi / 4;
deltaPhi = deltaPhi * 0.9 + rnd.NextDouble() - rnd.NextDouble();
int radius = (int)(abundance * Math.Sin( j * Math.PI / veinLen ) + 1);
float radius = abundance * (float)Math.Sin( j * Math.PI / veinLen ) + 1;
FillOblateSpheroid( (int)veinX, (int)veinY, (int)veinZ, radius, block );
}
}