internal void RenderFrame(double delta) { frameTimer.Reset(); frameTimer.Start(); Graphics.BeginFrame(this); Graphics.BindIb(Graphics.defaultIb); accumulator += delta; Vertices = 0; Camera.UpdateMouse(); if (!window.Focused && !Gui.ActiveScreen.HandlesAllInput) { Gui.SetNewScreen(new PauseScreen(this)); } bool allowZoom = Gui.activeScreen == null && !Gui.hudScreen.HandlesAllInput; if (allowZoom && IsKeyDown(KeyBind.ZoomScrolling)) { Input.SetFOV(ZoomFov, false); } DoScheduledTasks(delta); float t = (float)(entTask.Accumulator / entTask.Interval); LocalPlayer.SetInterpPosition(t); if (!SkipClear) { Graphics.Clear(); } CurrentCameraPos = Camera.GetPosition(t); UpdateViewMatrix(); bool visible = Gui.activeScreen == null || !Gui.activeScreen.BlocksWorld; if (!World.HasBlocks) { visible = false; } if (visible) { Render3D(delta, t); } else { SelectedPos.SetAsInvalid(); } Gui.Render(delta); if (screenshotRequested) { TakeScreenshot(); } Graphics.EndFrame(this); LimitFPS(); }
internal void RenderFrame(double delta) { frameTimer.Reset(); frameTimer.Start(); Graphics.BeginFrame(this); Graphics.BindIb(defaultIb); accumulator += delta; Vertices = 0; Mode.BeginFrame(delta); Graphics.UpdateLightsEntity(); Camera.UpdateMouse(); if (!Focused && !Gui.ActiveScreen.HandlesAllInput) { Gui.SetNewScreen(new PauseScreen(this)); } CheckZoomFov(); DoScheduledTasks(delta); float t = (float)(entTask.Accumulator / entTask.Interval); LocalPlayer.SetInterpPosition(t); if (!SkipClear) { Graphics.Clear(); } CurrentCameraPos = Camera.GetCameraPos(t); UpdateViewMatrix(); bool visible = Gui.activeScreen == null || !Gui.activeScreen.BlocksWorld; if (!World.HasBlocks) { visible = false; } if (visible) { Render3D(delta, t); } else { SelectedPos.SetAsInvalid(); } Gui.Render(delta); if (screenshotRequested) { TakeScreenshot(); } Mode.EndFrame(delta); Graphics.EndFrame(this); LimitFPS(); }
internal void RenderFrame(double delta) { frameTimer.Reset(); frameTimer.Start(); Graphics.BeginFrame(this); Graphics.BindIb(defaultIb); accumulator += delta; Vertices = 0; if (!Focused && !ActiveScreen.HandlesAllInput) { SetNewScreen(new PauseScreen(this)); } CheckZoomFov(); CheckScheduledTasks(delta); float t = (float)(ticksAccumulator / ticksPeriod); LocalPlayer.SetInterpPosition(t); Graphics.Clear(); UpdateViewMatrix(delta); bool visible = activeScreen == null || !activeScreen.BlocksWorld; if (World.IsNotLoaded) { visible = false; } if (visible) { Render3D(delta, t); } else { SelectedPos.SetAsInvalid(); } RenderGui(delta); if (screenshotRequested) { TakeScreenshot(); } Graphics.EndFrame(this); LimitFPS(); }
private void cbFindPosNumber_SelectedIndexChanged(object sender, EventArgs e) { string pos = (string)cbFindPosNumber.SelectedItem; SelectedPos copy = null; if (!m_PosProperties.TryGetValue(pos, out copy)) { return; } txtReplaceCount.Text = copy.Count; cbReplaceDiameter.SelectedItem = copy.Diameter; txtReplaceSpacing.Text = copy.Spacing; txtReplaceNote.Text = copy.Note; txtReplaceMultiplier.Text = copy.Multiplier; SetReplaceShape(copy.Shape); txtReplaceA.Text = copy.A; txtReplaceB.Text = copy.B; txtReplaceC.Text = copy.C; txtReplaceD.Text = copy.D; txtReplaceE.Text = copy.E; txtReplaceF.Text = copy.F; }
private void ReadSelection() { m_PosList = new SortedDictionary<string, List<ObjectId>>(); m_CountList = new SortedDictionary<string, List<ObjectId>>(); m_DiameterList = new SortedDictionary<string, List<ObjectId>>(); m_SpacingList = new SortedDictionary<string, List<ObjectId>>(); m_NoteList = new SortedDictionary<string, List<ObjectId>>(); m_MultiplierList = new SortedDictionary<int, List<ObjectId>>(); m_ShapeList = new SortedDictionary<string, List<ObjectId>>(); m_PosProperties = new Dictionary<string, SelectedPos>(); cbFindPosNumber.Items.Clear(); cbFindCount.Items.Clear(); cbFindDiameter.Items.Clear(); cbFindSpacing.Items.Clear(); cbFindNote.Items.Clear(); cbFindMultiplier.Items.Clear(); if (m_Selection == null || m_Selection.Length == 0) { return; } // Read all pos properties in selection Database db = HostApplicationServices.WorkingDatabase; using (Transaction tr = db.TransactionManager.StartTransaction()) { try { foreach (ObjectId id in m_Selection) { RebarPos pos = tr.GetObject(id, OpenMode.ForRead) as RebarPos; if (pos != null) { List<ObjectId> list = null; if (m_PosList.TryGetValue(pos.Pos, out list)) list.Add(id); else m_PosList.Add(pos.Pos, new List<ObjectId>() { id }); if (pos.Detached) continue; if (m_CountList.TryGetValue(pos.Count, out list)) list.Add(id); else m_CountList.Add(pos.Count, new List<ObjectId>() { id }); if (m_DiameterList.TryGetValue(pos.Diameter, out list)) list.Add(id); else m_DiameterList.Add(pos.Diameter, new List<ObjectId>() { id }); if (m_SpacingList.TryGetValue(pos.Spacing, out list)) list.Add(id); else m_SpacingList.Add(pos.Spacing, new List<ObjectId>() { id }); if (m_NoteList.TryGetValue(pos.Note, out list)) list.Add(id); else m_NoteList.Add(pos.Note, new List<ObjectId>() { id }); if (m_MultiplierList.TryGetValue(pos.Multiplier, out list)) list.Add(id); else m_MultiplierList.Add(pos.Multiplier, new List<ObjectId>() { id }); if (m_ShapeList.TryGetValue(pos.Shape, out list)) list.Add(id); else m_ShapeList.Add(pos.Shape, new List<ObjectId>() { id }); SelectedPos copy = null; if (!m_PosProperties.TryGetValue(pos.Pos, out copy)) { copy = new SelectedPos(); m_PosProperties.Add(pos.Pos, copy); } copy.SetFrom(pos); } } } catch (System.Exception) { ; } } // Populate list boxes foreach (string name in m_PosList.Keys) cbFindPosNumber.Items.Add(name); foreach (string name in m_CountList.Keys) cbFindCount.Items.Add(name); foreach (string name in m_DiameterList.Keys) cbFindDiameter.Items.Add(name); foreach (string name in m_SpacingList.Keys) cbFindSpacing.Items.Add(name); foreach (string name in m_NoteList.Keys) cbFindNote.Items.Add(name); foreach (int mult in m_MultiplierList.Keys) cbFindMultiplier.Items.Add(mult.ToString()); cbReplaceDiameter.Items.Clear(); foreach (int d in DWGUtility.GetStandardDiameters()) { cbReplaceDiameter.Items.Add(d.ToString()); } if (cbReplaceDiameter.Items.Count > 0) cbReplaceDiameter.SelectedIndex = 0; if (m_ShapeList.Count > 0) { foreach (string name in m_ShapeList.Keys) { SetFindShape(name); SetReplaceShape(name); break; } } if (cbFindPosNumber.Items.Count > 0) cbFindPosNumber.SelectedIndex = 0; if (cbFindCount.Items.Count > 0) cbFindCount.SelectedIndex = 0; if (cbFindDiameter.Items.Count > 0) cbFindDiameter.SelectedIndex = 0; if (cbFindSpacing.Items.Count > 0) cbFindSpacing.SelectedIndex = 0; if (cbFindNote.Items.Count > 0) cbFindNote.SelectedIndex = 0; if (cbFindMultiplier.Items.Count > 0) cbFindMultiplier.SelectedIndex = 0; }
private void ReadSelection() { m_PosList = new SortedDictionary <string, List <ObjectId> >(); m_CountList = new SortedDictionary <string, List <ObjectId> >(); m_DiameterList = new SortedDictionary <string, List <ObjectId> >(); m_SpacingList = new SortedDictionary <string, List <ObjectId> >(); m_NoteList = new SortedDictionary <string, List <ObjectId> >(); m_MultiplierList = new SortedDictionary <int, List <ObjectId> >(); m_ShapeList = new SortedDictionary <string, List <ObjectId> >(); m_PosProperties = new Dictionary <string, SelectedPos>(); cbFindPosNumber.Items.Clear(); cbFindCount.Items.Clear(); cbFindDiameter.Items.Clear(); cbFindSpacing.Items.Clear(); cbFindNote.Items.Clear(); cbFindMultiplier.Items.Clear(); if (m_Selection == null || m_Selection.Length == 0) { return; } // Read all pos properties in selection Database db = HostApplicationServices.WorkingDatabase; using (Transaction tr = db.TransactionManager.StartTransaction()) { try { foreach (ObjectId id in m_Selection) { RebarPos pos = tr.GetObject(id, OpenMode.ForRead) as RebarPos; if (pos != null) { List <ObjectId> list = null; if (m_PosList.TryGetValue(pos.Pos, out list)) { list.Add(id); } else { m_PosList.Add(pos.Pos, new List <ObjectId>() { id }); } if (pos.Detached) { continue; } if (m_CountList.TryGetValue(pos.Count, out list)) { list.Add(id); } else { m_CountList.Add(pos.Count, new List <ObjectId>() { id }); } if (m_DiameterList.TryGetValue(pos.Diameter, out list)) { list.Add(id); } else { m_DiameterList.Add(pos.Diameter, new List <ObjectId>() { id }); } if (m_SpacingList.TryGetValue(pos.Spacing, out list)) { list.Add(id); } else { m_SpacingList.Add(pos.Spacing, new List <ObjectId>() { id }); } if (m_NoteList.TryGetValue(pos.Note, out list)) { list.Add(id); } else { m_NoteList.Add(pos.Note, new List <ObjectId>() { id }); } if (m_MultiplierList.TryGetValue(pos.Multiplier, out list)) { list.Add(id); } else { m_MultiplierList.Add(pos.Multiplier, new List <ObjectId>() { id }); } if (m_ShapeList.TryGetValue(pos.Shape, out list)) { list.Add(id); } else { m_ShapeList.Add(pos.Shape, new List <ObjectId>() { id }); } SelectedPos copy = null; if (!m_PosProperties.TryGetValue(pos.Pos, out copy)) { copy = new SelectedPos(); m_PosProperties.Add(pos.Pos, copy); } copy.SetFrom(pos); } } } catch (System.Exception) { ; } } // Populate list boxes foreach (string name in m_PosList.Keys) { cbFindPosNumber.Items.Add(name); } foreach (string name in m_CountList.Keys) { cbFindCount.Items.Add(name); } foreach (string name in m_DiameterList.Keys) { cbFindDiameter.Items.Add(name); } foreach (string name in m_SpacingList.Keys) { cbFindSpacing.Items.Add(name); } foreach (string name in m_NoteList.Keys) { cbFindNote.Items.Add(name); } foreach (int mult in m_MultiplierList.Keys) { cbFindMultiplier.Items.Add(mult.ToString()); } cbReplaceDiameter.Items.Clear(); foreach (int d in DWGUtility.GetStandardDiameters()) { cbReplaceDiameter.Items.Add(d.ToString()); } if (cbReplaceDiameter.Items.Count > 0) { cbReplaceDiameter.SelectedIndex = 0; } if (m_ShapeList.Count > 0) { foreach (string name in m_ShapeList.Keys) { SetFindShape(name); SetReplaceShape(name); break; } } if (cbFindPosNumber.Items.Count > 0) { cbFindPosNumber.SelectedIndex = 0; } if (cbFindCount.Items.Count > 0) { cbFindCount.SelectedIndex = 0; } if (cbFindDiameter.Items.Count > 0) { cbFindDiameter.SelectedIndex = 0; } if (cbFindSpacing.Items.Count > 0) { cbFindSpacing.SelectedIndex = 0; } if (cbFindNote.Items.Count > 0) { cbFindNote.SelectedIndex = 0; } if (cbFindMultiplier.Items.Count > 0) { cbFindMultiplier.SelectedIndex = 0; } }
protected override void OnRenderFrame(FrameEventArgs e) { PerformFpsElapsed(e.Time * 1000); Graphics.BeginFrame(this); Graphics.BindIb(defaultIb); accumulator += e.Time; Vertices = 0; if (!Focused && !ScreenLockedInput) { SetNewScreen(new PauseScreen(this)); } base.OnRenderFrame(e); CheckScheduledTasks(e.Time); float t = (float)(ticksAccumulator / ticksPeriod); LocalPlayer.SetInterpPosition(t); Graphics.Clear(); Graphics.SetMatrixMode(MatrixType.Modelview); Matrix4 modelView = Camera.GetView(e.Time); View = modelView; Graphics.LoadMatrix(ref modelView); Culling.CalcFrustumEquations(ref Projection, ref modelView); bool visible = activeScreen == null || !activeScreen.BlocksWorld; if (visible) { AxisLinesRenderer.Render(e.Time); Players.RenderModels(Graphics, e.Time, t); Players.RenderNames(Graphics, e.Time, t); CurrentCameraPos = Camera.GetCameraPos(LocalPlayer.EyePosition); ParticleManager.Render(e.Time, t); Camera.GetPickedBlock(SelectedPos); // TODO: only pick when necessary EnvRenderer.Render(e.Time); if (SelectedPos.Valid && !HideGui) { Picking.Render(e.Time, SelectedPos); } MapRenderer.Render(e.Time); SelectionManager.Render(e.Time); WeatherRenderer.Render(e.Time); Players.RenderHoveredNames(Graphics, e.Time, t); bool left = IsMousePressed(MouseButton.Left); bool middle = IsMousePressed(MouseButton.Middle); bool right = IsMousePressed(MouseButton.Right); InputHandler.PickBlocks(true, left, middle, right); if (!HideGui) { BlockHandRenderer.Render(e.Time, t); } } else { SelectedPos.SetAsInvalid(); } Graphics.Mode2D(Width, Height, EnvRenderer is StandardEnvRenderer); fpsScreen.Render(e.Time); if (activeScreen == null || !activeScreen.HidesHud) { hudScreen.Render(e.Time); } if (activeScreen != null) { activeScreen.Render(e.Time); } Graphics.Mode3D(EnvRenderer is StandardEnvRenderer); if (screenshotRequested) { TakeScreenshot(); } Graphics.EndFrame(this); }