CVS: data/Models/Weather big_thunderstorm.xml, NONE, 1.1 bigstorm-3d.ac, NONE, 1.1 cirrocumulus1.ac, NONE, 1.1 cirrocumulus1.xml, NONE, 1.1 cirrocumulus2.ac, NONE, 1.1 cirrocumulus2.xml, NONE, 1.1 cirrocumulus3.ac, NONE, 1.1 cirrus1.xml, NONE, 1.1 cirrus2.xml, NONE, 1.1 cirrus3.xml, NONE, 1.1 cirrus_alt1.ac, NONE, 1.1

Vivian Meazza <[email protected]> Mon, 12 Apr 2010 14:37:03 -0500
Newsgroups gmane.games.flightgear.cvc
Message-ID <[email protected]>
Update of /var/cvs/FlightGear-0.9/data/Models/Weather
In directory baron.flightgear.org:/tmp/cvs-serv31376

Added Files:
	big_thunderstorm.xml bigstorm-3d.ac cirrocumulus1.ac 
	cirrocumulus1.xml cirrocumulus2.ac cirrocumulus2.xml 
	cirrocumulus3.ac cirrus1.xml cirrus2.xml cirrus3.xml 
	cirrus_alt1.ac 
Log Message:
Add layered clouds

--- NEW FILE "big_thunderstorm.xml" ---
<?xml version="1.0"?>

