public void Initialize(string utopiaPath) { if (_engine == null) { _utopiaFolder = utopiaPath; ClientSettings.PathRoot = _utopiaFolder; ClientSettings.EffectPack = Path.Combine(_utopiaFolder, @"EffectsPacks\Default\"); ClientSettings.TexturePack = Path.Combine(_utopiaFolder, @"TexturesPacks\Default\"); _engine = new D3DEngine(); DXStates.CreateStates(_engine); } var modelsStorage = new ModelSQLiteStorage(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Realms", "Common", "models.db")); var voxelMeshFactory = new VoxelMeshFactory(_engine); _modelManager = new VoxelModelManager(); _modelManager.VoxelModelStorage = modelsStorage; _modelManager.VoxelMeshFactory = voxelMeshFactory; _modelManager.Initialize(); _visualWorldParameters = new VisualWorldParameters(); _textureManager = new CubeTexturesManager(_engine); _textureManager.Initialization(_engine.ImmediateContext, FilterFlags.Point); _cubeTextureView = _textureManager.CubeArrayTexture; _visualWorldParameters.CubeTextureManager = _textureManager; _iconFactory = new IconFactory(_engine, _modelManager, _visualWorldParameters); //ArrayTexture.CreateTexture2DFromFiles(_engine.Device, _engine.ImmediateContext, // Path.Combine(ClientSettings.TexturePack, @"Terran\"), @"ct*.png", // FilterFlags.Point, "ArrayTexture_DefaultEntityRenderer", // out _cubeTextureView); }
private void LoadMissingModels(WorldConfiguration configuration, VoxelModelManager voxelModelManager) { ThreadsManager.RunAsync(() => { voxelModelManager.Initialize(); var availableModels = voxelModelManager.Enumerate().Select(m => m.VoxelModel.Name).ToList(); var neededModels = configuration.GetUsedModelsNames().Where(m => !availableModels.Contains(m)).ToList(); foreach (var neededModel in neededModels) { voxelModelManager.DownloadModel(neededModel); } }); }