/// <summary> /// Initializes the database /// </summary> private static void backgroundWorker_doWork(object sender, DoWorkEventArgs e) { //Load zones BackgroundWorker worker = (BackgroundWorker)sender; QuestDesignerMain.DesignerForm.StatusProgress.Step = QuestDesignerMain.DesignerForm.StatusProgress.Maximum / m_OpenedRegion.Zones.Count; lock (DXControl.GeoObjects) { foreach (Zone zone in m_OpenedRegion.Zones) { //Create it! Plane mesh = new Plane(Common.Device, zone.Width, zone.Height, false); Texture tex = Textures.LoadTexture(zone.Texture); if (e.Cancel || worker.CancellationPending) { e.Cancel = true; e.Result = false; return; } //float scaleX = zone.Width / tex.GetLevelDescription(0).Width; //float scaleY = zone.Height / tex.GetLevelDescription(0).Height; Model model = new Model(mesh, tex); GeometryObj obj = new GeometryObj(null, model, DrawLevel.Background, DetailLevel.Nondetailed, zone.X, zone.Y, 0.0f, 0.0f, 0.0f, 0.0f, new Vector3(1.0f, 1.0f, 1.0f), false, false); DXControl.GeoObjects.Add(obj); if (QuestDesignerMain.DesignerForm != null && !QuestDesignerMain.DesignerForm.StatusProgress.IsDisposed) { QuestDesignerMain.DesignerForm.StatusProgress.PerformStep(); QuestDesignerMain.DesignerForm.DXControl.Invalidate(); } } } e.Result = true; }
/// <summary> /// Initializes the database /// </summary> private static void backgroundWorker_doWork(object sender, DoWorkEventArgs e) { //Load zones BackgroundWorker worker = (BackgroundWorker) sender; QuestDesignerMain.DesignerForm.StatusProgress.Step = QuestDesignerMain.DesignerForm.StatusProgress.Maximum / m_OpenedRegion.Zones.Count; lock (DXControl.GeoObjects) { foreach (Zone zone in m_OpenedRegion.Zones) { //Create it! Plane mesh = new Plane(Common.Device, zone.Width, zone.Height, false); Texture tex = Textures.LoadTexture(zone.Texture); if (e.Cancel || worker.CancellationPending) { e.Cancel = true; e.Result = false; return; } //float scaleX = zone.Width / tex.GetLevelDescription(0).Width; //float scaleY = zone.Height / tex.GetLevelDescription(0).Height; Model model = new Model(mesh, tex); GeometryObj obj = new GeometryObj(null,model, DrawLevel.Background, DetailLevel.Nondetailed, zone.X, zone.Y, 0.0f, 0.0f, 0.0f, 0.0f, new Vector3(1.0f, 1.0f, 1.0f),false,false); DXControl.GeoObjects.Add(obj); if (QuestDesignerMain.DesignerForm != null && !QuestDesignerMain.DesignerForm.StatusProgress.IsDisposed) { QuestDesignerMain.DesignerForm.StatusProgress.PerformStep(); QuestDesignerMain.DesignerForm.DXControl.Invalidate(); } } } e.Result = true; }