public VisualTopoService(MeshService meshService, ElevationService elevationService, ILogger <VisualTopoService> logger)
 {
     _meshService         = meshService;
     _elevationService    = elevationService;
     convers3Reprojection = new Convers3Reprojection();
     _logger = logger;
 }
    public Mesh generateChunk(int chunkX, int chunkY)
    {
        // debugging instances only
        MeshService     = GetComponent <MeshService>();
        NoiseMapService = GetComponent <NoiseMapService>();
        // debugging instances only

        GameObject   chunk           = loadChunk(chunkX, chunkY);
        MeshFilter   meshFilter      = chunk.GetComponent <MeshFilter>();
        MeshRenderer textureRenderer = chunk.GetComponent <MeshRenderer>();

        var mesh = meshFilter.mesh;

        // Noise Map Provider for all types of Noises
        float[,] noiseMap = NoiseMapService.getNoiseMap(chunkX, chunkY);

        // generate the new mesh
        meshFilter.sharedMesh = MeshService.GenerateMesh(mesh, NoiseMapService.mapSize, noiseMap);

        // destroy the previous mesh collider
        DestroyImmediate(chunk.GetComponent <MeshCollider>());

        // update the mesh collider
        chunk.AddComponent <MeshCollider>();

        // render mesh texture
        Texture2D meshTexture = NoiseMapService.getNoiseTexture(MeshService.heightCurve, noiseMap);

        textureRenderer.material.mainTexture = meshTexture;

        // notify other modules in the generator that the terrain is complete
        // EventBus.Manager.Broadcast(EventBus.Actions.GENERATE_WORLD_COMPLETE, chunkX, chunkY);

        return(mesh);
    }
示例#3
0
 public glTFTests(DemNetFixture fixture)
 {
     _rasterService    = fixture.ServiceProvider.GetService <RasterService>();
     _elevationService = fixture.ServiceProvider.GetService <ElevationService>();
     _sharpGltfService = fixture.ServiceProvider.GetService <SharpGltfService>();
     _meshService      = fixture.ServiceProvider.GetService <MeshService>();
 }
示例#4
0
        public DemNetVisualTopoService()
        {
            var config = new ConfigurationBuilder()
                         .SetBasePath(AppContext.BaseDirectory)
                         .AddJsonFile("appsettings.json", optional: true)
                         .AddJsonFile("secrets.json", optional: true, reloadOnChange: false)
                         .Build();


            this.services = new ServiceCollection()
                            .AddOptions()
                            .AddLogging(loggingBuilder => loggingBuilder
                                        .AddDebug()
                                        .SetMinimumLevel(LogLevel.Debug))
                            .Configure <AppSecrets>(config.GetSection(nameof(AppSecrets)))
                            .Configure <DEMNetOptions>(config.GetSection(nameof(DEMNetOptions)))
                            .AddDemNetCore()
                            .AddDemNetglTF()
                            .AddDemNetVisualTopoExtension()
                            .BuildServiceProvider();



            this.visualTopoService = services.GetService <VisualTopoService>();
            this.elevationService  = services.GetService <ElevationService>();
            this.meshService       = services.GetService <MeshService>();
            this.sharpGltfService  = services.GetService <SharpGltfService>();
            this.imageryService    = services.GetService <ImageryService>();
        }
示例#5
0
    void Start()
    {
        WorldEngine     = GetComponent <WorldEngine>();
        NoiseMapService = GetComponent <NoiseMapService>();
        MeshService     = GetComponent <MeshService>();

        EventBus.Manager.Subscribe(EventBus.Actions.GENERATE_WORLD_COMPLETE, generateLakes);
    }
示例#6
0
        public async Task <IActionResult> PutMeshSettings([FromBody] MeshSettings meshSettings)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await MeshService.UpdateSettingsAsync(meshSettings);

            return(NoContent());
        }
示例#7
0
 public ImageryService(MeshService meshService,
                       IOptions <AppSecrets> appSecrets,
                       IOptions <DEMNetOptions> options,
                       ImageryCache cache,
                       ILogger <ImageryService> logger = null)
 {
     _logger         = logger;
     _meshService    = meshService;
     this.appSecrets = appSecrets?.Value;
     this.options    = options?.Value;
     this.cache      = cache;
 }
示例#8
0
 public void Init(ElevationService elevationService
                  , SharpGltfService gltfService
                  , MeshService meshService
                  , IOsmDataService osmDataService
                  , ILogger logger)
 {
     this._elevationService = elevationService;
     this._gltfService      = gltfService;
     this._meshService      = meshService;
     this._osmDataService   = osmDataService;
     this._logger           = logger;
 }
 public CustomRasterElevationSample(ILogger <CustomRasterElevationSample> logger
                                    , RasterService rasterService
                                    , ElevationService elevationService
                                    , MeshService meshService
                                    , SharpGltfService sharpGltfService
                                    , ImageryService imageryService)
 {
     _logger           = logger;
     _rasterService    = rasterService;
     _elevationService = elevationService;
     _sharpGltfService = sharpGltfService;
     _imageryService   = imageryService;
     _meshService      = meshService;
 }