<PropertyList>
	<path>bigstorm-3d.ac</path>
	<nasal>
		<load>
			<![CDATA[
#############################################################################
#
# Routines checking and adjusting weather close to AI thunderstorms
# 
# Thorsten Renk, started Feb. 2010
#
#############################################################################

var transition = func {

	var n_steps = 10;
	var stepsize = 4000 / (n_steps - 1);	

	if (transition_flag == 1) {visibility = 5000 - transition_counter * stepsize;}
	else if (transition_flag == 2) {visibility = 1000 + transition_counter * stepsize;}

	var econfig_aloftNode = props.globals.getNode("environment/config/aloft", 1);
	var entries_aloft = econfig_aloftNode.getChildren("entry");
	foreach (var e; entries_aloft) {
		var v = e.getNode("visibility-m");
		v.setValue(visibility);
		}

	var econfig_boundaryNode = props.globals.getNode("environment/config/boundary", 1);
	var entries_boundary = econfig_boundaryNode.getChildren("entry");
	foreach (var e; entries_boundary) {
		var v = e.getNode("visibility-m");
		v.setValue(visibility);
		}
	fgcommand("reinit", props.Node.new({subsystem:"environment"}));
	transition_counter = transition_counter + 1;
	if (transition_counter < n_steps) {settimer(transition, 0.1);}
	else {
		transition_counter = 0;
		if (transition_flag==1) {transition_flag = 2;setprop("ai/models/thunderstorm[0]/in-cloud",'true');}
		else {transition_flag = 1; setprop("ai/models/thunderstorm[0]/in-cloud",'false');};
		}
}


var store = func {

	setprop("tmp/clouds/layer[0]/elevation-ft",getprop("environment/clouds/layer[0]/elevation-ft"));
	setprop("tmp/metar/rain-norm",getprop("environment/metar/rain-norm"));
	setprop("tmp/metar/snow-norm",getprop("environment/metar/snow-norm"));

	var econfig_aloftNode = props.globals.getNode("environment/config/aloft", 1);
	var entries_aloft = econfig_aloftNode.getChildren("entry");
	var i = 0;
	foreach (var e; entries_aloft) {
		var v = e.getNode("visibility-m");
		aloft_vis[i] = v.getValue();
		i=i+1;
	}


	var econfig_boundaryNode = props.globals.getNode("environment/config/boundary", 1);
	var entries_boundary = econfig_boundaryNode.getChildren("entry");
	i = 0;
	foreach (var e; entries_boundary) {
		var v = e.getNode("visibility-m");
		boundary_vis[i] = v.getValue();
		i=i+1;
	}
	
}

var reset = func {

	setprop("environment/clouds/layer[0]/elevation-ft",getprop("tmp/clouds/layer[0]/elevation-ft"));
	setprop("environment/metar/rain-norm",getprop("tmp/metar/rain-norm"));
	setprop("environment/metar/snow-norm",getprop("tmp/metar/snow-norm"));

	var econfig_aloftNode = props.globals.getNode("environment/config/aloft", 1);
	var entries_aloft = econfig_aloftNode.getChildren("entry");
	var i = 0;
	foreach (var e; entries_aloft) {
		var v = e.getNode("visibility-m");
		v.setValue(aloft_vis[i]);
		i = i + 1;
	}


	var econfig_boundaryNode = props.globals.getNode("environment/config/boundary", 1);
	var entries_boundary = econfig_boundaryNode.getChildren("entry");
	var i = 0;
	foreach (var e; entries_boundary) {
		var v = e.getNode("visibility-m");
		v.setValue(boundary_vis[i]);
		i = i + 1;
	}

	fgcommand("reinit", props.Node.new({subsystem:"environment"}));
}

var thunderstorm_loop = func {

var clat = getprop("position/latitude-deg");
var clong = getprop("position/longitude-deg");
var altitude=getprop("position/altitude-ft");
var ccart = geodtocart(clat,clong ,1000);

var cx = ccart[0];
var cy = ccart[1];

var slat = getprop("ai/models/thunderstorm[0]/position/latitude-deg");
var slong = getprop("ai/models/thunderstorm[0]/position/longitude-deg");
var scart = geodtocart(slat,slong ,1000);
var spos = geo.Coord.new().set_latlon(slat, slong);

var sx=scart[0];
var sy=scart[1];


var sdistance = ((cx-sx)*(cx-sx) + (cy-sy)*(cy-sy) + 0.01);

if (sdistance >  100.0)
	{var distance = math.sqrt(sdistance);}
else
	{var distance = 0.0;}

if ((distance < 3000) and (distance > 2000.0) and (altitude<38000))
	{

	if (flag==1) # store the original settings when entering cloud
		{
		store();
		flag=2; # set flag to prevent further action
		}


	if (transition_flag==1)
		{
		transition();
		}
	else
		{

		setprop("environment/metar/rain-norm",getprop("tmp/metar/rain-norm"));
		setprop("environment/metar/snow-norm",getprop("tmp/metar/snow-norm"));

		var econfig_aloftNode = props.globals.getNode("environment/config/aloft", 1);
		var entries_aloft = econfig_aloftNode.getChildren("entry");
		foreach (var e; entries_aloft) {
			var v = e.getNode("visibility-m");
			v.setValue(1000);
			}


		var econfig_boundaryNode = props.globals.getNode("environment/config/boundary", 1);
		var entries_boundary = econfig_boundaryNode.getChildren("entry");
		foreach (var e; entries_boundary) {
			var v = e.getNode("visibility-m");
			v.setValue(1000);
			}

		fgcommand("reinit", props.Node.new({subsystem:"environment"}));
		}
	}
else if ((distance < 2000) and (distance > 0.0) and (altitude<38000))
	{
	
	setprop("environment/clouds/layer[0]/elevation-ft",20000);
	if (altitude < 10000) 
		{ 
		setprop("environment/metar/rain-norm",0.8); 
		setprop("environment/metar/snow-norm",0);		
		}
	else if ((altitude < 20000) and (altitude > 10000))
		{ 
		setprop("environment/metar/rain-norm",0); 
		setprop("environment/metar/snow-norm",0.8);		
		}
	else
		{
		setprop("environment/metar/rain-norm",0); 
		setprop("environment/metar/snow-norm",0);	
	
		}
	if (altitude<5000)
		{
		var econfig_aloftNode = props.globals.getNode("environment/config/aloft", 1);
		var entries_aloft = econfig_aloftNode.getChildren("entry");
		foreach (var e; entries_aloft) {
			var v = e.getNode("visibility-m");
			v.setValue(1000);
			}

		var econfig_boundaryNode = props.globals.getNode("environment/config/boundary", 1);
		var entries_boundary = econfig_boundaryNode.getChildren("entry");
		foreach (var e; entries_boundary) {
			var v = e.getNode("visibility-m");
			v.setValue(1000);
			}
		fgcommand("reinit", props.Node.new({subsystem:"environment"}));
		}
	else
		{
		var econfig_aloftNode = props.globals.getNode("environment/config/aloft", 1);
		var entries_aloft = econfig_aloftNode.getChildren("entry");
		foreach (var e; entries_aloft) {
			var v = e.getNode("visibility-m");
			v.setValue(100);
			}
		var econfig_boundaryNode = props.globals.getNode("environment/config/boundary", 1);
		var entries_boundary = econfig_boundaryNode.getChildren("entry");
		foreach (var e; entries_boundary) {
			var v = e.getNode("visibility-m");
			v.setValue(1000);
			}
		fgcommand("reinit", props.Node.new({subsystem:"environment"}));
		}
	}

else	# we're not in the cloud
	{
	
	if ((flag==2) and (transition_flag==2)) # and  we just left the cloud
		{
		# restore cloud layer altitude before initializing transition		
		setprop("environment/clouds/layer[0]/elevation-ft",getprop("tmp/clouds/layer[0]/elevation-ft"));
		transition();
		}
	else if (flag==2) # we have left the cloud, restore the original settings
		{
		reset();
		flag = 1;
		}

	}

    settimer(thunderstorm_loop, 1);
}



var thunderstorm_turning_loop = func {

var clat = getprop("position/latitude-deg");
var clong = getprop("position/longitude-deg");
var slat = getprop("ai/models/thunderstorm[0]/position/latitude-deg");
var slong = getprop("ai/models/thunderstorm[0]/position/longitude-deg");
var angle = math.mod(math.atan2(math.sin(slong-clong) * math.cos(slat), math.cos(clat) * math.sin(slat)- math.sin(clat) * math.cos(slat) * math.cos(slong-clong)), 2 * math.pi) * R2D;

setprop("ai/models/thunderstorm[0]/orientation/rotation-deg",90-angle-heading);

    settimer(thunderstorm_turning_loop, 0.05);
}


var count_nodes = func {
	var econfig_aloftNode = props.globals.getNode("environment/config/aloft", 1);
	var entries_aloft = econfig_aloftNode.getChildren("entry");
	foreach (var e; entries_aloft) {
		naloft=naloft+1;
	}

	var econfig_boundaryNode = props.globals.getNode("environment/config/boundary", 1);
	var entries_boundary = econfig_boundaryNode.getChildren("entry");
	foreach (var e; entries_boundary) {
		nboundary=nboundary+1;
	}
	setsize(aloft_vis,naloft);
	setsize(boundary_vis,nboundary);
}



print("Starting thunderstorm routines...");
var flag = 1;
var transition_flag = 1;
var transition_counter = 0;
var aloft_vis=[];
var naloft=0;
var boundary_vis=[];
var nboundary=0;

var heading = getprop("ai/models/thunderstorm[0]/orientation/true-heading-deg");


setprop("ai/models/thunderstorm[0]/in-cloud",'false');

settimer(count_nodes,1);
settimer(thunderstorm_loop,1.5);        # start loop
settimer(thunderstorm_turning_loop,1.5);        # start alignment transformation

print("Done.");  
]]>
		</load>

		<unload>
			<![CDATA[
            print("Unloading thunderstorm routines!"); 
	]]>
		</unload>
	</nasal>

	<!--<animation>
  <type>billboard</type>
  <spherical>false</spherical>
 </animation> -->


	<!--<animation>
  <type>translate</type>
  <property>orientation/rotation-deg</property>
  <factor>1.0</factor>
  <axis>
   <x>0.0</x>
   <y>0.0</y>
   <z>1.0</z>
  </axis>
