Skip to content

Commit

Permalink
try refactory AdjustLaneIntersection()
Browse files Browse the repository at this point in the history
  • Loading branch information
MikiraSora committed Sep 21, 2024
1 parent 56521c6 commit 6b9eef5
Show file tree
Hide file tree
Showing 3 changed files with 202 additions and 87 deletions.
2 changes: 1 addition & 1 deletion OngekiFumenEditor/AppBootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ void exceptionDump(Exception e, int level = 0)
exceptionHandling = true;
Environment.Exit(-1);
#else
throw exception;
throw new Exception(exception.Message, exception);
#endif
}

Expand Down
69 changes: 36 additions & 33 deletions OngekiFumenEditor/Kernel/Graphics/IDrawingContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,50 @@

namespace OngekiFumenEditor.Kernel.Graphics
{
public interface IDrawingContext
{
/// <summary>
/// 左手坐标系为世界坐标系的可视区域
/// </summary>
public struct VisibleRect
{
public VisibleRect(Vector2 buttomRight, Vector2 topLeft)
{
TopLeft = topLeft;
ButtomRight = buttomRight;
}
public interface IDrawingContext
{
/// <summary>
/// 左手坐标系为世界坐标系的可视区域
/// </summary>
public struct VisibleRect
{
public VisibleRect(Vector2 buttomRight, Vector2 topLeft)
{
TopLeft = topLeft;
ButtomRight = buttomRight;
}

public Vector2 TopLeft { get; init; }
public Vector2 ButtomRight { get; init; }
public Vector2 TopLeft { get; init; }
public Vector2 ButtomRight { get; init; }

public float Width => ButtomRight.X - TopLeft.X;
public float Height => TopLeft.Y - ButtomRight.Y;
public float Width => ButtomRight.X - TopLeft.X;
public float Height => TopLeft.Y - ButtomRight.Y;

public float MinY => ButtomRight.Y;
public float MaxY => TopLeft.Y;
public float MinY => ButtomRight.Y;
public float MaxY => TopLeft.Y;

public float MinX => TopLeft.X;
public float MaxX => ButtomRight.X;
}
public float CenterX => (ButtomRight.X + TopLeft.X) / 2;
public float CenterY => (ButtomRight.Y + TopLeft.Y) / 2;

//values are updating by frame
public VisibleRect Rect { get; }
public float MinX => TopLeft.X;
public float MaxX => ButtomRight.X;
}

public float ViewWidth => Rect.Width;
public float ViewHeight => Rect.Height;
//values are updating by frame
public VisibleRect Rect { get; }

Matrix4 ProjectionMatrix { get; }
Matrix4 ViewMatrix { get; }
Matrix4 ViewProjectionMatrix { get; }
public float ViewWidth => Rect.Width;
public float ViewHeight => Rect.Height;

IPerfomenceMonitor PerfomenceMonitor { get; }
Matrix4 ProjectionMatrix { get; }
Matrix4 ViewMatrix { get; }
Matrix4 ViewProjectionMatrix { get; }

void PrepareEditorLoop(GLWpfControl glView);
void OnRenderSizeChanged(GLWpfControl glView, SizeChangedEventArgs e);
IPerfomenceMonitor PerfomenceMonitor { get; }

void Render(TimeSpan ts);
}
void PrepareEditorLoop(GLWpfControl glView);
void OnRenderSizeChanged(GLWpfControl glView, SizeChangedEventArgs e);

void Render(TimeSpan ts);
}
}
Loading

0 comments on commit 6b9eef5

Please sign in to comment.