This repository has been archived on 2024-03-22. You can view files and clone it, but cannot push or open issues or pull requests.
DX11Starter/SimpleVertexPBR.hlsl
2022-04-09 20:19:44 -04:00

24 lines
633 B
HLSL

#include "Defines.hlsli"
cbuffer ExternalData : register(b0)
{
matrix world;
matrix worldInvTranspose;
matrix view;
matrix projection;
}
VertexToPixel main(VertexShaderInput input)
{
VertexToPixel output;
matrix worldViewProjection = mul(projection, mul(view, world));
output.screenPosition = mul(worldViewProjection, float4(input.localPosition, 1.0f));
output.uv = input.uv;
output.normal = normalize(mul((float3x3)worldInvTranspose, input.normal));
output.tangent = normalize(mul((float3x3)worldInvTranspose, input.tangent));
output.worldPosition = mul(world, float4(input.localPosition, 1)).xyz;
return output;
}