</animation>-->

	<animation>
		<type>rotate</type>
		<property>orientation/rotation-deg</property>
		<factor>1.0</factor>
		<axis>
			<x>0</x>
			<y>0</y>
			<z>1</z>
		</axis>
	</animation>


	<animation>
		<type>select</type>
		<object-name>lightning</object-name>

		<condition>
			<property>/environment/lightning/flash</property>
		</condition>
	</animation>

	<animation>
		<enable-hot type="bool">false</enable-hot>
	</animation>

	<animation>
		<type>select</type>
		<object-name>rain</object-name>
		<object-name>main cloud layer</object-name>
		<object-name>background cloud layer</object-name>
		<object-name>foreground cloud layer</object-name>
		<condition>
			<not>
				<property>in-cloud</property>
			</not>
		</condition>
	</animation>

	<!--<animation>
  <type>select</type>
  <object-name>rain</object-name>
  <condition>
    <not>
      <property>in-cloud</property>
    </not>
  </condition>
 </animation>-->

	<!--
      turning rain off during a lightning flash helps make
      the flash more visible, but it's kind of cheezy :) 
 -->

	<!--<animation>
  <type>select</type>
  <object-name>rain</object-name>
  <condition>
    <not>
      <property>/environment/lightning/flash</property>
    </not>
  </condition>
 </animation>-->