示例#10
0
 public VisualTopoSample(ILogger <VisualTopoSample> logger
                         , SharpGltfService gltfService
                         , MeshService meshService
                         , ElevationService elevationService
                         , ImageryService imageryService
                         , VisualTopoService visualTopoService)
 {
     _logger            = logger;
     _meshService       = meshService;
     _gltfService       = gltfService;
     _elevationService  = elevationService;
     _imageryService    = imageryService;
     _visualTopoService = visualTopoService;
 }
示例#11
0
        public async Task <IActionResult> PostMeshSettings([FromBody] MeshSettings meshSettings)
        {
            meshSettings.LogicalName = "experiment_settings";
            meshSettings.CreatedOn   = DateTime.Now;
            meshSettings.Mesh        = await MeshRepository.GetAsync(meshSettings.MeshId);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            meshSettings = await MeshService.CreateSettingsAsync(meshSettings);

            return(CreatedAtAction("GetMeshSettings", new { id = meshSettings.Id }, meshSettings));
        }
示例#12
0
 public Text3DSample(ILogger <Text3DSample> logger
                     , ElevationService elevationService
                     , MeshService meshService
                     , AdornmentsService adornmentsService
                     , RasterService rasterService
                     , ImageryService imageryService
                     , SharpGltfService sharpGltfService)
 {
     _logger            = logger;
     _elevationService  = elevationService;
     _rasterService     = rasterService;
     _imageryService    = imageryService;
     _sharpGltfService  = sharpGltfService;
     _adornmentsService = adornmentsService;
     _meshService       = meshService;
 }
示例#13
0
 public DefaultOsmProcessor(ElevationService elevationService
                            , SharpGltfService gltfService
                            , MeshService meshService
                            , IOsmDataServiceFactory dataServiceFactory
                            , IOptions <DEMNetOptions> options
                            , IOptions <OsmElevationOptions> osmOptions
                            , ILogger <DefaultOsmProcessor> logger)
 {
     this._dataServiceFactory = dataServiceFactory;
     this._options            = options.Value;
     this.Settings            = osmOptions.Value;
     this._elevationService   = elevationService;
     this._gltfService        = gltfService;
     this._meshService        = meshService;
     this._logger             = logger;
 }
示例#14
0
        public void Run(AlgorithmSettings settings)
        {
            settings.OptModel.ResetCallCount();
            Chromosome.ResetIdentity();
            InitialMesh = MeshService.GetMesh(settings.OptModel, settings.InitialPointCount, settings.InitialLoadType);
            Generations = new List <Generation>();
            Generations.Add(new Generation(InitialMesh.Chromosomes, settings));
            int i = 0;

            while (!Generations[i].IsFinal)
            {
                Generations.Add(new Generation(Generations[i]));
                i++;
            }
            CallCount = settings.OptModel.CallCount;
            Best      = Generations[i].BestChromosome;
        }
    public void generateWorld(dynamic parameters, dynamic dummy)
    {
        // debugging instances only
        MeshService     = GetComponent <MeshService>();
        NoiseMapService = GetComponent <NoiseMapService>();

        // debugging instances only

        ClearChunks();

        generateChunk(0, 0);
        generateChunk(1, 0);
        // generateChunk(0, 1);
        // generateChunk(1, 1);

        var LakeService = GetComponent <LakeService>();

        LakeService.generateLakes(0, 0);
        LakeService.generateLakes(1, 0);
    }
        public HelladicSample(DefaultOsmProcessor sampleOsmProcessor
                              , ImageryService imageryService
                              , ElevationService elevationService
                              , SharpGltfService gltfService
                              , MeshService meshService
                              , Sketchfab.SketchfabApi sketchFabApi
                              , IOptions <AppSecrets> secrets
                              , ILogger <HelladicSample> logger)
        {
            this._sampleOsmProcessor = sampleOsmProcessor;
            this._imageryService     = imageryService;
            this._elevationService   = elevationService;
            this._gltfService        = gltfService;
            this._meshService        = meshService;
            this._sketchFabApi       = sketchFabApi;
            this._sketchFabToken     = secrets.Value.SketchFabToken;
            this._logger             = logger;

            if (string.IsNullOrEmpty(_sketchFabToken))
            {
                _logger.LogWarning($"SketchfabToken is not set. Ensure you have a secrets.json file with a SketchfabToken entry with your api token (see https://sketchfab.com/settings/password)");
            }
        }
示例#17
0
 public SharpGltfService(MeshService meshService, ILogger <SharpGltfService> logger = null)
 {
     _logger      = logger;
     _meshService = meshService;
 }
示例#18
0
 public SharpGltfService(MeshService meshService, MeshReducer meshReducer, ILogger <SharpGltfService> logger = null)
 {
     _logger      = logger;
     _meshService = meshService;
     _meshReducer = meshReducer;
 }