Tonegod.skydome.FogFilter ERROR

 Bad compile of:
1	uniform sampler2D m_Texture;
2	
3	uniform sampler2D m_DepthTexture;
4	
5	varying vec2 texCoord;
6	
7	
8	
9	uniform int m_FogMode;
10	
11	uniform vec4 m_FogColor;
12	
13	uniform float m_FogDensity;
14	
15	uniform float m_FogStartDistance;
16	
17	uniform float m_FogEndDistance;
18	
19	uniform bool m_ExcludeSky;
20	
21	
22	
23	uniform float g_Time;
24	
25	
26	
27	const float LOG2 = 1.442695;
28	
29	
30	
31	float computeLinearFogFactor(in float depth, in vec2 frustumNear, in vec2 frustumFar) {
32	
33	float depthS = (2.0 * frustumNear.x) / (frustumNear.y + frustumNear.x * (frustumNear.y - frustumNear.x));
34	
35	float depthE = (2.0 * frustumFar.x) / (frustumFar.y + frustumFar.x * (frustumFar.y - frustumFar.x));
36	
37	float fogDepth =	1.0/((frustumFar.y) /
38	
39	(frustumNear.y - depth *
40	
41	(frustumNear.y)));
42	
43	float fogFactor;
44	
45	fogFactor = (depthE - fogDepth) / (depthE - depthS);
46	
47	fogFactor = clamp( fogFactor, 0.0, 1.0 );
48	
49	return fogFactor;
50	
51	}
52	
53	
54	
55	float computeExp2FogFactorC2D(in float depth, in vec2 frustumNear) {
56	
57	float depthS = 1.0-(2.0 * frustumNear.x) / (frustumNear.y + frustumNear.x * (frustumNear.y-frustumNear.x));
58	
59	float fogDepth = ((depthS) /
60	
61	((frustumNear.y) - depth *
62	
63	((frustumNear.y))))(depthS4.0);
64	
65	float fogFactor = 0.0;
66	
67	if (depth < depthS)
68	
69	fogFactor = exp2( -m_FogDensity * m_FogDensity * fogDepth * fogDepth * LOG2 );
70	
71	fogFactor = clamp(fogFactor, 0.0, 1.0);
72	
73	return fogFactor;
74	
75	}
76	
77	
78	
79	float computeExp2FogFactorD2I(in float depth, in vec2 frustumNear) {
80	
81	float depthS = 1.0-(2.0 * frustumNear.x) / (frustumNear.y + frustumNear.x * (frustumNear.y-frustumNear.x));
82	
83	float fogDepth = 1.0-((depthS) /
84	
85	((frustumNear.y) - depth *
86	
87	((frustumNear.y))));
88	
89	float fogFactor = 1.0;
90	
91	if (depth > depthS)
92	
93	fogFactor = exp2( -m_FogDensity * m_FogDensity * fogDepth * fogDepth * LOG2 );
94	
95	fogFactor = clamp(fogFactor, 0.0, 1.0);
96	
97	return fogFactor;
98	
99	}
100	
101	
102	
103	void main() {
104	
105	vec4 texVal = texture2D(m_Texture, texCoord);
106	
107	float depth	= texture2D(m_DepthTexture,texCoord).r;
108	
109	vec2 frustumNear	= vec2(1.0,m_FogStartDistance);
110	
111	vec2 frustumFar	= vec2(1.0,m_FogEndDistance);
112	
113	
114	
115	float fogFactor;
116	
117	
118	
119	if (m_FogMode == 0) fogFactor = computeLinearFogFactor(depth, frustumNear, frustumFar);
120	
121	if (m_FogMode == 1) fogFactor = computeExp2FogFactorC2D(depth, frustumNear);
122	
123	if (m_FogMode == 2) fogFactor = computeExp2FogFactorD2I(depth, frustumNear);
124	
125	
126	
127	if (m_ExcludeSky) {
128	
129	if (depth < 1.0)
130	
131	gl_FragColor = mix(m_FogColor,texVal,fogFactor);
132	
133	else
134	
135	gl_FragColor = texVal;
136	
137	} else
138	
139	gl_FragColor = mix(m_FogColor,texVal,fogFactor);
140	
141	
142	
143	}

2015-1-28 1:14:18 com.jme3.app.Application handleError
严重: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
com.jme3.renderer.RendererException: compile error in:ShaderSource[name=tonegod/skydome/shaders/Fog.frag, defines, type=Fragment, language=GLSL100] error:ERROR: 0:59: '' : binary-expression function call can only be subroutine array dereference 
ERROR: 0:63: 'depthS4' : undeclared identifier 
ERROR: 0:63: '.0' : syntax error syntax error