mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 19:15:14 -04:00
Fix ore veins being too small. (Thanks MarsBarsFood)
This commit is contained in:
parent
05336ee5ca
commit
ce2274dc05
@ -10,11 +10,14 @@ namespace ClassicalSharp.Generator {
|
|||||||
// TODO: figure out how noise functions differ, probably based on rnd.
|
// TODO: figure out how noise functions differ, probably based on rnd.
|
||||||
public sealed partial class NotchyGenerator {
|
public sealed partial class NotchyGenerator {
|
||||||
|
|
||||||
void FillOblateSpheroid( int x, int y, int z, int radius, byte block ) {
|
void FillOblateSpheroid( int x, int y, int z, float radius, byte block ) {
|
||||||
int xStart = Math.Max( x - radius, 0 ), xEnd = Math.Min( x + radius, width - 1 );
|
int xStart = Utils.Floor( Math.Max( x - radius, 0 ) );
|
||||||
int yStart = Math.Max( y - radius, 0 ), yEnd = Math.Min( y + radius, height - 1 );
|
int xEnd = Utils.Floor( Math.Min( x + radius, width - 1 ) );
|
||||||
int zStart = Math.Max( z - radius, 0 ), zEnd = Math.Min( z + radius, length - 1 );
|
int yStart = Utils.Floor( Math.Max( y - radius, 0 ) );
|
||||||
int radiusSq = radius * radius;
|
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 yy = yStart; yy <= yEnd; yy++ )
|
||||||
for( int zz = zStart; zz <= zEnd; zz++ )
|
for( int zz = zStart; zz <= zEnd; zz++ )
|
||||||
|
@ -132,7 +132,7 @@ namespace ClassicalSharp.Generator {
|
|||||||
double radius = (height - cenY) / (double)height;
|
double radius = (height - cenY) / (double)height;
|
||||||
radius = 1.2 + (radius * 3.5 + 1) * caveRadius;
|
radius = 1.2 + (radius * 3.5 + 1) * caveRadius;
|
||||||
radius = radius + Math.Sin( j * Math.PI / caveLen );
|
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;
|
phi = phi / 2 + deltaPhi / 4;
|
||||||
deltaPhi = deltaPhi * 0.9 + rnd.NextDouble() - rnd.NextDouble();
|
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 );
|
FillOblateSpheroid( (int)veinX, (int)veinY, (int)veinZ, radius, block );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user