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.
This commit is contained in:
@@ -10,20 +10,16 @@ Output main(uint vertexIndex : SV_VertexID)
|
||||
{
|
||||
Output output;
|
||||
|
||||
// Retrieve the buffer using SM6.6 bindless syntax
|
||||
// Use BufferIndex from RootConstants (pushed via SetPushConstants)
|
||||
ByteAddressBuffer buffer = ResourceDescriptorHeap[BufferIndex];
|
||||
|
||||
// Read position from buffer (Index * stride)
|
||||
// Stride = 2 float (pos) + 4 float (color) = 6 * 4 = 24 bytes ?
|
||||
// Let's assume just position 2D (8 bytes) + Color (16 bytes)
|
||||
uint stride = 24;
|
||||
uint stride = 28;
|
||||
uint offset = vertexIndex * stride;
|
||||
|
||||
float2 pos = asfloat(buffer.Load2(offset));
|
||||
float4 col = asfloat(buffer.Load4(offset + 8));
|
||||
float3 pos = asfloat(buffer.Load3(offset));
|
||||
float4 col = asfloat(buffer.Load4(offset + 12));
|
||||
|
||||
output.Position = float4(pos, 0.0f, 1.0f);
|
||||
//output.Position = float4(pos, 1.0f);
|
||||
output.Position = mul(ViewProjection, float4(pos, 1.0f));
|
||||
output.Color = col;
|
||||
return output;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user