From afaaa99dbea156a5af03b9c0c86086d66c7050d3 Mon Sep 17 00:00:00 2001
From: miku-666 <74728189+NessieHax@users.noreply.github.com>
Date: Sun, 12 Nov 2023 12:10:59 +0100
Subject: [PATCH] Added IVertexLayout
---
PCK-Studio/PckStudio.csproj | 1 +
PCK-Studio/Rendering/IVertexLayout.cs | 13 +++++++++++++
PCK-Studio/Rendering/TextureVertex.cs | 7 ++++++-
3 files changed, 20 insertions(+), 1 deletion(-)
create mode 100644 PCK-Studio/Rendering/IVertexLayout.cs
diff --git a/PCK-Studio/PckStudio.csproj b/PCK-Studio/PckStudio.csproj
index ef939342..72dcfa5e 100644
--- a/PCK-Studio/PckStudio.csproj
+++ b/PCK-Studio/PckStudio.csproj
@@ -151,6 +151,7 @@
+
diff --git a/PCK-Studio/Rendering/IVertexLayout.cs b/PCK-Studio/Rendering/IVertexLayout.cs
new file mode 100644
index 00000000..131d8e8f
--- /dev/null
+++ b/PCK-Studio/Rendering/IVertexLayout.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PckStudio.Rendering
+{
+ internal interface IVertexLayout
+ {
+ public VertexBufferLayout GetLayout();
+ }
+}
diff --git a/PCK-Studio/Rendering/TextureVertex.cs b/PCK-Studio/Rendering/TextureVertex.cs
index 682db8bf..413b797c 100644
--- a/PCK-Studio/Rendering/TextureVertex.cs
+++ b/PCK-Studio/Rendering/TextureVertex.cs
@@ -11,7 +11,7 @@ using OpenTK.Graphics;
namespace PckStudio.Rendering
{
[StructLayout(LayoutKind.Sequential, Pack = 4)]
- internal struct TextureVertex
+ internal struct TextureVertex : IVertexLayout
{
public static int SizeInBytes = Marshal.SizeOf(typeof(TextureVertex));
@@ -23,5 +23,10 @@ namespace PckStudio.Rendering
internal Vector3 Position { get; set; }
internal Vector2 TexPosition { get; set; }
+
+ public VertexBufferLayout GetLayout()
+ {
+ return new VertexBufferLayout().Add(3).Add(2);
+ }
}
}