public Grass2IntensityMapGenerator( HabitatToGrassIntensityMapGenerator habitatToGrassIntensityMapGenerator, HabitatTexturesGenerator habitatTexturesGenerator, Grass2IntensityMapGeneratorConfiguration configuration, PathProximityTextureDbProxy pathProximityTextureDb) { _habitatToGrassIntensityMapGenerator = habitatToGrassIntensityMapGenerator; _habitatTexturesGenerator = habitatTexturesGenerator; _configuration = configuration; _pathProximityTextureDb = pathProximityTextureDb; }
public void Start() { TaskUtils.SetGlobalMultithreading(false); var generator = new HabitatToGrassIntensityMapGenerator(ComputeShaderContainer, new UnityThreadComputeShaderExecutorObject(), new CommonExecutorUTProxy(), new HabitatToGrassIntensityMapGenerator.HabitatToGrassIntensityMapGeneratorConfiguration() { GrassTypeToSourceHabitats = new Dictionary <GrassType, List <HabitatType> >() { { GrassType.Debug1, new List <HabitatType>() { HabitatType.Forest } }, { GrassType.Debug2, new List <HabitatType>() { HabitatType.Meadow, HabitatType.Fell } }, }, OutputPixelsPerUnit = 2 }); var result = generator.GenerateGrassIntenstiyAsync( new MyRectangle(0, 0, 256, 256), CreateHabitatTexturesDict(), new IntVector2(HabitatTexturesSize, HabitatTexturesSize), GeneratePathProximityTexture() ).Result; Debug.Log("ResultCount: " + result.Count); Debug.Log("A1: " + result[0].IntensityFigure.GetPixel(0, 0)); result.Select((c, i) => { CreateDebugObject(c, i); return(0); }).ToList(); }
public void Start() { TaskUtils.SetGlobalMultithreading(false); var queryingArea = new MyRectangle(526 * 90, 582 * 90, 90, 90); HabitatToGrassIntensityMapGenerator habitatToGrassIntensityMapGenerator = new HabitatToGrassIntensityMapGenerator(ComputeShaderContainer, new UnityThreadComputeShaderExecutorObject(), new CommonExecutorUTProxy(), new HabitatToGrassIntensityMapGenerator.HabitatToGrassIntensityMapGeneratorConfiguration() { GrassTypeToSourceHabitats = new Dictionary <GrassType, List <HabitatType> >() { { GrassType.Debug1, new List <HabitatType>() { HabitatType.Forest } }, { GrassType.Debug2, new List <HabitatType>() { HabitatType.Meadow, HabitatType.Fell } }, }, OutputPixelsPerUnit = 1 }); HabitatMapDbProxy habitatDbProxy = new HabitatMapDbProxy(new HabitatMapDb( new HabitatMapDb.HabitatMapDbInitializationInfo() { RootSerializationPath = @"C:\inz\habitating2\" })); var mapsGenerator = new Grass2IntensityMapGenerator( habitatToGrassIntensityMapGenerator, new HabitatTexturesGenerator(habitatDbProxy, new HabitatTexturesGenerator.HabitatTexturesGeneratorConfiguration() { HabitatMargin = 5, HabitatSamplingUnit = 3 }, new TextureConcieverUTProxy()), new Grass2IntensityMapGenerator.Grass2IntensityMapGeneratorConfiguration() { HabitatSamplingUnit = 3 }, null); var db = new SpatialDb <List <Grass2TypeWithIntensity> >(mapsGenerator, new SpatialDbConfiguration() { QueryingCellSize = new Vector2(90, 90) }); var retrivedMap = db.ProvidePartsAt(queryingArea).Result.CoordedPart.Part; Debug.Log("Ret: " + retrivedMap.Count); retrivedMap.Select(c => new Grass2TypeWithIntensity() { GrassType = c.GrassType, IntensityFigure = c.IntensityFigure }).Select((c, i) => { HabitatToGrassIntensityMapGeneratorDebugObject.CreateDebugObject(c, i); return(0); }).ToList(); }