예제 #1
0
        public void DrawEditor(Object3DControlsLayer object3DControlLayer, List <Object3DView> transparentMeshes, DrawEventArgs e)
        {
            var start = PositionsHaveBeenSet ? StartPosition : StartPosition.Transform(Matrix);
            var end   = PositionsHaveBeenSet ? EndPosition : EndPosition.Transform(Matrix);

            object3DControlLayer.World.Render3DLine(start, end, Color.Black, true, width: GuiWidget.DeviceScale);
        }
예제 #2
0
        public void DrawEditor(Object3DControlsLayer object3DControlLayer, List <Object3DView> transparentMeshes, DrawEventArgs e)
        {
            var start = PositionsHaveBeenSet ? StartPosition : StartPosition.Transform(Matrix);
            var end   = PositionsHaveBeenSet ? EndPosition : EndPosition.Transform(Matrix);

            // draw on top of anything that is already drawn
            object3DControlLayer.World.Render3DLine(start, end, Color.Black.WithAlpha(Constants.LineAlpha), false, width: GuiWidget.DeviceScale);

            // Restore DepthTest
            object3DControlLayer.World.Render3DLine(start, end, Color.Black, true, width: GuiWidget.DeviceScale);
        }
예제 #3
0
        public void AddObject3DControls(Object3DControlsLayer object3DControlsLayer)
        {
            if (editorControls == null)
            {
                editorControls = new List <IObject3DControl>
                {
                    new TracedPositionObject3DControl(object3DControlsLayer,
                                                      this,
                                                      () =>
                    {
                        return(PositionsHaveBeenSet ? StartPosition : StartPosition.Transform(Matrix));
                    },
                                                      (position) =>
                    {
                        if (!PositionsHaveBeenSet)
                        {
                            PositionsHaveBeenSet = true;
                            EndPosition          = EndPosition.Transform(this.Matrix);
                        }

                        StartPosition = position;
                        Distance      = (StartPosition - EndPosition).Length;
                        UiThread.RunOnIdle(() => Invalidate(InvalidateType.DisplayValues));
                    }),
                    new TracedPositionObject3DControl(object3DControlsLayer,
                                                      this,
                                                      () =>
                    {
                        return(PositionsHaveBeenSet ? EndPosition : EndPosition.Transform(Matrix));
                    },
                                                      (position) =>
                    {
                        if (!PositionsHaveBeenSet)
                        {
                            PositionsHaveBeenSet = true;
                            StartPosition        = StartPosition.Transform(this.Matrix);
                        }

                        EndPosition = position;
                        Distance    = (StartPosition - EndPosition).Length;
                        UiThread.RunOnIdle(() => Invalidate(InvalidateType.DisplayValues));
                    }),
                };
            }

            object3DControlsLayer.Object3DControls.Modify((list) =>
            {
                list.AddRange(editorControls);
            });
        }