Support for creating high altitude noctilucent clouds in Advanced Weather/ALS
[fg:toms-fgdata.git] / Nasal / local_weather / cloud_definitions.nas
1
2 ########################################################
3 # routines to set up, transform and manage local weather
4 # Thorsten Renk, August 2011
5 ########################################################
6
7 # function                      purpose
8 #
9 # select_cloud_model            to define the cloud parameters, given the cloud type and subtype
10
11
12 ###########################################################
13 # define various cloud models
14 ###########################################################
15
16 var select_cloud_model = func(type, subtype) {
17
18 var rn = rand();
19 var path="Models/Weather/blank.ac";
20
21
22 if (type == "Cumulus (cloudlet)"){
23                 
24         cloudAssembly = local_weather.cloud.new(type, subtype);
25
26         if (subtype == "small") 
27                 {
28                 cloudAssembly.texture_sheet = "/Models/Weather/cumulus_sheet2.rgb";
29                 cloudAssembly.n_sprites = 10;
30                 cloudAssembly.min_width = 500.0;
31                 cloudAssembly.max_width = 700.0;
32                 cloudAssembly.min_height = 500.0;
33                 cloudAssembly.max_height = 700.0;
34                 cloudAssembly.min_cloud_width = 1300;
35                 cloudAssembly.min_cloud_height = 750;
36                 cloudAssembly.bottom_shade = 0.4;
37                 }
38         else
39                 {
40                 cloudAssembly.texture_sheet = "/Models/Weather/cumulus_sheet1.rgb";
41                 cloudAssembly.n_sprites = 5;
42                 cloudAssembly.min_width = 600.0;
43                 cloudAssembly.max_width = 900.0;
44                 cloudAssembly.min_height = 600.0;
45                 cloudAssembly.max_height = 900.0;
46                 cloudAssembly.min_cloud_width = 1300;
47                 cloudAssembly.min_cloud_height = 950;
48                 cloudAssembly.bottom_shade = 0.4;
49                 }
50                         
51
52         # characterize the basic texture sheet
53         cloudAssembly.num_tex_x = 3;
54         cloudAssembly.num_tex_y = 3;
55         
56         #characterize the cloud
57         cloudAssembly.z_scale = 1.0;
58
59         #signal that new routines are used
60         path = "new";
61         }
62
63 else if (type == "Cu (volume)"){
64
65
66
67         cloudAssembly = local_weather.cloud.new(type, subtype);
68
69         if (subtype == "small") 
70                 {
71                 cloudAssembly.texture_sheet = "/Models/Weather/cumulus_sheet2.rgb";
72                 cloudAssembly.n_sprites = 5;
73                 cloudAssembly.min_width = 400.0;
74                 cloudAssembly.max_width = 700.0;
75                 cloudAssembly.min_height = 400.0;
76                 cloudAssembly.max_height = 700.0;
77                 cloudAssembly.min_cloud_width = 1000;
78                 cloudAssembly.min_cloud_height = 1000;
79                 cloudAssembly.bottom_shade = 0.4;
80                 }
81         else
82                 {
83                 cloudAssembly.texture_sheet = "/Models/Weather/cumulus_sheet1.rgb";
84                 cloudAssembly.n_sprites = 5;
85                 cloudAssembly.min_width = 800.0;
86                 cloudAssembly.max_width = 1100.0;
87                 cloudAssembly.min_height = 800.0;
88                 cloudAssembly.max_height = 1100.0;
89                 cloudAssembly.min_cloud_width = 1500;
90                 cloudAssembly.min_cloud_height = 1150;
91                 cloudAssembly.bottom_shade = 0.4;
92                 }
93                         
94
95         # characterize the basic texture sheet
96         cloudAssembly.num_tex_x = 3;
97         cloudAssembly.num_tex_y = 3;
98         
99         #characterize the cloud
100         cloudAssembly.z_scale = 1.0;
101
102         #signal that new routines are used
103         path = "new";
104         }
105
106
107 else if (type == "Congestus"){
108         
109         cloudAssembly = local_weather.cloud.new(type, subtype);
110
111         if (subtype == "small") 
112                 {
113                 cloudAssembly.texture_sheet = "/Models/Weather/cumulus_sheet1.rgb";
114                 cloudAssembly.num_tex_x = 3;
115                 cloudAssembly.num_tex_y = 3;
116                 cloudAssembly.n_sprites = 5;
117                 cloudAssembly.min_width = 600.0;
118                 cloudAssembly.max_width = 900.0;
119                 cloudAssembly.min_height = 600.0;
120                 cloudAssembly.max_height = 900.0;
121                 cloudAssembly.min_cloud_width = 1300;
122                 cloudAssembly.min_cloud_height = 1000;
123                 cloudAssembly.bottom_shade = 0.4;
124                 }
125         else 
126                 {       
127
128                 if (rand() > 0.5)
129                         {
130                         cloudAssembly.texture_sheet = "/Models/Weather/congestus_sheet1.rgb";
131                         cloudAssembly.num_tex_x = 1;
132                         cloudAssembly.num_tex_y = 3;
133                         cloudAssembly.min_width = 1300.0;
134                         cloudAssembly.max_width = 2000.0;
135                         cloudAssembly.min_height = 600.0;
136                         cloudAssembly.max_height = 900.0;                       
137                         }
138                 else    
139                         {
140                         cloudAssembly.texture_sheet = "/Models/Weather/congestus_sheet2.rgb";
141                         cloudAssembly.num_tex_x = 1;
142                         cloudAssembly.num_tex_y = 2;
143                         cloudAssembly.min_width = 1200.0;
144                         cloudAssembly.max_width = 1800.0;
145                         cloudAssembly.min_height = 700.0;
146                         cloudAssembly.max_height = 1000.0;                      
147                         }
148
149
150                 cloudAssembly.n_sprites = 3;
151                 cloudAssembly.min_cloud_width = 2200.0;
152                 cloudAssembly.min_cloud_height = 1200.0;
153                 cloudAssembly.bottom_shade = 0.4;
154
155                 }
156         cloudAssembly.z_scale = 1.0;
157
158         #signal that new routines are used
159         path = "new";
160
161         }
162 else if (type == "Stratocumulus"){
163
164                 cloudAssembly = local_weather.cloud.new(type, subtype);
165
166                 if (subtype == "small") 
167                         {
168                         cloudAssembly.texture_sheet = "/Models/Weather/cumulus_sheet1.rgb";
169                         cloudAssembly.num_tex_x = 3;
170                         cloudAssembly.num_tex_y = 3;
171                         cloudAssembly.n_sprites = 7;
172                         cloudAssembly.min_width = 600.0;
173                         cloudAssembly.max_width = 900.0;
174                         cloudAssembly.min_height = 600.0;
175                         cloudAssembly.max_height = 900.0;
176                         cloudAssembly.min_cloud_width = 1300;
177                         cloudAssembly.min_cloud_height = 1300;
178                         cloudAssembly.bottom_shade = 0.4;
179                         }
180                 else
181                         {
182                         if (rand() > 0.66)
183                                 {
184                                 cloudAssembly.texture_sheet = "/Models/Weather/congestus_sheet1.rgb";
185                                 cloudAssembly.num_tex_x = 1;
186                                 cloudAssembly.num_tex_y = 3;
187                                 cloudAssembly.min_width = 1900.0;
188                                 cloudAssembly.max_width = 2100.0;
189                                 cloudAssembly.min_height = 1000.0;
190                                 cloudAssembly.max_height = 1100.0;      
191                                 cloudAssembly.n_sprites = 3;    
192                                 cloudAssembly.bottom_shade = 0.5;
193                                 cloudAssembly.min_cloud_width = 3500.0; 
194                                 cloudAssembly.min_cloud_height = 1600.0;
195                                 }
196                         else if (rand() > 0.33)
197                                 {
198                                 cloudAssembly.texture_sheet = "/Models/Weather/congestus_sheet2.rgb";
199                                 cloudAssembly.num_tex_x = 1;
200                                 cloudAssembly.num_tex_y = 2;
201                                 cloudAssembly.min_width = 1900.0;
202                                 cloudAssembly.max_width = 2000.0;
203                                 cloudAssembly.min_height = 1000.0;
204                                 cloudAssembly.max_height = 1100.0;      
205                                 cloudAssembly.n_sprites = 3;    
206                                 cloudAssembly.bottom_shade = 0.4;
207                                 cloudAssembly.min_cloud_width = 3500.0;
208                                 cloudAssembly.min_cloud_height = 1600.0;        
209                                 }       
210                         else 
211                                 {
212                                 cloudAssembly.texture_sheet = "/Models/Weather/cumulus_sheet1.rgb";
213                                 cloudAssembly.num_tex_x = 3;
214                                 cloudAssembly.num_tex_y = 3;
215                                 cloudAssembly.min_width = 800.0;
216                                 cloudAssembly.max_width = 1000.0;
217                                 cloudAssembly.min_height = 800.0;
218                                 cloudAssembly.max_height = 1000.0;      
219                                 cloudAssembly.n_sprites = 5;    
220                                 cloudAssembly.bottom_shade = 0.4;
221                                 cloudAssembly.min_cloud_width = 3000.0;
222                                 cloudAssembly.min_cloud_height = 1100.0;        
223                                 }       
224                         }
225                         
226
227                 cloudAssembly.z_scale = 1.0;
228
229                 #signal that new routines are used
230                 path = "new";
231                 
232
233         
234         }
235 else if (type == "Cumulus (whisp)"){
236
237         
238         cloudAssembly = local_weather.cloud.new(type, subtype);
239
240         var mult = 1.0;
241
242         # characterize the basic texture sheet
243         cloudAssembly.texture_sheet = "/Models/Weather/altocumulus_sheet1.rgb";
244         cloudAssembly.num_tex_x = 3;
245         cloudAssembly.num_tex_y = 3;
246         
247         #characterize the cloud
248         cloudAssembly.bottom_shade = 0.8;
249         cloudAssembly.n_sprites = 4;
250         cloudAssembly.min_width = 400.0 * mult;
251         cloudAssembly.max_width = 600.0 * mult;
252         cloudAssembly.min_height = 400.0 * mult;
253         cloudAssembly.max_height = 600.0 * mult;
254         cloudAssembly.min_cloud_width = 800;
255         cloudAssembly.min_cloud_height = 800;
256         cloudAssembly.z_scale = 1.0;
257
258         #signal that new routines are used
259         path = "new";
260         
261         
262         }
263 else if (type == "Cumulus bottom"){
264
265         cloudAssembly = local_weather.cloud.new(type, subtype);
266
267         var mult = 1.0;
268
269         # characterize the basic texture sheet
270         cloudAssembly.texture_sheet = "/Models/Weather/cumulus_bottom_sheet1.rgb";
271         cloudAssembly.num_tex_x = 1;
272         cloudAssembly.num_tex_y = 1;
273         
274         #characterize the cloud
275         cloudAssembly.bottom_shade = 0.4;
276         cloudAssembly.n_sprites = 4;
277         cloudAssembly.min_width = 600.0 * mult;
278         cloudAssembly.max_width = 800.0 * mult;
279         cloudAssembly.min_height = 600.0 * mult;
280         cloudAssembly.max_height = 800.0 * mult;
281         cloudAssembly.min_cloud_width = 1200 * mult * mult;
282         cloudAssembly.min_cloud_height = 800 * mult * mult;
283         cloudAssembly.z_scale = 0.6;
284
285         #signal that new routines are used
286         path = "new";
287                 
288         }
289 else if (type == "Congestus bottom"){
290
291         cloudAssembly = local_weather.cloud.new(type, subtype);
292
293         var mult = 1.0;
294
295         # characterize the basic texture sheet
296         cloudAssembly.texture_sheet = "/Models/Weather/cumulus_bottom_sheet1.rgb";
297         cloudAssembly.num_tex_x = 1;
298         cloudAssembly.num_tex_y = 1;
299         
300         #characterize the cloud
301         cloudAssembly.bottom_shade = 0.4;
302         cloudAssembly.n_sprites = 4;
303         cloudAssembly.min_width = 1100.0 * mult;
304         cloudAssembly.max_width = 1400.0 * mult;
305         cloudAssembly.min_height = 1100.0 * mult;
306         cloudAssembly.max_height = 1400.0 * mult;
307         cloudAssembly.min_cloud_width = 1600 * mult * mult;
308         cloudAssembly.min_cloud_height = 1200 * mult * mult;
309         cloudAssembly.z_scale = 0.4;
310
311         #signal that new routines are used
312         path = "new";
313         
314         }
315 else if (type == "Stratocumulus bottom"){
316
317         cloudAssembly = local_weather.cloud.new(type, subtype);
318
319         # characterize the basic texture sheet
320         cloudAssembly.texture_sheet = "/Models/Weather/cumulus_bottom_sheet1.rgb";
321         cloudAssembly.num_tex_x = 1;
322         cloudAssembly.num_tex_y = 1;
323         
324         #characterize the cloud
325         cloudAssembly.bottom_shade = 0.7;
326         cloudAssembly.n_sprites = 3;
327         cloudAssembly.min_width = 1200.0;
328         cloudAssembly.max_width = 1600.0;
329         cloudAssembly.min_height = 1200.0 ;
330         cloudAssembly.max_height = 1600.0;
331         cloudAssembly.min_cloud_width = 2000 ;
332         cloudAssembly.min_cloud_height = 1700;
333         cloudAssembly.z_scale = 0.4;
334
335         #signal that new routines are used
336         path = "new";
337         
338         }
339 else if (type == "Cumulonimbus (cloudlet)"){
340
341         cloudAssembly = local_weather.cloud.new(type, subtype);
342
343         # characterize the basic texture sheet
344                                 
345
346         cloudAssembly.num_tex_x = 2;
347         cloudAssembly.num_tex_y = 2;
348                 
349         if (rand() < 0.5)
350                 {cloudAssembly.texture_sheet = "/Models/Weather/cumulonimbus_sheet2.rgb";}                      
351         else
352                 {cloudAssembly.texture_sheet = "/Models/Weather/cumulonimbus_sheet1.rgb";}
353                 
354         var mult = 1.0;
355         if (subtype == "small") {mult = 0.7;}
356
357         #characterize the cloud
358         cloudAssembly.bottom_shade = 0.6;
359         cloudAssembly.n_sprites = 5;                    
360         cloudAssembly.min_width = 1700.0 * mult;
361         cloudAssembly.max_width = 2200.0 * mult;
362         cloudAssembly.min_height = 1700.0 * mult;
363         cloudAssembly.max_height = 2200.0 * mult;
364         cloudAssembly.min_cloud_width = 3500.0 * mult;
365         cloudAssembly.min_cloud_height = 3500.0 * mult;
366         cloudAssembly.z_scale = 1.0;
367
368         #signal that new routines are used
369         path = "new";
370         }
371
372 else if (type == "Altocumulus"){
373                 
374         cloudAssembly = local_weather.cloud.new(type, subtype);
375
376         var mult = 1.0;
377         if (subtype == "small") {mult = 0.7;}
378         else {mult = 1.0;}
379
380         # characterize the basic texture sheet
381         cloudAssembly.texture_sheet = "/Models/Weather/altocumulus_sheet1.rgb";
382         cloudAssembly.num_tex_x = 3;
383         cloudAssembly.num_tex_y = 3;
384         
385         #characterize the cloud
386         cloudAssembly.bottom_shade = 0.7;
387         cloudAssembly.n_sprites = 6;
388         cloudAssembly.min_width = 40.0 * mult;
389         cloudAssembly.max_width = 600.0 * mult;
390         cloudAssembly.min_height = 400.0 * mult;
391         cloudAssembly.max_height = 600.0 * mult;
392         cloudAssembly.min_cloud_width = 1000 * mult * mult;
393         cloudAssembly.min_cloud_height = 1000 * mult * mult;
394         cloudAssembly.z_scale = 0.8;
395
396         #signal that new routines are used
397         path = "new";
398         }
399
400 else if (type == "Stratus (structured)"){
401                 
402         cloudAssembly = local_weather.cloud.new(type, subtype);
403
404         var mult = 1.0;
405         if (subtype == "small") {mult = 0.7;}
406         else {mult = 1.0;}
407
408         # characterize the basic texture sheet
409         cloudAssembly.texture_sheet = "/Models/Weather/altocumulus_sheet1.rgb";
410         cloudAssembly.num_tex_x = 3;
411         cloudAssembly.num_tex_y = 3;
412         
413         #characterize the cloud
414         cloudAssembly.bottom_shade = 0.4;
415         # cloudAssembly.n_sprites = 25;
416         cloudAssembly.n_sprites = 12;
417         cloudAssembly.min_width = 1700.0 * mult;
418         cloudAssembly.max_width = 2500.0 * mult;
419         cloudAssembly.min_height = 1700.0 * mult;
420         cloudAssembly.max_height = 2500.0 * mult;
421         cloudAssembly.min_cloud_width = 3200.0 * mult * mult;
422         cloudAssembly.min_cloud_height = 500.0 * mult * mult + cloudAssembly.max_height;
423         cloudAssembly.z_scale = 0.3;
424
425         #signal that new routines are used
426         path = "new";
427         }
428         
429 else if (type == "Stratus structured CS"){
430                 
431         cloudAssembly = local_weather.cloud.new(type, subtype);
432
433         var mult = 1.0;
434         
435         mult = mult * local_weather.cloud_size_scale;
436
437         # characterize the basic texture sheet
438         cloudAssembly.texture_sheet = "/Models/Weather/altocumulus_sheet1.rgb";
439         cloudAssembly.num_tex_x = 3;
440         cloudAssembly.num_tex_y = 3;
441         
442         #characterize the cloud
443         cloudAssembly.bottom_shade = 0.4;
444         cloudAssembly.n_sprites = 6;
445         cloudAssembly.min_width = 1000.0 * mult;
446         cloudAssembly.max_width = 1000.0 * mult;
447         cloudAssembly.min_height = 1000.0 * mult;
448         cloudAssembly.max_height = 1000.0 * mult;
449         cloudAssembly.min_cloud_width = 1305 * mult;
450         cloudAssembly.min_cloud_height = 1305.0 * mult;
451         cloudAssembly.z_scale = 0.3;
452
453         #signal that new routines are used
454         path = "new";
455         }       
456         
457 else if (type == "Altocumulus perlucidus"){
458
459         # new code
460         cloudAssembly = local_weather.cloud.new(type, subtype);
461
462         var mult = 1.0;
463         if (subtype == "small") {mult = 0.7;}
464         else if (subtype == "huge") {mult = 1.5;}
465
466         # characterize the basic texture sheet
467         cloudAssembly.texture_sheet = "/Models/Weather/altocumulus_sheet1.rgb";
468         cloudAssembly.num_tex_x = 3;
469         cloudAssembly.num_tex_y = 3;
470         
471         #characterize the cloud
472         cloudAssembly.bottom_shade = 0.7;
473         cloudAssembly.n_sprites = 25;
474         cloudAssembly.min_width = 1700.0 * mult;
475         cloudAssembly.max_width = 2500.0 * mult;
476         cloudAssembly.min_height = 1700.0 * mult;
477         cloudAssembly.max_height = 2500.0 * mult;
478         cloudAssembly.min_cloud_width = 3200.0 * mult * mult;
479         cloudAssembly.min_cloud_height = 500.0 * mult * mult + cloudAssembly.max_height;
480         cloudAssembly.z_scale = 0.2;
481
482         #signal that new routines are used
483         path = "new";
484         }
485 else if ((type == "Cumulonimbus") or (type == "Cumulonimbus (rain)")) {
486         if (subtype == "small") {
487                 if (rn > 0.5) {path = "Models/Weather/cumulonimbus_small1.xml";}
488                 else  {path = "Models/Weather/cumulonimbus_small2.xml";}
489                 }       
490         else if (subtype == "large") {
491                 if (rn > 0.5) {path = "Models/Weather/cumulonimbus_small1.xml";}
492                 else  {path = "Models/Weather/cumulonimbus_small2.xml";}
493                 }
494         }       
495 else if (type == "Cirrus") {
496         if (subtype == "large") {
497                 if (rn > 0.916) {path = "Models/Weather/cirrus1.xml";}
498                 else if (rn > 0.833) {path = "Models/Weather/cirrus2.xml";}
499                 else if (rn > 0.75) {path = "Models/Weather/cirrus3.xml";}
500                 else if (rn > 0.666) {path = "Models/Weather/cirrus4.xml";}
501                 else if (rn > 0.583) {path = "Models/Weather/cirrus5.xml";}
502                 else if (rn > 0.500) {path = "Models/Weather/cirrus6.xml";}
503                 else if (rn > 0.416) {path = "Models/Weather/cirrus7.xml";}
504                 else if (rn > 0.333) {path = "Models/Weather/cirrus8.xml";}
505                 else if (rn > 0.250) {path = "Models/Weather/cirrus9.xml";}
506                 else if (rn > 0.166) {path = "Models/Weather/cirrus10.xml";}
507                 else if (rn > 0.083) {path = "Models/Weather/cirrus11.xml";}
508                 else  {path = "Models/Weather/cirrus12.xml";}
509                 }       
510         else if (subtype == "small") {
511                 if (rn > 0.75) {path = "Models/Weather/cirrus_amorphous1.xml";}
512                 else if (rn > 0.5) {path = "Models/Weather/cirrus_amorphous2.xml";}
513                 else if (rn > 0.25) {path = "Models/Weather/cirrus_amorphous3.xml";}
514                 else  {path = "Models/Weather/cirrus_amorphous4.xml";}
515                 }       
516         }
517 else if (type == "Cirrocumulus") {
518         if (subtype == "small") {
519                 if (rn > 0.5) {path = "Models/Weather/cirrocumulus1.xml";}
520                 else  {path = "Models/Weather/cirrocumulus2.xml";}
521                 }       
522         else if (subtype == "large") {
523                 if (rn > 0.875) {path = "Models/Weather/cirrocumulus1.xml";}
524                 else if (rn > 0.750){path = "Models/Weather/cirrocumulus4.xml";}
525                 else if (rn > 0.625){path = "Models/Weather/cirrocumulus5.xml";}
526                 else if (rn > 0.500){path = "Models/Weather/cirrocumulus6.xml";}
527                 else if (rn > 0.385){path = "Models/Weather/cirrocumulus7.xml";}
528                 else if (rn > 0.250){path = "Models/Weather/cirrocumulus8.xml";}
529                 else if (rn > 0.125){path = "Models/Weather/cirrocumulus9.xml";}
530                 else {path = "Models/Weather/cirrocumulus10.xml";}
531                 }       
532         }
533 else if (type=="Noctilucent") {
534                 if (rn>0.75) {path = "Models/Weather/noctilucent7.xml";}
535                 else if (rn > 0.5) {path = "Models/Weather/noctilucent8.xml";}
536                 else if (rn > 0.25) {path = "Models/Weather/noctilucent9.xml";}
537                 else  {path = "Models/Weather/noctilucent10.xml";}
538         }
539 else if (type == "Cirrocumulus (cloudlet)") {
540
541         cloudAssembly = local_weather.cloud.new(type, subtype);
542
543         var mult = 1.0;
544         if (subtype == "small") {mult = 0.6;}
545         else if (subtype == "huge") {mult = 1.5;}
546
547         # characterize the basic texture sheet
548         cloudAssembly.texture_sheet = "/Models/Weather/cirrocumulus_sheet1.rgb";
549         cloudAssembly.num_tex_x = 3;
550         cloudAssembly.num_tex_y = 3;
551         
552         #characterize the cloud
553         cloudAssembly.bottom_shade = 1.0;
554         cloudAssembly.n_sprites = 8;
555         cloudAssembly.min_width = 700.0 * mult;
556         cloudAssembly.max_width = 1200.0 * mult;
557         cloudAssembly.min_height = 700.0 * mult;
558         cloudAssembly.max_height = 1200.0 * mult;
559         cloudAssembly.min_cloud_width = 1500.0;
560         cloudAssembly.min_cloud_height = 1300.0 * mult;
561         cloudAssembly.z_scale = 0.3;
562
563         path = "new";
564         }
565 else if (type == "Cirrocumulus (new)") {
566
567         cloudAssembly = local_weather.cloud.new(type, subtype);
568
569         var mult = 1.0;
570         if (subtype == "small") {mult = 0.7;}
571         else {mult = 1.3;}
572
573         # characterize the basic texture sheet
574         cloudAssembly.texture_sheet = "/Models/Weather/cirrocumulus_sheet1.rgb";
575         cloudAssembly.num_tex_x = 3;
576         cloudAssembly.num_tex_y = 3;
577         
578         #characterize the cloud
579         cloudAssembly.bottom_shade = 1.0;
580         cloudAssembly.n_sprites = 2;
581         cloudAssembly.min_width = 200.0 * mult;
582         cloudAssembly.max_width = 300.0 * mult;
583         cloudAssembly.min_height = 200.0 * mult;
584         cloudAssembly.max_height = 300.0 * mult;
585         cloudAssembly.min_cloud_width = 400.0 * mult;
586         cloudAssembly.min_cloud_height = 400.0 * mult;
587         cloudAssembly.z_scale = 0.5;
588
589         #signal that new routines are used
590         path = "new";           
591         }
592
593 else if (type == "Fogpatch") {
594
595         cloudAssembly = local_weather.cloud.new(type, subtype);
596
597         var mult = 1.0;
598         if (subtype == "small") {mult = 0.7;}
599         else {mult = 1.0;}
600         
601         mult = mult * local_weather.cloud_size_scale;
602
603         # characterize the basic texture sheet
604         cloudAssembly.texture_sheet = "/Models/Weather/fogpatch_sheet1.rgb";
605         cloudAssembly.num_tex_x = 1;
606         cloudAssembly.num_tex_y = 1;
607         
608         #characterize the cloud
609         cloudAssembly.bottom_shade = 1.0;
610         cloudAssembly.n_sprites = 1;
611         cloudAssembly.min_width = 300.0 * mult;
612         cloudAssembly.max_width = 300.0 * mult;
613         cloudAssembly.min_height = 300.0 * mult;
614         cloudAssembly.max_height = 300.0 * mult;
615         cloudAssembly.min_cloud_width = 305.0 * mult;
616         cloudAssembly.min_cloud_height = 305.0 * mult;
617         cloudAssembly.z_scale = 0.5;
618
619         #signal that new routines are used
620         path = "new";           
621         }       
622         
623 else if (type == "Nimbus") {
624         
625         cloudAssembly = local_weather.cloud.new(type, subtype);
626
627         var mult = 1.0;
628         if (subtype == "small") {mult = 0.7;}
629         else {mult = 1.0;}
630
631         # characterize the basic texture sheet
632         cloudAssembly.texture_sheet = "/Models/Weather/nimbus_sheet1.rgb";
633         cloudAssembly.num_tex_x = 2;
634         cloudAssembly.num_tex_y = 3;
635         
636         #characterize the cloud
637         cloudAssembly.bottom_shade = 0.6;
638         #cloudAssembly.n_sprites = 10;
639         cloudAssembly.n_sprites = 5;
640         cloudAssembly.min_width = 2700.0 * mult;
641         cloudAssembly.max_width = 3000.0 * mult;
642         cloudAssembly.min_height = 2700.0 * mult;
643         cloudAssembly.max_height = 3000.0 * mult;
644         cloudAssembly.min_cloud_width = 3500.0 * mult;
645         cloudAssembly.min_cloud_height = 3200.0 * mult;
646         cloudAssembly.z_scale = 0.4;
647         cloudAssembly.tracer_flag = 1;
648
649         #signal that new routines are used
650         path = "new";
651         }
652 else if (type == "Stratus") {
653                 
654         cloudAssembly = local_weather.cloud.new(type, subtype);
655
656         var mult = 1.0;
657         if (subtype == "small") 
658                 {
659                 mult = 0.8;
660                 cloudAssembly.texture_sheet = "/Models/Weather/cirrocumulus_sheet1.rgb";
661                 cloudAssembly.num_tex_x = 3;
662                 cloudAssembly.num_tex_y = 3;
663                 cloudAssembly.n_sprites = 10;
664                 cloudAssembly.z_scale = 0.6;
665                 }
666         else    
667                 {
668                 mult = 1.0;
669                 cloudAssembly.texture_sheet = "/Models/Weather/stratus_sheet1.rgb";
670                 cloudAssembly.num_tex_x = 3;
671                 cloudAssembly.num_tex_y = 2;
672                 #cloudAssembly.n_sprites = 10;
673                 cloudAssembly.n_sprites = 6;
674                 cloudAssembly.z_scale = 0.4;
675                 }
676         
677         #characterize the cloud
678         cloudAssembly.bottom_shade = 0.4;
679         cloudAssembly.min_width = 2000.0 * mult;
680         cloudAssembly.max_width = 2500.0 * mult;
681         cloudAssembly.min_height = 2000.0 * mult;
682         cloudAssembly.max_height = 2500.0 * mult;
683         cloudAssembly.min_cloud_width = 5000.0;
684         cloudAssembly.min_cloud_height = 2600 * mult; #1.1 *  cloudAssembly.max_height;
685
686
687         #signal that new routines are used
688         path = "new";
689         
690         }
691 else if (type == "Stratus (thin)") {
692
693         cloudAssembly = local_weather.cloud.new(type, subtype);
694
695         var mult = 1.0;
696         if (subtype == "small") 
697                 {
698                 mult = 0.5;
699                 cloudAssembly.texture_sheet = "/Models/Weather/cirrocumulus_sheet1.rgb";
700                 cloudAssembly.num_tex_x = 3;
701                 cloudAssembly.num_tex_y = 3;
702                 # cloudAssembly.n_sprites = 20;
703                 cloudAssembly.n_sprites = 10;
704                 cloudAssembly.z_scale = 0.4;
705                 }
706         else 
707                 {
708                 mult = 1.0;
709                 cloudAssembly.texture_sheet = "/Models/Weather/stratus_sheet1.rgb";
710                 cloudAssembly.num_tex_x = 3;
711                 cloudAssembly.num_tex_y = 2;
712                 # cloudAssembly.n_sprites = 10;
713                 cloudAssembly.n_sprites = 6;
714                 cloudAssembly.z_scale = 0.3;
715                 }
716
717                 
718         
719         #characterize the cloud
720         cloudAssembly.bottom_shade = 0.8;
721         cloudAssembly.min_width = 1900.0 * mult;
722         cloudAssembly.max_width = 2400.0 * mult;
723         cloudAssembly.min_height = 1900.0 * mult;
724         cloudAssembly.max_height = 2400.0 * mult;
725         cloudAssembly.min_cloud_width = 4200.0;         
726         cloudAssembly.min_cloud_height = 2500.0 * mult;
727
728
729         #signal that new routines are used
730         path = "new";
731                 
732         
733         }
734 else if (type == "Cirrostratus") {
735                 
736         cloudAssembly = local_weather.cloud.new(type, subtype);
737
738         var mult = 1.0;
739         if (subtype == "small") {mult = 0.7;}
740         else {mult = 1.0;}
741
742         # characterize the basic texture sheet
743         cloudAssembly.texture_sheet = "/Models/Weather/cirrostratus_sheet1.rgb";
744         cloudAssembly.num_tex_x = 2;
745         cloudAssembly.num_tex_y = 2;
746         
747         #characterize the cloud
748         cloudAssembly.bottom_shade = 1.0;
749         cloudAssembly.n_sprites = 4;
750         cloudAssembly.min_width = 3500.0 * mult;
751         cloudAssembly.max_width = 4000.0 * mult;
752         cloudAssembly.min_height = 3500.0 * mult;
753         cloudAssembly.max_height = 4000.0 * mult;
754         cloudAssembly.min_cloud_width = 8000.0;
755         cloudAssembly.min_cloud_height = 50.0;
756         cloudAssembly.z_scale = 0.3;
757
758         #signal that new routines are used
759         path = "new";
760         
761         }
762 else if (type == "Cirrostratus (small)") {
763                 
764         cloudAssembly = local_weather.cloud.new(type, subtype);
765
766         var mult = 1.0;
767         if (subtype == "small") {mult = 0.45;}
768         else {mult = 0.7;}
769
770         # characterize the basic texture sheet
771         cloudAssembly.texture_sheet = "/Models/Weather/cirrostratus_sheet1.rgb";
772         cloudAssembly.num_tex_x = 2;
773         cloudAssembly.num_tex_y = 2;
774         
775         #characterize the cloud
776         cloudAssembly.bottom_shade = 1.0;
777         cloudAssembly.n_sprites = 2;
778         cloudAssembly.min_width = 3500.0 * mult;
779         cloudAssembly.max_width = 4000.0 * mult;
780         cloudAssembly.min_height = 3500.0 * mult;
781         cloudAssembly.max_height = 4000.0 * mult;
782         cloudAssembly.min_cloud_width = 4500.0 * mult;
783         cloudAssembly.min_cloud_height = 4500.0 * mult;
784         cloudAssembly.z_scale = 0.5;
785
786         #signal that new routines are used
787         path = "new";
788         
789         }       
790         
791 else if (type == "Fog (thin)") {
792         if (subtype == "small") {
793                 if (rn > 0.8) {path = "Models/Weather/stratus_thin1.xml";}
794                 else if (rn > 0.6) {path = "Models/Weather/stratus_thin2.xml";}
795                 else if (rn > 0.4) {path = "Models/Weather/stratus_thin3.xml";}
796                 else if (rn > 0.2) {path = "Models/Weather/stratus_thin4.xml";}
797                 else  {path = "Models/Weather/stratus_thin5.xml";}
798                 }       
799         else if (subtype == "large") {
800                 if (rn > 0.8) {path = "Models/Weather/stratus_thin1.xml";}
801                 else if (rn > 0.6) {path = "Models/Weather/stratus_thin2.xml";}
802                 else if (rn > 0.4) {path = "Models/Weather/stratus_thin3.xml";}
803                 else if (rn > 0.2) {path = "Models/Weather/stratus_thin4.xml";}
804                 else  {path = "Models/Weather/stratus_thin5.xml";}
805                 }       
806         }
807 else if (type == "Fog (thick)") {
808
809         cloudAssembly = local_weather.cloud.new(type, subtype);
810
811         var mult = 1.0;
812         if (subtype == "small") 
813                 {
814                 mult = 0.8;
815                 cloudAssembly.texture_sheet = "/Models/Weather/stratus_sheet1.rgb";
816                 cloudAssembly.num_tex_x = 3;
817                 cloudAssembly.num_tex_y = 2;
818                 cloudAssembly.n_sprites = 5;
819                 cloudAssembly.z_scale = 1.0;
820                 }
821         else    
822                 {
823                 mult = 1.0;
824                 cloudAssembly.texture_sheet = "/Models/Weather/stratus_sheet1.rgb";
825                 cloudAssembly.num_tex_x = 3;
826                 cloudAssembly.num_tex_y = 2;
827                 cloudAssembly.n_sprites = 5;
828                 cloudAssembly.z_scale = 1.0;
829                 }
830         
831         #characterize the cloud
832         cloudAssembly.bottom_shade = 0.4;
833         cloudAssembly.min_width = 2000.0 * mult;
834         cloudAssembly.max_width = 2500.0 * mult;
835         cloudAssembly.min_height = 2000.0 * mult;
836         cloudAssembly.max_height = 2500.0 * mult;
837         cloudAssembly.min_cloud_width = 5000.0;
838         cloudAssembly.min_cloud_height = 1.1 *  cloudAssembly.max_height;
839
840
841         #signal that new routines are used
842         path = "new";
843         }
844 else if (type == "Test") {path="Models/Weather/single_cloud.xml";}
845 else if (type == "Box_test") {
846         if (subtype == "standard") {
847                 if (rn > 0.8) {path = "Models/Weather/cloudbox1.xml";}
848                 else if (rn > 0.6) {path = "Models/Weather/cloudbox2.xml";}
849                 else if (rn > 0.4) {path = "Models/Weather/cloudbox3.xml";}
850                 else if (rn > 0.2) {path = "Models/Weather/cloudbox4.xml";}
851                 else  {path = "Models/Weather/cloudbox5.xml";}          
852                 }
853         else if (subtype == "core") {
854                 if (rn > 0.8) {path = "Models/Weather/cloudbox_core1.xml";}
855                 else if (rn > 0.6) {path = "Models/Weather/cloudbox_core2.xml";}
856                 else if (rn > 0.4) {path = "Models/Weather/cloudbox_core3.xml";}
857                 else if (rn > 0.2) {path = "Models/Weather/cloudbox_core4.xml";}
858                 else  {path = "Models/Weather/cloudbox_core5.xml";}             
859                 }
860         else if (subtype == "bottom") {
861                 if (rn > 0.66) {path = "Models/Weather/cloudbox_bottom1.xml";}
862                 else if (rn > 0.33) {path = "Models/Weather/cloudbox_bottom2.xml";}
863                 else if (rn > 0.0) {path = "Models/Weather/cloudbox_bottom3.xml";}      
864                 }
865         }
866 else if (type == "Cb_box") {
867
868                 cloudAssembly = local_weather.cloud.new(type, subtype);
869
870                 if (subtype == "standard")
871                         {
872                         if (rand() > 0.5) # use a Congestus texture
873                                 {
874
875                                 if (rand() > 0.5)
876                                         {
877                                         cloudAssembly.texture_sheet = "/Models/Weather/congestus_sheet1.rgb";
878                                         cloudAssembly.num_tex_x = 1;
879                                         cloudAssembly.num_tex_y = 3;
880                                         cloudAssembly.min_width = 1300.0;
881                                         cloudAssembly.max_width = 2000.0;
882                                         cloudAssembly.min_height = 600.0;
883                                         cloudAssembly.max_height = 900.0;                       
884                                         }
885                                 else    
886                                         {
887                                         cloudAssembly.texture_sheet = "/Models/Weather/congestus_sheet2.rgb";
888                                         cloudAssembly.num_tex_x = 1;
889                                         cloudAssembly.num_tex_y = 2;
890                                         cloudAssembly.min_width = 1200.0;
891                                         cloudAssembly.max_width = 1800.0;
892                                         cloudAssembly.min_height = 700.0;
893                                         cloudAssembly.max_height = 1000.0;                      
894                                         }
895
896                                 cloudAssembly.n_sprites = 3;
897                                 cloudAssembly.min_cloud_width = 2200.0;
898                                 cloudAssembly.min_cloud_height = 1200.0;
899                                 cloudAssembly.bottom_shade = 0.6;
900                                 cloudAssembly.z_scale = 1.0;
901                                 }
902                         else
903                                 {
904                                 # characterize the basic texture sheet
905                                 cloudAssembly.texture_sheet = "/Models/Weather/cumulonimbus_sheet2.rgb";
906                                 cloudAssembly.num_tex_x = 2;
907                                 cloudAssembly.num_tex_y = 2;
908                 
909                                 #characterize the cloud
910                                 cloudAssembly.bottom_shade = 0.6;
911                                 cloudAssembly.n_sprites = 6;
912                                 cloudAssembly.min_width = 800.0;
913                                 cloudAssembly.max_width = 1100.0;
914                                 cloudAssembly.min_height = 800.0;
915                                 cloudAssembly.max_height = 1100.0;
916                                 cloudAssembly.min_cloud_width = 3000.0;
917                                 cloudAssembly.min_cloud_height = 1500.0;
918                                 cloudAssembly.z_scale = 1.0;
919                                 
920
921                                 }
922                         }
923                 else if (subtype == "core")
924                         {
925                         # characterize the basic texture sheet
926                         cloudAssembly.texture_sheet = "/Models/Weather/cumulonimbus_sheet1.rgb";
927                         cloudAssembly.num_tex_x = 2;
928                         cloudAssembly.num_tex_y = 2;
929         
930                         #characterize the cloud
931                         cloudAssembly.bottom_shade = 0.6;
932                         cloudAssembly.n_sprites = 20;
933                         cloudAssembly.min_width = 1000.0;
934                         cloudAssembly.max_width = 1500.0;
935                         cloudAssembly.min_height = 1000.0;
936                         cloudAssembly.max_height = 1500.0 ;
937                         cloudAssembly.min_cloud_width = 3500.0;
938                         cloudAssembly.min_cloud_height = 2000.0;
939                         cloudAssembly.z_scale = 1.0;
940                         }
941                 else if (subtype == "bottom")
942                         {
943                         cloudAssembly.texture_sheet = "/Models/Weather/cumulus_bottom_sheet1.rgb";
944                         cloudAssembly.num_tex_x = 1;
945                         cloudAssembly.num_tex_y = 1;
946         
947                         #characterize the cloud
948                         cloudAssembly.bottom_shade = 0.4;
949                         cloudAssembly.n_sprites = 4;
950                         cloudAssembly.min_width = 1100.0;
951                         cloudAssembly.max_width = 1400.0;
952                         cloudAssembly.min_height = 1100.0;
953                         cloudAssembly.max_height = 1400.0;
954                         cloudAssembly.min_cloud_width = 1600;
955                         cloudAssembly.min_cloud_height = 1200;
956                         cloudAssembly.z_scale = 0.4;
957
958                         }
959
960                 #signal that new routines are used
961                 path = "new";
962
963         
964         }
965
966
967 else {print("Cloud type ", type, " subtype ",subtype, " not available!");}
968
969 return path;
970 }
971
972 # hash for assembling hard-coded clouds
973
974 var cloudAssembly = {};
975