Files
Juliet/Assets/source/ImGui.vert.hlsl
Patedam 87831d0fd6 Added basic concept of Mesh
Right now can create a quad or a cube.
Need a mesh renderer taht keep the buffer and all to optimally handle the mega buffer.
2026-02-15 17:44:48 -05:00

45 lines
944 B
HLSL

struct Output
{
float4 Color : TEXCOORD0;
float2 UV : TEXCOORD1;
float4 Position : SV_Position;
};
#include "RootConstants.hlsl"
struct Vertex
{
float2 Pos;
float2 UV;
uint Color;
};
Output main(uint vertexIndex : SV_VertexID)
{
Output output;
ByteAddressBuffer buffer = ResourceDescriptorHeap[BufferIndex];
uint actualVertexIndex = vertexIndex + VertexOffset;
uint stride = 20;
uint offset = actualVertexIndex * stride;
float2 pos = asfloat(buffer.Load2(offset));
float2 uv = asfloat(buffer.Load2(offset + 8));
uint col = buffer.Load(offset + 16);
float4 c;
c.x = float(col & 0xFF) / 255.0f;
c.y = float((col >> 8) & 0xFF) / 255.0f;
c.z = float((col >> 16) & 0xFF) / 255.0f;
c.w = float((col >> 24) & 0xFF) / 255.0f;
output.Position = float4(pos * Scale + Translate, 0.0f, 1.0f);
output.Color = c;
output.UV = uv;
return output;
}