/// <summary> /// Feed in the whole image, this will break it down into the smaller rect. /// </summary> /// <param name="startPoint"></param> /// <param name="width"></param> /// <param name="height"></param> /// <param name="threadTexture"></param> internal PaintTexture(ThreadTexture threadTexture, int seed) { Seed = seed; StartPoint = new Point(0, 0); Width = 1024; Height = 1024; EndPoint = new Point(StartPoint.x + Width, StartPoint.y + Height); Texture = threadTexture; Points = new TexturePoints(GetAllPixels(), new Rectangle(0, 0, threadTexture.Width, threadTexture.Height)); Regions = new List <Region>(); }
/// <summary> /// This is a very slow process that takes a Sphere_Template file and /// processes a heightmap from the regions. Run this async so it doesn't /// kill your framerate. /// </summary> /// <param name="material">The renderer material</param> /// <param name="mainTexturePixels"></param> /// <param name="height"></param> /// <param name="width"></param> /// <param name="seed"></param> /// <returns></returns> public static ThreadTexture GenerateHeightmap(Material material, Color[] mainTexturePixels, int height, int width, int seed) { var texture = new ThreadTexture(mainTexturePixels, width, height); var paintable = new PaintTexture(texture, seed); const int NUMBER_OF_POINTS = 1024; GenerateTerrain(NUMBER_OF_POINTS, paintable, seed); paintable.Paint(); texture = paintable.Texture; return(texture); }