2019-10-20 18:57:48 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using OpenTK;
|
|
|
|
|
using OpenTK.Graphics.OpenGL;
|
|
|
|
|
using FirstPlugin.Turbo.CourseMuuntStructs;
|
|
|
|
|
using Toolbox.Library;
|
2019-10-27 02:28:56 +02:00
|
|
|
|
using Toolbox.Library.IO;
|
2019-10-20 18:57:48 +02:00
|
|
|
|
|
|
|
|
|
namespace FirstPlugin.MuuntEditor
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Represets a path with multiple grouped points that connect to each other
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class RenderablePath : IDrawableObject
|
|
|
|
|
{
|
|
|
|
|
public Color LineColor = Color.Green;
|
|
|
|
|
|
|
|
|
|
public List<BasePathGroup> PathGroups = new List<BasePathGroup>();
|
|
|
|
|
|
2019-10-27 02:28:56 +02:00
|
|
|
|
public RenderablePath(List<BasePathGroup> pathGroups, Color color)
|
2019-10-20 18:57:48 +02:00
|
|
|
|
{
|
|
|
|
|
PathGroups = pathGroups;
|
2019-10-27 02:28:56 +02:00
|
|
|
|
LineColor = color;
|
2019-10-20 18:57:48 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Draw(Matrix4 mvp)
|
|
|
|
|
{
|
2019-10-27 02:28:56 +02:00
|
|
|
|
GL.Disable(EnableCap.DepthTest);
|
2019-10-20 18:57:48 +02:00
|
|
|
|
for (int i = 0; i < PathGroups.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
foreach (var path in PathGroups[i].PathPoints)
|
|
|
|
|
{
|
|
|
|
|
var translate = new Vector3(path.Translate.X, path.Translate.Z, path.Translate.Y);
|
|
|
|
|
|
|
|
|
|
if (path.IsSelected)
|
2019-10-27 02:28:56 +02:00
|
|
|
|
Render2D.DrawFilledCircle(translate, Color.LightGreen, 30, 40, true);
|
2019-10-20 18:57:48 +02:00
|
|
|
|
else if (path.IsHovered)
|
2019-10-27 02:28:56 +02:00
|
|
|
|
Render2D.DrawFilledCircle(translate, LineColor.Lighten(40), 40, 40, true);
|
2019-10-20 18:57:48 +02:00
|
|
|
|
else
|
2019-10-27 02:28:56 +02:00
|
|
|
|
Render2D.DrawFilledCircle(translate, LineColor.Darken(20), 30, 40, true);
|
2019-10-20 18:57:48 +02:00
|
|
|
|
|
|
|
|
|
GL.LineWidth(2f);
|
|
|
|
|
foreach (var nextPt in path.NextPoints)
|
|
|
|
|
{
|
|
|
|
|
var nextTranslate = PathGroups[nextPt.PathID].PathPoints[nextPt.PtID].Translate;
|
|
|
|
|
|
|
|
|
|
GL.Color3(LineColor);
|
|
|
|
|
GL.Begin(PrimitiveType.Lines);
|
|
|
|
|
GL.Vertex3(translate);
|
|
|
|
|
GL.Vertex3(nextTranslate.X, nextTranslate.Z, nextTranslate.Y);
|
|
|
|
|
GL.End();
|
|
|
|
|
}
|
|
|
|
|
foreach (var prevPt in path.PrevPoints)
|
|
|
|
|
{
|
|
|
|
|
var prevTranslate = PathGroups[prevPt.PathID].PathPoints[prevPt.PtID].Translate;
|
|
|
|
|
|
|
|
|
|
GL.Color3(LineColor);
|
|
|
|
|
GL.Begin(PrimitiveType.Lines);
|
|
|
|
|
GL.Vertex3(translate);
|
|
|
|
|
GL.Vertex3(prevTranslate.X, prevTranslate.Z, prevTranslate.Y);
|
|
|
|
|
GL.End();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-10-27 02:28:56 +02:00
|
|
|
|
GL.Enable(EnableCap.DepthTest);
|
2019-10-20 18:57:48 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|