Ejemplo n.º 1
0
 public RenderManagerRenderable(ViewportBase viewport, RenderManager manager)
 {
     _viewport = viewport;
     _manager  = manager;
     _is3D     = viewport is Viewport3D;
 }
 public RenderManagerRenderable(ViewportBase viewport, RenderManager manager)
 {
     _viewport = viewport;
     _manager = manager;
     _is3D = viewport is Viewport3D;
 }
Ejemplo n.º 3
0
        public Document(string mapFile, Map map, Game game)
        {
            MapFile = mapFile;
            Map = map;
            Game = game;
            MapFileName = mapFile == null
                              ? DocumentManager.GetUntitledDocumentName()
                              : Path.GetFileName(mapFile);

            _subscriptions = new DocumentSubscriptions(this);

            _memory = new DocumentMemory();

            var cam = Map.GetActiveCamera();
            if (cam != null) _memory.SetCamera(cam.EyePosition, cam.LookPosition);

            Selection = new SelectionManager(this);
            History = new HistoryManager(this);
            if (Map.GridSpacing <= 0)
            {
                Map.GridSpacing = Grid.DefaultSize;
            }

            try
            {
                GameData =  GameDataProvider.GetGameDataFromFiles(game.Fgds.Select(f => f.Path));
            }
            catch(ProviderException)
            {
                // TODO: Error logging
                GameData = new GameData();
            }

            TextureCollection = TextureProvider.CreateCollection(game.Wads.Select(x => x.Path).Distinct());
            var texList = Map.GetAllTextures();
            var items = TextureCollection.GetItems(texList);
            TextureCollection.LoadTextureItems(items);

            Map.PostLoadProcess(GameData, GetTexture, SettingsManager.GetSpecialTextureOpacity);

            HelperManager = new HelperManager(this);
            Renderer = new RenderManager(this);

            if (MapFile != null) Mediator.Publish(EditorMediator.FileOpened, MapFile);

            // Autosaving
            if (Game.Autosave)
            {
                var at = Math.Max(1, Game.AutosaveTime);
                Scheduler.Schedule(this, Autosave, TimeSpan.FromMinutes(at));
            }
        }