From 54197f91fb16ffe1e0cf7f638a0b0e4d0ed14f29 Mon Sep 17 00:00:00 2001 From: divverent Date: Wed, 24 Aug 2011 09:02:05 +0000 Subject: [PATCH] who's inserting CRLFs all the time git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11294 d7cf8633-e32d-0410-b094-e92efae38249 --- shader_glsl.h | 74 +++++++++++++++++++++++++-------------------------- shader_hlsl.h | 62 +++++++++++++++++++++--------------------- 2 files changed, 68 insertions(+), 68 deletions(-) diff --git a/shader_glsl.h b/shader_glsl.h index befd8b53..cfc1c64a 100644 --- a/shader_glsl.h +++ b/shader_glsl.h @@ -671,43 +671,43 @@ "\n" "#ifdef USEOFFSETMAPPING\n" "uniform mediump vec4 OffsetMapping_ScaleSteps;\n" -"#ifdef USEOFFSETMAPPING_LOD\n" -"uniform mediump float OffsetMapping_LodDistance;\n" -"#endif\n" -"vec2 OffsetMapping(vec2 TexCoord, vec2 dPdx, vec2 dPdy)\n" -"{\n" -" float i;\n" -" // distance-based LOD\n" -"#ifdef USEOFFSETMAPPING_LOD\n" -" mediump float LODFactor = min(1.0, OffsetMapping_LodDistance / EyeVectorFogDepth.z);\n" -" mediump vec4 ScaleSteps = vec4(OffsetMapping_ScaleSteps.x, OffsetMapping_ScaleSteps.y * LODFactor, OffsetMapping_ScaleSteps.z / LODFactor, OffsetMapping_ScaleSteps.w * LODFactor);\n" -"#else\n" -" #define ScaleSteps OffsetMapping_ScaleSteps\n" -"#endif\n" -"#ifdef USEOFFSETMAPPING_RELIEFMAPPING\n" -" float f;\n" -" // 14 sample relief mapping: linear search and then binary search\n" -" // this basically steps forward a small amount repeatedly until it finds\n" -" // itself inside solid, then jitters forward and back using decreasing\n" -" // amounts to find the impact\n" -" //vec3 OffsetVector = vec3(EyeVectorFogDepth.xy * ((1.0 / EyeVectorFogDepth.z) * ScaleSteps.x) * vec2(-1, 1), -1);\n" -" //vec3 OffsetVector = vec3(normalize(EyeVectorFogDepth.xy) * ScaleSteps.x * vec2(-1, 1), -1);\n" -" vec3 OffsetVector = vec3(normalize(EyeVectorFogDepth.xyz).xy * ScaleSteps.x * vec2(-1, 1), -1);\n" -" vec3 RT = vec3(TexCoord, 1);\n" -" OffsetVector *= ScaleSteps.z;\n" -" for(i = 1.0; i < ScaleSteps.y; ++i)\n" -" RT += OffsetVector * step(dp_textureGrad(Texture_Normal, RT.xy, dPdx, dPdy).a, RT.z);\n" -" for(i = 0.0, f = 1.0; i < ScaleSteps.w; ++i, f *= 0.5)\n" -" RT += OffsetVector * (step(dp_textureGrad(Texture_Normal, RT.xy, dPdx, dPdy).a, RT.z) * f - 0.5 * f);\n" -" return RT.xy;\n" -"#else\n" -" // 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)\n" -" //vec2 OffsetVector = vec2(EyeVectorFogDepth.xy * ((1.0 / EyeVectorFogDepth.z) * ScaleSteps.x) * vec2(-1, 1));\n" -" //vec2 OffsetVector = vec2(normalize(EyeVectorFogDepth.xy) * ScaleSteps.x * vec2(-1, 1));\n" -" vec2 OffsetVector = vec2(normalize(EyeVectorFogDepth.xyz).xy * ScaleSteps.x * vec2(-1, 1));\n" -" OffsetVector *= ScaleSteps.z;\n" -" for(i = 0.0; i < ScaleSteps.y; ++i)\n" -" TexCoord += OffsetVector * (1.0 - dp_textureGrad(Texture_Normal, TexCoord, dPdx, dPdy).a);\n" +"#ifdef USEOFFSETMAPPING_LOD\n" +"uniform mediump float OffsetMapping_LodDistance;\n" +"#endif\n" +"vec2 OffsetMapping(vec2 TexCoord, vec2 dPdx, vec2 dPdy)\n" +"{\n" +" float i;\n" +" // distance-based LOD\n" +"#ifdef USEOFFSETMAPPING_LOD\n" +" mediump float LODFactor = min(1.0, OffsetMapping_LodDistance / EyeVectorFogDepth.z);\n" +" mediump vec4 ScaleSteps = vec4(OffsetMapping_ScaleSteps.x, OffsetMapping_ScaleSteps.y * LODFactor, OffsetMapping_ScaleSteps.z / LODFactor, OffsetMapping_ScaleSteps.w * LODFactor);\n" +"#else\n" +" #define ScaleSteps OffsetMapping_ScaleSteps\n" +"#endif\n" +"#ifdef USEOFFSETMAPPING_RELIEFMAPPING\n" +" float f;\n" +" // 14 sample relief mapping: linear search and then binary search\n" +" // this basically steps forward a small amount repeatedly until it finds\n" +" // itself inside solid, then jitters forward and back using decreasing\n" +" // amounts to find the impact\n" +" //vec3 OffsetVector = vec3(EyeVectorFogDepth.xy * ((1.0 / EyeVectorFogDepth.z) * ScaleSteps.x) * vec2(-1, 1), -1);\n" +" //vec3 OffsetVector = vec3(normalize(EyeVectorFogDepth.xy) * ScaleSteps.x * vec2(-1, 1), -1);\n" +" vec3 OffsetVector = vec3(normalize(EyeVectorFogDepth.xyz).xy * ScaleSteps.x * vec2(-1, 1), -1);\n" +" vec3 RT = vec3(TexCoord, 1);\n" +" OffsetVector *= ScaleSteps.z;\n" +" for(i = 1.0; i < ScaleSteps.y; ++i)\n" +" RT += OffsetVector * step(dp_textureGrad(Texture_Normal, RT.xy, dPdx, dPdy).a, RT.z);\n" +" for(i = 0.0, f = 1.0; i < ScaleSteps.w; ++i, f *= 0.5)\n" +" RT += OffsetVector * (step(dp_textureGrad(Texture_Normal, RT.xy, dPdx, dPdy).a, RT.z) * f - 0.5 * f);\n" +" return RT.xy;\n" +"#else\n" +" // 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)\n" +" //vec2 OffsetVector = vec2(EyeVectorFogDepth.xy * ((1.0 / EyeVectorFogDepth.z) * ScaleSteps.x) * vec2(-1, 1));\n" +" //vec2 OffsetVector = vec2(normalize(EyeVectorFogDepth.xy) * ScaleSteps.x * vec2(-1, 1));\n" +" vec2 OffsetVector = vec2(normalize(EyeVectorFogDepth.xyz).xy * ScaleSteps.x * vec2(-1, 1));\n" +" OffsetVector *= ScaleSteps.z;\n" +" for(i = 0.0; i < ScaleSteps.y; ++i)\n" +" TexCoord += OffsetVector * (1.0 - dp_textureGrad(Texture_Normal, TexCoord, dPdx, dPdy).a);\n" " return TexCoord;\n" "#endif\n" "}\n" diff --git a/shader_hlsl.h b/shader_hlsl.h index b7bc5f37..96cf8bab 100644 --- a/shader_hlsl.h +++ b/shader_hlsl.h @@ -547,37 +547,37 @@ "float2 OffsetMapping(float2 TexCoord, float4 OffsetMapping_ScaleSteps, float OffsetMapping_LodDistance, float3 EyeVector, sampler Texture_Normal, float2 dPdx, float2 dPdy)\n" "{\n" " float i;\n" -" // distance-based LOD\n" -"#ifdef USEOFFSETMAPPING_LOD\n" -" float LODFactor = min(1.0, OffsetMapping_LodDistance / EyeVectorFogDepth.z);\n" -" mediump vec4 ScaleSteps = float4(OffsetMapping_ScaleSteps.x, OffsetMapping_ScaleSteps.y * LODFactor, OffsetMapping_ScaleSteps.z / LODFactor, OffsetMapping_ScaleSteps.w * LODFactor);\n" -"#else\n" -" #define ScaleSteps OffsetMapping_ScaleSteps\n" -"#endif\n" -"#ifdef USEOFFSETMAPPING_RELIEFMAPPING\n" -" // 14 sample relief mapping: linear search and then binary search\n" -" // this basically steps forward a small amount repeatedly until it finds\n" -" // itself inside solid, then jitters forward and back using decreasing\n" -" // amounts to find the impact\n" -" //float3 OffsetVector = float3(EyeVector.xy * ((1.0 / EyeVector.z) * ScaleSteps.x) * float2(-1, 1), -1);\n" -" //float3 OffsetVector = float3(normalize(EyeVector.xy) * ScaleSteps.x * float2(-1, 1), -1);\n" -" float3 OffsetVector = float3(normalize(EyeVector).xy * ScaleSteps.x * float2(-1, 1), -1);\n" -" float3 RT = float3(TexCoord, 1);\n" -" OffsetVector *= ScaleSteps.z;\n" -" for(i = 1.0; i < ScaleSteps.y; ++i)\n" -" RT += OffsetVector * step(tex2Dgrad(Texture_Normal, RT.xy, dPdx, dPdy).a, RT.z);\n" -" for(i = 0.0, f = 1.0; i < ScaleSteps.w; ++i, f *= 0.5)\n" -" RT += OffsetVector * (step(tex2Dgrad(Texture_Normal, RT.xy, dPdx, dPdy).a, RT.z) * f - 0.5 * f);\n" -" return RT.xy;\n" -"#else\n" -" // 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)\n" -" //float2 OffsetVector = float2(EyeVector.xy * ((1.0 / EyeVector.z) * ScaleSteps.x) * float2(-1, 1));\n" -" //float2 OffsetVector = float2(normalize(EyeVector.xy) * ScaleSteps.x * float2(-1, 1));\n" -" float2 OffsetVector = float2(normalize(EyeVector).xy * ScaleSteps.x * float2(-1, 1));\n" -" OffsetVector *= ScaleSteps.z;\n" -" for(i = 0.0; i < ScaleSteps.y; ++i)\n" -" TexCoord += OffsetVector * (1.0 - tex2Dgrad(Texture_Normal, TexCoord, dPdx, dPdy).a);\n" -" return TexCoord;\n" +" // distance-based LOD\n" +"#ifdef USEOFFSETMAPPING_LOD\n" +" float LODFactor = min(1.0, OffsetMapping_LodDistance / EyeVectorFogDepth.z);\n" +" mediump vec4 ScaleSteps = float4(OffsetMapping_ScaleSteps.x, OffsetMapping_ScaleSteps.y * LODFactor, OffsetMapping_ScaleSteps.z / LODFactor, OffsetMapping_ScaleSteps.w * LODFactor);\n" +"#else\n" +" #define ScaleSteps OffsetMapping_ScaleSteps\n" +"#endif\n" +"#ifdef USEOFFSETMAPPING_RELIEFMAPPING\n" +" // 14 sample relief mapping: linear search and then binary search\n" +" // this basically steps forward a small amount repeatedly until it finds\n" +" // itself inside solid, then jitters forward and back using decreasing\n" +" // amounts to find the impact\n" +" //float3 OffsetVector = float3(EyeVector.xy * ((1.0 / EyeVector.z) * ScaleSteps.x) * float2(-1, 1), -1);\n" +" //float3 OffsetVector = float3(normalize(EyeVector.xy) * ScaleSteps.x * float2(-1, 1), -1);\n" +" float3 OffsetVector = float3(normalize(EyeVector).xy * ScaleSteps.x * float2(-1, 1), -1);\n" +" float3 RT = float3(TexCoord, 1);\n" +" OffsetVector *= ScaleSteps.z;\n" +" for(i = 1.0; i < ScaleSteps.y; ++i)\n" +" RT += OffsetVector * step(tex2Dgrad(Texture_Normal, RT.xy, dPdx, dPdy).a, RT.z);\n" +" for(i = 0.0, f = 1.0; i < ScaleSteps.w; ++i, f *= 0.5)\n" +" RT += OffsetVector * (step(tex2Dgrad(Texture_Normal, RT.xy, dPdx, dPdy).a, RT.z) * f - 0.5 * f);\n" +" return RT.xy;\n" +"#else\n" +" // 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)\n" +" //float2 OffsetVector = float2(EyeVector.xy * ((1.0 / EyeVector.z) * ScaleSteps.x) * float2(-1, 1));\n" +" //float2 OffsetVector = float2(normalize(EyeVector.xy) * ScaleSteps.x * float2(-1, 1));\n" +" float2 OffsetVector = float2(normalize(EyeVector).xy * ScaleSteps.x * float2(-1, 1));\n" +" OffsetVector *= ScaleSteps.z;\n" +" for(i = 0.0; i < ScaleSteps.y; ++i)\n" +" TexCoord += OffsetVector * (1.0 - tex2Dgrad(Texture_Normal, TexCoord, dPdx, dPdy).a);\n" +" return TexCoord;\n" "#endif\n" "}\n" "#endif // USEOFFSETMAPPING\n" -- 2.39.2