Correct extension handling in the urban fragment shader.
[fg:toms-fgdata.git] / Effects / urban.eff
1 <?xml version="1.0" encoding="utf-8"?>
2 <PropertyList>
3         <name>Effects/urban</name>
4         <inherits-from>Effects/terrain-default</inherits-from>
5         <parameters>
6                 <snow-level>
7                         <use>/environment/snow-level-m</use>
8                 </snow-level>
9                 <depth-factor type="float">0.008</depth-factor>
10                 <night-color type="vec3d">0.75 0.59 0.05</night-color>
11                 <quality-level>
12                         <use>/sim/rendering/shaders/urban</use>
13                 </quality-level>
14
15                 <!--fog include--> 
16                 <visibility>
17                         <use>/environment/ground-visibility-m</use>
18                 </visibility>
19                 <avisibility>
20                         <use>/environment/visibility-m</use>
21                 </avisibility>
22                 <lthickness>
23                         <use>/environment/ground-haze-thickness-m</use>
24                 </lthickness>
25                 <scattering>
26                         <use>/rendering/scene/scattering</use>
27                 </scattering>
28                 <terminator>
29                         <use>/environment/terminator-relative-position-m</use>
30                 </terminator>
31                 <fogtype>
32                         <use>/sim/rendering/scattering-shader</use>
33                 </fogtype>
34                 <!--    END fog include -->
35
36         </parameters>
37         <generate>
38                 <normal type="int">15</normal>
39                 <tangent type="int">6</tangent>
40                 <binormal type="int">7</binormal>
41         </generate>
42         <technique n="8">
43                 <predicate>
44                         <and>
45                                 <property>/sim/rendering/shaders/urban</property>
46                                 <property>/sim/rendering/shaders/quality-level</property>
47                                 <less-equal>
48                                         <value type="float">4.0</value>
49                                         <float-property>/sim/rendering/shaders/urban</float-property>
50                                 </less-equal>
51                                 <and>
52                                         <or>
53                                                 <less-equal>
54                                                         <value type="float">2.0</value>
55                                                         <glversion/>
56                                                 </less-equal>
57                                                 <and>
58                                                         <extension-supported>GL_ARB_shader_objects</extension-supported>
59                                                         <extension-supported>GL_ARB_shading_language_100</extension-supported>
60                                                         <extension-supported>GL_ARB_vertex_shader</extension-supported>
61                                                         <extension-supported>GL_ARB_fragment_shader</extension-supported>
62                                                 </and>
63                                         </or>
64                                         <or>
65                                                 <extension-supported>GL_ATI_shader_texture_lod</extension-supported>
66                                                 <extension-supported>GL_ARB_shader_texture_lod</extension-supported>
67                                         </or>
68                                 </and>
69                         </and>
70                 </predicate>
71                 <pass>
72                         <lighting>true</lighting>
73                         <material>
74                                 <ambient>
75                                         <use>material/ambient</use>
76                                 </ambient>
77                                 <diffuse>
78                                         <use>material/diffuse</use>
79                                 </diffuse>
80                                 <specular>
81                                         <use>material/specular</use>
82                                 </specular>
83                                 <color-mode>ambient-and-diffuse</color-mode>
84                         </material>
85                         <blend>
86                                 <use>transparent</use>
87                         </blend>
88                         <alpha-test>
89                                 <use>transparent</use>
90                         </alpha-test>
91                         <shade-model>smooth</shade-model>
92                         <cull-face>back</cull-face>
93                         <render-bin>
94                                 <bin-number>
95                                         <use>render-bin/bin-number</use>
96                                 </bin-number>
97                                 <bin-name>
98                                         <use>render-bin/bin-name</use>
99                                 </bin-name>
100                         </render-bin>
101                         <texture-unit>
102                                 <unit>0</unit>
103                                 <image>
104                                         <use>texture[0]/image</use>
105                                 </image>
106                                 <filter>
107                                         <use>texture[0]/filter</use>
108                                 </filter>
109                                 <wrap-s>
110                                         <use>texture[0]/wrap-s</use>
111                                 </wrap-s>
112                                 <wrap-t>
113                                         <use>texture[0]/wrap-t</use>
114                                 </wrap-t>
115                                 <internal-format>
116                                         <use>texture[0]/internal-format</use>
117                                 </internal-format>
118                         </texture-unit>
119                         <texture-unit>
120                                 <unit>1</unit>
121                                 <image>
122                                         <use>texture[2]/image</use>
123                                 </image>
124                                 <filter>
125                                         <use>texture[2]/filter</use>
126                                 </filter>
127                                 <wrap-s>
128                                         <use>texture[2]/wrap-s</use>
129                                 </wrap-s>
130                                 <wrap-t>
131                                         <use>texture[2]/wrap-t</use>
132                                 </wrap-t>
133                                 <internal-format>
134                                         <use>texture[2]/internal-format</use>
135                                 </internal-format>
136                         </texture-unit>
137                         <texture-unit>
138                                 <unit>2</unit>
139                                 <image>
140                                         <use>texture[2]/image</use>
141                                 </image>
142                                 <filter>nearest-mipmap-nearest</filter>
143                                 <wrap-s>
144                                         <use>texture[2]/wrap-s</use>
145                                 </wrap-s>
146                                 <wrap-t>
147                                         <use>texture[2]/wrap-t</use>
148                                 </wrap-t>
149                                 <internal-format>
150                                         <use>texture[2]/internal-format</use>
151                                 </internal-format>
152                                 <mipmap-control>
153                                         <function-r>average</function-r>
154                                         <function-g>average</function-g>
155                                         <function-b>average</function-b>
156                                         <function-a>min</function-a>
157                                 </mipmap-control>
158                         </texture-unit>
159                         <texture-unit>
160                                 <unit>3</unit>
161                                 <type>noise</type>
162                         </texture-unit>
163                         <program>
164                                 <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
165                                 <vertex-shader n="1">Shaders/urban.vert</vertex-shader>
166                                 <fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
167                                 <fragment-shader n="1">Shaders/urban.frag</fragment-shader>
168                                 <attribute>
169                                         <name>tangent</name>
170                                         <index>6</index>
171                                 </attribute>
172                                 <attribute>
173                                         <name>binormal</name>
174                                         <index>7</index>
175                                 </attribute>
176                                 <attribute>
177                                         <name>normal</name>
178                                         <index>15</index>
179                                 </attribute>
180                         </program>
181                         <uniform>
182                                 <name>BaseTex</name>
183                                 <type>sampler-2d</type>
184                                 <value type="int">0</value>
185                         </uniform>
186                         <uniform>
187                                 <name>NormalTex</name>
188                                 <type>sampler-2d</type>
189                                 <value type="int">1</value>
190                         </uniform>
191                         <uniform>
192                                 <name>QDMTex</name>
193                                 <type>sampler-2d</type>
194                                 <value type="int">2</value>
195                         </uniform>
196                         <uniform>
197                                 <name>NoiseTex</name>
198                                 <type>sampler-3d</type>
199                                 <value type="int">3</value>
200                         </uniform>
201                         <uniform>
202                                 <name>depth_factor</name>
203                                 <type>float</type>
204                                 <value>
205                                         <use>depth-factor</use>
206                                 </value>
207                         </uniform>
208                         <uniform>
209                                 <name>tile_size</name>
210                                 <type>float</type>
211                                 <value>
212                                         <use>xsize</use>
213                                 </value>
214                         </uniform>
215                         <uniform>
216                                 <name>night_color</name>
217                                 <type>float-vec3</type>
218                                 <value>
219                                         <use>night-color</use>
220                                 </value>
221                         </uniform>
222                         <uniform>
223                                 <name>quality_level</name>
224                                 <type>float</type>
225                                 <value>
226                                         <use>quality-level</use>
227                                 </value>
228                         </uniform>
229                         <uniform>
230                                 <name>snowlevel</name>
231                                 <type>float</type>
232                                 <value>
233                                         <use>snow-level</use>
234                                 </value>
235                         </uniform>
236                         <uniform>
237                                 <name>max_lod_level</name>
238                                 <type>float</type>
239                                 <value>
240                                         <use>max-lod-level</use>
241                                 </value>
242                         </uniform>
243                         <!--        BEGIN fog include -->
244                         <uniform>
245                                 <name>visibility</name>
246                                 <type>float</type>
247                                 <value>
248                                         <use>visibility</use>
249                                 </value>
250                         </uniform>
251                         <uniform>
252                                 <name>avisibility</name>
253                                 <type>float</type>
254                                 <value>
255                                         <use>avisibility</use>
256                                 </value>
257                         </uniform>
258                         <uniform>
259                                 <name>hazeLayerAltitude</name>
260                                 <type>float</type>
261                                 <value>
262                                         <use>lthickness</use>
263                                 </value>
264                         </uniform>
265                         <uniform>
266                                 <name>scattering</name>
267                                 <type>float</type>
268                                 <value>
269                                         <use>scattering</use>
270                                 </value>
271                         </uniform>
272                         <uniform>
273                                 <name>terminator</name>
274                                 <type>float</type>
275                                 <value>
276                                         <use>terminator</use>
277                                 </value>
278                         </uniform>
279                         <uniform>
280                                 <name>fogType</name>
281                                 <type>int</type>
282                                 <value>
283                                         <use>fogtype</use>
284                                 </value>
285                         </uniform>
286                         <!--                    END fog include -->
287                 </pass>
288         </technique>
289         <technique n="9">
290                 <predicate>
291                         <and>
292                                 <property>/sim/rendering/shaders/urban</property>
293                                 <!--<property>/sim/rendering/shader-effects</property>-->
294                                 <less-equal>
295                                         <value type="float">2.0</value>
296                                         <float-property>/sim/rendering/shaders/quality-level</float-property>
297                                 </less-equal>
298                                 <and>
299                                         <or>
300                                                 <less-equal>
301                                                         <value type="float">2.0</value>
302                                                         <glversion/>
303                                                 </less-equal>
304                                                 <and>
305                                                         <extension-supported>GL_ARB_shader_objects</extension-supported>
306                                                         <extension-supported>GL_ARB_shading_language_100</extension-supported>
307                                                         <extension-supported>GL_ARB_vertex_shader</extension-supported>
308                                                         <extension-supported>GL_ARB_fragment_shader</extension-supported>
309                                                 </and>
310                                         </or>
311                                         <or>
312                                                 <extension-supported>GL_ATI_shader_texture_lod</extension-supported>
313                                                 <extension-supported>GL_ARB_shader_texture_lod</extension-supported>
314                                         </or>
315                                 </and>
316                         </and>
317                 </predicate>
318                 <pass>
319                         <lighting>true</lighting>
320                         <material>
321                                 <ambient>
322                                         <use>material/ambient</use>
323                                 </ambient>
324                                 <diffuse>
325                                         <use>material/diffuse</use>
326                                 </diffuse>
327                                 <specular>
328                                         <use>material/specular</use>
329                                 </specular>
330                                 <color-mode>ambient-and-diffuse</color-mode>
331                         </material>
332                         <blend>
333                                 <use>transparent</use>
334                         </blend>
335                         <alpha-test>
336                                 <use>transparent</use>
337                         </alpha-test>
338                         <shade-model>smooth</shade-model>
339                         <cull-face>back</cull-face>
340                         <render-bin>
341                                 <bin-number>
342                                         <use>render-bin/bin-number</use>
343                                 </bin-number>
344                                 <bin-name>
345                                         <use>render-bin/bin-name</use>
346                                 </bin-name>
347                         </render-bin>
348                         <texture-unit>
349                                 <unit>0</unit>
350                                 <image>
351                                         <use>texture[0]/image</use>
352                                 </image>
353                                 <filter>
354                                         <use>texture[0]/filter</use>
355                                 </filter>
356                                 <wrap-s>
357                                         <use>texture[0]/wrap-s</use>
358                                 </wrap-s>
359                                 <wrap-t>
360                                         <use>texture[0]/wrap-t</use>
361                                 </wrap-t>
362                                 <internal-format>
363                                         <use>texture[0]/internal-format</use>
364                                 </internal-format>
365                         </texture-unit>
366                         <texture-unit>
367                                 <unit>1</unit>
368                                 <image>
369                                         <use>texture[2]/image</use>
370                                 </image>
371                                 <filter>
372                                         <use>texture[2]/filter</use>
373                                 </filter>
374                                 <wrap-s>
375                                         <use>texture[2]/wrap-s</use>
376                                 </wrap-s>
377                                 <wrap-t>
378                                         <use>texture[2]/wrap-t</use>
379                                 </wrap-t>
380                                 <internal-format>
381                                         <use>texture[2]/internal-format</use>
382                                 </internal-format>
383                         </texture-unit>
384                         <texture-unit>
385                                 <unit>2</unit>
386                                 <type>noise</type>
387                         </texture-unit>
388                         <program>
389                                 <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
390                                 <vertex-shader n="1">Shaders/urban.vert</vertex-shader>
391                                 <fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
392                                 <fragment-shader n="1">Shaders/urban.frag</fragment-shader>
393                                 <attribute>
394                                         <name>tangent</name>
395                                         <index>6</index>
396                                 </attribute>
397                                 <attribute>
398                                         <name>binormal</name>
399                                         <index>7</index>
400                                 </attribute>
401                                 <attribute>
402                                         <name>normal</name>
403                                         <index>15</index>
404                                 </attribute>
405                         </program>
406                         <!--        BEGIN fog include -->
407                         <uniform>
408                                 <name>visibility</name>
409                                 <type>float</type>
410                                 <value>
411                                         <use>visibility</use>
412                                 </value>
413                         </uniform>
414                         <uniform>
415                                 <name>avisibility</name>
416                                 <type>float</type>
417                                 <value>
418                                         <use>avisibility</use>
419                                 </value>
420                         </uniform>
421                         <uniform>
422                                 <name>hazeLayerAltitude</name>
423                                 <type>float</type>
424                                 <value>
425                                         <use>lthickness</use>
426                                 </value>
427                         </uniform>
428                         <uniform>
429                                 <name>scattering</name>
430                                 <type>float</type>
431                                 <value>
432                                         <use>scattering</use>
433                                 </value>
434                         </uniform>
435                         <uniform>
436                                 <name>terminator</name>
437                                 <type>float</type>
438                                 <value>
439                                         <use>terminator</use>
440                                 </value>
441                         </uniform>
442                         <uniform>
443                                 <name>fogType</name>
444                                 <type>int</type>
445                                 <value>
446                                         <use>fogtype</use>
447                                 </value>
448                         </uniform>
449                         <!--                    END fog include -->
450                         <uniform>
451                                 <name>BaseTex</name>
452                                 <type>sampler-2d</type>
453                                 <value type="int">0</value>
454                         </uniform>
455                         <uniform>
456                                 <name>NormalTex</name>
457                                 <type>sampler-2d</type>
458                                 <value type="int">1</value>
459                         </uniform>
460                         <uniform>
461                                 <name>NoiseTex</name>
462                                 <type>sampler-3d</type>
463                                 <value type="int">2</value>
464                         </uniform>
465                         <uniform>
466                                 <name>depth_factor</name>
467                                 <type>float</type>
468                                 <value>
469                                         <use>depth-factor</use>
470                                 </value>
471                         </uniform>
472                         <uniform>
473                                 <name>tile_size</name>
474                                 <type>float</type>
475                                 <value>
476                                         <use>xsize</use>
477                                 </value>
478                         </uniform>
479                         <uniform>
480                                 <name>night_color</name>
481                                 <type>float-vec3</type>
482                                 <value>
483                                         <use>night-color</use>
484                                 </value>
485                         </uniform>
486                         <uniform>
487                                 <name>quality_level</name>
488                                 <type>float</type>
489                                 <value>
490                                         <use>quality-level</use>
491                                 </value>
492                         </uniform>
493                         <uniform>
494                                 <name>snowlevel</name>
495                                 <type>float</type>
496                                 <value>
497                                         <use>snow-level</use>
498                                 </value>
499                         </uniform>
500                         
501
502                 </pass>
503         </technique>
504 </PropertyList>