</PropertyList>

--- NEW FILE "bigstorm-3d.ac" ---
AC3Db
MATERIAL "ac3dmat1" rgb 1 1 1  amb 0.2 0.2 0.2  emis 0 0 0  spec 0.2 0.2 0.2  shi 128  trans 0
OBJECT world
kids 5
OBJECT poly
name "background cloud layer"
loc 790.092 4840.92 -558.845
texture "cloud-textures.rgb"
crease 45.000000
numvert 4
-5089.64 4502.62 0
5089.64 4502.62 0
5089.64 -4502.62 0
-5089.64 -4502.62 0
numsurf 1
SURF 0x30
mat 0
refs 4
0 0.00976557 0.578125
[...1685 lines suppressed...]
refs 4
22 0.64502 0.703221
10 0.64502 0.548828
11 0.762696 0.548828
23 0.762696 0.703221
SURF 0x10
mat 0
refs 4
23 0.762696 0.703221
11 0.762696 0.548828
12 0.880372 0.548828
24 0.880372 0.703221
SURF 0x10
mat 0
refs 4
24 0.880372 0.703221
12 0.880372 0.548828
13 0.966516 0.548828
25 0.966516 0.703221
kids 0

--- NEW FILE "cirrocumulus1.ac" ---
AC3Db
MATERIAL "ac3dmat1" rgb 1 1 1  amb 1 1 1  emis 0 0 0  spec 1 1 1  shi 0  trans 0
OBJECT world
kids 1
OBJECT poly
name "mesh"
loc -1128.44 0 1525.32
texture "cirrocumulus_textures.rgb"
crease 180.000000
numvert 236
-2818.15 0 -2899.75
-2818.15 0 -2537.28
-2816.25 22.7729 -2174.81
-2810.56 91.0917 -1812.34
-563.63 0 -2899.75
-548.448 182.183 -2537.28
-2252.62 22.7729 -2537.28
-1690.89 0 -2899.75
-2254.52 0 -2899.75
[...1666 lines suppressed...]
refs 4
225 0.350916 0.677116
229 0.383798 0.677116
227 0.383798 0.698642
228 0.350916 0.698642
SURF 0x30
mat 0
refs 4
230 0.41668 0.720167
235 0.449562 0.720167
231 0.449562 0.741693
232 0.41668 0.741693
SURF 0x30
mat 0
refs 4
231 0.449562 0.741693
235 0.449562 0.720167
233 0.482444 0.720167
234 0.482444 0.741693
kids 0

--- NEW FILE "cirrocumulus1.xml" ---
<?xml version="1.0"?>

<PropertyList>
 <path>cirrocumulus1.ac</path>

<animation>
		<type>material</type>
		<object-name>mesh</object-name>
		
		<emission>
			<red-prop>/rendering/scene/diffuse/red</red-prop>
	  		<green-prop>/rendering/scene/diffuse/green</green-prop>
	    		<blue-prop>/rendering/scene/diffuse/blue</blue-prop>
		</emission>
		<diffuse>
			<red>1.0</red>
			<green>1.0</green>
			<blue>1.0</blue>
		</diffuse>
		<ambient>
			<red>1.0</red>
			<green>1.0</green>
			<blue>1.0</blue>
		</ambient>
		<specular>
			<red>1.0</red>
			<green>1.0</green>
			<blue>1.0</blue>
		</specular>
		<shininess>0</shininess>
	</animation>

