public override bool OnMouseUp(Point mouseCurPos, MouseButtons button, BaseViewport viewport) { if (viewport.ViewportType != BaseViewport.ViewportTypes.PERSPECTIVE && button == MouseButtons.Left) { // ON MOUSE UP // -- action == selectDrag && NOT control pressed && if we did not move the mouse // -- and selected new vertices we select them (adding them to existing selection) switch (currentAction) { case VertexToolActionType.SelectMultiple: if (mouseHasMoved) { SelectHandlesWithBlanket(viewport, coverBlanket); } else { ClearAllSelectedVertices(); } break; case VertexToolActionType.SelectDrag: bool isControlPressed = modifierKey == Keys.Control; bool anySelected = newHandlesHit.All((pair) => pair.Value.Any((index) => pair.Key.SelectedVertices.Contains(index))); if (!isControlPressed && !mouseHasMoved && anySelected) { foreach (KeyValuePair <Solid, List <int> > pair in newHandlesHit) { pair.Value.ForEach((index) => { if (!pair.Key.SelectedVertices.Contains(index)) { pair.Key.SelectedVertices.Add(index); } }); } } break; } coverBlanket.Reset(); coverBlanket.Grow(Vector3.Zero); mouseHasMoved = false; currentAction = VertexToolActionType.None; } return(false); }
private bool IsHandleHit(Handle handle, Point point, BaseViewport viewport) { int width = viewport.Width; int height = viewport.Height; // convert ndc space handle to screenspace int minX = (int)((1 + handle.TopLeft.X) * width / 2.0f + 0.5f); int minY = (int)((1 - handle.TopLeft.Y) * height / 2.0f + 0.5f); int maxX = (int)((1 + handle.BottomRight.X) * width / 2.0f + 0.5f); int maxY = (int)((1 - handle.BottomRight.Y) * height / 2.0f + 0.5f); return(point.X >= minX && point.X <= maxX && point.Y >= minY && point.Y <= maxY); }
/// <summary> /// Constructor initalizing important variables /// </summary> public EditorGlViewport() : base(new GraphicsMode(32, 24, 0, 8), 3, 3, GraphicsContextFlags.Default) { BackColor = Color.Black; Dock = DockStyle.Fill; Margin = new Padding(0, 0, 0, 0); TabIndex = 0; graphics = new Graphics.Graphics(); viewports = new BaseViewport[VIEWPORT_COUNT]; capturedViewport = null; InitializeComponent(); InitializeViewports(); }
/// <summary> /// Check if we hit the handles /// </summary> /// <param name="x"></param> /// <param name="y"></param> /// <param name="viewport"></param> /// <returns></returns> private int GetGrableHandleHit(int x, int y, BaseViewport viewport) { MapObjectGroup selectedMapObjectGroup = controller.Selection; if (selectedMapObjectGroup.Empty) { return((int)SolidGrabHandles.HitStatus.None); } Matrix4 toGridMatrix = viewport.Camera.GetWorldMatrix().ClearTranslation(); SolidGrabHandles handles = controller.RubberBand.Handles; handles.CreateHandles(selectedMapObjectGroup, toGridMatrix, viewport.Zoom); return(handles.CheckHit(viewport.ViewportToRay(x, y))); }
/// <summary> /// Only draw for the current viewport that is doing the action /// </summary> /// <param name="graphics"></param> /// <param name="viewport"></param> private void RenderBlanket(Graphics.Graphics graphics, BaseViewport viewport) { if (viewport.ViewportType != BaseViewport.ViewportTypes.PERSPECTIVE && coverBlanket.HasVolume2D && currentActionViewport == viewport.ViewportType) { Vector3 bottomLeft = new Vector3(coverBlanket.Min.X, coverBlanket.Min.Y, 0); Vector3 bottomRight = new Vector3(coverBlanket.Max.X, coverBlanket.Min.Y, 0); Vector3 topRight = new Vector3(coverBlanket.Max.X, coverBlanket.Max.Y, 0); Vector3 topLeft = new Vector3(coverBlanket.Min.X, coverBlanket.Max.Y, 0); graphics.BeginDraw(Matrix4.CreateOrthographicOffCenter(0, viewport.Width, viewport.Height, 0, 0, 1)); //Color blanketColor = Color.FromArgb(64, Color.LightSkyBlue); //renderer.DrawSolidRectangle(topLeft, topRight, bottomRight, bottomLeft, blanketColor); // TODO FIX winding....??!?!?!? graphics.DrawRectangle(bottomLeft, bottomRight, topRight, topLeft, Graphics.Graphics.LineType.LineDashed, Color.DeepSkyBlue); graphics.EndDraw(); } }
public override bool OnMouseDown(Point mouseCurPos, MouseButtons button, BaseViewport viewport) { if (viewport.ViewportType != BaseViewport.ViewportTypes.PERSPECTIVE && button == MouseButtons.Left) { RubberBand rubberBand = controller.RubberBand; bool controlPressed = Control.ModifierKeys == Keys.Control; bool isSelectedSolidHit = IsSelectedSolidAabbHit(mouseCurPos.X, mouseCurPos.Y, viewport); bool isGrabHandleHit = GetGrableHandleHit(mouseCurPos.X, mouseCurPos.Y, viewport) != (int)SolidGrabHandles.HitStatus.None; // check if we want to do something with the selected solids if ((isSelectedSolidHit || isGrabHandleHit) && !controlPressed) { currentAction = isSelectedSolidHit ? SolidToolActionType.Drag : SolidToolActionType.Transform; rubberBand.Color = Color.Red; rubberBand.Bounds = (AABB)controller.Selection.Bounds.Clone(); } else { // default is solid creation rubberBand.Color = Color.Yellow; currentAction = SolidToolActionType.Create; MapObject hitMapObject = controller.GetMapObjectIfHit(mouseCurPos.X, mouseCurPos.Y, viewport); SelectMapObject(hitMapObject); controller.UpdateUserInterface(); if (hitMapObject != null) { currentAction = SolidToolActionType.Select; } } } else if (button == MouseButtons.Left) { MapObject hitMapObject = controller.GetMapObjectIfHit(mouseCurPos.X, mouseCurPos.Y, viewport); SelectMapObject(hitMapObject); controller.UpdateUserInterface(); } mouseDownPos = mouseCurPos; return(true); }
/// <summary> /// Mousewheel movement /// </summary> private void OnMouseWheel(object sender, MouseEventArgs e) { if (capturedViewport != null) { capturedViewport.MouseWheel(e.X, e.Y, e.Delta); } else { for (int i = 0; i < VIEWPORT_COUNT; i++) { if (viewports[i].IsPointInViewport(e.X, e.Y)) { lastFocusedViewport = viewports[i]; viewports[i].MouseWheel(e.X, e.Y, e.Delta); RaiseOnViewportFocusEvent(viewports[i]); break; } } } }
private bool DoesBlanketIntersectsHandle(AABB blanket, Handle handle, BaseViewport viewport) { int width = viewport.Width; int height = viewport.Height; //Matrix4 toViewportMatrix = viewport.Camera.GetViewMatrix().ClearTranslation(); Vector3 min = blanket.Min; //.TransformL(toViewportMatrix); Vector3 max = blanket.Max; //.TransformL(toViewportMatrix); // convert ndc space handle to screenspace float minX = (1 + handle.TopLeft.X) * width / 2.0f; float minY = (1 - handle.TopLeft.Y) * height / 2.0f; float maxX = (1 + handle.BottomRight.X) * width / 2.0f; float maxY = (1 - handle.BottomRight.Y) * height / 2.0f; return(!(min.X > maxX || max.X < minX || min.Y > maxY || max.Y < minY)); }
public override bool OnMouseMove(Point mouseCurPos, Point mousePrevPos, BaseViewport viewport) { if (viewport.ViewportType != BaseViewport.ViewportTypes.PERSPECTIVE) { controller.SetCursor(Cursors.Cross); if (viewport.IsButtonHeld(BaseViewport.ViewportButtons.LEFT)) { Vector3 mouseDownPosition = new Vector3(mouseDownPos.X, mouseDownPos.Y, 0); Vector3 currentMousePosition = new Vector3(mouseCurPos.X, mouseCurPos.Y, 0); Vector3 currentMouseWorld = viewport.ViewportToWorld(currentMousePosition); Vector3 snappedCurrentMouseWorld = GeneralUtility.SnapToGrid(currentMouseWorld, viewport.GridSize); mouseHasMoved = (currentMousePosition - mouseDownPosition).Length > GeneralUtility.Epsilon; switch (currentAction) { case VertexToolActionType.SelectMultiple: coverBlanket.Reset(); coverBlanket.Grow(mouseDownPosition); coverBlanket.Grow(currentMousePosition); break; case VertexToolActionType.SelectDrag: Vector3 delta = snappedCurrentMouseWorld - dragStartPosition; if (delta != Vector3.Zero) { TranslateVertices(delta); } dragStartPosition = snappedCurrentMouseWorld; break; } } } else { controller.SetCursor(Cursors.Default); } return(false); }
public void UpdateStatusBar(BaseViewport viewport) { editorStatusbarGrid.Text = viewport.GridSize > 0 ? string.Format(GridUnitsText, viewport.GridSize) : string.Empty; editorStatusbarZoom.Text = viewport.Zoom > 0.0f ? string.Format(ZoomText, Math.Round(1.0f / viewport.Zoom * 100.0f, 2)) : string.Empty; MapObjectGroup selectedMapObjectGroup = viewport.Controller.Selection; if (selectedMapObjectGroup.Empty) { ResetData(); return; } Vector3 center = selectedMapObjectGroup.Bounds.Center; editorStatusbarPositon.Text = string.Format(PositionText, Math.Round(center.X, 0), Math.Round(center.Y, 0), Math.Round(center.Z, 0)); Vector3 dimensions = selectedMapObjectGroup.Bounds.Max - selectedMapObjectGroup.Bounds.Min; editorStatusbarDimensions.Text = string.Format(DimensionsText, Math.Round(dimensions.X, 0), Math.Round(dimensions.Y, 0), Math.Round(dimensions.Z, 0)); }
public override void OnRender(Graphics.Graphics graphics, BaseViewport viewport) { BaseViewportCamera camera = viewport.Camera; SolidRenderOperation render = new SolidRenderOperation { Viewport = viewport, Graphics = graphics }; // Draw all solid if (viewport.ViewportType == BaseViewport.ViewportTypes.PERSPECTIVE) { GL.Enable(EnableCap.DepthTest); } graphics.BeginDraw(camera.GetViewMatrix() * camera.GetProjMatrix()); foreach (MapObject mapObject in controller.SceneDocument) { if (mapObject.Selected) { continue; } mapObject.PerformOperation(render); } controller.Selection?.PerformOperation(render); graphics.EndDraw(); if (viewport.ViewportType == BaseViewport.ViewportTypes.PERSPECTIVE) { GL.Disable(EnableCap.DepthTest); } }
public virtual bool OnMouseMove(Point mouseCurPos, Point mousePrevPos, BaseViewport viewport) { return(false); }
public override bool OnMouseDown(Point mouseCurPos, MouseButtons button, BaseViewport viewport) { if (button == MouseButtons.Left) { currentActionViewport = viewport.ViewportType; MapObjectGroup selectedMapObjectGroup = controller.Selection; bool isControlPressed = modifierKey == Keys.Control; newHandlesHit = GetHandlesHitWithMouse(viewport, mouseCurPos); // Check if we hit a vertex handle if (newHandlesHit.Count > 0) { Action dragStartPositionAction = () => { // any vertex will do var first = newHandlesHit.First(); Solid solid = first.Key; int firstVertex = first.Value[0]; SetSelectDragAction(solid.VertexPositions[firstVertex], viewport); }; Action isAnySelected = () => { // if still any selected left, setSelectDrag bool selected = newHandlesHit.All((pair) => pair.Value.Any((index) => pair.Key.SelectedVertices.Contains(index))); if (selected) { dragStartPositionAction(); } }; bool anySelected = newHandlesHit.All((pair) => pair.Value.Any((index) => pair.Key.SelectedVertices.Contains(index))); if (isControlPressed) { foreach (KeyValuePair <Solid, List <int> > pair in newHandlesHit) { pair.Value.ForEach((index) => { if (pair.Key.SelectedVertices.Contains(index)) { pair.Key.SelectedVertices.Remove(index); } else { pair.Key.SelectedVertices.Add(index); } }); } isAnySelected(); } else if (anySelected) { dragStartPositionAction(); } else { ClearAllSelectedVertices(); foreach (KeyValuePair <Solid, List <int> > pair in newHandlesHit) { pair.Value.ForEach((index) => { if (!pair.Key.SelectedVertices.Contains(index)) { pair.Key.SelectedVertices.Add(index); } }); } isAnySelected(); } } else // if no handles hit, check if we hit a solid { MapObject rootMapObject = controller.GetMapObjectIfHit(mouseCurPos.X, mouseCurPos.Y, viewport); if (rootMapObject == null) { if (viewport.ViewportType == BaseViewport.ViewportTypes.PERSPECTIVE) { ClearAllSelectedVertices(); } else // no map object hit for orthographic set action to SelectMultiple { currentAction = VertexToolActionType.SelectMultiple; } } else { if (isControlPressed) { if (!rootMapObject.Selected) { rootMapObject.Selected = true; selectedMapObjectGroup.Add(rootMapObject); } else { DoSolidAction(rootMapObject, (solid) => { solid.SelectedVertices.Clear(); }); rootMapObject.Selected = false; selectedMapObjectGroup.Remove(rootMapObject); } } else if (!rootMapObject.Selected) { ClearAllSelectedVertices(); selectedMapObjectGroup.Clear(); rootMapObject.Selected = true; selectedMapObjectGroup.Add(rootMapObject); } else { // solid we hit was already selected so we set action to SelectMultiples currentAction = VertexToolActionType.SelectMultiple; } } } mouseDownPos = mouseCurPos; } return(true); }
public SolidFaceHitOperation(BaseViewport view, Point mousePosition) { ray = view.ViewportToRay(mousePosition.X, mousePosition.Y); t = float.MaxValue; }
public ViewportEventArgs(BaseViewport viewport) { FocusedViewport = viewport; }
public override bool OnMouseMove(Point mouseCurPos, Point mousePrevPos, BaseViewport viewport) { if (viewport.ViewportType != BaseViewport.ViewportTypes.PERSPECTIVE) { UpdateCursor(mouseCurPos, viewport); if (viewport.IsButtonHeld(BaseViewport.ViewportButtons.LEFT)) { // set standard values Vector3 mouseDownPosition = new Vector3(mouseDownPos.X, mouseDownPos.Y, 0); Vector3 prevMousePosition = new Vector3(mousePrevPos.X, mousePrevPos.Y, 0); Vector3 currentMousePosition = new Vector3(mouseCurPos.X, mouseCurPos.Y, 0); Matrix4 fromGridSpaceMatrix = viewport.Camera.GetViewMatrix().ClearTranslation(); // we only give the rubberband volume if the mouse has moved in creation mode bool mouseHasMoved = (currentMousePosition - mouseDownPosition).Length > GeneralUtility.Epsilon; if (currentAction == SolidToolActionType.Create && mouseHasMoved) { mouseDownPosition.Z = -viewport.GridSize * 4; currentMousePosition.Z = viewport.GridSize * 4; } // convert to world mouseDownPosition = viewport.ViewportToWorld(mouseDownPosition); prevMousePosition = viewport.ViewportToWorld(prevMousePosition); currentMousePosition = viewport.ViewportToWorld(currentMousePosition); // snap Vector3 snappedDownMousePosition = GeneralUtility.SnapToGrid(mouseDownPosition, viewport.GridSize); Vector3 snappedPrevMousePosition = GeneralUtility.SnapToGrid(prevMousePosition, viewport.GridSize); Vector3 snappedCurrentMousePosition = GeneralUtility.SnapToGrid(currentMousePosition, viewport.GridSize); RubberBand rubberband = controller.RubberBand; switch (currentAction) { case SolidToolActionType.Create: rubberband.Bounds.Reset(); rubberband.Bounds.Grow(snappedDownMousePosition); rubberband.Bounds.Grow(snappedCurrentMousePosition); break; case SolidToolActionType.Drag: { Vector3 delta = snappedCurrentMousePosition - snappedPrevMousePosition; if (delta != Vector3.Zero) { TranslateOperation translate = new TranslateOperation(delta) { GridSize = viewport.GridSize, Transform = fromGridSpaceMatrix }; rubberband.PerformOperation(translate); rubberband.ShowGrabhandles = false; } } break; case SolidToolActionType.Transform: { SolidGrabHandles handles = rubberband.Handles; IMapObjectOperation operation = null; Vector3 delta = currentMousePosition - prevMousePosition; if (delta != Vector3.Zero) { rubberband.ShowGrabhandles = false; } switch (handles.Mode) { case SolidGrabHandles.HandleMode.Resize: operation = new ResizeTransformation(fromGridSpaceMatrix, snappedPrevMousePosition, snappedCurrentMousePosition, handles.LastHitStatus, viewport.GridSize); break; case SolidGrabHandles.HandleMode.Rotate: operation = new RotateTransformation(fromGridSpaceMatrix, mouseDownPosition, currentMousePosition, Matrix4.Identity); break; case SolidGrabHandles.HandleMode.Skew: operation = new SkewTransformation(fromGridSpaceMatrix, snappedDownMousePosition, snappedCurrentMousePosition, Matrix4.Identity, handles.LastHitStatus); break; } if (operation != null) { controller.RubberBand.PerformOperation(operation); } } break; } } } else { controller.SetCursor(Cursors.Default); } return(true); }
/// <summary> /// handles viewport capturing /// </summary> /// <param name="viewport"></param> private void CaptureViewport(BaseViewport viewport) { capturedViewport = lastFocusedViewport = viewport; }
private void RaiseOnViewportFocusEvent(BaseViewport viewport) { ViewportEventArgs e = new ViewportEventArgs(viewport); OnViewportFocus?.Invoke(this, e); }
public virtual bool OnMouseUp(Point mouseCurPos, MouseButtons button, BaseViewport viewport) { return(false); }
public override bool OnMouseUp(Point mouseCurPos, MouseButtons button, BaseViewport viewport) { if (viewport.ViewportType != BaseViewport.ViewportTypes.PERSPECTIVE && button == MouseButtons.Left) { RubberBand rubberBand = controller.RubberBand; MapObject selectionGroup = controller.Selection; SolidGrabHandles handles = rubberBand.Handles; Matrix4 fromGridSpaceMatrix = viewport.Camera.GetViewMatrix().ClearTranslation(); // check for the program to decide if it needs to go the next grab handle mode bool isHoveringSelectedSolid = IsSelectedSolidAabbHit(mouseCurPos.X, mouseCurPos.Y, viewport); bool hasNoNewSelection = currentAction != SolidToolActionType.Select; Vector3 snappedDownMousePosition = GeneralUtility.SnapToGrid( new Vector3(mouseDownPos.X, mouseDownPos.Y, 0), viewport.GridSize); Vector3 snappedCurMousePosition = GeneralUtility.SnapToGrid(new Vector3(mouseCurPos.X, mouseCurPos.Y, 0), viewport.GridSize); bool mouseHasNotMoved = snappedDownMousePosition == snappedCurMousePosition; if (isHoveringSelectedSolid && mouseHasNotMoved && hasNoNewSelection) { handles.NextMode(); } else { switch (currentAction) { case SolidToolActionType.Create: controller.CreateSolid(fromGridSpaceMatrix); break; case SolidToolActionType.Drag: // set new position Vector3 displacement = rubberBand.Bounds.Center - selectionGroup.Bounds.Center; controller.Selection.PerformOperation(new TranslateOperation(displacement)); break; case SolidToolActionType.Transform: Vector3 oldBoundVector = selectionGroup.Bounds.Max - selectionGroup.Bounds.Min; Vector3 newBoundVector = rubberBand.Bounds.Max - rubberBand.Bounds.Min; IMapObjectOperation operation = null; switch (handles.Mode) { case SolidGrabHandles.HandleMode.Resize: operation = new ResizeTransformation(fromGridSpaceMatrix, oldBoundVector, newBoundVector, handles.LastHitStatus, viewport.GridSize); break; case SolidGrabHandles.HandleMode.Rotate: operation = new RotateTransformation(fromGridSpaceMatrix, Vector3.Zero, Vector3.Zero, rubberBand.Transformation); break; case SolidGrabHandles.HandleMode.Skew: operation = new SkewTransformation(fromGridSpaceMatrix, Vector3.Zero, Vector3.Zero, rubberBand.Transformation, handles.LastHitStatus); break; } if (operation != null) { controller.Selection.PerformOperation(operation); } break; } controller.UpdateUserInterface(); } rubberBand.SetToZeroVolume(); rubberBand.ShowGrabhandles = true; currentAction = SolidToolActionType.None; } return(true); }
public virtual void OnRender(Graphics.Graphics graphics, BaseViewport viewport) { }
public override void OnRender(Graphics.Graphics graphics, BaseViewport viewport) { BaseViewportCamera camera = viewport.Camera; RubberBand rubberband = controller.RubberBand; SolidRenderOperation render = new SolidRenderOperation { Viewport = viewport, Graphics = graphics }; // Draw all solids if (viewport.ViewportType == BaseViewport.ViewportTypes.PERSPECTIVE) { GL.Enable(EnableCap.DepthTest); } graphics.BeginDraw(camera.GetViewMatrix() * camera.GetProjMatrix()); foreach (MapObject mapObject in controller.SceneDocument) { if (mapObject.Selected) { continue; } mapObject.PerformOperation(render); } controller.Selection?.PerformOperation(render); // only in orthographic viewport if (viewport.ViewportType != BaseViewport.ViewportTypes.PERSPECTIVE) { // draw rubberband if (rubberband.Bounds.HasVolume2D) { graphics.DrawWireframeAabb(rubberband.Bounds, Graphics.Graphics.LineType.LineDashed, rubberband.Color, rubberband.Transformation, viewport.Zoom); } else { // draw "rubberband" for the selection graphics.DrawWireframeAabb(controller.Selection?.Bounds, Graphics.Graphics.LineType.LineDashed, viewport.RenderMode == BaseViewport.RenderModes.SOLID ? Color.Yellow : Color.Red, Matrix4.Identity, viewport.Zoom); } // draw grabhandles for selection if (controller.RubberBand.ShowGrabhandles) { SolidGrabHandles handles = controller.RubberBand.Handles; Matrix4 viewportMatrix = viewport.Camera.GetWorldMatrix().ClearTranslation(); handles.CreateHandles(controller.Selection, viewportMatrix, viewport.Zoom); handles.Render(graphics); } } graphics.EndDraw(); if (viewport.ViewportType == BaseViewport.ViewportTypes.PERSPECTIVE) { GL.Disable(EnableCap.DepthTest); } }
private void RenderAllVertexHandles(Graphics.Graphics graphics, BaseViewport viewport) { int nearDepth = 1; int farDepth = 0; //TODO check why this is neccessary if (viewport.ViewportType == BaseViewport.ViewportTypes.PERSPECTIVE) { nearDepth = 0; farDepth = 1; } // handle vertices are already in NDC space when send to the graphicscard GL.Clear(ClearBufferMask.DepthBufferBit); GL.DepthRange(nearDepth, farDepth); GL.Enable(EnableCap.DepthTest); graphics.BeginDraw(Matrix4.Identity); Vector3 handleDimensions = new Vector3((float)HandleSize / viewport.Width, (float)HandleSize / viewport.Height, 0.0f); Matrix4 vpMatrix = viewport.Camera.GetViewMatrix() * viewport.Camera.GetProjMatrix(); Handle handle = new Handle(); List <Handle> selectedHandles = new List <Handle>(); // create handles and draw non selected handles DoSolidAction(controller.Selection, (solid) => { int index = 0; foreach (Vector3 position in solid.VertexPositions) { Vector4 vec4Pos = new Vector4(position, 1.0f) * vpMatrix; Vector3 pos = vec4Pos.Xyz / vec4Pos.W; handle.BottomLeft = pos + (-Vector3.UnitX - Vector3.UnitY) * handleDimensions; handle.BottomRight = pos + (Vector3.UnitX - Vector3.UnitY) * handleDimensions; handle.TopRight = pos + (Vector3.UnitX + Vector3.UnitY) * handleDimensions; handle.TopLeft = pos + (-Vector3.UnitX + Vector3.UnitY) * handleDimensions; if (solid.SelectedVertices.Contains(index)) { selectedHandles.Add(handle); index++; continue; } index++; graphics.DrawSolidRectangle(handle.BottomLeft, handle.BottomRight, handle.TopRight, handle.TopLeft, Color.White); graphics.DrawRectangle(handle.BottomLeft, handle.BottomRight, handle.TopRight, handle.TopLeft, Graphics.Graphics.LineType.LineNormal, Color.Black); } }); graphics.EndDraw(); GL.Clear(ClearBufferMask.DepthBufferBit); graphics.BeginDraw(Matrix4.Identity); //draw selected handles foreach (Handle selectedHandle in selectedHandles) { graphics.DrawSolidRectangle(selectedHandle.BottomLeft, selectedHandle.BottomRight, selectedHandle.TopRight, selectedHandle.TopLeft, Color.Red); graphics.DrawRectangle(selectedHandle.BottomLeft, selectedHandle.BottomRight, selectedHandle.TopRight, selectedHandle.TopLeft, Graphics.Graphics.LineType.LineNormal, Color.Black); } graphics.EndDraw(); GL.Disable(EnableCap.DepthTest); GL.DepthRange(farDepth, nearDepth); }