Files
XCEngine/engine/assets/builtin/shaders/forward-lit/forward-lit.vs.hlsl

34 lines
949 B
HLSL
Raw Normal View History

// XC_BUILTIN_FORWARD_LIT_D3D12_VS
cbuffer PerObjectConstants : register(b1) {
float4x4 gProjectionMatrix;
float4x4 gViewMatrix;
float4x4 gModelMatrix;
float4x4 gNormalMatrix;
float4 gMainLightDirectionAndIntensity;
float4 gMainLightColorAndFlags;
};
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;
};
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;
return output;
}