当前位置: 首页>>代码示例>>C#>>正文


C# Viewport2D.GetModelViewMatrix方法代码示例

本文整理汇总了C#中Sledge.UI.Viewport2D.GetModelViewMatrix方法的典型用法代码示例。如果您正苦于以下问题:C# Viewport2D.GetModelViewMatrix方法的具体用法?C# Viewport2D.GetModelViewMatrix怎么用?C# Viewport2D.GetModelViewMatrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sledge.UI.Viewport2D的用法示例。


在下文中一共展示了Viewport2D.GetModelViewMatrix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Render2D

        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);
            Matrix.Pop();

            // Draw in order by the unused coordinate (the up axis for this viewport)
            var ordered = (from point in Points
                           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();
        }
开发者ID:074769,项目名称:sledge,代码行数:32,代码来源:VMTool.cs

示例2: Render2D

 protected override void Render2D(Viewport2D viewport)
 {
     base.Render2D(viewport);
     if (ShouldDrawBox(viewport) && _preview != null)
     {
         GL.Color3(GetRenderColour());
         Graphics.Helpers.Matrix.Push();
         var matrix = viewport.GetModelViewMatrix();
         GL.MultMatrix(ref matrix);
         MapObjectRenderer.DrawWireframe(_preview, true, false);
         Graphics.Helpers.Matrix.Pop();
     }
 }
开发者ID:KonstantinUb,项目名称:sledge,代码行数:13,代码来源:BrushTool.cs

示例3: Render2D

        private void Render2D(Viewport2D vp)
        {
            if (_state == ClipState.None
                || _clipPlanePoint1 == null
                || _clipPlanePoint2 == null
                || _clipPlanePoint3 == null) return; // Nothing to draw at this point

            var z = (double) vp.Zoom;
            var p1 = vp.Flatten(_clipPlanePoint1);
            var p2 = vp.Flatten(_clipPlanePoint2);
            var p3 = vp.Flatten(_clipPlanePoint3);
            // Draw points
            GL.Begin(BeginMode.Quads);
            GL.Color3(Color.White);
            GLX.Square(new Vector2d(p1.DX, p1.DY), 4, z, true);
            GLX.Square(new Vector2d(p2.DX, p2.DY), 4, z, true);
            GLX.Square(new Vector2d(p3.DX, p3.DY), 4, z, true);
            GL.End();

            GL.Enable(EnableCap.LineSmooth);
            GL.Hint(HintTarget.LineSmoothHint, HintMode.Nicest);

            // Draw lines between points and point outlines
            GL.Begin(BeginMode.Lines);
            GL.Color3(Color.White);
            GL.Vertex2(p1.DX, p1.DY);
            GL.Vertex2(p2.DX, p2.DY);
            GL.Vertex2(p2.DX, p2.DY);
            GL.Vertex2(p3.DX, p3.DY);
            GL.Vertex2(p3.DX, p3.DY);
            GL.Vertex2(p1.DX, p1.DY);
            GL.Color3(Color.Black);
            GLX.Square(new Vector2d(p1.DX, p1.DY), 4, z);
            GLX.Square(new Vector2d(p2.DX, p2.DY), 4, z);
            GLX.Square(new Vector2d(p3.DX, p3.DY), 4, z);
            GL.End();

            // Draw the clipped brushes
            if (!_clipPlanePoint1.EquivalentTo(_clipPlanePoint2)
                    && !_clipPlanePoint2.EquivalentTo(_clipPlanePoint3)
                    && !_clipPlanePoint1.EquivalentTo(_clipPlanePoint3))
            {
                var plane = new Plane(_clipPlanePoint1, _clipPlanePoint2, _clipPlanePoint3);
                var faces = new List<Face>();
                var idg = new IDGenerator();
                foreach (var solid in Document.Selection.GetSelectedObjects().OfType<Solid>().ToList())
                {
                    Solid back, front;
                    if (solid.Split(plane, out back, out front, idg))
                    {
                        faces.AddRange(back.Faces);
                        faces.AddRange(front.Faces);
                    }
                }
                GL.LineWidth(2);
                GL.Color3(Color.White);
                Matrix.Push();
                var mat = vp.GetModelViewMatrix();
                GL.MultMatrix(ref mat);
                DataStructures.Rendering.Rendering.DrawWireframe(faces, true);
                Matrix.Pop();
                GL.LineWidth(1);
            }

            GL.Hint(HintTarget.LineSmoothHint, HintMode.Fastest);
            GL.Disable(EnableCap.LineSmooth);
        }
开发者ID:ChristopherHaws,项目名称:sledge,代码行数:67,代码来源:ClipTool.cs


注:本文中的Sledge.UI.Viewport2D.GetModelViewMatrix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。