55 lines
1.7 KiB
Plaintext
55 lines
1.7 KiB
Plaintext
{
|
|
parms {
|
|
stageSort sortCoverage
|
|
}
|
|
state {
|
|
depthfunc GL_LEQUAL
|
|
}
|
|
hlsl_vp {
|
|
#include "includes/vertex.inc"
|
|
|
|
CALC_TEXCOORDS( result.texcoord0 );
|
|
float4 position;
|
|
float4 normal;
|
|
float4 tangent;
|
|
float3 worldPosition;
|
|
CALC_PNT( position, normal, tangent );
|
|
CALC_SKINNED_POSITION_NORMALS( result.position, result.texcoord1, result.texcoord2, result.texcoord3, result.texcoord4, position, normal, tangent, worldPosition );
|
|
}
|
|
hlsl_fp {
|
|
#include "includes/vmtr.inc"
|
|
|
|
half4 sampleDiffuse;
|
|
half4 sampleSpecular;
|
|
half4 sampleNormal;
|
|
half3 fromViewerN;
|
|
half3 globalNormal;
|
|
half4 globalReflection;
|
|
half4 color;
|
|
|
|
sampleDiffuse = tex2D( $spareDiffuseMap, fragment.texcoord0.xy );
|
|
sampleSpecular = tex2D( $spareSpecularMap, fragment.texcoord0.xy );
|
|
sampleNormal = tex2D( $spareBumpMap, fragment.texcoord0.xy );
|
|
|
|
half3 diffuse = sampleDiffuse.xyz;
|
|
half3 specular = sampleSpecular.xyz;
|
|
half power = 1.0;
|
|
|
|
CALC_FROM_VIEWER( fromViewerN, fragment.texcoord4.xyz );
|
|
CALC_GLOBAL_NORMAL( globalNormal, sampleNormal, fragment.texcoord1.xyz, fragment.texcoord2.xyz, fragment.texcoord3.xyz );
|
|
CALC_GLOBAL_REFLECTION( globalReflection, globalNormal, fromViewerN );
|
|
|
|
APPLY_SPECULAR_REFLECTION( specular, power, globalReflection );
|
|
{
|
|
half3 cameraLightV = normalize( -fragment.texcoord4.xyz + half3( 0.0, 0.0, 6.5 ) );
|
|
half cameraDot = saturate( dot3( globalNormal, cameraLightV ) );
|
|
specular += _half3( saturate( pow( cameraDot, $eyeHighlightPowLevel.x ) * $eyeHighlightPowLevel.y ) );
|
|
}
|
|
APPLY_SCALING( diffuse, specular );
|
|
|
|
APPLY_LIGHTING( color, diffuse, specular, globalNormal );
|
|
|
|
result.color0 = color;
|
|
result.color1 = _float4( 0.0 );
|
|
}
|
|
} |