1
0
Fork 0

Earthview loads only texture sheets actually used

This commit is contained in:
Thorsten Renk 2015-11-08 20:42:20 +02:00
parent a89c966067
commit 57c5bf1fbf
4 changed files with 247 additions and 1 deletions

View file

@ -15,6 +15,70 @@
<enable-hot type="bool">false</enable-hot>
</animation>
<animation>
<object-name>clouds_N1</object-name>
<type>select</type>
<condition>
<property>/earthview/show-n1</property>
</condition>
</animation>
<animation>
<object-name>clouds_N2</object-name>
<type>select</type>
<condition>
<property>/earthview/show-n2</property>
</condition>
</animation>
<animation>
<object-name>clouds_N3</object-name>
<type>select</type>
<condition>
<property>/earthview/show-n3</property>
</condition>
</animation>
<animation>
<object-name>clouds_N4</object-name>
<type>select</type>
<condition>
<property>/earthview/show-n4</property>
</condition>
</animation>
<animation>
<object-name>clouds_S1</object-name>
<type>select</type>
<condition>
<property>/earthview/show-s1</property>
</condition>
</animation>
<animation>
<object-name>clouds_S2</object-name>
<type>select</type>
<condition>
<property>/earthview/show-s2</property>
</condition>
</animation>
<animation>
<object-name>clouds_S3</object-name>
<type>select</type>
<condition>
<property>/earthview/show-s3</property>
</condition>
</animation>
<animation>
<object-name>clouds_S4</object-name>
<type>select</type>
<condition>
<property>/earthview/show-s4</property>
</condition>
</animation>
<animation>
<type>rotate</type>

View file

@ -16,6 +16,70 @@
<enable-hot type="bool">false</enable-hot>
</animation>
<animation>
<object-name>earth_N1</object-name>
<type>select</type>
<condition>
<property>/earthview/show-n1</property>
</condition>
</animation>
<animation>
<object-name>earth_N2</object-name>
<type>select</type>
<condition>
<property>/earthview/show-n2</property>
</condition>
</animation>
<animation>
<object-name>earth_N3</object-name>
<type>select</type>
<condition>
<property>/earthview/show-n3</property>
</condition>
</animation>
<animation>
<object-name>earth_N4</object-name>
<type>select</type>
<condition>
<property>/earthview/show-n4</property>
</condition>
</animation>
<animation>
<object-name>earth_S1</object-name>
<type>select</type>
<condition>
<property>/earthview/show-s1</property>
</condition>
</animation>
<animation>
<object-name>earth_S2</object-name>
<type>select</type>
<condition>
<property>/earthview/show-s2</property>
</condition>
</animation>
<animation>
<object-name>earth_S3</object-name>
<type>select</type>
<condition>
<property>/earthview/show-s3</property>
</condition>
</animation>
<animation>
<object-name>earth_S4</object-name>
<type>select</type>
<condition>
<property>/earthview/show-s4</property>
</condition>
</animation>
<animation>
<!--<object-name>earth_N1</object-name>
<object-name>earth_N2</object-name>

View file

