internal void LoadTag(string filename) { this.Tag = filename; this.HaloTag = new Tag(filename); if (this.HaloTag.Type == "mode") { Model = new Sunfish.Mode.RenderModel(HaloTag); foreach (Mode.Region r in Model.Regions) listBox1.Items.Add(r.name); } else if (this.HaloTag.Type == "coll") { CollisionModel = new Sunfish.Mode.Coll.CollisionModel(); CollisionModel.Load(HaloTag.TagStream, 0, 0); } game = new Renderer(this, xnaViewer1.Height, xnaViewer1.Width); if (this.HaloTag.Type == "coll") { cmbCollRegions.Items.Clear(); foreach (Mode.Coll.Region region in CollisionModel.Regions) { cmbCollRegions.Items.Add(region); } cmbCollRegions.SelectedIndex = 0; } xnaViewer1.RunGame(game); }
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; }