public override void UpdateFrame(ViewportBase viewport, FrameInfo frame) { }
public void UpdateFrame(FrameInfo frame) { if (!ShouldRelayEvent(ToolManager.ActiveTool)) return; ToolManager.ActiveTool.UpdateFrame(Viewport, frame); }
public override void UpdateFrame(ViewportBase viewport, FrameInfo frame) { WidgetAction((w, vp, ev) => w.UpdateFrame(vp, frame), viewport, null); base.UpdateFrame(viewport, frame); }
public override void UpdateFrame(ViewportBase viewport, FrameInfo frame) { if (_updatePreview && ShouldDrawBox(viewport)) { var box = new Box(State.BoxStart, State.BoxEnd); var brush = GetBrush(box, new IDGenerator()); _preview = new List<Face>(); CollectFaces(_preview, new[] { brush }); var color = GetRenderBoxColour(); _preview.ForEach(x => { x.Colour = color; }); } _updatePreview = false; }
public void UpdateFrame(FrameInfo frame) { if (Viewport2D.IsFocused && _mouseDown != null && Control.MouseButtons.HasFlag(MouseButtons.Left) && !KeyboardState.IsKeyDown(Keys.Space)) { var pt = Viewport2D.PointToClient(Control.MousePosition); if (pt.X < ScrollPadding) { var mx = ScrollStart + ScrollIncrement * Math.Min(ScrollMaximum, ScrollPadding - pt.X); mx = mx * mx + ScrollStart; Viewport2D.Position.X -= mx / Viewport2D.Zoom; } else if (pt.X > Viewport2D.Width - ScrollPadding) { var mx = ScrollStart + ScrollIncrement * Math.Min(ScrollMaximum, pt.X - (Viewport2D.Width - ScrollPadding)); mx = mx * mx + ScrollStart; Viewport2D.Position.X += mx / Viewport2D.Zoom; } if (pt.Y < ScrollPadding) { var my = ScrollStart + ScrollIncrement * Math.Min(ScrollMaximum, ScrollPadding - pt.Y); my = my * my + ScrollStart; Viewport2D.Position.Y += my / Viewport2D.Zoom; } else if (pt.Y > Viewport2D.Height - ScrollPadding) { var my = ScrollStart + ScrollIncrement * Math.Min(ScrollMaximum, pt.Y - (Viewport2D.Height - ScrollPadding)); my = my * my + ScrollStart; Viewport2D.Position.Y -= my / Viewport2D.Zoom; } } }
public override void UpdateFrame(ViewportBase viewport, FrameInfo frame) { if (_currentTool != null) _currentTool.UpdateFrame(viewport, frame); base.UpdateFrame(viewport, frame); }
public abstract void UpdateFrame(ViewportBase viewport, FrameInfo frame);
protected void UpdateFrame() { if (!IsFocused) // Change this if things start to get choppy { UnfocusedUpdateCounter++; // Update every 10th frame if (UnfocusedUpdateCounter % 10 != 0) { return; } } UnfocusedUpdateCounter = 0; try { if (!Context.IsCurrent) { MakeCurrent(); } } catch (Exception ex) { OnRenderException(ex); } var frame = new FrameInfo(_stopwatch.ElapsedMilliseconds); ListenerDo(x => x.UpdateFrame(frame)); LoadIdentity(); UpdateAfterLoadIdentity(); UpdateBeforeSetViewport(); SetViewport(); UpdateBeforeClearViewport(); ClearViewport(); try { UpdateBeforeRender(); RenderContext.Render(this); UpdateAfterRender(); } catch(Exception ex) { OnRenderException(ex); } if (IsDisposed) return; SwapBuffers(); }
public void UpdateFrame(FrameInfo frame) { }
public void UpdateFrame(FrameInfo frame) { // Not used }
public void UpdateFrame(FrameInfo frame) { var currMillis = _lastMillis; _lastMillis = frame.Milliseconds; if (currMillis == 0) return; if (!Focus || !Viewport.IsUnlocked(this) || !Viewport.IsFocused) { if (FreeLook || FreeLookToggle) { FreeLook = FreeLookToggle = false; SetFreeLook(); } return; } var seconds = (frame.Milliseconds - currMillis) / 1000m; var units = Sledge.Settings.View.ForwardSpeed * seconds; var down = KeyboardState.IsAnyKeyDown(Keys.W, Keys.A, Keys.S, Keys.D); if (!down) _downMillis = 0; else if (_downMillis == 0) _downMillis = currMillis; if (Sledge.Settings.View.TimeToTopSpeed > 0) { var downFor = (frame.Milliseconds - _downMillis) / Sledge.Settings.View.TimeToTopSpeed; if (downFor >= 0 && downFor < 1) units *= _easing.Evaluate(downFor); } var move = units; var tilt = 2m; // These keys are used for hotkeys, don't want the 3D view to move about when trying to use hotkeys. var ignore = KeyboardState.IsAnyKeyDown(Keys.ShiftKey, Keys.ControlKey, Keys.Alt); IfKey(Keys.W, () => Camera.Advance(move), ignore); IfKey(Keys.S, () => Camera.Advance(-move), ignore); IfKey(Keys.A, () => Camera.Strafe(-move), ignore); IfKey(Keys.D, () => Camera.Strafe(move), ignore); IfKey(Keys.Q, () => Camera.AscendAbsolute(move), ignore); IfKey(Keys.E, () => Camera.AscendAbsolute(-move), ignore); // Arrow keys are not really used for hotkeys all that much, so we allow shift+arrows to match Hammer's keys var shiftDown = KeyboardState.IsKeyDown(Keys.ShiftKey); var otherDown = KeyboardState.IsAnyKeyDown(Keys.ControlKey, Keys.Alt); IfKey(Keys.Right, () => { if (shiftDown) Camera.Strafe(move); else Camera.Pan(-tilt); }, otherDown); IfKey(Keys.Left, () => { if (shiftDown) Camera.Strafe(-move); else Camera.Pan(tilt); }, otherDown); IfKey(Keys.Up, () => { if (shiftDown) Camera.Ascend(move); else Camera.Tilt(-tilt); }, otherDown); IfKey(Keys.Down, () => { if (shiftDown) Camera.Ascend(-move); else Camera.Tilt(tilt); }, otherDown); }
public override void UpdateFrame(ViewportBase viewport, FrameInfo frame) { var vp = viewport as Viewport3D; if (vp == null) return; if (_moveCount > 0) { PaintCurrentPoint(vp, _moveCount); _moveCount = 0; } // Check the current intersecting point var ray = vp.CastRayFromScreen(_mousePos.X, _mousePos.Y); var selectedFaces = Document.Selection.GetSelectedFaces().OfType<Displacement>(); var closestPoints = selectedFaces.Select(x => x.GetClosestDisplacementPoint(ray)); _currentPoint = closestPoints .OrderBy(x => (x.Location - ray.ClosestPoint(x.Location)).VectorMagnitude()) .FirstOrDefault(); if (_needsRedraw) { // update display lists? _needsRedraw = false; } }
public void UpdateFrame(FrameInfo frame) { var currMillis = _lastMillis; _lastMillis = frame.Milliseconds; if (currMillis == 0) return; if (!Focus || !Viewport.IsUnlocked(this)) return; var seconds = (frame.Milliseconds - currMillis) / 1000m; var units = Sledge.Settings.View.ForwardSpeed * seconds; var down = KeyboardState.IsAnyKeyDown(Keys.W, Keys.A, Keys.S, Keys.D); if (!down) _downMillis = 0; else if (_downMillis == 0) _downMillis = currMillis; if (Sledge.Settings.View.TimeToTopSpeed > 0) { var downFor = (frame.Milliseconds - _downMillis) / Sledge.Settings.View.TimeToTopSpeed; if (downFor >= 0 && downFor < 1) units *= _easing.Evaluate(downFor); } var move = units; var tilt = 2m; // These keys are used for hotkeys, don't want the 3D view to move about when trying to use hotkeys. var ignore = KeyboardState.IsAnyKeyDown(Keys.ShiftKey, Keys.ControlKey, Keys.Alt); IfKey(Keys.W, () => Camera.Advance(move), ignore); IfKey(Keys.S, () => Camera.Advance(-move), ignore); IfKey(Keys.A, () => Camera.Strafe(-move), ignore); IfKey(Keys.D, () => Camera.Strafe(move), ignore); IfKey(Keys.Right, () => Camera.Pan(-tilt), ignore); IfKey(Keys.Left, () => Camera.Pan(tilt), ignore); IfKey(Keys.Up, () => Camera.Tilt(-tilt), ignore); IfKey(Keys.Down, () => Camera.Tilt(tilt), ignore); }