Esempio n. 1
0
        protected override void Render2D(Viewport2D vp)
        {
            base.Render2D(vp);

            if (_currentTool != null)
            {
                _currentTool.Render2D(vp);
            }

            // Render out the solid previews
            GL.Color3(Color.Pink);
            Matrix.Push();
            var matrix = vp.GetModelViewMatrix();

            GL.MultMatrix(ref matrix);
            MapObjectRenderer.DrawWireframe(_copies.Keys.SelectMany(x => x.Faces), true, false);
            Matrix.Pop();

            // Draw in order by the unused coordinate (the up axis for this viewport)
            var ordered = (from point in Points
                           where (point.IsMidPoint && _showPoints != ShowPoints.Vertices) || (!point.IsMidPoint && _showPoints != ShowPoints.Midpoints)
                           let unused = vp.GetUnusedCoordinate(point.Coordinate)
                                        orderby point.IsSelected, unused.X + unused.Y + unused.Z
                           select point).ToList();
            // Render out the point handles
            var z = (double)vp.Zoom;

            GL.Begin(BeginMode.Quads);
            foreach (var point in ordered)
            {
                var c = vp.Flatten(point.Coordinate);
                GL.Color3(Color.Black);
                GLX.Square(new Vector2d(c.DX, c.DY), 4, z, true);
                GL.Color3(point.GetColour());
                GLX.Square(new Vector2d(c.DX, c.DY), 3, z, true);
            }
            GL.End();
        }