<animation>
  <object-name>mesh</object-name>
  <enable-hot type="bool">false</enable-hot>
</animation>

<effect>
  <inherits-from>Effects/cloud-models</inherits-from>
  <object-name>mesh</object-name>
</effect>

</PropertyList>

--- NEW FILE "cirrocumulus2.ac" ---
AC3Db
MATERIAL "ac3dmat1" rgb 1 1 1  amb 1 1 1  emis 0 0 0  spec 1 1 1  shi 0  trans 0.255
OBJECT world
kids 1
OBJECT poly
name "mesh"
loc 1126.58 -99.4877 -1672.57
texture "cirrocumulus_textures.rgb"
crease 180.000000
numvert 289
-3360.26 0 -895.641
-3360.26 0 -595.385
-4778.8 0 -595.385
-4305.95 0 -895.641
-4778.8 0 -895.641
-3833.11 0 -595.385
-3833.11 0 -895.641
-4305.95 0 -595.385
-4778.8 0 5.12659
[...2054 lines suppressed...]
refs 4
280 0.425781 0.308838
288 0.399536 0.308838
281 0.399536 0.296875
282 0.425781 0.296875
SURF 0x30
mat 0
refs 4
281 0.399536 0.296875
288 0.399536 0.308838
283 0.373291 0.308838
284 0.373291 0.296875
SURF 0x30
mat 0
refs 4
283 0.373291 0.308838
288 0.399536 0.308838
285 0.399536 0.320801
286 0.373291 0.320801
kids 0

--- NEW FILE "cirrocumulus2.xml" ---
<?xml version="1.0"?>

<PropertyList>
 <path>cirrocumulus2.ac</path>

<animation>
		<type>material</type>
		<object-name>mesh</object-name>
		<emission>
			<red-prop>/rendering/scene/diffuse/red</red-prop>
	  		<green-prop>/rendering/scene/diffuse/green</green-prop>
	    		<blue-prop>/rendering/scene/diffuse/blue</blue-prop>
		</emission>
		<diffuse>
			<red>1.0</red>
			<green>1.0</green>
			<blue>1.0</blue>
		</diffuse>
		<ambient>
			<red>1.0</red>
			<green>1.0</green>
			<blue>1.0</blue>
		</ambient>
		<specular>
			<red>1.0</red>
			<green>1.0</green>
			<blue>1.0</blue>
		</specular>
		<shininess>0</shininess>
	</animation>

<animation>
  <object-name>mesh</object-name>
  <enable-hot type="bool">false</enable-hot>
</animation>

<effect>
  <inherits-from>Effects/cloud-models</inherits-from>
  <object-name>mesh</object-name>
</effect>

</PropertyList>

--- NEW FILE "cirrocumulus3.ac" ---
AC3Db
MATERIAL "ac3dmat1" rgb 1 1 1  amb 1 1 1  emis 0 0 0  spec 1 1 1  shi 0  trans 0.225
OBJECT world
kids 1
OBJECT poly
name "mesh"
loc 90.9646 -5.46013e-06 -5.92932
texture "cirrocumulus_textures.rgb"
crease 180.000000
numvert 185
-3734.68 0 -2190.73
-3485.7 0 -2044.68
-746.935 0 -3067.02
-497.957 0 -2920.98
-2925.5 11.3879 -2154.22
-2240.8 0 -2628.88
-2987.74 0 -2519.34
-2240.8 45.5515 -2190.73
-1493.87 92.7299 -2190.73
[...1271 lines suppressed...]
refs 4
176 0.847656 0.0185547
184 0.810058 0.0185547
177 0.810058 -0.00195312
178 0.847656 -0.00195312
SURF 0x30
mat 0
refs 4
177 0.810058 -0.00195312
184 0.810058 0.0185547
179 0.772461 0.0185547
180 0.772461 -0.00195312
SURF 0x30
mat 0
refs 4
179 0.772461 0.0185547
184 0.810058 0.0185547
181 0.810058 0.0390625
182 0.772461 0.0390625
kids 0

