// Disposer
        public override void Dispose()
        {
            // Not already disposed?
            if (!isdisposed)
            {
                // Clean up
                foreach (KeyValuePair <Sector, VisualSector> s in allsectors)
                {
                    s.Value.Dispose();
                }
                blockmap.Dispose();
                visiblesectors  = null;
                visiblegeometry = null;
                visibleblocks   = null;
                visiblethings   = null;
                allsectors      = null;
                allthings       = null;
                blockmap        = null;

                //mxd
                selectedVisualSectors = null;
                selectedVisualThings  = null;

                // Done
                base.Dispose();
            }
        }
        /// <summary>
        /// Provides specialized functionality for a visual (3D) Doom Builder editing mode.
        /// </summary>
        protected VisualMode()
        {
            // Initialize
            this.renderer        = General.Map.Renderer3D;
            this.blockmap        = new VisualBlockMap();
            this.allsectors      = new Dictionary <Sector, VisualSector>(General.Map.Map.Sectors.Count);
            this.allthings       = new Dictionary <Thing, VisualThing>(General.Map.Map.Things.Count);
            this.visibleblocks   = new List <VisualBlockEntry>();
            this.visiblesectors  = new Dictionary <Sector, VisualSector>(50);
            this.visiblegeometry = new List <VisualGeometry>(200);
            this.visiblethings   = new Dictionary <Thing, VisualThing>(100);
            this.processgeometry = true;
            this.processthings   = true;
            this.vertices        = new Dictionary <Vertex, VisualVertexPair>();     //mxd

            //mxd. Synch camera position to cursor position or center of the screen in 2d-mode
            if (General.Settings.GZSynchCameras && General.Editing.Mode is ClassicMode)
            {
                ClassicMode oldmode = (ClassicMode)General.Editing.Mode;

                if (oldmode.IsMouseInside)
                {
                    initialcameraposition = new Vector2D(oldmode.MouseMapPos.x, oldmode.MouseMapPos.y);
                }
                else
                {
                    initialcameraposition = new Vector2D(General.Map.CRenderer2D.Viewport.Left + General.Map.CRenderer2D.Viewport.Width / 2.0f, General.Map.CRenderer2D.Viewport.Top + General.Map.CRenderer2D.Viewport.Height / 2.0f);
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// This is called when the blockmap needs to be refilled, because it was invalidated.
        /// This usually happens when geometry is changed by undo, redo, cut or paste actions.
        /// Lines and Things are added to the block map by the base implementation.
        /// </summary>
        protected virtual void FillBlockMap()
        {
            if (blockmap != null)
            {
                blockmap.Dispose();
            }
            blockmap = new VisualBlockMap();

            blockmap.AddLinedefsSet(General.Map.Map.Linedefs);
            blockmap.AddThingsSet(General.Map.Map.Things);
            blockmap.AddSectorsSet(General.Map.Map.Sectors);
        }
Exemple #4
0
 /// <summary>
 /// Provides specialized functionality for a visual (3D) Doom Builder editing mode.
 /// </summary>
 public VisualMode()
 {
     // Initialize
     this.renderer        = General.Map.Renderer3D;
     this.renderer3d      = (Renderer3D)General.Map.Renderer3D;
     this.blockmap        = new VisualBlockMap();
     this.allsectors      = new Dictionary <Sector, VisualSector>(General.Map.Map.Sectors.Count);
     this.allthings       = new Dictionary <Thing, VisualThing>(General.Map.Map.Things.Count);
     this.visibleblocks   = new List <VisualBlockEntry>();
     this.visiblesectors  = new Dictionary <Sector, VisualSector>(50);
     this.visiblegeometry = new List <VisualGeometry>(200);
     this.visiblethings   = new List <VisualThing>(100);
     this.processgeometry = true;
     this.processthings   = true;
 }