40 lines
960 B
HLSL
40 lines
960 B
HLSL
#include "PreparedSplatView.hlsli"
|
|
|
|
cbuffer FrameConstants : register(b0)
|
|
{
|
|
float4x4 gViewProjection;
|
|
float4x4 gView;
|
|
float4x4 gProjection;
|
|
float4 gCameraWorldPos;
|
|
float4 gScreenParams;
|
|
float4 gSettings;
|
|
};
|
|
|
|
StructuredBuffer<PreparedSplatView> gPreparedViews : register(t0);
|
|
StructuredBuffer<uint> gOrderBuffer : register(t1);
|
|
|
|
struct VertexOutput
|
|
{
|
|
float4 position : SV_Position;
|
|
float4 color : COLOR0;
|
|
};
|
|
|
|
VertexOutput MainVS(uint vertexId : SV_VertexID, uint instanceId : SV_InstanceID)
|
|
{
|
|
VertexOutput output;
|
|
uint splatIndex = gOrderBuffer[instanceId];
|
|
PreparedSplatView view = gPreparedViews[splatIndex];
|
|
float4 color = UnpackPreparedColor(view);
|
|
|
|
if (view.clipPosition.w <= 0.0)
|
|
{
|
|
output.position = float4(2.0, 2.0, 2.0, 1.0);
|
|
output.color = 0.0;
|
|
return output;
|
|
}
|
|
|
|
output.position = view.clipPosition;
|
|
output.color = float4(color.rgb, 1.0);
|
|
return output;
|
|
}
|