Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void vs_main(
- // INs
- in float3 inPos : POSITION0,
- in float2 inTexCoord : TEXCOORD0,
- in float3 inNormal : NORMAL0,
- in float3 inTangent : TANGENT0,
- // OUTs
- out float4 outPos : POSITION,
- out float2 outTexCoord : TEXCOORD0,
- out float4 outLightDir : TEXCOORD1,
- // Uniforms
- uniform float4x4 worldInvTrans,
- uniform float4x4 worldViewProjection,
- uniform float terrainTilingFactor,
- uniform float3 sunlightDir
- )
- {
- float3 n = mul((float3x3)worldInvTrans, inNormal);
- float3 t = mul((float3x3)worldInvTrans, inTangent);
- float3 b = cross(n,t);
- float3x3 tbnMatrix = float3x3(t.x, b.x, n.x,
- t.y, b.y, n.y,
- t.z, b.z, n.z);
- outPos = mul(worldViewProjection, float4(inPos, 1.0f));
- outTexCoord = inTexCoord * terrainTilingFactor;
- outLightDir.xyz = -sunlightDir;
- outLightDir.xyz = mul(tbnMatrix, outLightDir.xyz);
- // Store the terrain height at this vertex position.
- // The terrain height will be used to generate the terrain texture.
- outLightDir.w = inPos.y;
- }
Add Comment
Please, Sign In to add comment