Render EntityIDs (breaks post processing)

This commit is contained in:
Simon Lübeß
2022-05-28 15:42:48 +02:00
parent 164d420a25
commit d212576719
17 changed files with 242 additions and 191 deletions
+32 -2
View File
@@ -1,3 +1,5 @@
#define EDITOR
Texture2D Texture : register(t0);
SamplerState Sampler : register(s0);
@@ -13,6 +15,9 @@ struct VS_Input
float4x4 Transform : TRANSFORM;
float4 Color : COLOR;
float4 UVTransform : TEXCOORD1;
#ifdef EDITOR
uint EntityId : ENTITYID;
#endif
};
struct PS_Input
@@ -20,6 +25,9 @@ struct PS_Input
float4 Position : SV_Position;
float2 Texcoord : TEXCOORD;
float4 Color : COLOR;
#ifdef EDITOR
nointerpolation uint EntityId : ENTITYID;
#endif
};
PS_Input VS(VS_Input input)
@@ -30,12 +38,34 @@ PS_Input VS(VS_Input input)
output.Texcoord = input.UVTransform.xy + input.UVTransform.zw * input.Texcoord;
output.Color = input.Color;
#ifdef EDITOR
output.EntityId = input.EntityId;
#endif
return output;
}
float4 PS(PS_Input input) : SV_Target0
struct PS_Output
{
return Texture.Sample(Sampler, input.Texcoord) * input.Color;
float4 Color : SV_Target0;
#ifdef EDITOR
uint EntityId : SV_TARGET1;
#endif
};
PS_Output PS(PS_Input input)
{
PS_Output output;
output.Color = Texture.Sample(Sampler, input.Texcoord) * input.Color;
clip(output.Color.a - 0.001f);
#ifdef EDITOR
output.EntityId = input.EntityId;
#endif
return output;
}
#effect[VS=VS, PS=PS]