Danbias/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/VertexGatherData.hlsl

25 lines
963 B
HLSL

#include "GBufferHeader.hlsli"
VertexOut main( VertexIn input )
{
VertexOut output;
float3 offsetX = input.pos - BindPoseData[input.boneIndex.x][3].xyz;
float3 offsetY = input.pos - BindPoseData[input.boneIndex.y][3].xyz;
float3 offsetZ = input.pos - BindPoseData[input.boneIndex.z][3].xyz;
float3 offsetW = input.pos - BindPoseData[input.boneIndex.w][3].xyz;
Matrix boneTrans = AnimatedData[input.boneIndex.x]*input.boneWeight.x +
AnimatedData[input.boneIndex.y]*input.boneWeight.y +
AnimatedData[input.boneIndex.z]*input.boneWeight.z +
AnimatedData[input.boneIndex.w]*input.boneWeight.w;
input.pos = mul(boneTrans,float4(input.pos,1)).xyz * Animated + input.pos * int(1-Animated);
input.normal = mul(boneTrans,float4(input.normal,1)).xyz * Animated + input.normal * int(1-Animated);
output.pos = mul(WVP, float4(input.pos,1));
output.normal = mul(WV, float4(input.normal,0)).xyz;
output.UV = input.UV;
return output;
}