@ -11,6 +11,73 @@ earthview_running_flag = 1;
var lat = getprop("/position/latitude-deg");
var lon = getprop("/position/longitude-deg");
# define the tile centers
center_N1 = geo.Coord.new();
center_N2 = geo.Coord.new();
center_N3 = geo.Coord.new();
center_N4 = geo.Coord.new();
center_S1 = geo.Coord.new();
center_S2 = geo.Coord.new();
center_S3 = geo.Coord.new();
center_S4 = geo.Coord.new();
center_N1.set_latlon(45.0, -135.0);
center_N2.set_latlon(45.0, -45.0);
center_N3.set_latlon(45.0, 45.0);
center_N4.set_latlon(45.0, 135.0);
center_S1.set_latlon(-45.0, -135.0);
center_S2.set_latlon(-45.0, -45.0);
center_S3.set_latlon(-45.0, 45.0);
center_S4.set_latlon(-45.0, 135.0);
# determine which tiles to show
var shuttle_pos = geo.aircraft_position();
#print(shuttle_pos.distance_to(center_N1));
#print(shuttle_pos.distance_to(center_N2));
#print(shuttle_pos.distance_to(center_N3));
#print(shuttle_pos.distance_to(center_N4));
#print(shuttle_pos.distance_to(center_S1));
#print(shuttle_pos.distance_to(center_S2));
#print(shuttle_pos.distance_to(center_S3));
#print(shuttle_pos.distance_to(center_S4));
if (shuttle_pos.distance_to(center_N1) > 8000000.0)
{setprop("/earthview/show-n1", 0);}
else {setprop("/earthview/show-n1", 1);}
if (shuttle_pos.distance_to(center_N2) > 8000000.0)
{setprop("/earthview/show-n2", 0);}
else {setprop("/earthview/show-n2", 1);}
if (shuttle_pos.distance_to(center_N3) > 8000000.0)
{setprop("/earthview/show-n3", 0);}
else {setprop("/earthview/show-n3", 1);}
if (shuttle_pos.distance_to(center_N4) > 8000000.0)
{setprop("/earthview/show-n4", 0);}
else {setprop("/earthview/show-n4", 1);}
if (shuttle_pos.distance_to(center_S1) > 8000000.0)
{setprop("/earthview/show-s1", 0);}
else {setprop("/earthview/show-s1", 1);}
if (shuttle_pos.distance_to(center_S2) > 8000000.0)
{setprop("/earthview/show-s2", 0);}
else {setprop("/earthview/show-s2", 1);}
if (shuttle_pos.distance_to(center_S3) > 8000000.0)
{setprop("/earthview/show-s3", 0);}
else {setprop("/earthview/show-s3", 1);}
if (shuttle_pos.distance_to(center_S4) > 8000000.0)
{setprop("/earthview/show-s4", 0);}
else {setprop("/earthview/show-s4", 1);}
earth_model.node = earthview.place_earth_model("Models/Astro/earth.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
cloudsphere_model.node = earthview.place_earth_model("Models/Astro/cloudsphere.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
@ -25,6 +92,8 @@ setprop("/sim/rendering/mie", 0.0);
setprop("/sim/rendering/rayleigh", 0.00002);
setprop("/sim/rendering/dome-density", 1.0);
control_loop();
}
@ -111,6 +180,40 @@ setprop("/earthview/longitude-deg", lon);
setprop("/earthview/roll-deg", -(90-lat));
setprop("/earthview/yaw-deg", -lon);
var shuttle_pos = geo.aircraft_position();
if (shuttle_pos.distance_to(center_N1) > 8000000.0)
{setprop("/earthview/show-n1", 0);}
else {setprop("/earthview/show-n1", 1);}
if (shuttle_pos.distance_to(center_N2) > 8000000.0)
{setprop("/earthview/show-n2", 0);}
else {setprop("/earthview/show-n2", 1);}
if (shuttle_pos.distance_to(center_N3) > 8000000.0)
{setprop("/earthview/show-n3", 0);}
else {setprop("/earthview/show-n3", 1);}
if (shuttle_pos.distance_to(center_N4) > 8000000.0)
{setprop("/earthview/show-n4", 0);}
else {setprop("/earthview/show-n4", 1);}
if (shuttle_pos.distance_to(center_S1) > 8000000.0)
{setprop("/earthview/show-s1", 0);}
else {setprop("/earthview/show-s1", 1);}
if (shuttle_pos.distance_to(center_S2) > 8000000.0)
{setprop("/earthview/show-s2", 0);}
else {setprop("/earthview/show-s2", 1);}
if (shuttle_pos.distance_to(center_S3) > 8000000.0)
{setprop("/earthview/show-s3", 0);}
else {setprop("/earthview/show-s3", 1);}
if (shuttle_pos.distance_to(center_S4) > 8000000.0)
{setprop("/earthview/show-s4", 0);}
else {setprop("/earthview/show-s4", 1);}
# now set scattering paramaters
if (getprop("/earthview/mrd-flag") == 1)
@ -157,4 +260,11 @@ var earth_model = {};
var cloudsphere_model = {};
var earthview_running_flag = 0;
var center_N1 = {};
var center_N2 = {};
var center_N3 = {};
var center_N4 = {};
var center_S1 = {};
var center_S2 = {};
var center_S3 = {};
var center_S4 = {};

View file

@ -1274,6 +1274,14 @@ Started September 2000 by David Megginson, david@megginson.com
<overlay-texture-flag type="bool" userarchive="y">true</overlay-texture-flag>
<mrd-flag type="bool" userarchive="y">true</mrd-flag>
<cloudsphere-angle type="double" userarchive="n">0.0</cloudsphere-angle>
<show-n1 type="bool" userarchive="n">true</show-n1>
<show-n2 type="bool" userarchive="n">true</show-n2>
<show-n3 type="bool" userarchive="n">true</show-n3>
<show-n4 type="bool" userarchive="n">true</show-n4>
<show-s1 type="bool" userarchive="n">true</show-s1>
<show-s2 type="bool" userarchive="n">true</show-s2>
<show-s3 type="bool" userarchive="n">true</show-s3>
<show-s4 type="bool" userarchive="n">true</show-s4>
</earthview>
</PropertyList>
<!-- end of preferences.xml -->