--- NEW FILE "cirrus1.xml" ---
<?xml version="1.0"?>

<PropertyList>
 <path>cirrus_alt1.ac</path>

<animation>
		<type>material</type>
		<object-name>mesh</object-name>
		
		<emission>
			<red-prop>/rendering/scene/diffuse/red</red-prop>
	  		<green-prop>/rendering/scene/diffuse/green</green-prop>
	    		<blue-prop>/rendering/scene/diffuse/blue</blue-prop>
		</emission>
		<diffuse>
			<red>1.0</red>
			<green>1.0</green>
			<blue>1.0</blue>
		</diffuse>
		<ambient>
			<red>1.0</red>
			<green>1.0</green>
			<blue>1.0</blue>
		</ambient>
		<specular>
			<red>1.0</red>
			<green>1.0</green>
			<blue>1.0</blue>
		</specular>
		<shininess>0</shininess>
	</animation>

<animation>
  <object-name>mesh</object-name>
  <enable-hot type="bool">false</enable-hot>
</animation>

<effect>
  <inherits-from>Effects/cloud-models</inherits-from>
  <object-name>mesh</object-name>
</effect>

</PropertyList>

--- NEW FILE "cirrus2.xml" ---
<?xml version="1.0"?>

<PropertyList>
 <path>cirrus_alt2.ac</path>

<animation>
		<type>material</type>
		<object-name>mesh</object-name>
		<emission>
			<red-prop>/rendering/scene/diffuse/red</red-prop>
	  		<green-prop>/rendering/scene/diffuse/green</green-prop>
	    		<blue-prop>/rendering/scene/diffuse/blue</blue-prop>
		</emission>
		<diffuse>
			<red>1.0</red>
			<green>1.0</green>
			<blue>1.0</blue>
		</diffuse>
		<ambient>
			<red>1.0</red>
			<green>1.0</green>
			<blue>1.0</blue>
		</ambient>
		<specular>
			<red>1.0</red>
			<green>1.0</green>
			<blue>1.0</blue>
		</specular>
		<shininess>0</shininess>
	</animation>

<animation>
  <object-name>mesh</object-name>
  <enable-hot type="bool">false</enable-hot>
</animation>

<effect>
  <inherits-from>Effects/cloud-models</inherits-from>
  <object-name>mesh</object-name>
</effect>

</PropertyList>

--- NEW FILE "cirrus3.xml" ---
<?xml version="1.0"?>

<PropertyList>
	<path>cirrus_alt3.ac</path>

	<animation>
		<enable-hot type="bool">false</enable-hot>
	</animation>

</PropertyList>

--- NEW FILE "cirrus_alt1.ac" ---
AC3Db
MATERIAL "ac3dmat1" rgb 1 1 1  amb 1 1 1  emis 0 0 0  spec 1 1 1  shi 0  trans 0
OBJECT world
kids 1
OBJECT poly
name "mesh"
loc -536.343 2.23391e-06 417.038
texture "cirrus_textures.rgb"
crease 180.000000
numvert 213
7238.75 -680.122 3775.77
5429.06 -673.83 3775.77
6333.91 -677.015 3775.77
4524.22 -335.658 4405.06
3619.37 -666.922 3775.77
4524.22 -670.491 3775.77
3619.37 0 5034.36
3619.37 -335.658 4405.06
4524.22 0 5034.36
[...1476 lines suppressed...]
refs 4
198 0.653657 0.626457
211 0.626923 0.635583
203 0.620249 0.625105
190 0.646982 0.615979
SURF 0x30
mat 0
refs 4
212 0.633598 0.646062
211 0.626923 0.635583
198 0.653657 0.626457
196 0.660331 0.636936
SURF 0x30
mat 0
refs 4
209 0.60019 0.644709
211 0.626923 0.635583
212 0.633598 0.646062
208 0.606865 0.655188
kids 0


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev