2026-04-02 23:04:59 +08:00
|
|
|
// XC_BUILTIN_FORWARD_LIT_D3D12_VS
|
2026-04-05 13:50:52 +08:00
|
|
|
cbuffer PerObjectConstants : register(b0) {
|
2026-04-02 23:04:59 +08:00
|
|
|
float4x4 gProjectionMatrix;
|
|
|
|
|
float4x4 gViewMatrix;
|
|
|
|
|
float4x4 gModelMatrix;
|
|
|
|
|
float4x4 gNormalMatrix;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct VSInput {
|
|
|
|
|
float3 position : POSITION;
|
|
|
|
|
float3 normal : NORMAL;
|
|
|
|
|
float2 texcoord : TEXCOORD0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct PSInput {
|
|
|
|
|
float4 position : SV_POSITION;
|
|
|
|
|
float3 normalWS : TEXCOORD0;
|
|
|
|
|
float2 texcoord : TEXCOORD1;
|
2026-04-04 23:01:34 +08:00
|
|
|
float3 positionWS : TEXCOORD2;
|
2026-04-02 23:04:59 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
PSInput MainVS(VSInput input) {
|
|
|
|
|
PSInput output;
|
|
|
|
|
float4 positionWS = mul(gModelMatrix, float4(input.position, 1.0f));
|
|
|
|
|
float4 positionVS = mul(gViewMatrix, positionWS);
|
|
|
|
|
output.position = mul(gProjectionMatrix, positionVS);
|
|
|
|
|
output.normalWS = mul((float3x3)gNormalMatrix, input.normal);
|
|
|
|
|
output.texcoord = input.texcoord;
|
2026-04-04 23:01:34 +08:00
|
|
|
output.positionWS = positionWS.xyz;
|
2026-04-02 23:04:59 +08:00
|
|
|
return output;
|
|
|
|
|
}
|