Improve memory and instantiation time of random buildings.
[fg:toms-fgdata.git] / Effects / building.eff
1 <?xml version="1.0" encoding="utf-8"?>
2 <PropertyList>
3   <name>Effects/building</name>
4   <inherits-from>Effects/model-combined-deferred</inherits-from>
5   <parameters>
6     <texture n="0">
7       <type>2d</type>
8       <image>Textures/buildings.png</image>
9       <filter>linear-mipmap-linear</filter>
10       <wrap-s>clamp</wrap-s>
11       <wrap-t>clamp</wrap-t>
12       <internal-format>normalized</internal-format>
13     </texture>
14     <!-- Normal Map -->
15     <normalmap-enabled type="int"> 0 </normalmap-enabled>
16     <normalmap-dds type="int"> 0 </normalmap-dds>
17     <normalmap-tiling type="float"> 1.0 </normalmap-tiling>
18     <!-- Light Map -->
19     <texture n="3">
20       <image>Textures/buildings-lightmap.png</image>
21       <filter>linear-mipmap-linear</filter>
22       <wrap-s>clamp</wrap-s>
23       <wrap-t>clamp</wrap-t>
24       <internal-format>normalized</internal-format>
25     </texture>
26     <lightmap-enabled type="int"> 1 </lightmap-enabled>
27     <lightmap-multi type="int"> 0 </lightmap-multi>
28     <lightmap-factor type="float" n="0">
29       <use>/sim/time/sun-angle-rad</use>
30     </lightmap-factor>
31     <lightmap-color type="vec3d" n="0"> 0.3 0.3 0.3 </lightmap-color>
32     <!--<lightmap-factor type="float" n="1">1.0</lightmap-factor>
33     <lightmap-color type="vec3d" n="1"> 1.0 1.0 1.0 </lightmap-color>
34     <lightmap-factor type="float" n="2">1.0</lightmap-factor>
35     <lightmap-color type="vec3d" n="2"> 1.0 1.0 1.0 </lightmap-color>
36     <lightmap-factor type="float" n="3">1.0</lightmap-factor>
37     <lightmap-color type="vec3d" n="3"> 1.0 1.0 1.0 </lightmap-color>-->
38     <!-- Reflection -->
39     <reflection-enabled type="int"> 1 </reflection-enabled>
40 <!--    <reflect-map-enabled type="int"> 1 </reflect-map-enabled>  -->
41 <reflect-map-enabled type="int"> 0 </reflect-map-enabled>
42     <reflection-correction type="float"> 0.10 </reflection-correction>
43     <reflection-dynamic type="int"> 0 </reflection-dynamic>
44     <reflection-fresnel type="float"> 0.0 </reflection-fresnel>
45     <reflection-rainbow type="float"> 0.0 </reflection-rainbow>
46     <reflection-noise type="float"> 0.0 </reflection-noise>
47         <texture n= "5" >
48                 <type>cubemap</type>
49                 <images>
50                         <positive-x>Aircraft/Generic/Effects/CubeMaps/fgfs-sky/1.png</positive-x>
51                         <negative-x>Aircraft/Generic/Effects/CubeMaps/fgfs-sky/4.png</negative-x>
52                         <positive-y>Aircraft/Generic/Effects/CubeMaps/fgfs-sky/2.png</positive-y>
53                         <negative-y>Aircraft/Generic/Effects/CubeMaps/fgfs-sky/3.png</negative-y>
54                         <positive-z>Aircraft/Generic/Effects/CubeMaps/fgfs-sky/6.png</positive-z>
55                         <negative-z>Aircraft/Generic/Effects/CubeMaps/fgfs-sky/5.png</negative-z>
56                 </images>
57         </texture>
58     <!--Ambient correction -->
59     <ambient-correction type="float"> 0.0 </ambient-correction>
60     <dirt-enabled type="int"> 0 </dirt-enabled>
61     <dirt-color type="vec3d"> 0.0 0.0 0.0 </dirt-color>
62     <dirt-factor type="float"> 0.0 </dirt-factor>
63     <material>
64       <active>true</active>
65       <color-mode-uniform>1</color-mode-uniform>
66       <ambient type="vec4d">0.6 0.6 0.6 1.0</ambient>
67       <diffuse type="vec4d">1.0 1.0 1.0 1.0</diffuse>
68       <specular type="vec4d">0.0 0.0 0.0 1.0</specular>
69       <emissive type="vec4d">0.02 0.02 0.02 1.0</emissive>
70       <shininess>0.1</shininess>
71       <color-mode>ambient-and-diffuse</color-mode>
72       <color-mode-uniform>ambient-and-diffuse</color-mode-uniform>
73       <!-- DIFFUSE -->
74           </material>
75           <material-id>0</material-id>
76           <blend>
77       <active>0</active>
78       <source>0</source>
79       <destination>0</destination>
80           </blend>
81           <shade-model>flat</shade-model>
82           <cull-face>back</cull-face>
83           <rendering-hint>opaque</rendering-hint>
84                 <!--    fog include for atmospheric scattering-->
85                 <visibility><use>/environment/ground-visibility-m</use></visibility>
86                 <avisibility><use>/environment/visibility-m</use></avisibility>
87                 <lthickness><use>/environment/ground-haze-thickness-m</use></lthickness>
88                 <scattering><use>/rendering/scene/scattering</use></scattering>
89                 <ground_scattering><use>/environment/surface/scattering</use></ground_scattering>
90                 <terminator><use>/environment/terminator-relative-position-m</use></terminator>
91                 <fogtype><use>/sim/rendering/shaders/skydome</use></fogtype>
92                 <terrain_alt><use>/environment/mean-terrain-elevation-m</use></terrain_alt>
93     <overcast><use>/rendering/scene/overcast</use></overcast>
94     <eye_alt><use>/sim/rendering/eye-altitude-m</use></eye_alt>
95                 <snow_level><use>/environment/snow-level-m</use></snow_level>
96                 <dust_cover_factor><use>/environment/surface/dust-cover-factor</use></dust_cover_factor>
97                 <fogtype><use>/sim/rendering/shaders/skydome</use></fogtype>
98                 <fogstructure><use>/environment/fog-structure</use></fogstructure>
99                 <!--    END fog include -->
100   </parameters>
101
102   <!-- Atmospheric scattering technique -->
103   <technique n="5">
104     <predicate>
105       <and>
106         <property>/sim/rendering/shaders/skydome</property>
107         <or>
108           <less-equal>
109             <value type="float">2.0</value>
110             <glversion/>
111           </less-equal>
112           <and>
113             <extension-supported>GL_ARB_shader_objects</extension-supported>
114             <extension-supported>GL_ARB_shading_language_100</extension-supported>
115             <extension-supported>GL_ARB_vertex_shader</extension-supported>
116             <extension-supported>GL_ARB_fragment_shader</extension-supported>
117           </and>
118         </or>
119       </and>
120     </predicate>
121
122     <pass>
123       <lighting>true</lighting>
124       <material>
125         <ambient><use>material/ambient</use></ambient>
126         <diffuse><use>material/diffuse</use></diffuse>
127         <specular><use>material/specular</use></specular>
128         <emissive><use>material/emissive</use></emissive>
129         <shininess><use>material/shininess</use></shininess>
130         <color-mode>ambient-and-diffuse</color-mode>
131       </material>
132       <alpha-test>false</alpha-test>
133       <shade-model>flat</shade-model>
134       <cull-face>back</cull-face>
135       <render-bin>
136         <bin-number>-1</bin-number>
137         <bin-name>RenderBin</bin-name>
138       </render-bin>
139       <texture-unit>
140         <unit>0</unit>
141           <image><use>texture[0]/image</use></image>
142           <filter><use>texture[0]/filter</use></filter>
143           <wrap-s><use>texture[0]/wrap-s</use></wrap-s>
144           <wrap-t><use>texture[0]/wrap-t</use></wrap-t>
145           <internal-format>
146             <use>texture[0]/internal-format</use>
147           </internal-format>
148       </texture-unit>
149       <program>
150         <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
151         <vertex-shader n="1">Shaders/building-default.vert</vertex-shader>
152         <fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
153         <fragment-shader n="1">Shaders/terrain-nocolor.frag</fragment-shader>
154       </program>
155       <uniform>
156         <name>texture</name>
157         <type>sampler-2d</type>
158         <value type="int">0</value>
159       </uniform>
160       <color-mask type="vec4d">0 0 0 0</color-mask>
161     </pass>
162     <pass>
163       <lighting>true</lighting>
164       <material>
165         <ambient><use>material/ambient</use></ambient>
166         <diffuse><use>material/diffuse</use></diffuse>
167         <specular><use>material/specular</use></specular>
168         <emissive><use>material/emissive</use></emissive>
169         <shininess><use>material/shininess</use></shininess>
170         <color-mode>ambient-and-diffuse</color-mode>
171       </material>
172       <blend>false</blend>
173       <alpha-test>false</alpha-test>
174       <shade-model>flat</shade-model>
175       <cull-face>back</cull-face>
176       <render-bin>
177         <bin-number><use>render-bin/bin-number</use></bin-number>
178         <bin-name><use>render-bin/bin-name</use></bin-name>
179       </render-bin>
180       <texture-unit>
181         <unit>0</unit>
182           <image><use>texture[0]/image</use></image>
183           <filter><use>texture[0]/filter</use></filter>
184           <wrap-s><use>texture[0]/wrap-s</use></wrap-s>
185           <wrap-t><use>texture[0]/wrap-t</use></wrap-t>
186           <internal-format>
187             <use>texture[0]/internal-format</use>
188           </internal-format>
189       </texture-unit>
190       <program>
191         <vertex-shader>Shaders/building-haze.vert</vertex-shader>
192         <fragment-shader>Shaders/terrain-haze.frag</fragment-shader>
193       </program>
194       <uniform>
195         <name>visibility</name>
196         <type>float</type>
197         <value><use>visibility</use></value>
198       </uniform>
199       <uniform>
200         <name>avisibility</name>
201         <type>float</type>
202         <value><use>avisibility</use></value>
203       </uniform>
204        <uniform>
205         <name>hazeLayerAltitude</name>
206         <type>float</type>
207         <value><use>lthickness</use></value>
208       </uniform>
209       <uniform>
210         <name>scattering</name>
211         <type>float</type>
212         <value><use>scattering</use></value>
213       </uniform>
214       <uniform>
215         <name>ground_scattering</name>
216         <type>float</type>
217         <value><use>ground_scattering</use></value>
218       </uniform>
219       <uniform>
220         <name>terminator</name>
221         <type>float</type>
222         <value><use>terminator</use></value>
223       </uniform>
224       <uniform>
225         <name>terrain_alt</name>
226         <type>float</type>
227         <value><use>terrain_alt</use></value>
228       </uniform>
229       <uniform>
230         <name>overcast</name>
231         <type>float</type>
232         <value><use>overcast</use></value>
233       </uniform>
234      <uniform>
235         <name>eye_alt</name>
236         <type>float</type>
237         <value><use>eye_alt</use></value>
238       </uniform>
239       <uniform>
240         <name>texture</name>
241         <type>sampler-2d</type>
242         <value type="int">0</value>
243       </uniform>
244       <uniform>
245         <name>colorMode</name>
246         <type>int</type>
247         <value>2</value> <!-- AMBIENT_AND_DIFFUSE -->
248       </uniform>
249       <depth>
250         <function>lequal</function>
251         <write-mask type="bool">false</write-mask>
252       </depth>
253     </pass>
254   </technique>
255
256   <technique n="7">
257         <pass>
258           <texture-unit n="4">
259                 <unit>4</unit>
260                 <image> 
261                   <use>texture[3]/image</use>
262                 </image>
263                 <filter>
264                   <use>texture[3]/filter</use>
265                 </filter>
266                 <wrap-s>
267                   <use>texture[3]/wrap-s</use>
268                 </wrap-s>
269                 <wrap-t>
270                   <use>texture[3]/wrap-t</use>
271                 </wrap-t>
272                 <internal-format>
273                   <use>texture[3]/internal-format</use>
274                 </internal-format>
275           </texture-unit>
276           <program n="0">
277                 <vertex-shader n="0">Shaders/building-ubershader.vert</vertex-shader>
278           </program>
279         </pass>
280   </technique>
281   
282   <technique n="8">
283         <pass>
284           <texture-unit n="4">
285                 <unit>4</unit>
286                 <image> 
287                   <use>texture[3]/image</use>
288                 </image>
289                 <filter>
290                   <use>texture[3]/filter</use>
291                 </filter>
292                 <wrap-s>
293                   <use>texture[3]/wrap-s</use>
294                 </wrap-s>
295                 <wrap-t>
296                   <use>texture[3]/wrap-t</use>
297                 </wrap-t>
298                 <internal-format>
299                   <use>texture[3]/internal-format</use>
300                 </internal-format>
301           </texture-unit>
302           <program n="0">
303                 <vertex-shader n="1">Shaders/building-ubershader.vert</vertex-shader>
304           </program>
305         </pass>
306   </technique>
307   
308   <technique n="9">
309         <pass>
310           <texture-unit n="4">
311                 <unit>4</unit>
312                 <image> 
313                   <use>texture[3]/image</use>
314                 </image>
315                 <filter>
316                   <use>texture[3]/filter</use>
317                 </filter>
318                 <wrap-s>
319                   <use>texture[3]/wrap-s</use>
320                 </wrap-s>
321                 <wrap-t>
322                   <use>texture[3]/wrap-t</use>
323                 </wrap-t>
324                 <internal-format>
325                   <use>texture[3]/internal-format</use>
326                 </internal-format>
327           </texture-unit>
328           <program n="0">
329                 <vertex-shader n="1">Shaders/building-ubershader.vert</vertex-shader>
330           </program>
331         </pass>
332   </technique>  
333   
334   <technique n="10">
335     <pass>
336       <program n="0">
337         <vertex-shader n="0">Shaders/building-deferred-gbuffer.vert</vertex-shader>
338       </program>
339     </pass>
340   </technique>  
341   
342   <technique n="11">
343     <pass>
344       <program n="0">
345         <vertex-shader n="0">Shaders/building-default.vert</vertex-shader>
346       </program>
347     </pass>
348   </technique>  
349
350         <technique n="12">
351                 <pass>
352                         <lighting>true</lighting>
353                         <material>
354                                 <active>
355                                         <use>material/active</use>
356                                 </active>
357                                 <ambient>
358                                         <use>material/ambient</use>
359                                 </ambient>
360                                 <diffuse>
361                                         <use>material/diffuse</use>
362                                 </diffuse>
363                                 <specular>
364                                         <use>material/specular</use>
365                                 </specular>
366                                 <emissive>
367                                         <use>material/emissive</use>
368                                 </emissive>
369                                 <shininess>
370                                         <use>material/shininess</use>
371                                 </shininess>
372                                 <color-mode>off</color-mode>
373                         </material>
374       <render-bin>
375                                 <bin-number>2</bin-number>
376                                 <bin-name>RenderBin</bin-name>
377       </render-bin>
378                         <blend>
379                                 <active>
380                                         <use>blend/active</use>
381                                 </active>
382                                 <source>
383                                         <use>blend/source</use>
384                                 </source>
385                                 <destination>
386                                         <use>blend/destination</use>
387                                 </destination>
388                         </blend>
389                         <shade-model>
390                                 <use>shade-model</use>
391                         </shade-model>
392                         <cull-face>
393                                 <use>cull-face</use>
394                         </cull-face>
395                         <rendering-hint>
396                                 <use>rendering-hint</use>
397                         </rendering-hint>
398                         <texture-unit>
399                                 <!-- The texture unit is always active because the shaders expect
400              that. -->
401                                 <unit>0</unit>
402                                 <!-- If there is a texture, the type in the derived effect
403         will be "2d". -->
404                                 <type>
405                                         <use>texture[0]/type</use>
406                                 </type>
407                                 <image>
408                                         <use>texture[0]/image</use>
409                                 </image>
410                                 <filter>
411                                         <use>texture[0]/filter</use>
412                                 </filter>
413                                 <wrap-s>
414                                         <use>texture[0]/wrap-s</use>
415                                 </wrap-s>
416                                 <wrap-t>
417                                         <use>texture[0]/wrap-t</use>
418                                 </wrap-t>
419                                 <!--
420         <internal-format>
421           <use>texture[0]/internal-format</use>
422         </internal-format>
423         -->
424                         </texture-unit>
425                         <vertex-program-two-side>
426                                 <use>vertex-program-two-side</use>
427                         </vertex-program-two-side>
428                         <program>
429 <!--                            <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader> -->
430                                 <!--fog include-->
431                                 <vertex-shader n="1">Shaders/building-default.vert</vertex-shader>
432                                 <fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
433                                 <!--fog include-->
434                                 <fragment-shader n="1">Shaders/default.frag</fragment-shader>
435                         </program>
436                         <!--                    BEGIN fog include -->
437                         <uniform>
438                                 <name>visibility</name>
439                                 <type>float</type>
440                                 <value>
441                                         <use>visibility</use>
442                                 </value>
443                         </uniform>
444                         <uniform>
445                                 <name>avisibility</name>
446                                 <type>float</type>
447                                 <value>
448                                         <use>avisibility</use>
449                                 </value>
450                         </uniform>
451                         <uniform>
452                                 <name>hazeLayerAltitude</name>
453                                 <type>float</type>
454                                 <value>
455                                         <use>lthickness</use>
456                                 </value>
457                         </uniform>
458                         <uniform>
459                                 <name>scattering</name>
460                                 <type>float</type>
461                                 <value>
462                                         <use>scattering</use>
463                                 </value>
464                         </uniform>
465                         <uniform>
466                                 <name>terminator</name>
467                                 <type>float</type>
468                                 <value>
469                                         <use>terminator</use>
470                                 </value>
471                         </uniform>
472                         <uniform>
473                                 <name>fogType</name>
474                                 <type>int</type>
475                                 <value>
476                                         <use>fogtype</use>
477                                 </value>
478                         </uniform>
479                         <!--                    END fog include -->
480                         <uniform>
481                                 <name>texture</name>
482                                 <type>sampler-2d</type>
483                                 <value type="int">0</value>
484                         </uniform>
485                         <uniform>
486                                 <name>colorMode</name>
487                                 <type>int</type>
488                                 <value>
489                                         <use>material/color-mode-uniform</use>
490                                 </value>
491                         </uniform>
492                 </pass>
493         </technique>  
494
495 </PropertyList>