14 namespace FogShaderIncludes
16 const std::string CameraRelativeModelOriginName =
"CameraRelativeModelOrigin";
17 const std::string WorldUpName =
"WorldUp";
18 const std::string FogIntensitiesName =
"FogIntensities";
19 const std::string FogRampName =
"FogRamp";
20 const std::string FogColourName =
"FogColour";
25 #define FOG_VERTEX_SHADER_UNIFORMS \
26 "uniform highp vec3 CameraRelativeModelOrigin;\n" \
27 "uniform lowp vec3 WorldUp;\n" \
28 "uniform lowp vec3 FogIntensities;\n" \
29 "uniform highp vec4 FogRamp;\n"
31 #define FOG_VERTEX_SHADER_FUNCTIONS \
32 "lowp float CalcHeightFogDensity(highp vec3 vertexPos) {\n" \
33 "highp vec3 cameraRelativePos = CameraRelativeModelOrigin + vertexPos;\n" \
34 "highp vec2 rampParams = vec2(dot(cameraRelativePos, WorldUp), dot(cameraRelativePos, cameraRelativePos));\n" \
35 "lowp vec2 ramps = smoothstep(FogRamp.yz, FogRamp.xw, rampParams);\n" \
36 "lowp vec2 heightAndDistanceFogParams = vec2(ramps.x*ramps.x, ramps.y); \n" \
37 "return clamp(dot(heightAndDistanceFogParams, FogIntensities.xy), 0.0, 1.0); \n" \
41 #define FOG_FRAGMENT_SHADER_UNIFORMS \
42 "uniform lowp vec4 FogColour;\n"