Quality slider overwrites custom shader settings. All effects now listen to the new...
[fg:toms-fgdata.git] / gui / dialogs / shaders.xml
1 <?xml version="1.0"?>
2
3 <PropertyList>
4         <name>shaders</name>
5         <modal>false</modal>
6         <layout>vbox</layout>
7         <padding>20</padding>
8
9         <group>
10                 <layout>hbox</layout>
11                 <empty>
12                         <stretch>1</stretch>
13                 </empty>
14
15                 <text>
16                         <label>Shader options</label>
17                 </text>
18
19                 <empty>
20                         <stretch>1</stretch>
21                 </empty>
22
23                 <button>
24                         <pref-width>16</pref-width>
25                         <pref-height>16</pref-height>
26                         <legend></legend>
27                         <keynum>27</keynum>
28                         <border>2</border>
29                         <binding>
30                                 <command>dialog-close</command>
31                         </binding>
32                 </button>
33         </group>
34
35         <hrule/>
36
37         <group>
38                 <layout>hbox</layout>
39                 <text>
40                         <label>General</label>
41                         <halign>left</halign>
42                 </text>
43                 <hrule>
44                         <stretch>true</stretch>
45                 </hrule>
46         </group>
47
48         <group>
49                 <layout>hbox</layout>
50
51                 <group>
52                         <layout>vbox</layout>
53                         <halign>left</halign>
54
55                         <text>
56                                 <halign>left</halign>
57                                 <label>Generic</label>
58                                 <enable>
59                                         <property>/sim/rendering/shaders/generic</property>
60                                 </enable>
61                         </text>
62                         
63                         <text>
64                                 <halign>left</halign>
65                                 <label>Crop</label>
66                                 <enable>
67                                         <property>/sim/rendering/shaders/crop</property>
68                                 </enable>
69                         </text>
70
71                         <text>
72                                 <halign>left</halign>
73                                 <label>Landmass</label>
74                                 <enable>
75                                         <property>/sim/rendering/shaders/landmass</property>
76                                 </enable>
77                         </text>
78
79                         <text>
80                                 <halign>left</halign>
81                                 <label>Persistent contrails</label>
82                                 <enable>
83                                         <property>/sim/rendering/shaders/contrails</property>
84                                 </enable>
85                         </text>
86
87                         <text>
88                                 <halign>left</halign>
89                                 <label>Transition</label>
90                                 <enable>
91                                         <property>/sim/rendering/shaders/transition</property>
92                                 </enable>
93                         </text>
94                         
95                         <text>
96                                 <halign>left</halign>
97                                 <label>Model</label>
98                                 <enable>
99                                         <property>/sim/rendering/shaders/model</property>
100                                 </enable>
101                         </text>
102
103                         <text>
104                                 <halign>left</halign>
105                                 <label>Urban</label>
106                                 <enable>
107                                         <property>/sim/rendering/shaders/urban</property>
108                                 </enable>
109                         </text>
110
111                         <text>
112                                 <halign>left</halign>
113                                 <label>Water</label>
114                                 <enable>
115                                         <property>/sim/rendering/shaders/water</property>
116                                 </enable>
117                         </text>
118
119                 </group>
120
121                 <group>
122                         <layout>vbox</layout>
123
124                         <slider>
125                                 <name>generic</name>
126                                 <min>0.0</min>
127                                 <max>1.0</max>
128                                 <step>1.0</step>
129                                 <fraction>0.5</fraction>
130                                 <live>true</live>
131                                 <property>/sim/rendering/shaders/generic</property>
132                                 <binding>
133                                         <command>dialog-apply</command>
134                                         <object-name>generic</object-name>
135                                 </binding>
136                         </slider>
137                         
138                         <slider>
139                                 <name>crop</name>
140                                 <min>0.0</min>
141                                 <max>1.0</max>
142                                 <step>1.0</step>
143                                 <fraction>0.5</fraction>
144                                 <live>true</live>
145                                 <property>/sim/rendering/shaders/crop</property>
146                                 <binding>
147                                         <command>dialog-apply</command>
148                                         <object-name>crop</object-name>
149                                 </binding>
150                         </slider>
151
152                         <slider>
153                                 <name>landmass</name>
154                                 <min>0.0</min>
155                                 <max>5.0</max>
156                                 <step>1.0</step>
157                                 <fraction>0.17</fraction>
158                                 <live>true</live>
159                                 <property>/sim/rendering/shaders/landmass</property>
160                                 <binding>
161                                         <command>dialog-apply</command>
162                                         <object-name>landmass</object-name>
163                                 </binding>
164                         </slider>
165
166                         <slider>
167                                 <name>contrails</name>
168                                 <min>0.0</min>
169                                 <max>1.0</max>
170                                 <step>1.0</step>
171                                 <fraction>0.5</fraction>
172                                 <live>true</live>
173                                 <property>/sim/rendering/shaders/contrails</property>
174                                 <binding>
175                                         <command>dialog-apply</command>
176                                         <object-name>contrails</object-name>
177                                 </binding>
178                         </slider>
179
180                         <slider>
181                                 <name>transition</name>
182                                 <min>0.0</min>
183                                 <max>1.0</max>
184                                 <step>1.0</step>
185                                 <fraction>0.5</fraction>
186                                 <live>true</live>
187                                 <property>/sim/rendering/shaders/transition</property>
188                                 <binding>
189                                         <command>dialog-apply</command>
190                                         <object-name>transition</object-name>
191                                 </binding>
192                         </slider>
193
194                         <slider>
195                                 <name>model</name>
196                                 <min>0.0</min>
197                                 <max>3.0</max>
198                                 <step>1.0</step>
199                                 <fraction>0.25</fraction>
200                                 <live>true</live>
201                                 <property>/sim/rendering/shaders/model</property>
202                                 <binding>
203                                         <command>dialog-apply</command>
204                                         <object-name>model</object-name>
205                                 </binding>
206                         </slider>
207
208                         <slider>
209                                 <name>urban</name>
210                                 <min>0.0</min>
211                                 <max>5.0</max>
212                                 <step>1.0</step>
213                                 <fraction>0.17</fraction>
214                                 <live>true</live>
215                                 <property>/sim/rendering/shaders/urban</property>
216                                 <binding>
217                                         <command>dialog-apply</command>
218                                         <object-name>urban</object-name>
219                                 </binding>
220                         </slider>
221
222                         <slider>
223                                 <name>water</name>
224                                 <min>0.0</min>
225                                 <max>5.0</max>
226                                 <step>1.0</step>
227                                 <fraction>0.17</fraction>
228                                 <live>true</live>
229                                 <property>/sim/rendering/shaders/water</property>
230                                 <binding>
231                                         <command>dialog-apply</command>
232                                         <object-name>water</object-name>
233                                 </binding>
234                         </slider>
235
236                 </group>
237
238         </group>
239
240         <group>
241                 <layout>hbox</layout>
242                 <text>
243                         <label>Aircraft</label>
244                         <halign>left</halign>
245                 </text>
246                 <hrule>
247                         <stretch>true</stretch>
248                 </hrule>
249         </group>
250
251         <nasal>
252                 <open>
253                         if (props.globals.getNode("/sim/rendering/shaders/aircraft") != nil) {
254                         var group = cmdarg().getChildren("group")[4];
255                         group.removeChildren("slider");
256                         group.removeChildren("hrule");
257                         group.removeChildren("text");
258                         var shaders = props.globals.getNode("/sim/rendering/shaders/aircraft").getChildren();
259                         for(i=0; size(shaders) > i; i+=1) {
260
261                         var fraction    = 0.5;
262                         var min                 = 0;
263                         var max                 = 1;
264                         var step                = 1;
265
266                         var name        = shaders[i].getNode("name");
267
268                         if (shaders[i].getNode("step") != nil){
269                         step    = shaders[i].getNode("step");
270                         }
271                         if (shaders[i].getNode("min") != nil){
272                         min     = shaders[i].getNode("min");
273                         }
274                         if (shaders[i].getNode("max") != nil){
275                         max     = shaders[i].getNode("max");
276                         }
277
278                         if (min != nil and max != nil and step != nil){
279                         fraction = step/(max+step);
280                         }
281
282                         var target = group.getChild("slider", i, 1);
283                         props.copy(group.getNode("slider-template"), target);
284                         target.getNode("label").setValue(name != nil ? name.getValue() : (shaders[i].getName()));
285                         target.getNode("name").setValue("aircraftshader"~i);
286                         target.getNode("binding").getNode("object-name").setValue("aircraftshader"~i);
287                         target.getNode("min").setValue(min);
288                         target.getNode("max").setValue(max);
289                         target.getNode("step").setValue(step);
290                         target.getNode("fraction").setValue(fraction);
291                         target.getNode("property").setValue(shaders[i].getPath()~"/quality-level");
292                         }
293                         }
294
295                 </open>
296         </nasal>
297
298         <group>
299                 <layout>vbox</layout>
300                 <halign>left</halign>
301
302                 <slider-template>
303                         <name>
304                                 <!---->
305                         </name>
306                         <label>
307                                 <!---->
308                         </label>
309                         <min>
310                                 <!---->
311                         </min>
312                         <max>
313                                 <!---->
314                         </max>
315                         <step>
316                                 <!---->
317                         </step>
318                         <fraction>
319                                 <!---->
320                         </fraction>
321                         <property>
322                                 <!---->
323                         </property>
324                         <binding>
325                                 <command>dialog-apply</command>
326                                 <object-name>
327                                         <!---->
328                                 </object-name>
329                         </binding>
330                 </slider-template>
331         </group>
332
333         <hrule/>
334
335         <button>
336                 <legend>Close</legend>
337                 <default>true</default>
338                 <key>Esc</key>
339                 <binding>
340                         <command>dialog-close</command>
341                 </binding>
342         </button>
343
344 </PropertyList>