Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- FOUR WEIGHT ENVMAP SKINNING
- */
- void hardwareSkinningSecondary_vp(
- uniform float4x4 texViewProj,
- uniform float4 ambient,
- uniform float4 diffuse,
- uniform float4 emissive,
- float4 position : POSITION,
- float3 normal : NORMAL,
- float2 uv : TEXCOORD0,
- float3 uv1 : TEXCOORD1,
- float4 blendIdx : BLENDINDICES,
- float4 blendWgt : BLENDWEIGHT,
- out float4 oPosition : POSITION,
- out float2 oUv : TEXCOORD0,
- out float2 oUv1 : TEXCOORD1,
- out float3 oUv2 : TEXCOORD2,
- out float4 colour : COLOR,
- // Support up to 24 bones of float3x4
- // vs_1_1 only supports 96 params so more than this is not feasible
- uniform float3x4 worldMatrix3x4Array[64],
- uniform float4x4 viewProjectionMatrix,
- uniform float4x4 viewMatrix,
- uniform float4 lightPos[1],
- uniform float4 lightDiffuseColour[1])
- {
- // transform by indexed matrix
- float4 blendPos = float4(0,0,0,0);
- int i;
- for (i = 0; i < 4; ++i)
- {
- blendPos += float4(mul(worldMatrix3x4Array[blendIdx[i]], position).xyz, 1.0) * blendWgt[i];
- }
- // view / projection
- oPosition = mul(viewProjectionMatrix, blendPos);
- // transform normal
- float3 norm = float3(0,0,0);
- for (i = 0; i < 4; ++i)
- {
- norm += mul((float3x3)worldMatrix3x4Array[blendIdx[i]], normal) *
- blendWgt[i];
- }
- norm = normalize(norm);
- // Lighting - support point and directional
- float3 lightDir0 = normalize(
- lightPos[0].xyz - (blendPos.xyz * lightPos[0].w));
- oUv = uv;
- oUv1 = uv;
- colour = ambient * diffuse +
- diffuse * (saturate(dot(lightDir0, norm)) * lightDiffuseColour[0]) +
- emissive;
- colour = saturate( colour );
- colour.a=1;
- norm = mul( (float3x3)viewMatrix, norm );
- norm = mul( (float3x3)texViewProj, norm );
- oUv2 = norm;
- }
- /*
- THREE WEIGHT ENVMAP SKINNING
- */
- void hardwareSkinningThreeSecondary_vp(
- uniform float4x4 texViewProj,
- uniform float4 ambient,
- uniform float4 diffuse,
- uniform float4 emissive,
- float4 position : POSITION,
- float3 normal : NORMAL,
- float2 uv : TEXCOORD0,
- float3 uv1 : TEXCOORD1,
- float4 blendIdx : BLENDINDICES,
- float4 blendWgt : BLENDWEIGHT,
- out float4 oPosition : POSITION,
- out float2 oUv : TEXCOORD0,
- out float2 oUv1 : TEXCOORD1,
- out float3 oUv2 : TEXCOORD2,
- out float4 colour : COLOR,
- // Support up to 24 bones of float3x4
- // vs_1_1 only supports 96 params so more than this is not feasible
- uniform float3x4 worldMatrix3x4Array[64],
- uniform float4x4 viewProjectionMatrix,
- uniform float4x4 viewMatrix,
- uniform float4 lightPos[1],
- uniform float4 lightDiffuseColour[1])
- {
- // transform by indexed matrix
- float4 blendPos = float4(0,0,0,0);
- int i;
- for (i = 0; i < 3; ++i)
- {
- blendPos += float4(mul(worldMatrix3x4Array[blendIdx[i]], position).xyz, 1.0) * blendWgt[i];
- }
- // view / projection
- oPosition = mul(viewProjectionMatrix, blendPos);
- // transform normal
- float3 norm = float3(0,0,0);
- for (i = 0; i < 3; ++i)
- {
- norm += mul((float3x3)worldMatrix3x4Array[blendIdx[i]], normal) *
- blendWgt[i];
- }
- norm = normalize(norm);
- // Lighting - support point and directional
- float3 lightDir0 = normalize(
- lightPos[0].xyz - (blendPos.xyz * lightPos[0].w));
- oUv = uv;
- oUv1 = uv;
- colour = ambient * diffuse +
- diffuse * (saturate(dot(lightDir0, norm)) * lightDiffuseColour[0]) +
- emissive;
- colour = saturate( colour );
- colour.a=1;
- norm = mul( (float3x3)viewMatrix, norm );
- norm = mul( (float3x3)texViewProj, norm );
- oUv2 = norm;
- }
- /*
- TWO WEIGHT ENVMAP SKINNING
- */
- void hardwareSkinningTwoSecondary_vp(
- uniform float4x4 texViewProj,
- uniform float4 ambient,
- uniform float4 diffuse,
- uniform float4 emissive,
- float4 position : POSITION,
- float3 normal : NORMAL,
- float2 uv : TEXCOORD0,
- float3 uv1 : TEXCOORD1,
- float4 blendIdx : BLENDINDICES,
- float4 blendWgt : BLENDWEIGHT,
- out float4 oPosition : POSITION,
- out float2 oUv : TEXCOORD0,
- out float2 oUv1 : TEXCOORD1,
- out float3 oUv2 : TEXCOORD2,
- out float4 colour : COLOR,
- // Support up to 24 bones of float3x4
- // vs_1_1 only supports 96 params so more than this is not feasible
- uniform float3x4 worldMatrix3x4Array[64],
- uniform float4x4 viewProjectionMatrix,
- uniform float4x4 viewMatrix,
- uniform float4 lightPos[1],
- uniform float4 lightDiffuseColour[1])
- {
- // transform by indexed matrix
- float4 blendPos = float4(0,0,0,0);
- int i;
- for (i = 0; i < 2; ++i)
- {
- blendPos += float4(mul(worldMatrix3x4Array[blendIdx[i]], position).xyz, 1.0) * blendWgt[i];
- }
- // view / projection
- oPosition = mul(viewProjectionMatrix, blendPos);
- // transform normal
- float3 norm = float3(0,0,0);
- for (i = 0; i < 2; ++i)
- {
- norm += mul((float3x3)worldMatrix3x4Array[blendIdx[i]], normal) *
- blendWgt[i];
- }
- norm = normalize(norm);
- // Lighting - support point and directional
- float3 lightDir0 = normalize(
- lightPos[0].xyz - (blendPos.xyz * lightPos[0].w));
- oUv = uv;
- oUv1 = uv;
- colour = ambient * diffuse +
- diffuse * (saturate(dot(lightDir0, norm)) * lightDiffuseColour[0]) +
- emissive;
- colour = saturate( colour );
- colour.a=1;
- norm = mul( (float3x3)viewMatrix, norm );
- norm = mul( (float3x3)texViewProj, norm );
- oUv2 = norm;
- }
- /*
- ONE WEIGHT ENVMAP SKINNING
- */
- void hardwareSkinningOneSecondary_vp(
- uniform float4x4 texViewProj,
- uniform float4 ambient,
- uniform float4 diffuse,
- uniform float4 emissive,
- float4 position : POSITION,
- float3 normal : NORMAL,
- float2 uv : TEXCOORD0,
- float3 uv1 : TEXCOORD1,
- float4 blendIdx : BLENDINDICES,
- float4 blendWgt : BLENDWEIGHT,
- out float4 oPosition : POSITION,
- out float2 oUv : TEXCOORD0,
- out float2 oUv1 : TEXCOORD1,
- out float3 oUv2 : TEXCOORD2,
- out float4 colour : COLOR,
- // Support up to 24 bones of float3x4
- // vs_1_1 only supports 96 params so more than this is not feasible
- uniform float3x4 worldMatrix3x4Array[64],
- uniform float4x4 viewProjectionMatrix,
- uniform float4x4 viewMatrix,
- uniform float4 lightPos[1],
- uniform float4 lightDiffuseColour[1])
- {
- // transform by indexed matrix
- float4 blendPos = float4(0,0,0,0);
- int i;
- for (i = 0; i < 1; ++i)
- {
- blendPos += float4(mul(worldMatrix3x4Array[blendIdx[i]], position).xyz, 1.0) * blendWgt[i];
- }
- // view / projection
- oPosition = mul(viewProjectionMatrix, blendPos);
- // transform normal
- float3 norm = float3(0,0,0);
- for (i = 0; i < 1; ++i)
- {
- norm += mul((float3x3)worldMatrix3x4Array[blendIdx[i]], normal) *
- blendWgt[i];
- }
- norm = normalize(norm);
- // Lighting - support point and directional
- float3 lightDir0 = normalize(
- lightPos[0].xyz - (blendPos.xyz * lightPos[0].w));
- oUv = uv;
- oUv1 = uv;
- colour = ambient * diffuse +
- diffuse * (saturate(dot(lightDir0, norm)) * lightDiffuseColour[0]) +
- emissive;
- colour = saturate( colour );
- colour.a=1;
- norm = mul( (float3x3)viewMatrix, norm );
- norm = mul( (float3x3)texViewProj, norm );
- oUv2 = norm;
- }
- /*
- FOUR WEIGHT SKINNING
- */
- void hardwareSkinning_vp(
- uniform float4x4 texViewProj,
- uniform float4 ambient,
- uniform float4 diffuse,
- uniform float4 emissive,
- float4 position : POSITION,
- float3 normal : NORMAL,
- float2 uv : TEXCOORD0,
- float3 uv1 : TEXCOORD1,
- float4 blendIdx : BLENDINDICES,
- float4 blendWgt : BLENDWEIGHT,
- out float4 oPosition : POSITION,
- out float2 oUv : TEXCOORD0,
- out float3 oUv1 : TEXCOORD1,
- out float4 colour : COLOR,
- // Support up to 24 bones of float3x4
- // vs_1_1 only supports 96 params so more than this is not feasible
- uniform float3x4 worldMatrix3x4Array[64],
- uniform float4x4 viewProjectionMatrix,
- uniform float4x4 viewMatrix,
- uniform float4 lightPos[1],
- uniform float4 lightDiffuseColour[1])
- {
- // transform by indexed matrix
- float4 blendPos = float4(0,0,0,0);
- int i;
- for (i = 0; i < 4; ++i)
- {
- blendPos += float4(mul(worldMatrix3x4Array[blendIdx[i]], position).xyz, 1.0) * blendWgt[i];
- }
- // view / projection
- oPosition = mul(viewProjectionMatrix, blendPos);
- // transform normal
- float3 norm = float3(0,0,0);
- for (i = 0; i < 4; ++i)
- {
- norm += mul((float3x3)worldMatrix3x4Array[blendIdx[i]], normal) *
- blendWgt[i];
- }
- norm = normalize(norm);
- // Lighting - support point and directional
- float3 lightDir0 = normalize(
- lightPos[0].xyz - (blendPos.xyz * lightPos[0].w));
- oUv = uv;
- colour = ambient * diffuse +
- diffuse * (saturate(dot(lightDir0, norm)) * lightDiffuseColour[0]) +
- emissive;
- colour = saturate( colour );
- colour.a=1;
- norm = mul( (float3x3)viewMatrix, norm );
- norm = mul( (float3x3)texViewProj, norm );
- oUv1 = norm;
- }
- /*
- THREE WEIGHT SKINNING
- */
- void hardwareSkinningThree_vp(
- uniform float4x4 texViewProj,
- uniform float4 ambient,
- uniform float4 diffuse,
- uniform float4 emissive,
- float4 position : POSITION,
- float3 normal : NORMAL,
- float2 uv : TEXCOORD0,
- float3 uv1 : TEXCOORD1,
- float4 blendIdx : BLENDINDICES,
- float4 blendWgt : BLENDWEIGHT,
- out float4 oPosition : POSITION,
- out float2 oUv : TEXCOORD0,
- out float3 oUv1 : TEXCOORD1,
- out float4 colour : COLOR,
- // Support up to 24 bones of float3x4
- // vs_1_1 only supports 96 params so more than this is not feasible
- uniform float3x4 worldMatrix3x4Array[64],
- uniform float4x4 viewProjectionMatrix,
- uniform float4x4 viewMatrix,
- uniform float4 lightPos[1],
- uniform float4 lightDiffuseColour[1])
- {
- // transform by indexed matrix
- float4 blendPos = float4(0,0,0,0);
- int i;
- for (i = 0; i < 3; ++i)
- {
- blendPos += float4(mul(worldMatrix3x4Array[blendIdx[i]], position).xyz, 1.0) * blendWgt[i];
- }
- // view / projection
- oPosition = mul(viewProjectionMatrix, blendPos);
- // transform normal
- float3 norm = float3(0,0,0);
- for (i = 0; i < 3; ++i)
- {
- norm += mul((float3x3)worldMatrix3x4Array[blendIdx[i]], normal) *
- blendWgt[i];
- }
- norm = normalize(norm);
- // Lighting - support point and directional
- float3 lightDir0 = normalize(
- lightPos[0].xyz - (blendPos.xyz * lightPos[0].w));
- oUv = uv;
- colour = ambient * diffuse +
- diffuse * (saturate(dot(lightDir0, norm)) * lightDiffuseColour[0]) +
- emissive;
- colour = saturate( colour );
- colour.a=1;
- norm = mul( (float3x3)viewMatrix, norm );
- norm = mul( (float3x3)texViewProj, norm );
- oUv1 = norm;
- }
- /*
- TWO WEIGHT SKINNING
- */
- void hardwareSkinningTwo_vp(
- uniform float4x4 texViewProj,
- uniform float4 ambient,
- uniform float4 diffuse,
- uniform float4 emissive,
- float4 position : POSITION,
- float3 normal : NORMAL,
- float2 uv : TEXCOORD0,
- float3 uv1 : TEXCOORD1,
- float4 blendIdx : BLENDINDICES,
- float4 blendWgt : BLENDWEIGHT,
- out float4 oPosition : POSITION,
- out float2 oUv : TEXCOORD0,
- out float3 oUv1 : TEXCOORD1,
- out float4 colour : COLOR,
- // Support up to 24 bones of float3x4
- // vs_1_1 only supports 96 params so more than this is not feasible
- uniform float3x4 worldMatrix3x4Array[64],
- uniform float4x4 viewProjectionMatrix,
- uniform float4x4 viewMatrix,
- uniform float4 lightPos[1],
- uniform float4 lightDiffuseColour[1])
- {
- // transform by indexed matrix
- float4 blendPos = float4(0,0,0,0);
- int i;
- for (i = 0; i < 2; ++i)
- {
- blendPos += float4(mul(worldMatrix3x4Array[blendIdx[i]], position).xyz, 1.0) * blendWgt[i];
- }
- // view / projection
- oPosition = mul(viewProjectionMatrix, blendPos);
- // transform normal
- float3 norm = float3(0,0,0);
- for (i = 0; i < 2; ++i)
- {
- norm += mul((float3x3)worldMatrix3x4Array[blendIdx[i]], normal) *
- blendWgt[i];
- }
- norm = normalize(norm);
- // Lighting - support point and directional
- float3 lightDir0 = normalize(
- lightPos[0].xyz - (blendPos.xyz * lightPos[0].w));
- oUv = uv;
- colour = ambient * diffuse +
- diffuse * (saturate(dot(lightDir0, norm)) * lightDiffuseColour[0]) +
- emissive;
- colour = saturate( colour );
- colour.a=1;
- norm = mul( (float3x3)viewMatrix, norm );
- norm = mul( (float3x3)texViewProj, norm );
- oUv1 = norm;
- }
- /*
- ONE WEIGHT SKINNING
- */
- void hardwareSkinningOne_vp(
- uniform float4x4 texViewProj,
- uniform float4 ambient,
- uniform float4 diffuse,
- uniform float4 emissive,
- float4 position : POSITION,
- float3 normal : NORMAL,
- float2 uv : TEXCOORD0,
- float3 uv1 : TEXCOORD1,
- float4 blendIdx : BLENDINDICES,
- float4 blendWgt : BLENDWEIGHT,
- out float4 oPosition : POSITION,
- out float2 oUv : TEXCOORD0,
- out float3 oUv1 : TEXCOORD1,
- out float4 colour : COLOR,
- // Support up to 24 bones of float3x4
- // vs_1_1 only supports 96 params so more than this is not feasible
- uniform float3x4 worldMatrix3x4Array[64],
- uniform float4x4 viewProjectionMatrix,
- uniform float4x4 viewMatrix,
- uniform float4 lightPos[1],
- uniform float4 lightDiffuseColour[1])
- {
- // transform by indexed matrix
- float4 blendPos = float4(0,0,0,0);
- int i;
- for (i = 0; i < 1; ++i)
- {
- blendPos += float4(mul(worldMatrix3x4Array[blendIdx[i]], position).xyz, 1.0) * blendWgt[i];
- }
- // view / projection
- oPosition = mul(viewProjectionMatrix, blendPos);
- // transform normal
- float3 norm = float3(0,0,0);
- for (i = 0; i < 1; ++i)
- {
- norm += mul((float3x3)worldMatrix3x4Array[blendIdx[i]], normal) *
- blendWgt[i];
- }
- norm = normalize(norm);
- // Lighting - support point and directional
- float3 lightDir0 = normalize(
- lightPos[0].xyz - (blendPos.xyz * lightPos[0].w));
- oUv = uv;
- colour = ambient * diffuse +
- diffuse * (saturate(dot(lightDir0, norm)) * lightDiffuseColour[0]) +
- emissive;
- colour = saturate( colour );
- colour.a=1;
- norm = mul( (float3x3)viewMatrix, norm );
- norm = mul( (float3x3)texViewProj, norm );
- oUv1 = norm;
- }
- /*
- FOUR WEIGHT SKINNING BEHIND
- */
- void hardwareSkinningBehind_vp(
- uniform float4x4 texViewProj,
- uniform float4 ambient,
- uniform float4 diffuse,
- uniform float4 emissive,
- float4 position : POSITION,
- float3 normal : NORMAL,
- float2 uv : TEXCOORD0,
- float4 blendIdx : BLENDINDICES,
- float4 blendWgt : BLENDWEIGHT,
- out float4 oPosition : POSITION,
- out float2 oUv : TEXCOORD0,
- out float4 colour : COLOR,
- // Support up to 24 bones of float3x4
- // vs_1_1 only supports 96 params so more than this is not feasible
- uniform float3x4 worldMatrix3x4Array[64],
- uniform float4x4 viewProjectionMatrix,
- uniform float4x4 viewMatrix,
- uniform float4 lightPos[1],
- uniform float4 lightDiffuseColour[1])
- {
- // transform by indexed matrix
- float4 blendPos = float4(0,0,0,0);
- int i;
- for (i = 0; i < 4; ++i)
- {
- blendPos += float4(mul(worldMatrix3x4Array[blendIdx[i]], position).xyz, 1.0) * blendWgt[i];
- }
- // view / projection
- oPosition = mul(viewProjectionMatrix, blendPos);
- // transform normal
- float3 norm = float3(0,0,0);
- for (i = 0; i < 4; ++i)
- {
- norm += mul((float3x3)worldMatrix3x4Array[blendIdx[i]], normal) *
- blendWgt[i];
- }
- norm = normalize(norm);
- // Lighting - support point and directional
- float3 lightDir0 = normalize(
- lightPos[0].xyz - (blendPos.xyz * lightPos[0].w));
- colour = ambient * diffuse +
- diffuse * (saturate(dot(lightDir0, norm)) * lightDiffuseColour[0]) +
- emissive;
- colour = saturate( colour );
- colour.a=1;
- norm = mul( (float3x3)viewMatrix, norm );
- norm.xy *= .5;
- norm.xy += .5;
- norm.y *= -1.0;
- oUv = norm;
- }
- /*
- THREE WEIGHT SKINNING BEHIND
- */
- void hardwareSkinningBehindThree_vp(
- uniform float4x4 texViewProj,
- uniform float4 ambient,
- uniform float4 diffuse,
- uniform float4 emissive,
- float4 position : POSITION,
- float3 normal : NORMAL,
- float2 uv : TEXCOORD0,
- float4 blendIdx : BLENDINDICES,
- float4 blendWgt : BLENDWEIGHT,
- out float4 oPosition : POSITION,
- out float2 oUv : TEXCOORD0,
- out float4 colour : COLOR,
- // Support up to 24 bones of float3x4
- // vs_1_1 only supports 96 params so more than this is not feasible
- uniform float3x4 worldMatrix3x4Array[64],
- uniform float4x4 viewProjectionMatrix,
- uniform float4x4 viewMatrix,
- uniform float4 lightPos[1],
- uniform float4 lightDiffuseColour[1])
- {
- // transform by indexed matrix
- float4 blendPos = float4(0,0,0,0);
- int i;
- for (i = 0; i < 3; ++i)
- {
- blendPos += float4(mul(worldMatrix3x4Array[blendIdx[i]], position).xyz, 1.0) * blendWgt[i];
- }
- // view / projection
- oPosition = mul(viewProjectionMatrix, blendPos);
- // transform normal
- float3 norm = float3(0,0,0);
- for (i = 0; i < 3; ++i)
- {
- norm += mul((float3x3)worldMatrix3x4Array[blendIdx[i]], normal) *
- blendWgt[i];
- }
- norm = normalize(norm);
- // Lighting - support point and directional
- float3 lightDir0 = normalize(
- lightPos[0].xyz - (blendPos.xyz * lightPos[0].w));
- colour = ambient * diffuse +
- diffuse * (saturate(dot(lightDir0, norm)) * lightDiffuseColour[0]) +
- emissive;
- colour = saturate( colour );
- colour.a=1;
- norm = mul( (float3x3)viewMatrix, norm );
- norm.xy *= .5;
- norm.xy += .5;
- norm.y *= -1.0;
- oUv = norm;
- }
- /*
- TWO WEIGHT SKINNING BEHIND
- */
- void hardwareSkinningBehindTwo_vp(
- uniform float4x4 texViewProj,
- uniform float4 ambient,
- uniform float4 diffuse,
- uniform float4 emissive,
- float4 position : POSITION,
- float3 normal : NORMAL,
- float2 uv : TEXCOORD0,
- float4 blendIdx : BLENDINDICES,
- float4 blendWgt : BLENDWEIGHT,
- out float4 oPosition : POSITION,
- out float2 oUv : TEXCOORD0,
- out float4 colour : COLOR,
- // Support up to 24 bones of float3x4
- // vs_1_1 only supports 96 params so more than this is not feasible
- uniform float3x4 worldMatrix3x4Array[64],
- uniform float4x4 viewProjectionMatrix,
- uniform float4x4 viewMatrix,
- uniform float4 lightPos[1],
- uniform float4 lightDiffuseColour[1])
- {
- // transform by indexed matrix
- float4 blendPos = float4(0,0,0,0);
- int i;
- for (i = 0; i < 2; ++i)
- {
- blendPos += float4(mul(worldMatrix3x4Array[blendIdx[i]], position).xyz, 1.0) * blendWgt[i];
- }
- // view / projection
- oPosition = mul(viewProjectionMatrix, blendPos);
- // transform normal
- float3 norm = float3(0,0,0);
- for (i = 0; i < 2; ++i)
- {
- norm += mul((float3x3)worldMatrix3x4Array[blendIdx[i]], normal) *
- blendWgt[i];
- }
- norm = normalize(norm);
- // Lighting - support point and directional
- float3 lightDir0 = normalize(
- lightPos[0].xyz - (blendPos.xyz * lightPos[0].w));
- colour = ambient * diffuse +
- diffuse * (saturate(dot(lightDir0, norm)) * lightDiffuseColour[0]) +
- emissive;
- colour = saturate( colour );
- colour.a=1;
- norm = mul( (float3x3)viewMatrix, norm );
- norm.xy *= .5;
- norm.xy += .5;
- norm.y *= -1.0;
- oUv = norm;
- }
- /*
- ONE WEIGHT SKINNING BEHIND
- */
- void hardwareSkinningBehindOne_vp(
- uniform float4x4 texViewProj,
- uniform float4 ambient,
- uniform float4 diffuse,
- uniform float4 emissive,
- float4 position : POSITION,
- float3 normal : NORMAL,
- float2 uv : TEXCOORD0,
- float4 blendIdx : BLENDINDICES,
- float4 blendWgt : BLENDWEIGHT,
- out float4 oPosition : POSITION,
- out float2 oUv : TEXCOORD0,
- out float4 colour : COLOR,
- // Support up to 24 bones of float3x4
- // vs_1_1 only supports 96 params so more than this is not feasible
- uniform float3x4 worldMatrix3x4Array[64],
- uniform float4x4 viewProjectionMatrix,
- uniform float4x4 viewMatrix,
- uniform float4 lightPos[1],
- uniform float4 lightDiffuseColour[1])
- {
- // transform by indexed matrix
- float4 blendPos = float4(0,0,0,0);
- int i;
- for (i = 0; i < 1; ++i)
- {
- blendPos += float4(mul(worldMatrix3x4Array[blendIdx[i]], position).xyz, 1.0) * blendWgt[i];
- }
- // view / projection
- oPosition = mul(viewProjectionMatrix, blendPos);
- // transform normal
- float3 norm = float3(0,0,0);
- for (i = 0; i < 1; ++i)
- {
- norm += mul((float3x3)worldMatrix3x4Array[blendIdx[i]], normal) *
- blendWgt[i];
- }
- norm = normalize(norm);
- // Lighting - support point and directional
- float3 lightDir0 = normalize(
- lightPos[0].xyz - (blendPos.xyz * lightPos[0].w));
- colour = ambient * diffuse +
- diffuse * (saturate(dot(lightDir0, norm)) * lightDiffuseColour[0]) +
- emissive;
- colour = saturate( colour );
- colour.a=1;
- norm = mul( (float3x3)viewMatrix, norm );
- norm.xy *= .5;
- norm.xy += .5;
- norm.y *= -1.0;
- oUv = norm;
- }
- /*
- FOUR WEIGHT CASTER
- */
- void hardwareSkinningCaster_vp(
- uniform float4 emissive,
- float4 position : POSITION,
- float3 normal : NORMAL,
- float4 blendIdx : BLENDINDICES,
- float4 blendWgt : BLENDWEIGHT,
- out float4 oPosition : POSITION,
- out float4 colour : COLOR,
- // Support up to 24 bones of float3x4
- // vs_1_1 only supports 96 params so more than this is not feasible
- uniform float3x4 worldMatrix3x4Array[64],
- uniform float4x4 viewProjectionMatrix)
- {
- // transform by indexed matrix
- float4 blendPos = float4(0,0,0,0);
- int i;
- for (i = 0; i < 4; ++i)
- {
- blendPos += float4(mul(worldMatrix3x4Array[blendIdx[i]], position).xyz, 1.0) * blendWgt[i];
- }
- // view / projection
- oPosition = mul(viewProjectionMatrix, blendPos);
- // transform normal
- colour = float4( 0, 0, 0, 1 ) + emissive;
- colour.a=1;
- }
- /*
- THREE WEIGHT CASTER
- */
- void hardwareSkinningCasterThree_vp(
- uniform float4 emissive,
- float4 position : POSITION,
- float3 normal : NORMAL,
- float4 blendIdx : BLENDINDICES,
- float4 blendWgt : BLENDWEIGHT,
- out float4 oPosition : POSITION,
- out float4 colour : COLOR,
- // Support up to 24 bones of float3x4
- // vs_1_1 only supports 96 params so more than this is not feasible
- uniform float3x4 worldMatrix3x4Array[64],
- uniform float4x4 viewProjectionMatrix)
- {
- // transform by indexed matrix
- float4 blendPos = float4(0,0,0,0);
- int i;
- for (i = 0; i < 3; ++i)
- {
- blendPos += float4(mul(worldMatrix3x4Array[blendIdx[i]], position).xyz, 1.0) * blendWgt[i];
- }
- // view / projection
- oPosition = mul(viewProjectionMatrix, blendPos);
- // transform normal
- colour = float4( 0, 0, 0, 1 ) + emissive;
- colour.a=1;
- }
- /*
- TWO WEIGHT CASTER
- */
- void hardwareSkinningCasterTwo_vp(
- uniform float4 emissive,
- float4 position : POSITION,
- float3 normal : NORMAL,
- float4 blendIdx : BLENDINDICES,
- float4 blendWgt : BLENDWEIGHT,
- out float4 oPosition : POSITION,
- out float4 colour : COLOR,
- // Support up to 24 bones of float3x4
- // vs_1_1 only supports 96 params so more than this is not feasible
- uniform float3x4 worldMatrix3x4Array[64],
- uniform float4x4 viewProjectionMatrix)
- {
- // transform by indexed matrix
- float4 blendPos = float4(0,0,0,0);
- int i;
- for (i = 0; i < 2; ++i)
- {
- blendPos += float4(mul(worldMatrix3x4Array[blendIdx[i]], position).xyz, 1.0) * blendWgt[i];
- }
- // view / projection
- oPosition = mul(viewProjectionMatrix, blendPos);
- // transform normal
- colour = float4( 0, 0, 0, 1 ) + emissive;
- colour.a=1;
- }
- /*
- ONE WEIGHT CASTER
- */
- void hardwareSkinningCasterOne_vp(
- uniform float4 emissive,
- float4 position : POSITION,
- float3 normal : NORMAL,
- float4 blendIdx : BLENDINDICES,
- float4 blendWgt : BLENDWEIGHT,
- out float4 oPosition : POSITION,
- out float4 colour : COLOR,
- // Support up to 24 bones of float3x4
- // vs_1_1 only supports 96 params so more than this is not feasible
- uniform float3x4 worldMatrix3x4Array[64],
- uniform float4x4 viewProjectionMatrix)
- {
- // transform by indexed matrix
- float4 blendPos = float4(0,0,0,0);
- int i;
- for (i = 0; i < 1; ++i)
- {
- blendPos += float4(mul(worldMatrix3x4Array[blendIdx[i]], position).xyz, 1.0) * blendWgt[i];
- }
- // view / projection
- oPosition = mul(viewProjectionMatrix, blendPos);
- // transform normal
- colour = float4( 0, 0, 0, 1 ) + emissive;
- colour.a=1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement