From 90c8d96d1c7f02dd10a114811a668915921b8834 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期二, 18 三月 2025 13:28:05 +0800 Subject: [PATCH] 模型加载,基础功能缩放、平移、旋转 --- Yw.WinFrmUI.Hydro.L3d.Core/04-control/OrthoDrawer2d.cs | 77 +------------------------------------- 1 files changed, 2 insertions(+), 75 deletions(-) diff --git a/Yw.WinFrmUI.Hydro.L3d.Core/03-control/OrthoDrawer2d.cs b/Yw.WinFrmUI.Hydro.L3d.Core/04-control/OrthoDrawer2d.cs similarity index 63% rename from Yw.WinFrmUI.Hydro.L3d.Core/03-control/OrthoDrawer2d.cs rename to Yw.WinFrmUI.Hydro.L3d.Core/04-control/OrthoDrawer2d.cs index 3aaeb4a..08b4f39 100644 --- a/Yw.WinFrmUI.Hydro.L3d.Core/03-control/OrthoDrawer2d.cs +++ b/Yw.WinFrmUI.Hydro.L3d.Core/04-control/OrthoDrawer2d.cs @@ -69,76 +69,8 @@ RenderGL(); } - //鑾峰彇鑺傜偣 - private void DrawNodes() - { - if (_nw == null) - { - return; - } - GL.PointSize(5f); - GL.Begin(PrimitiveType.Points); - foreach (NodeL3d node in _nw.Nodes) - { - // 鏍规嵁楂樺害璁剧疆涓嶅悓棰滆壊 - GL.Color3(Color.Red); - GL.Vertex3(node.Position.X, node.Position.Y, node.Position.Z); - } - GL.End(); - } - - //缁樺埗绠℃ - private void DrawLinks() - { - GL.LineWidth(2.5f); - GL.Begin(PrimitiveType.Lines); - GL.Color3(Color.Blue); // 绠¢亾棰滆壊 - - foreach (var link in _nw.Links) - { - // 缁樺埗绠¢亾璧风偣鍜岀粓鐐� - GL.Vertex3(link.StartPosition.X, link.StartPosition.Y, link.StartPosition.Z); - GL.Vertex3(link.EndPosition.X, link.EndPosition.Y, link.EndPosition.Z); - } - - GL.End(); - } - - // 娣诲姞鍧愭爣杞存樉绀� - private void DrawAxes() - { - var mc = _orthoHelper.MC; - var radius = _orthoHelper.Radius; - - GL.Begin(PrimitiveType.Lines); - - // X杞达紙绾㈣壊锛� - GL.Color3(Color.Red); - GL.Vertex3(mc); - GL.Vertex3(mc + Vector3.UnitX * radius); - // Y杞达紙缁胯壊锛� - GL.Color3(Color.Green); - GL.Vertex3(mc); - GL.Vertex3(mc + Vector3.UnitY * radius); - // Z杞达紙钃濊壊锛� - GL.Color3(Color.Blue); - GL.Vertex3(mc); - GL.Vertex3(mc + Vector3.UnitZ * radius); - GL.End(); - } - - private void DrawRotationCenter() - { - GL.Color3(Color.Red); - GL.Begin(PrimitiveType.Lines); - GL.Vertex3(_orthoHelper.MC - Vector3.UnitX * 0.5f); - GL.Vertex3(_orthoHelper.MC + Vector3.UnitX * 0.5f); - GL.Vertex3(_orthoHelper.MC - Vector3.UnitY * 0.5f); - GL.Vertex3(_orthoHelper.MC + Vector3.UnitY * 0.5f); - GL.End(); - } // 娓叉煋 private void RenderGL() @@ -161,13 +93,8 @@ GL.LoadMatrix(ref viewMatrix); - DrawLinks(); - DrawNodes(); - - - //DrawAxes(); - - DrawRotationCenter(); + _nw.Draw2d(); + var code = GL.GetError(); this.glControl1.SwapBuffers(); } -- Gitblit v1.9.3