2022-11-09 19:54:42 +00:00
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using MoonWorks.Graphics;
|
|
|
|
|
using MoonWorks.Math.Float;
|
|
|
|
|
|
|
|
|
|
namespace MoonWorks.Test
|
|
|
|
|
{
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
2023-01-06 20:38:30 +00:00
|
|
|
|
public struct PositionVertex : IVertexType
|
2022-11-12 17:51:22 +00:00
|
|
|
|
{
|
|
|
|
|
public Vector3 Position;
|
|
|
|
|
|
|
|
|
|
public PositionVertex(Vector3 position)
|
|
|
|
|
{
|
|
|
|
|
Position = position;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-06 20:38:30 +00:00
|
|
|
|
public static VertexElementFormat[] Formats { get; } = new VertexElementFormat[1]
|
|
|
|
|
{
|
|
|
|
|
VertexElementFormat.Vector3
|
|
|
|
|
};
|
|
|
|
|
|
2022-11-12 17:51:22 +00:00
|
|
|
|
public override string ToString()
|
2024-02-07 15:27:55 +00:00
|
|
|
|
{
|
2022-11-12 17:51:22 +00:00
|
|
|
|
return Position.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-07 15:27:55 +00:00
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
2023-01-06 20:38:30 +00:00
|
|
|
|
public struct PositionColorVertex : IVertexType
|
2022-11-09 19:54:42 +00:00
|
|
|
|
{
|
|
|
|
|
public Vector3 Position;
|
|
|
|
|
public Color Color;
|
|
|
|
|
|
|
|
|
|
public PositionColorVertex(Vector3 position, Color color)
|
|
|
|
|
{
|
|
|
|
|
Position = position;
|
|
|
|
|
Color = color;
|
|
|
|
|
}
|
2022-11-12 03:51:31 +00:00
|
|
|
|
|
2023-01-06 20:38:30 +00:00
|
|
|
|
public static VertexElementFormat[] Formats { get; } = new VertexElementFormat[2]
|
|
|
|
|
{
|
|
|
|
|
VertexElementFormat.Vector3,
|
|
|
|
|
VertexElementFormat.Color
|
|
|
|
|
};
|
|
|
|
|
|
2022-11-12 03:51:31 +00:00
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
|
|
|
|
return Position + " | " + Color;
|
|
|
|
|
}
|
2022-11-09 19:54:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
2023-01-06 20:38:30 +00:00
|
|
|
|
public struct PositionTextureVertex : IVertexType
|
2022-11-09 19:54:42 +00:00
|
|
|
|
{
|
|
|
|
|
public Vector3 Position;
|
|
|
|
|
public Vector2 TexCoord;
|
|
|
|
|
|
|
|
|
|
public PositionTextureVertex(Vector3 position, Vector2 texCoord)
|
|
|
|
|
{
|
|
|
|
|
Position = position;
|
|
|
|
|
TexCoord = texCoord;
|
|
|
|
|
}
|
2022-11-12 03:51:31 +00:00
|
|
|
|
|
2023-01-06 20:38:30 +00:00
|
|
|
|
public static VertexElementFormat[] Formats { get; } = new VertexElementFormat[2]
|
|
|
|
|
{
|
|
|
|
|
VertexElementFormat.Vector3,
|
|
|
|
|
VertexElementFormat.Vector2
|
|
|
|
|
};
|
|
|
|
|
|
2024-02-07 15:27:55 +00:00
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
2022-11-12 03:51:31 +00:00
|
|
|
|
return Position + " | " + TexCoord;
|
2024-02-07 15:27:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-11-09 19:54:42 +00:00
|
|
|
|
}
|