public Renderer(ModelEditor editor, int height, int width)
        {
            this.width = width;
            this.height = height;
            if (editor.Model != null)
            {
                this.RenderModel = editor.Model;
                editor.SelectedSectionChanged += new EventHandler<ModelEditor.ValueEventArgs>(editor_SelectedSectionChanged);
                editor.SelectedGroupChanged += new EventHandler<ModelEditor.ValueEventArgs>(editor_SelectedGroupChanged);

                LevelOfDetail = 5;
            } 
            if (editor.CollisionModel != null)
            {
                this.CollisionModel = editor.CollisionModel;
            }
            DeviceManager = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            StaticGame = this;
        }
 void editor_SelectedSectionChanged(object sender, ModelEditor.ValueEventArgs e)
 {
     SelectedSection = e.Value is int ? (int)e.Value : -1;
 }
        private void LoadTag(ClassTreeNode node)
        {
            foreach (DockContent dc in this.PrimaryDock.Documents)
                if ((string)(dc.Tag) == node.Path)
                {
                    dc.Activate();
                    return;
                }
            switch (Sunfish.Tag.Path.GetTagType(node.Path))
            {

                case "scnr":
                    MetaTool mt = new MetaTool();
                    mt.Text = Explorer.treeView1.SelectedNode.Text;
                    mt.Show(this.PrimaryDock, WeifenLuo.WinFormsUI.Docking.DockState.Document);
                    Sunfish.Tag scnr = new Tag(node.Path);
                    mt.LoadTag(scnr);
                    break;

                case "bitm":
                    BitmapTool bt = new BitmapTool();
                    bt.Text = Explorer.treeView1.SelectedNode.Text;
                    bt.Show(this.PrimaryDock, WeifenLuo.WinFormsUI.Docking.DockState.Document);
                    break;

                case "mode":
                    ModelEditor modeEdit = new ModelEditor();
                    modeEdit.Text = Explorer.treeView1.SelectedNode.Text;
                    modeEdit.Show(this.PrimaryDock, WeifenLuo.WinFormsUI.Docking.DockState.Document);
                    modeEdit.LoadTag(node.Path);
                    break;
                case "coll":
                    ModelEditor collEdit = new ModelEditor();
                    collEdit.Text = Explorer.treeView1.SelectedNode.Text;
                    collEdit.Show(this.PrimaryDock, WeifenLuo.WinFormsUI.Docking.DockState.Document);
                    collEdit.LoadTag(node.Path);
                    break;
                default:
                    mt = new MetaTool();
                    mt.Text = Explorer.treeView1.SelectedNode.Text;
                    mt.Show(this.PrimaryDock, WeifenLuo.WinFormsUI.Docking.DockState.Document);
                    Sunfish.Tag tag = new Tag(node.Path);
                    mt.LoadTag(tag);
                    break;
            }
        }