#define PARAM__clip_out_packed_distances1_UNUSED #define PARAM_vertexToFragment_color_dir3_5_UNUSED #define PARAM_vertexToFragment_Normal_1_UNUSED #define PARAM_vertexToFragment_litColor_6_UNUSED #define PARAM_vertexToFragment_Tangent_7_UNUSED #define PARAM_vertexToFragment_position_world_12_UNUSED #define PARAM_vertexToFragment_position_object_11_UNUSED #define PARAM_vertexToFragment_color_dir1_3_UNUSED #define PARAM_vertexToFragment_position_screen_10_UNUSED #define PARAM__clip_out_packed_distances2_UNUSED #define PARAM_vertexToFragment_Bitangent_8_UNUSED #define PARAM_vertexToFragment_position_camera_13_UNUSED #define PARAM_vertexToFragment_color_dir2_4_UNUSED #define PARAM_vertexToFragment_eyeDirectionObj_14_UNUSED #define PARAM_vertexToFragment_fogTC_16_UNUSED #define _INITIALIZE_UNUSED_V2F #ifdef PROGRAM_TYPE_VERTEX struct _ClipPlanes { uniform float4 plane0; uniform float4 plane1; uniform float4 plane2; uniform float4 plane3; uniform float4 plane4; uniform float4 plane5; uniform float4 packedDists0; uniform float4 packedDists1; }; _ClipPlanes _clipPlanes; #if (defined(VERT_PROFILE_VP40) || defined(VERT_PROFILE_GP4VP)) #define _CLIP_OUTPUT(N) out varying float _clip_ ## N : CLP ## N; #define _CLIP_OUTPUT_UNUSED(N) float _clip_ ## N; #else #define _CLIP_OUTPUT(N) #define _CLIP_OUTPUT_UNUSED(N) #ifndef PARAM__clip_out_packed_distances1_UNUSED out varying float4 _clip_out_packed_distances1 : TEXCOORD7; #endif #ifndef PARAM__clip_out_packed_distances2_UNUSED out varying float4 _clip_out_packed_distances2 : TEXCOORD6; #endif #endif #else #if !((defined(VERT_PROFILE_VP40) || defined(VERT_PROFILE_GP4VP))) #ifndef PARAM__clip_out_packed_distances1_UNUSED in varying float4 _clip_out_packed_distances1 : TEXCOORD7; #else float4 _clip_out_packed_distances1 = float4(0); #endif #ifndef PARAM__clip_out_packed_distances2_UNUSED in varying float4 _clip_out_packed_distances2 : TEXCOORD6; #else float4 _clip_out_packed_distances2 = float4(0); #endif #endif #endif #ifdef PROGRAM_TYPE_VERTEX #define _CLIP_COMPUTE_DIST(N, CLIP_POS) \ float _clip_dist ## N = dot (_clipPlanes.plane ## N, CLIP_POS); \ _clip_dist ## N -= (N < 4) \ ? _clipPlanes.packedDists0[N] \ : _clipPlanes.packedDists1[N-4]; #define _CLIP_COMPUTE_DIST_CD(N, CLIP_POS, CLIP_DIST) \ float _clip_dist ## N = dot (_clipPlanes.plane ## N, CLIP_POS); \ _clip_dist ## N -= CLIP_DIST; #define _CLIP_UNUSED(N) \ float _clip_dist ## N = 0; #else #endif #ifdef PROGRAM_TYPE_VERTEX #define _CLIP_COMPUTE_DISTS(P_Eye, P_World, P_Object) \ _CLIP_COMPUTE_DIST_CD(0, P_World, 0.000000) \ _CLIP_COMPUTE_DIST(1, P_Eye) \ _CLIP_COMPUTE_DIST(2, P_Eye) \ _CLIP_UNUSED(3) \ _CLIP_UNUSED(4) \ _CLIP_UNUSED(5) _CLIP_OUTPUT(0) _CLIP_OUTPUT(1) _CLIP_OUTPUT(2) _CLIP_OUTPUT_UNUSED(3) _CLIP_OUTPUT_UNUSED(4) _CLIP_OUTPUT_UNUSED(5) #endif #ifdef PROGRAM_TYPE_FRAGMENT #define _CLIP_TO_DISTS \ clip (_clip_out_packed_distances1); #endif #ifdef PROGRAM_TYPE_VERTEX #if (defined(VERT_PROFILE_VP40) || defined(VERT_PROFILE_GP4VP)) #define APPLY_CLIPPING_VP(P_Eye, P_World, P_Object) \ _CLIP_COMPUTE_DISTS(P_Eye, P_World, P_Object) \ _clip_0 = _clip_dist0; \ _clip_1 = _clip_dist1; \ _clip_2 = _clip_dist2; \ _clip_3 = _clip_dist3; \ _clip_4 = _clip_dist4; \ _clip_5 = _clip_dist5; #define APPLY_CLIPPING_VP_POSINV(P_Eye, P_World, P_Object) APPLY_CLIPPING_VP(P_Eye, P_World, P_Object) #else #define APPLY_CLIPPING_VP_POSINV(P_Eye, P_World, P_Object) #if defined(VENDOR_ATI) #define APPLY_CLIPPING_VP(P_Eye, P_World, P_Object) APPLY_CLIPPING_VP_POSINV(P_Eye, P_World, P_Object) #else #ifndef PARAM__clip_out_packed_distances1_UNUSED #define _CLIP_PACK_DISTS_1 \ _clip_out_packed_distances1.x = _clip_dist0; \ _clip_out_packed_distances1.y = _clip_dist1; \ _clip_out_packed_distances1.z = _clip_dist2; \ _clip_out_packed_distances1.w = _clip_dist3; #else #define _CLIP_PACK_DISTS_1 #endif #ifndef PARAM__clip_out_packed_distances2_UNUSED #define _CLIP_PACK_DISTS_2 \ _clip_out_packed_distances2.x = _clip_dist4; \ _clip_out_packed_distances2.y = _clip_dist5; \ _clip_out_packed_distances2.z = 0; \ _clip_out_packed_distances2.w = 0; #else #define _CLIP_PACK_DISTS_2 #endif #define APPLY_CLIPPING_VP(P_Eye, P_World, P_Object) \ _CLIP_COMPUTE_DISTS(P_Eye, P_World, P_Object) \ _CLIP_PACK_DISTS_1 \ _CLIP_PACK_DISTS_2 #endif #endif #else #define APPLY_CLIPPING_FP_POSINV #if ((defined(VERT_PROFILE_VP40) || defined(VERT_PROFILE_GP4VP))) #define APPLY_CLIPPING_FP #else #if defined(VENDOR_ATI) #define APPLY_CLIPPING_FP APPLY_CLIPPING_FP_POSINV #else #define APPLY_CLIPPING_FP _CLIP_TO_DISTS #endif #endif #endif //@@UNUSED? PARAM_vertexToFragment_texCoord_0_UNUSED //@@UNUSED? PARAM_vertexToFragment_Normal_1_UNUSED //@@UNUSED? PARAM_vertexToFragment_texCoordLM_2_UNUSED //@@UNUSED? PARAM_vertexToFragment_color_dir1_3_UNUSED //@@UNUSED? PARAM_vertexToFragment_color_dir2_4_UNUSED //@@UNUSED? PARAM_vertexToFragment_color_dir3_5_UNUSED //@@UNUSED? PARAM_vertexToFragment_litColor_6_UNUSED //@@UNUSED? PARAM_vertexToFragment_Tangent_7_UNUSED //@@UNUSED? PARAM_vertexToFragment_Bitangent_8_UNUSED //@@UNUSED? PARAM_vertexToFragment_position_9_UNUSED //@@UNUSED? PARAM_vertexToFragment_position_screen_10_UNUSED //@@UNUSED? PARAM_vertexToFragment_position_object_11_UNUSED //@@UNUSED? PARAM_vertexToFragment_position_world_12_UNUSED //@@UNUSED? PARAM_vertexToFragment_position_camera_13_UNUSED //@@UNUSED? PARAM_vertexToFragment_eyeDirectionObj_14_UNUSED //@@UNUSED? PARAM_vertexToFragment_eyeDirectionTangent_15_UNUSED //@@UNUSED? PARAM_vertexToFragment_fogTC_16_UNUSED #ifndef __CG_GLOBAL_OBJECTTOWORLD_CG_INC__ #define __CG_GLOBAL_OBJECTTOWORLD_CG_INC__ /* objectToWorld transform, set by the position snippet. Global variable instance of an (as usual) privately pulled input as objectToWorld may be set in different ways (notably in instanced vs 'normal' rendering) which only the position snippet really knows. */ float4x4 objectToWorld; void SetGlobalObjectToWorld (float4x4 o2w) { objectToWorld = o2w; } #endif // __CG_GLOBAL_OBJECTTOWORLD_CG_INC__ #ifndef __CG_GLOBAL_OBJECTTOWORLD_CG_INC__ #define __CG_GLOBAL_OBJECTTOWORLD_CG_INC__ /* objectToWorld transform, set by the position snippet. Global variable instance of an (as usual) privately pulled input as objectToWorld may be set in different ways (notably in instanced vs 'normal' rendering) which only the position snippet really knows. */ float4x4 objectToWorld; void SetGlobalObjectToWorld (float4x4 o2w) { objectToWorld = o2w; } #endif // __CG_GLOBAL_OBJECTTOWORLD_CG_INC__ #ifndef __DIRECTIONAL_LMS_CG_INC__ #define __DIRECTIONAL_LMS_CG_INC__ float3 ComputeDLMCoeff (float3 direction) { /* These should really match up with those in lighter2... */ float3 base[3] = { float3 (/* -1/sqrt(6) */ -0.408248, /* 1/sqrt(2) */ 0.707107, /* 1/sqrt(3) */ 0.577350), float3 (/* sqrt(2/3) */ 0.816497, 0, /* 1/sqrt(3) */ 0.577350), float3 (/* -1/sqrt(6) */ -0.408248, /* -1/sqrt(2) */ -0.707107, /* 1/sqrt(3) */ 0.577350) }; float3 coeff = float3 (saturate (dot (direction, base[0])), saturate (dot (direction, base[1])), saturate (dot (direction, base[2]))); return coeff * coeff; } float3 ComputeDLMColor (float3 direction, float3 baseColor[3]) { float3 coeff = ComputeDLMCoeff (direction); return (coeff.x * baseColor[0] + coeff.y * baseColor[1] + coeff.z * baseColor[2]); } #endif // __DIRECTIONAL_LMS_CG_INC__ #ifndef __LIGHTFUNCS_CG_INC__ #define __LIGHTFUNCS_CG_INC__ #define MAX_LIGHTS 8 half Attenuation_Linear (float d, float invLightRadius) { return (half)(saturate (1 - d * invLightRadius)); } half Attenuation_Inverse (float d) { return 1/d; } half Attenuation_Realistic (float d) { return 1/(d*d); } half Attenuation_CLQ (float d, float3 coeff) { return 1/(dot (float3 (1, d, d*d), float3 (coeff))); } half Light_Spot (half3 surfToLight, half3 lightDir, half falloffInner, half falloffOuter) { return smoothstep (falloffOuter, falloffInner, dot (surfToLight, lightDir)); } struct LightProperties { // Number of lights provided int count; // Light world-space position float4 posWorld[MAX_LIGHTS]; // Transformation from light space to world space float4x4 transform[MAX_LIGHTS]; // Transformation from world space to light space float4x4 transformInv[MAX_LIGHTS]; // Diffuse color float3 colorDiffuse[MAX_LIGHTS]; // Specular color float3 colorSpecular[MAX_LIGHTS]; // Attenuation vector (XYZ are CLQ coefficients; W is light radius) float4 attenuationVec[MAX_LIGHTS]; // Cosine of inner falloff angle float falloffInner[MAX_LIGHTS]; // Cosine of outerr falloff angle float falloffOuter[MAX_LIGHTS]; }; LightProperties lightProps; interface LightSpace { half3 GetDirection(); half3 GetSurfaceToLight(); float GetLightDistance (); }; struct LightSpaceWorld : LightSpace { half3 dir; half3 surfToLight; float lightDist; void Init (int lightNum, float4 surfPositionWorld) { float4 pos = lightProps.posWorld[lightNum]; float4x4 lightTransform = lightProps.transform[lightNum]; float3 lightDirW = mul (lightTransform, float4 (0, 0, 1, 0)).xyz; dir = lightDirW; /* Compute distance between surface and light with float precision to avoid precision issues with GF6 (see trac #561). */ float3 surfToLightF = (pos - surfPositionWorld).xyz; lightDist = length (surfToLightF); surfToLight = normalize (surfToLightF); } half3 GetDirection() { return dir; } half3 GetSurfaceToLight() { return surfToLight; } float GetLightDistance () {return lightDist; } }; struct LightSpaceTangent : LightSpace { half3 dir; half3 surfToLight; float lightDist; void InitVP (int lightNum, ", ' ' , "float4x4 world2tangent, float4 surfPositionWorld, ", ' ' , "out half3 vp_dir, out float3 vp_surfToLight) { float4 pos = lightProps.posWorld[lightNum]; float4x4 lightTransform = lightProps.transform[lightNum]; float4 lightDirW = mul (lightTransform, float4 (0, 0, 1, 0)); vp_dir = mul (world2tangent, lightDirW).xyz; vp_surfToLight = mul (world2tangent, float4 ((pos - surfPositionWorld).xyz, 0)).xyz; } void Init (half3 vp_dir, float3 vp_surfToLight) { dir = vp_dir; lightDist = length (vp_surfToLight); surfToLight = normalize (vp_surfToLight); } half3 GetDirection() { return dir; } half3 GetSurfaceToLight() { return surfToLight; } float GetLightDistance () {return lightDist; } }; interface Shadow { half GetVisibility(); }; struct ShadowNone : Shadow { half GetVisibility() { return 1; } }; interface ShadowShadowMap /*: Shadow*/ { half GetVisibility(); void InitVP (int lightNum, float4 surfPositionWorld, ", ' ' , "float3 normWorld, ", ' ' , "out float4 vp_shadowMapCoords, ", ' ' , "out float vp_gradientApprox); void Init (int lightNum, float4 vp_shadowMapCoords, float vp_gradient); }; struct ShadowShadowMapNone : ShadowShadowMap { half GetVisibility() { return 1; } void InitVP (int lightNum, float4 surfPositionWorld, ", ' ' , "float3 normWorld, ", ' ' , "out float4 vp_shadowMapCoords, ", ' ' , "out float vp_gradientApprox) {} void Init (int lightNum, float4 vp_shadowMapCoords, float vp_gradient) {} }; struct ShadowShadowShadowMapWrapper : Shadow { ShadowShadowMap shadow; half GetVisibility() { return shadow.GetVisibility(); } }; struct LightPropertiesShadowMap { // Transformation from light to shadow map space float4x4 shadowMapTF[MAX_LIGHTS]; // Shadow map sampler2D shadowMap[MAX_LIGHTS]; // Shadow map pixel size + dimensions float4 shadowMapPixels[MAX_LIGHTS]; float4 shadowMapUnscale[MAX_LIGHTS]; sampler2D shadowMapNoise; }; LightPropertiesShadowMap lightPropsSM; interface Light { half3 GetIncidence(); half GetAttenuation(); }; struct LightDirectional : Light { half3 dir; void Init (LightSpace space) { dir = -space.GetDirection(); } half3 GetIncidence() { return dir; } half GetAttenuation() { return 1; } }; struct LightPoint : Light { half3 dir; void Init (LightSpace space) { dir = space.GetSurfaceToLight(); } half3 GetIncidence() { return dir; } half GetAttenuation() { return 1; } }; struct LightSpot : Light { half3 dir; half spot; void Init (LightSpace space, half3 normal, half falloffInner, half falloffOuter) { dir = -space.GetDirection(); spot = Light_Spot (space.GetSurfaceToLight(), dir, falloffInner, falloffOuter); } half3 GetIncidence() { return dir; } half GetAttenuation() { return spot; } }; Light GetCurrentLight (LightSpace lightSpace, int lightNum, half3 surfNormal) { LightPoint lp; lp.Init (lightSpace); return lp; } void ComputeLight (LightSpace lightSpace, Light light, ", ' ' , "half3 eyeToSurf, half3 surfNormal, ", ' ' , "half surfShininess, ", ' ' , "float3 lightDiffuse, float3 lightSpecular, ", ' ' , "float4 lightAttenuationVec, ", ' ' , "half shadowFactor, ", ' ' , "out float3 d, out float3 s) { half3 L = light.GetIncidence(); half3 H = normalize (lightSpace.GetSurfaceToLight() - eyeToSurf); half spot = light.GetAttenuation(); float4 lightCoeff = lit (dot (surfNormal, L), dot (surfNormal, H), surfShininess); float lightDist = lightSpace.GetLightDistance(); half attn; float invAttnRadius = lightAttenuationVec.w; if (invAttnRadius > 0) attn = Attenuation_Linear (lightDist, invAttnRadius); else attn = Attenuation_CLQ (lightDist, lightAttenuationVec.xyz); attn *= shadowFactor; d = lightDiffuse * lightCoeff.y * spot * attn; s = lightSpecular * lightCoeff.z * spot * attn; } #endif // __LIGHTFUNCS_CG_INC__ #ifndef __DIRECTIONAL_LMS_CG_INC__ #define __DIRECTIONAL_LMS_CG_INC__ float3 ComputeDLMCoeff (float3 direction) { /* These should really match up with those in lighter2... */ float3 base[3] = { float3 (/* -1/sqrt(6) */ -0.408248, /* 1/sqrt(2) */ 0.707107, /* 1/sqrt(3) */ 0.577350), float3 (/* sqrt(2/3) */ 0.816497, 0, /* 1/sqrt(3) */ 0.577350), float3 (/* -1/sqrt(6) */ -0.408248, /* -1/sqrt(2) */ -0.707107, /* 1/sqrt(3) */ 0.577350) }; float3 coeff = float3 (saturate (dot (direction, base[0])), saturate (dot (direction, base[1])), saturate (dot (direction, base[2]))); return coeff * coeff; } float3 ComputeDLMColor (float3 direction, float3 baseColor[3]) { float3 coeff = ComputeDLMCoeff (direction); return (coeff.x * baseColor[0] + coeff.y * baseColor[1] + coeff.z * baseColor[2]); } #endif // __DIRECTIONAL_LMS_CG_INC__ struct vertex2fragment { void dummy() {} #ifdef HAVE_ARB_color_buffer_float #define _V2F_AUTOSEMANTIC_0 : COLOR1 #define _V2F_AUTOSEMANTIC_1 : COLOR0 #define _V2F_AUTOSEMANTIC _V2F_AUTOSEMANTIC_0 #define _V2F_AUTOSEMANTIC_CURRENT 0 #else #define _V2F_AUTOSEMANTIC #endif #ifndef PARAM_vertexToFragment_texCoord_0_UNUSED varying float2 texCoord_0 _V2F_AUTOSEMANTIC ; #ifdef HAVE_ARB_color_buffer_float #if 0 #elif _V2F_AUTOSEMANTIC_CURRENT == 0 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 1 #define _V2F_AUTOSEMANTIC _V2F_AUTOSEMANTIC_1 #elif _V2F_AUTOSEMANTIC_CURRENT == 1 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 2 #define _V2F_AUTOSEMANTIC #endif #endif #endif #ifndef PARAM_vertexToFragment_Normal_1_UNUSED varying float3 Normal_1 _V2F_AUTOSEMANTIC ; #ifdef HAVE_ARB_color_buffer_float #if 0 #elif _V2F_AUTOSEMANTIC_CURRENT == 0 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 1 #define _V2F_AUTOSEMANTIC _V2F_AUTOSEMANTIC_1 #elif _V2F_AUTOSEMANTIC_CURRENT == 1 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 2 #define _V2F_AUTOSEMANTIC #endif #endif #endif #ifndef PARAM_vertexToFragment_texCoordLM_2_UNUSED varying float2 texCoordLM_2 _V2F_AUTOSEMANTIC ; #ifdef HAVE_ARB_color_buffer_float #if 0 #elif _V2F_AUTOSEMANTIC_CURRENT == 0 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 1 #define _V2F_AUTOSEMANTIC _V2F_AUTOSEMANTIC_1 #elif _V2F_AUTOSEMANTIC_CURRENT == 1 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 2 #define _V2F_AUTOSEMANTIC #endif #endif #endif #ifndef PARAM_vertexToFragment_color_dir1_3_UNUSED varying float3 color_dir1_3 _V2F_AUTOSEMANTIC ; #ifdef HAVE_ARB_color_buffer_float #if 0 #elif _V2F_AUTOSEMANTIC_CURRENT == 0 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 1 #define _V2F_AUTOSEMANTIC _V2F_AUTOSEMANTIC_1 #elif _V2F_AUTOSEMANTIC_CURRENT == 1 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 2 #define _V2F_AUTOSEMANTIC #endif #endif #endif #ifndef PARAM_vertexToFragment_color_dir2_4_UNUSED varying float3 color_dir2_4 _V2F_AUTOSEMANTIC ; #ifdef HAVE_ARB_color_buffer_float #if 0 #elif _V2F_AUTOSEMANTIC_CURRENT == 0 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 1 #define _V2F_AUTOSEMANTIC _V2F_AUTOSEMANTIC_1 #elif _V2F_AUTOSEMANTIC_CURRENT == 1 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 2 #define _V2F_AUTOSEMANTIC #endif #endif #endif #ifndef PARAM_vertexToFragment_color_dir3_5_UNUSED varying float3 color_dir3_5 _V2F_AUTOSEMANTIC ; #ifdef HAVE_ARB_color_buffer_float #if 0 #elif _V2F_AUTOSEMANTIC_CURRENT == 0 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 1 #define _V2F_AUTOSEMANTIC _V2F_AUTOSEMANTIC_1 #elif _V2F_AUTOSEMANTIC_CURRENT == 1 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 2 #define _V2F_AUTOSEMANTIC #endif #endif #endif #ifndef PARAM_vertexToFragment_litColor_6_UNUSED varying float3 litColor_6 _V2F_AUTOSEMANTIC ; #ifdef HAVE_ARB_color_buffer_float #if 0 #elif _V2F_AUTOSEMANTIC_CURRENT == 0 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 1 #define _V2F_AUTOSEMANTIC _V2F_AUTOSEMANTIC_1 #elif _V2F_AUTOSEMANTIC_CURRENT == 1 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 2 #define _V2F_AUTOSEMANTIC #endif #endif #endif #ifndef PARAM_vertexToFragment_Tangent_7_UNUSED varying float3 Tangent_7 _V2F_AUTOSEMANTIC ; #ifdef HAVE_ARB_color_buffer_float #if 0 #elif _V2F_AUTOSEMANTIC_CURRENT == 0 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 1 #define _V2F_AUTOSEMANTIC _V2F_AUTOSEMANTIC_1 #elif _V2F_AUTOSEMANTIC_CURRENT == 1 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 2 #define _V2F_AUTOSEMANTIC #endif #endif #endif #ifndef PARAM_vertexToFragment_Bitangent_8_UNUSED varying float3 Bitangent_8 _V2F_AUTOSEMANTIC ; #ifdef HAVE_ARB_color_buffer_float #if 0 #elif _V2F_AUTOSEMANTIC_CURRENT == 0 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 1 #define _V2F_AUTOSEMANTIC _V2F_AUTOSEMANTIC_1 #elif _V2F_AUTOSEMANTIC_CURRENT == 1 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 2 #define _V2F_AUTOSEMANTIC #endif #endif #endif #ifndef PARAM_vertexToFragment_position_9_UNUSED varying float4 position_9 : POSITION; #endif #ifndef PARAM_vertexToFragment_position_screen_10_UNUSED varying float4 position_screen_10 _V2F_AUTOSEMANTIC ; #ifdef HAVE_ARB_color_buffer_float #if 0 #elif _V2F_AUTOSEMANTIC_CURRENT == 0 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 1 #define _V2F_AUTOSEMANTIC _V2F_AUTOSEMANTIC_1 #elif _V2F_AUTOSEMANTIC_CURRENT == 1 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 2 #define _V2F_AUTOSEMANTIC #endif #endif #endif #ifndef PARAM_vertexToFragment_position_object_11_UNUSED varying float4 position_object_11 _V2F_AUTOSEMANTIC ; #ifdef HAVE_ARB_color_buffer_float #if 0 #elif _V2F_AUTOSEMANTIC_CURRENT == 0 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 1 #define _V2F_AUTOSEMANTIC _V2F_AUTOSEMANTIC_1 #elif _V2F_AUTOSEMANTIC_CURRENT == 1 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 2 #define _V2F_AUTOSEMANTIC #endif #endif #endif #ifndef PARAM_vertexToFragment_position_world_12_UNUSED varying float4 position_world_12 _V2F_AUTOSEMANTIC ; #ifdef HAVE_ARB_color_buffer_float #if 0 #elif _V2F_AUTOSEMANTIC_CURRENT == 0 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 1 #define _V2F_AUTOSEMANTIC _V2F_AUTOSEMANTIC_1 #elif _V2F_AUTOSEMANTIC_CURRENT == 1 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 2 #define _V2F_AUTOSEMANTIC #endif #endif #endif #ifndef PARAM_vertexToFragment_position_camera_13_UNUSED varying float4 position_camera_13 _V2F_AUTOSEMANTIC ; #ifdef HAVE_ARB_color_buffer_float #if 0 #elif _V2F_AUTOSEMANTIC_CURRENT == 0 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 1 #define _V2F_AUTOSEMANTIC _V2F_AUTOSEMANTIC_1 #elif _V2F_AUTOSEMANTIC_CURRENT == 1 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 2 #define _V2F_AUTOSEMANTIC #endif #endif #endif #ifndef PARAM_vertexToFragment_eyeDirectionObj_14_UNUSED varying float3 eyeDirectionObj_14 _V2F_AUTOSEMANTIC ; #ifdef HAVE_ARB_color_buffer_float #if 0 #elif _V2F_AUTOSEMANTIC_CURRENT == 0 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 1 #define _V2F_AUTOSEMANTIC _V2F_AUTOSEMANTIC_1 #elif _V2F_AUTOSEMANTIC_CURRENT == 1 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 2 #define _V2F_AUTOSEMANTIC #endif #endif #endif #ifndef PARAM_vertexToFragment_eyeDirectionTangent_15_UNUSED varying float3 eyeDirectionTangent_15 _V2F_AUTOSEMANTIC ; #ifdef HAVE_ARB_color_buffer_float #if 0 #elif _V2F_AUTOSEMANTIC_CURRENT == 0 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 1 #define _V2F_AUTOSEMANTIC _V2F_AUTOSEMANTIC_1 #elif _V2F_AUTOSEMANTIC_CURRENT == 1 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 2 #define _V2F_AUTOSEMANTIC #endif #endif #endif #ifndef PARAM_vertexToFragment_fogTC_16_UNUSED varying float2 fogTC_16 _V2F_AUTOSEMANTIC ; #ifdef HAVE_ARB_color_buffer_float #if 0 #elif _V2F_AUTOSEMANTIC_CURRENT == 0 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 1 #define _V2F_AUTOSEMANTIC _V2F_AUTOSEMANTIC_1 #elif _V2F_AUTOSEMANTIC_CURRENT == 1 #undef _V2F_AUTOSEMANTIC_CURRENT #undef _V2F_AUTOSEMANTIC #define _V2F_AUTOSEMANTIC_CURRENT 2 #define _V2F_AUTOSEMANTIC #endif #endif #endif #undef _V2F_AUTOSEMANTIC_0 #undef _V2F_AUTOSEMANTIC_1 #undef _V2F_AUTOSEMANTIC }; struct FragmentInput { void dummy() {} uniform float4x4 ModelView : state.matrix.modelview; uniform float4x4 objectToWorld; uniform float4 eyePosWorld; uniform sampler2D texHeight; uniform float4 texHeight_Cg_WTF; uniform float heightMapScale; uniform float2 sampleLimits; uniform sampler2D texDiffuse; uniform float4 texDiffuse_Cg_WTF; uniform sampler2D texNormal; uniform float4 texNormal_Cg_WTF; uniform sampler2D texNormalCompressed; uniform float4 texNormalCompressed_Cg_WTF; uniform float4 color_modulation; uniform float mixModeAlpha; uniform sampler2D texAO; uniform float4 texAO_Cg_WTF; uniform sampler2D lightmap_dir1; uniform float4 lightmap_dir1_Cg_WTF; uniform sampler2D lightmap_dir2; uniform float4 lightmap_dir2_Cg_WTF; uniform sampler2D lightmap_dir3; uniform float4 lightmap_dir3_Cg_WTF; uniform sampler2D directions1; uniform float4 directions1_Cg_WTF; uniform sampler2D directions2; uniform float4 directions2_Cg_WTF; uniform sampler2D directions3; uniform float4 directions3_Cg_WTF; uniform sampler2D texSpecular; uniform float4 texSpecular_Cg_WTF; uniform float3 specular; uniform float3 combinedAmbient; uniform float3 dynamicAmbient; uniform sampler2D lightmap; uniform float4 lightmap_Cg_WTF; uniform float4 hdrScale; uniform sampler2D fogTex; uniform float4 fogTex_Cg_WTF; uniform float4 fogColor; uniform float fogFadeEnd; uniform float fogFadeStart; uniform float fogLimit; }; struct FragmentOutput { float4 color0 : COLOR0; float depth : DEPTH; }; FragmentOutput fragmentMain (vertex2fragment vertexToFragment, FragmentInput fragmentIn) { float4 outputColor_0; float4 result_1; float4 foggedColor_2; float4 surfaceWithGlow_3; float4 result_4; float4 outputColor_5; float3 diffuseColor_6; float3 specularColor_7; float4 result_8; float3 ambient_9; float3 specularColor_10; float4 outputColor_11; float3 o_normal_12; float3 eyeDirectionWorld_13; float3 specular_14; float occlusionFactor_15; float2 result_16; float normalmap_alpha_17; float4 surfaceColorOut_18; float4 position_19; float4 position_world_20; float4 position_object_21; float4 position_camera_22; float3 normal_23; float3 o_normal_24; float3 eyeDirectionTangent_25; int output_26; int output_27; float4 surfaceColor_28; float2 texCoordOffset_29; float3 eyeDirectionWorld_30; float3 eyeDirectionObj_31; float3 eyeDirectionTangent_32; float3 eyeDirectionObj_33; float3 output_34; float3 output_35; float3 output_36; float3 output_37; float3 output_38; float3 output_39; float4 output_40; float4 output_41; float3 output_42; float3 output_43; float4 in_Hposition; float4x4 in_ModelViewProj; float4x4 in_ModelView; float4x4 in_objectToWorld; float4x4 in_ModelViewIT; float4 in_eyePosWorld; float2 in_texCoord; float3 in_Normal; sampler2D in_texHeight; float in_heightMapScale; float2 in_sampleLimits; sampler2D in_texDiffuse; sampler2D in_texNormal; sampler2D in_texNormalCompressed; float4 in_color_modulation; float in_mixModeAlpha; float2 in_texCoordLM; sampler2D in_texAO; float3 in_color_dir1; float3 in_color_dir2; float3 in_color_dir3; sampler2D in_lightmap_dir1; sampler2D in_lightmap_dir2; sampler2D in_lightmap_dir3; sampler2D in_directions1; sampler2D in_directions2; sampler2D in_directions3; sampler2D in_texSpecular; float3 in_specular; float3 in_combinedAmbient; float3 in_dynamicAmbient; float3 in_litColor; sampler2D in_lightmap; sampler2D in_texGlow; float4 in_hdrScale; float3 in_Tangent; float3 in_Bitangent; bool normal_23_attr_perfragment; bool specular_14_attr_perfragment; bool output_41_attr_perfragment; bool diffuseColor_6_attr_perfragment; bool specularColor_7_attr_perfragment; bool output_40_attr_perfragment; bool surfaceColor_28_attr_perfragment; bool surfaceColorOut_18_attr_perfragment; bool normalmap_alpha_17_attr_perfragment; bool specularColor_10_attr_perfragment; bool occlusionFactor_15_attr_perfragment; bool ambient_9_attr_perfragment; bool outputColor_5_attr_perfragment; bool result_4_attr_perfragment; { float4 Hposition; in_Hposition = Hposition; } { float4x4 ModelViewProj; in_ModelViewProj = ModelViewProj; } { float4x4 ModelView; ModelView = fragmentIn.ModelView; in_ModelView = ModelView; } { float4x4 objectToWorld; objectToWorld = fragmentIn.objectToWorld; in_objectToWorld = objectToWorld; } { float4x4 ModelViewIT; in_ModelViewIT = ModelViewIT; } { float4 eyePosWorld; eyePosWorld = fragmentIn.eyePosWorld; in_eyePosWorld = eyePosWorld; } { float2 texCoord; #ifndef PARAM_vertexToFragment_texCoord_0_UNUSED texCoord = vertexToFragment.texCoord_0; #else #ifdef _INITIALIZE_UNUSED_V2F texCoord = float2(0); #endif #endif in_texCoord = texCoord; } { float3 Normal; #ifndef PARAM_vertexToFragment_Normal_1_UNUSED Normal = vertexToFragment.Normal_1; #else #ifdef _INITIALIZE_UNUSED_V2F Normal = float3(0); #endif #endif in_Normal = Normal; } { sampler2D texHeight; texHeight = fragmentIn.texHeight; in_texHeight = texHeight; } { float heightMapScale; heightMapScale = fragmentIn.heightMapScale; in_heightMapScale = heightMapScale; } { float2 sampleLimits; sampleLimits = fragmentIn.sampleLimits; in_sampleLimits = sampleLimits; } { sampler2D texDiffuse; texDiffuse = fragmentIn.texDiffuse; in_texDiffuse = texDiffuse; } { sampler2D texNormal; texNormal = fragmentIn.texNormal; in_texNormal = texNormal; } { sampler2D texNormalCompressed; texNormalCompressed = fragmentIn.texNormalCompressed; in_texNormalCompressed = texNormalCompressed; } { float4 color_modulation; color_modulation = fragmentIn.color_modulation; in_color_modulation = color_modulation; } { float mixModeAlpha; mixModeAlpha = fragmentIn.mixModeAlpha; in_mixModeAlpha = mixModeAlpha; } { float2 texCoordLM; #ifndef PARAM_vertexToFragment_texCoordLM_2_UNUSED texCoordLM = vertexToFragment.texCoordLM_2; #else #ifdef _INITIALIZE_UNUSED_V2F texCoordLM = float2(0); #endif #endif in_texCoordLM = texCoordLM; } { sampler2D texAO; texAO = fragmentIn.texAO; in_texAO = texAO; } { float3 color_dir1; #ifndef PARAM_vertexToFragment_color_dir1_3_UNUSED color_dir1 = vertexToFragment.color_dir1_3; #else #ifdef _INITIALIZE_UNUSED_V2F color_dir1 = float3(0); #endif #endif in_color_dir1 = color_dir1; } { float3 color_dir2; #ifndef PARAM_vertexToFragment_color_dir2_4_UNUSED color_dir2 = vertexToFragment.color_dir2_4; #else #ifdef _INITIALIZE_UNUSED_V2F color_dir2 = float3(0); #endif #endif in_color_dir2 = color_dir2; } { float3 color_dir3; #ifndef PARAM_vertexToFragment_color_dir3_5_UNUSED color_dir3 = vertexToFragment.color_dir3_5; #else #ifdef _INITIALIZE_UNUSED_V2F color_dir3 = float3(0); #endif #endif in_color_dir3 = color_dir3; } { sampler2D lightmap_dir1; lightmap_dir1 = fragmentIn.lightmap_dir1; in_lightmap_dir1 = lightmap_dir1; } { sampler2D lightmap_dir2; lightmap_dir2 = fragmentIn.lightmap_dir2; in_lightmap_dir2 = lightmap_dir2; } { sampler2D lightmap_dir3; lightmap_dir3 = fragmentIn.lightmap_dir3; in_lightmap_dir3 = lightmap_dir3; } { sampler2D directions1; directions1 = fragmentIn.directions1; in_directions1 = directions1; } { sampler2D directions2; directions2 = fragmentIn.directions2; in_directions2 = directions2; } { sampler2D directions3; directions3 = fragmentIn.directions3; in_directions3 = directions3; } { sampler2D texSpecular; texSpecular = fragmentIn.texSpecular; in_texSpecular = texSpecular; } { float3 specular; specular = fragmentIn.specular; in_specular = specular; } { float3 combinedAmbient; combinedAmbient = fragmentIn.combinedAmbient; in_combinedAmbient = combinedAmbient; } { float3 dynamicAmbient; dynamicAmbient = fragmentIn.dynamicAmbient; in_dynamicAmbient = dynamicAmbient; } { float3 litColor; #ifndef PARAM_vertexToFragment_litColor_6_UNUSED litColor = vertexToFragment.litColor_6; #else #ifdef _INITIALIZE_UNUSED_V2F litColor = float3(0); #endif #endif in_litColor = litColor; } { sampler2D lightmap; lightmap = fragmentIn.lightmap; in_lightmap = lightmap; } { sampler2D texGlow; in_texGlow = texGlow; } { float4 hdrScale; hdrScale = fragmentIn.hdrScale; in_hdrScale = hdrScale; } { float3 Tangent; #ifndef PARAM_vertexToFragment_Tangent_7_UNUSED Tangent = vertexToFragment.Tangent_7; #else #ifdef _INITIALIZE_UNUSED_V2F Tangent = float3(0); #endif #endif #if FRAGMENT_PROGRAM_LEVEL >= 0x200 // Renormalize, as interpolation will have denormalized it Tangent = normalize (Tangent); #endif in_Tangent = Tangent; } { float3 Bitangent; #ifndef PARAM_vertexToFragment_Bitangent_8_UNUSED Bitangent = vertexToFragment.Bitangent_8; #else #ifdef _INITIALIZE_UNUSED_V2F Bitangent = float3(0); #endif #endif #if FRAGMENT_PROGRAM_LEVEL >= 0x200 // Renormalize, as interpolation will have denormalized it Bitangent = normalize (Bitangent); #endif in_Bitangent = Bitangent; } { int output; output = 0;output_27 = output; } { float4 Hposition; float4x4 ModelViewProj; float4x4 ModelView; float4x4 objectToWorld; float4 position; float4 position_world; float4 position_object; float4 position_camera; float4 position_screen; Hposition = in_Hposition; ModelView = in_ModelView; objectToWorld = in_objectToWorld; ModelViewProj = in_ModelViewProj; #ifndef PARAM_vertexToFragment_position_9_UNUSED position = vertexToFragment.position_9; #else #ifdef _INITIALIZE_UNUSED_V2F position = float4(0); #endif #endif #ifndef PARAM_vertexToFragment_position_screen_10_UNUSED position_screen = vertexToFragment.position_screen_10; #else #ifdef _INITIALIZE_UNUSED_V2F position_screen = float4(0); #endif #endif #ifndef PARAM_vertexToFragment_position_object_11_UNUSED position_object = vertexToFragment.position_object_11; #else #ifdef _INITIALIZE_UNUSED_V2F position_object = float4(0); #endif #endif #ifndef PARAM_vertexToFragment_position_world_12_UNUSED position_world = vertexToFragment.position_world_12; #else #ifdef _INITIALIZE_UNUSED_V2F position_world = float4(0); #endif #endif #ifndef PARAM_vertexToFragment_position_camera_13_UNUSED position_camera = vertexToFragment.position_camera_13; #else #ifdef _INITIALIZE_UNUSED_V2F position_camera = float4(0); #endif #endif APPLY_CLIPPING_FP_POSINV; /* The objectToWorld transform is needed in other places, so there is a global variable for it. Set that */ SetGlobalObjectToWorld (objectToWorld); position = position_screen; position_object_21 = position_object; position_camera_22 = position_camera; position_world_20 = position_world; position_19 = position; } { float4 position; float4x4 ModelViewIT; float3 eyeDirectionObj; position = position_object_21; ModelViewIT = in_ModelViewIT; #ifndef PARAM_vertexToFragment_eyeDirectionObj_14_UNUSED eyeDirectionObj = vertexToFragment.eyeDirectionObj_14; #else #ifdef _INITIALIZE_UNUSED_V2F eyeDirectionObj = float3(0); #endif #endif eyeDirectionObj_33 = eyeDirectionObj; } { float3 Normal; float3 Tangent; float3 Bitangent; float3 input; float3 output; Tangent = in_Tangent; Normal = in_Normal; input = eyeDirectionObj_33; Bitangent = in_Bitangent; #if FRAGMENT_PROGRAM_LEVEL >= 0x200 float3x3 obj2tang; obj2tang[0] = Tangent; obj2tang[1] = Bitangent; obj2tang[2] = Normal; output = mul (obj2tang, input); #else /* PS1.x cant do matrix mul ... Leave output deliberately undefined to catch (undesired) uses of it */ #endif output_34 = output; } { float3 eyeVecT; float3 eyeDirectionTangent; eyeVecT = output_34; #ifndef PARAM_vertexToFragment_eyeDirectionTangent_15_UNUSED eyeDirectionTangent = vertexToFragment.eyeDirectionTangent_15; #else #ifdef _INITIALIZE_UNUSED_V2F eyeDirectionTangent = float3(0); #endif #endif eyeDirectionTangent_32 = eyeDirectionTangent; } { float4 position; float4 eyePosWorld; float3 eyeDirectionWorld; eyePosWorld = in_eyePosWorld; position = position_world_20; eyeDirectionWorld = (position - eyePosWorld).xyz; eyeDirectionWorld_30 = eyeDirectionWorld; } { float3 input; float3 output; input = eyeDirectionObj_33; output = mul (objectToWorld, float4 (input, 0)).xyz; output_35 = output; } { float2 texCoord; float3 Normal; float3 eyeVec; float3 eyeVecW; sampler2D texHeight; float heightMapScale; float2 sampleLimits; float2 texCoordOffset; eyeVecW = output_35; Normal = in_Normal; texCoord = in_texCoord; texHeight = in_texHeight; heightMapScale = in_heightMapScale; eyeVec = eyeDirectionTangent_32; sampleLimits = in_sampleLimits; float2 offset = float2(0, 0); texCoordOffset = texCoord + offset; texCoordOffset_29 = texCoordOffset; } { float2 texCoord; sampler2D texNormal; sampler2D texNormalCompressed; float3 normal; bool normal_attr_perfragment; texNormalCompressed = in_texNormalCompressed; texCoord = texCoordOffset_29; texNormal = in_texNormal; normal = half3 (0, 0, 1); normal_attr_perfragment = false; normal_23 = normal; normal_23_attr_perfragment = normal_attr_perfragment; } { float3 i_normal; float3 o_normal; i_normal = normal_23; o_normal = i_normal; o_normal_24 = o_normal; } { float3 Normal; float3 Tangent; float3 Bitangent; float3 input; float3 output; Tangent = in_Tangent; input = o_normal_24; Normal = in_Normal; Bitangent = in_Bitangent; float3x3 obj2tang; obj2tang[0] = Tangent; obj2tang[1] = Bitangent; obj2tang[2] = Normal; output = mul (input, obj2tang); output_38 = output; } { float2 texCoordLM; float2 result; texCoordLM = in_texCoordLM; result = texCoordLM; result_16 = result; } { float3 input; float3 output; input = eyeDirectionTangent_32; output = normalize (input); output_37 = output; } { float3 color_dir1; float3 color_dir2; float3 color_dir3; float2 texCoordLM; float3 eyeToSurf; float3 normal; bool normal_attr_perfragment; sampler2D lightmap_dir1; sampler2D lightmap_dir2; sampler2D lightmap_dir3; sampler2D directions1; sampler2D directions2; sampler2D directions3; float3 specular; bool specular_attr_perfragment; color_dir2 = in_color_dir2; color_dir3 = in_color_dir3; normal = o_normal_24; eyeToSurf = output_37; texCoordLM = in_texCoordLM; lightmap_dir1 = in_lightmap_dir1; lightmap_dir2 = in_lightmap_dir2; lightmap_dir3 = in_lightmap_dir3; directions1 = in_directions1; directions2 = in_directions2; directions3 = in_directions3; color_dir1 = in_color_dir1; normal_attr_perfragment = false; float3 spec = float3(0); float3 baseLit[3]; baseLit[0] = tex2D (lightmap_dir1, texCoordLM).rgb; baseLit[1] = tex2D (lightmap_dir2, texCoordLM).rgb; baseLit[2] = tex2D (lightmap_dir3, texCoordLM).rgb; float2 rawdir1 = tex2D (directions1, texCoordLM).ga * 2 -float2(1); float2 rawdir2 = tex2D (directions2, texCoordLM).ga * 2 -float2(1); float2 rawdir3 = tex2D (directions3, texCoordLM).ga * 2 -float2(1); float3 lightDir; lightDir.xy = rawdir1; lightDir.z = rawdir3.x; float3 speccol = 2 * ComputeDLMColor (lightDir, baseLit); float3 H = normalize (-eyeToSurf + lightDir); spec += (pow (saturate (dot (normal, H)), 32) * speccol); lightDir.xy = rawdir2; lightDir.z = rawdir3.y; speccol = 2 * ComputeDLMColor (lightDir, baseLit); H = normalize (-eyeToSurf + lightDir); spec += (pow (saturate (dot (normal, H)), 32) * speccol); specular = spec; specular_attr_perfragment = true; specular_14 = specular; specular_14_attr_perfragment = specular_attr_perfragment; } { float3 input; float4 output; bool output_attr_perfragment; input = specular_14; output_attr_perfragment = specular_14_attr_perfragment; output = float4 (input, 1); output_41 = output; output_41_attr_perfragment = output_attr_perfragment; } { float3 input; float3 output; input = output_38; output = mul (objectToWorld, float4 (input, 0)).xyz; output_39 = output; } { float3 eyeToSurf; float4 positionW; float3 normal; int lightOffset; int maxLights; int minLights; float3 diffuseColor; bool diffuseColor_attr_perfragment; float3 specularColor; bool specularColor_attr_perfragment; normal = output_39; minLights = int (0); positionW = position_world_20; lightOffset = output_27; maxLights = output_27; eyeToSurf = eyeDirectionWorld_30; diffuseColor = float3(0); specularColor = float3(0); half3 myEyeToSurf = eyeToSurf; myEyeToSurf = normalize (eyeToSurf); for (int l = 0;l < maxLights;l++) { int i = lightOffset + l; if ((i >= minLights) && (i >= lightProps.count)) break; LightSpaceWorld lightSpace; lightSpace.Init (i, positionW); Light light = GetCurrentLight (lightSpace, i, normal); float4 lightAttenuationVec = lightProps.attenuationVec[i]; float3 d, s; ComputeLight (lightSpace, light, myEyeToSurf, normal, 32, lightProps.colorDiffuse[i], lightProps.colorSpecular[i], lightAttenuationVec, 1, d, s); diffuseColor += d; specularColor += s; } diffuseColor_attr_perfragment = true; specularColor_attr_perfragment = true; diffuseColor_6 = diffuseColor; specularColor_7 = specularColor; specularColor_7_attr_perfragment = specularColor_attr_perfragment; diffuseColor_6_attr_perfragment = diffuseColor_attr_perfragment; } { float3 input; float4 output; bool output_attr_perfragment; input = specularColor_7; output_attr_perfragment = specularColor_7_attr_perfragment; output = float4 (input, 1); output_40 = output; output_40_attr_perfragment = output_attr_perfragment; } { float4 a; float4 b; float4 result; a = output_40; b = output_41; result = a+b; result_8 = result; } { float4 input; float3 output; input = result_8; output = input.rgb; output_42 = output; } { float2 texCoord; sampler2D texDiffuse; float4 surfaceColor; bool surfaceColor_attr_perfragment; texDiffuse = in_texDiffuse; texCoord = texCoordOffset_29; surfaceColor = tex2D (texDiffuse, texCoord); surfaceColor_attr_perfragment = true; surfaceColor_28 = surfaceColor; surfaceColor_28_attr_perfragment = surfaceColor_attr_perfragment; } { float4 surfaceColorIn; bool surfaceColorIn_attr_perfragment; float4 color_modulation; float4 surfaceColorOut; bool surfaceColorOut_attr_perfragment; surfaceColorIn = surfaceColor_28; color_modulation = in_color_modulation; surfaceColorIn_attr_perfragment = surfaceColor_28_attr_perfragment; surfaceColorOut.rgba = surfaceColorIn.rgba * color_modulation.rgba; surfaceColorOut_attr_perfragment = surfaceColorIn_attr_perfragment; surfaceColorOut_18 = surfaceColorOut; surfaceColorOut_18_attr_perfragment = surfaceColorOut_attr_perfragment; } { float4 inputColor; float mixModeAlpha; float4 outputColor; inputColor = surfaceColorOut_18; mixModeAlpha = in_mixModeAlpha; outputColor.rgb = inputColor.rgb; outputColor.a = inputColor.a * mixModeAlpha; outputColor_11 = outputColor; } { float2 texCoord; sampler2D texNormal; float normalmap_alpha; bool normalmap_alpha_attr_perfragment; texCoord = texCoordOffset_29; texNormal = in_texNormal; normalmap_alpha_attr_perfragment = false; normalmap_alpha = 1; normalmap_alpha_17 = normalmap_alpha; normalmap_alpha_17_attr_perfragment = normalmap_alpha_attr_perfragment; } { float normalMapAlpha; bool normalMapAlpha_attr_perfragment; float2 texCoord; sampler2D texSpecular; float4 surfaceColorWithAlpha; bool surfaceColorWithAlpha_attr_perfragment; float3 specular; float3 specularColor; bool specularColor_attr_perfragment; texSpecular = in_texSpecular; normalMapAlpha = normalmap_alpha_17; surfaceColorWithAlpha = outputColor_11; texCoord = texCoordOffset_29; specular = in_specular; surfaceColorWithAlpha_attr_perfragment = true; normalMapAlpha_attr_perfragment = normalmap_alpha_17_attr_perfragment; specularColor = tex2D (texSpecular, texCoord).rgb * specular; specularColor_attr_perfragment = true; float weirdCoef = (normalMapAlpha+1)/2; specularColor *= weirdCoef; specularColor *= surfaceColorWithAlpha.a; specularColor_10 = specularColor; specularColor_10_attr_perfragment = specularColor_attr_perfragment; } { float2 texCoord; sampler2D texAO; float occlusionFactor; bool occlusionFactor_attr_perfragment; texCoord = result_16; texAO = in_texAO; occlusionFactor = 1; occlusionFactor_attr_perfragment = false; occlusionFactor_15 = occlusionFactor; occlusionFactor_15_attr_perfragment = occlusionFactor_attr_perfragment; } { float3 combinedAmbient; float3 dynamicAmbient; float occlusionFactor; bool occlusionFactor_attr_perfragment; float3 litColor; float3 color_dir1; float3 color_dir2; float3 color_dir3; float2 texCoordLM; float3 normal; bool normal_attr_perfragment; sampler2D lightmap; sampler2D lightmap_dir1; sampler2D lightmap_dir2; sampler2D lightmap_dir3; float3 ambient; bool ambient_attr_perfragment; color_dir2 = in_color_dir2; occlusionFactor = occlusionFactor_15; color_dir3 = in_color_dir3; texCoordLM = result_16; lightmap = in_lightmap; lightmap_dir1 = in_lightmap_dir1; combinedAmbient = in_combinedAmbient; lightmap_dir2 = in_lightmap_dir2; lightmap_dir3 = in_lightmap_dir3; litColor = in_litColor; normal = normal_23; dynamicAmbient = in_dynamicAmbient; color_dir1 = in_color_dir1; normal_attr_perfragment = normal_23_attr_perfragment; occlusionFactor_attr_perfragment = occlusionFactor_15_attr_perfragment; float3 ambient_dynamic = dynamicAmbient * occlusionFactor; float3 ambient_static; // Utilize directional LM/colors only if normal is changed per-fragment if (normal_attr_perfragment) { float3 baseLit[3]; baseLit[0] = tex2D (lightmap_dir1, texCoordLM).rgb; baseLit[1] = tex2D (lightmap_dir2, texCoordLM).rgb; baseLit[2] = tex2D (lightmap_dir3, texCoordLM).rgb; ambient_static = 2 * ComputeDLMColor (normal, baseLit); ambient_attr_perfragment = true; } else // Use plain ol less detailed lighting otherwise { ambient_static = 2 * tex2D (lightmap, texCoordLM).rgb; ambient_attr_perfragment = true; } ambient = ambient_dynamic + ambient_static; ambient_9 = ambient; ambient_9_attr_perfragment = ambient_attr_perfragment; } { float4 surfaceColor; bool surfaceColor_attr_perfragment; float4 outputColor; bool outputColor_attr_perfragment; surfaceColor = outputColor_11; surfaceColor_attr_perfragment = true; outputColor = surfaceColor; outputColor.rgb *= surfaceColor.a; outputColor_attr_perfragment = surfaceColor_attr_perfragment; outputColor_5 = outputColor; outputColor_5_attr_perfragment = outputColor_attr_perfragment; } { float3 lightDiffuse; bool lightDiffuse_attr_perfragment; float3 lightSpecular; bool lightSpecular_attr_perfragment; float4 surfaceDiffuse; bool surfaceDiffuse_attr_perfragment; float3 surfaceSpecular; bool surfaceSpecular_attr_perfragment; float3 ambient; bool ambient_attr_perfragment; float4 result; bool result_attr_perfragment; surfaceSpecular = specularColor_10; lightDiffuse = diffuseColor_6; lightSpecular = output_42; ambient = ambient_9; surfaceDiffuse = outputColor_5; ambient_attr_perfragment = ambient_9_attr_perfragment; lightDiffuse_attr_perfragment = diffuseColor_6_attr_perfragment; lightSpecular_attr_perfragment = false; surfaceDiffuse_attr_perfragment = outputColor_5_attr_perfragment; surfaceSpecular_attr_perfragment = specularColor_10_attr_perfragment; result = float4 (ambient + lightDiffuse, 1)*surfaceDiffuse + float4 (surfaceSpecular*lightSpecular, 0); result_attr_perfragment = ambient_attr_perfragment || surfaceDiffuse_attr_perfragment || lightDiffuse_attr_perfragment || surfaceSpecular_attr_perfragment || lightSpecular_attr_perfragment; result_4 = result; result_4_attr_perfragment = result_attr_perfragment; } { float2 texCoord; sampler2D texGlow; float4 surfaceColor; float4 surfaceWithGlow; texGlow = in_texGlow; texCoord = result_16; surfaceColor = result_4; surfaceWithGlow = surfaceColor; surfaceWithGlow_3 = surfaceWithGlow; } { float4 litColor; float4 eyePos; float4 foggedColor; float2 fogTC; litColor = surfaceWithGlow_3; eyePos = position_camera_22; #ifndef PARAM_vertexToFragment_fogTC_16_UNUSED fogTC = vertexToFragment.fogTC_16; #else #ifdef _INITIALIZE_UNUSED_V2F fogTC = float2(0); #endif #endif foggedColor = litColor; foggedColor_2 = foggedColor; } { float4 a; float4 hdrScale; float4 result; hdrScale = in_hdrScale; a = foggedColor_2; result = float4 (a.rgb*hdrScale.y+hdrScale.w, a.a); result_1 = result; } { float4 outputColor; outputColor = result_1; outputColor_0 = outputColor; } FragmentOutput OUT; OUT.color0 = outputColor_0; return OUT; }