1
0
mirror of synced 2024-11-13 18:50:50 +01:00

More improvements

This commit is contained in:
KillzXGaming 2019-04-06 20:34:12 -04:00
parent 47dee0ea3d
commit a0b28dc7ae
12 changed files with 59 additions and 23 deletions

Binary file not shown.

View File

@ -15,7 +15,7 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
{ {
get get
{ {
var point = new RenderablePathPoint(Translate, Rotate, Scale, this); var point = new RenderablePathPoint(new Vector4(0f, 0.25f, 1f, 1f), Translate, Rotate, Scale, this);
return point; return point;
} }
} }

View File

@ -31,10 +31,12 @@ namespace GL_EditorFramework.EditorDrawables
public override bool IsSelected(int partIndex) => Selected; public override bool IsSelected(int partIndex) => Selected;
protected static Vector4 Color = new Vector4(0f, 0.25f, 1f, 1f); public Vector4 Color = new Vector4(0f, 0.25f, 1f, 1f);
public RenderablePathPoint(Vector3 pos, Vector3 rot, Vector3 sca, object nodeObject) { public RenderablePathPoint(Vector4 color, Vector3 pos, Vector3 rot, Vector3 sca, object nodeObject) {
NodeObject = nodeObject; NodeObject = nodeObject;
Color = color;
UpdateTransform(pos, rot, sca); UpdateTransform(pos, rot, sca);
} }

View File

@ -64,7 +64,7 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
{ {
get get
{ {
var point = new RenderablePathPoint(Translate, Rotate, new OpenTK.Vector3(30), this); var point = new RenderablePathPoint(new Vector4(1f, 0f, 0f, 1f), Translate, Rotate, new OpenTK.Vector3(30), this);
point.CanConnect = true; point.CanConnect = true;
return point; return point;
} }

View File

@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using GL_EditorFramework.EditorDrawables;
using OpenTK;
namespace FirstPlugin.Turbo.CourseMuuntStructs namespace FirstPlugin.Turbo.CourseMuuntStructs
{ {
@ -68,6 +70,17 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
public class LapPathPoint : PathPoint public class LapPathPoint : PathPoint
{ {
[Browsable(false)]
public override RenderablePathPoint RenderablePoint
{
get
{
var point = new RenderablePathPoint(new Vector4(0f, 0.25f, 1f, 0.1f), Translate, Rotate, Scale, this);
return point;
}
}
[Category("Properties")] [Category("Properties")]
public int CheckPoint public int CheckPoint
{ {

View File

@ -10,10 +10,21 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
{ {
public class RenderableConnectedPaths : AbstractGlDrawable public class RenderableConnectedPaths : AbstractGlDrawable
{ {
public Color LineColor = Color.Green;
public RenderableConnectedPaths(Color color) {
LineColor = color;
}
//Lap paths use 4 points for each rectangle
//This also applies to gravity paths
public bool Use4PointConnection = false;
private static ShaderProgram defaultShaderProgram; private static ShaderProgram defaultShaderProgram;
public List<PathGroup> PathGroups = new List<PathGroup>(); public List<PathGroup> PathGroups = new List<PathGroup>();
public void AddGroup(PathGroup group) public void AddGroup(PathGroup group)
{ {
PathGroups.Add(new PathGroup() PathGroups.Add(new PathGroup()
@ -60,7 +71,7 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
GL.LineWidth(2f); GL.LineWidth(2f);
foreach (var nextPt in path.NextPoints) foreach (var nextPt in path.NextPoints)
{ {
GL.Color3(Color.Blue); GL.Color3(LineColor);
GL.Begin(PrimitiveType.Lines); GL.Begin(PrimitiveType.Lines);
GL.Vertex3(path.Translate); GL.Vertex3(path.Translate);
GL.Vertex3(PathGroups[nextPt.PathID].PathPoints[nextPt.PtID].Translate); GL.Vertex3(PathGroups[nextPt.PathID].PathPoints[nextPt.PtID].Translate);
@ -68,7 +79,7 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
} }
foreach (var prevPt in path.PrevPoints) foreach (var prevPt in path.PrevPoints)
{ {
GL.Color3(Color.Blue); GL.Color3(LineColor);
GL.Begin(PrimitiveType.Lines); GL.Begin(PrimitiveType.Lines);
GL.Vertex3(path.Translate); GL.Vertex3(path.Translate);
GL.Vertex3(PathGroups[prevPt.PathID].PathPoints[prevPt.PtID].Translate); GL.Vertex3(PathGroups[prevPt.PathID].PathPoints[prevPt.PtID].Translate);
@ -86,22 +97,32 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
{ {
foreach (var path in group.PathPoints) foreach (var path in group.PathPoints)
{ {
GL.LineWidth(2f); if (Use4PointConnection)
foreach (var nextPt in path.NextPoints)
{ {
GL.Color3(Color.Blue); for (int i = 0; i < 4; i++)
GL.Begin(PrimitiveType.Lines); {
GL.Vertex3(path.Translate);
GL.Vertex3(PathGroups[nextPt.PathID].PathPoints[nextPt.PtID].Translate); }
GL.End();
} }
foreach (var prevPt in path.PrevPoints) else
{ {
GL.Color3(Color.Blue); GL.LineWidth(2f);
GL.Begin(PrimitiveType.Lines); foreach (var nextPt in path.NextPoints)
GL.Vertex3(path.Translate); {
GL.Vertex3(PathGroups[prevPt.PathID].PathPoints[prevPt.PtID].Translate); GL.Color3(LineColor);
GL.End(); GL.Begin(PrimitiveType.Lines);
GL.Vertex3(path.Translate);
GL.Vertex3(PathGroups[nextPt.PathID].PathPoints[nextPt.PtID].Translate);
GL.End();
}
foreach (var prevPt in path.PrevPoints)
{
GL.Color3(LineColor);
GL.Begin(PrimitiveType.Lines);
GL.Vertex3(path.Translate);
GL.Vertex3(PathGroups[prevPt.PathID].PathPoints[prevPt.PtID].Translate);
GL.End();
}
} }
} }
} }

View File

@ -73,19 +73,19 @@ namespace FirstPlugin.Forms
treeView1.Nodes.Add("Scene"); treeView1.Nodes.Add("Scene");
if (scene.EnemyPaths.Count > 0) { if (scene.EnemyPaths.Count > 0) {
AddPathDrawable("Enemy Path", scene.EnemyPaths); AddPathDrawable("Enemy Path", scene.EnemyPaths, Color.Red);
} }
if (scene.EnemyPaths.Count > 0) { if (scene.EnemyPaths.Count > 0) {
AddPathDrawable("Lap Path", scene.LapPaths, false); AddPathDrawable("Lap Path", scene.LapPaths,Color.Blue, false);
} }
IsLoaded = true; IsLoaded = true;
} }
private void AddPathDrawable(string Name, IEnumerable<PathGroup> Groups, bool CanConnect = true) private void AddPathDrawable(string Name, IEnumerable<PathGroup> Groups, Color color, bool CanConnect = true)
{ {
//Create a connectable object to connect each point //Create a connectable object to connect each point
var renderablePathConnected = new RenderableConnectedPaths(); var renderablePathConnected = new RenderableConnectedPaths(color);
if (CanConnect) { if (CanConnect) {
viewport.AddDrawable(renderablePathConnected); viewport.AddDrawable(renderablePathConnected);