Added IVertexLayout

This commit is contained in:
miku-666
2023-11-12 12:10:59 +01:00
parent ebf84dc4ba
commit afaaa99dbe
3 changed files with 20 additions and 1 deletions

View File

@@ -151,6 +151,7 @@
<Compile Include="Rendering\Camera.cs" />
<Compile Include="Rendering\CubeRenderGroup.cs" />
<Compile Include="Rendering\IndexBuffer.cs" />
<Compile Include="Rendering\IVertexLayout.cs" />
<Compile Include="Rendering\PerspectiveCamera.cs" />
<Compile Include="Rendering\RenderBuffer.cs" />
<Compile Include="Rendering\Renderer.cs" />

View File

@@ -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();
}
}

View File

@@ -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<float>(3).Add<float>(2);
}
}
}