public Cave(ref Random rnd, ref IMapHandler mh, Vector3i StartingPoint)
{
mMap = mh;
rand = rnd;
AddPoint(StartingPoint);
// We need at least 4 points.
int numPoints2Make = rand.Next(3, 10);
for(int i=0;i<numPoints2Make;i++)
{
i++;
AddPoint(new Vector3i(StartingPoint.X+rand.Next(-16, 16), StartingPoint.Y+rand.Next(-16, 16), StartingPoint.Z+rand.Next(-16, 16)));
}
Profiler profSphere = new Profiler("MakeSphere");
Profiler profSpline = new Profiler("GetInterpolatedSplinePoint");
int rad = rand.Next(1, 3);
for(int p = 0;p<20;p++)
{
double t = (double)p/(double)(Points.Count*32);
// Between 2/10 radius.
profSpline.Start();
Vector3i derp = this.GetInterpolatedSplinePoint(t);
profSpline.Stop();
mMap.SetBlockAt(derp.X, derp.Y, derp.Z, 0);
profSphere.Start();
MakeSphere(derp, rad);
profSphere.Stop();
//Console.WriteLine("MakeSphere r={0} @ t={1}", rad, t);
//t += 0.05;
}
mMap.SaveAll();
Console.WriteLine(profSpline.ToString());
Console.WriteLine(profSphere.ToString());
}