Updates to Earthview
This commit is contained in:
parent
4e13342019
commit
5a2ada9619
6 changed files with 134 additions and 8 deletions
|
@ -20,6 +20,7 @@
|
|||
<!-- DIFFUSE -->
|
||||
</material>
|
||||
<visibility><use>/environment/visibility-m</use></visibility>
|
||||
<use-clouds><use>/earthview/cloudsphere-flag</use></use-clouds>
|
||||
</parameters>
|
||||
<generate>
|
||||
<tangent type="int">6</tangent>
|
||||
|
@ -133,6 +134,13 @@
|
|||
<use>visibility</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>use_clouds</name>
|
||||
<type>bool</type>
|
||||
<value>
|
||||
<use>use-clouds</use>
|
||||
</value>
|
||||
</uniform>
|
||||
</pass>
|
||||
</technique>
|
||||
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
var start = func() {
|
||||
|
||||
if (earthview_running_flag == 1) {return;}
|
||||
|
||||
earthview_running_flag = 1;
|
||||
|
||||
var lat = getprop("/position/latitude-deg");
|
||||
var lon = getprop("/position/longitude-deg");
|
||||
|
||||
|
@ -16,6 +20,7 @@ var stop = func () {
|
|||
earth_model.node.remove();
|
||||
cloudsphere_model.node.remove();
|
||||
setprop("/earthview/control_loop_flag",0);
|
||||
earthview_running_flag = 0;
|
||||
}
|
||||
|
||||
var place_earth_model = func(path, lat, lon, alt, heading, pitch, roll) {
|
||||
|
@ -96,7 +101,7 @@ setprop("/earthview/yaw-deg", -lon);
|
|||
if (getprop("/earthview/control_loop_flag") ==1) {settimer( func {control_loop(); },0);}
|
||||
}
|
||||
|
||||
|
||||
var earthview_running_flag = 0;
|
||||
var ft_to_m = 0.30480;
|
||||
var m_to_ft = 1.0/ft_to_m;
|
||||
var earth_model = {};
|
||||
|
|
|
@ -40,6 +40,12 @@ void main()
|
|||
|
||||
vec3 light_specular = vec3 (1.0, 1.0, 1.0);
|
||||
NdotL = dot(n, lightDir);
|
||||
|
||||
float intensity = length(diffuse_term);
|
||||
vec4 dawn = intensity * normalize (vec4 (1.0,0.4,0.4,1.0));
|
||||
|
||||
vec4 diff_term = mix(dawn, diffuse_term, smoothstep(0.0, 0.2, NdotL));
|
||||
|
||||
if (NdotL > 0.0) {
|
||||
color += diffuse_term * NdotL ;
|
||||
NdotHV = max(dot(n, halfVector), 0.0);
|
||||
|
|
|
@ -9,6 +9,7 @@ varying vec3 ecViewDir;
|
|||
varying vec3 VTangent;
|
||||
|
||||
uniform float visibility;
|
||||
uniform bool use_clouds;
|
||||
uniform sampler2D texture;
|
||||
uniform sampler2D shadowtex;
|
||||
|
||||
|
@ -43,15 +44,30 @@ void main()
|
|||
float xOffset = -0.005 * dot(normalize(lightDir), normalize(VTangent));
|
||||
float yOffset = -0.005 * dot(normalize(lightDir), normalize(VBinormal));
|
||||
|
||||
shadowTexel = texture2D(shadowtex, vec2(gl_TexCoord[0].s-xOffset, gl_TexCoord[0].t-yOffset));
|
||||
if (use_clouds)
|
||||
{shadowTexel = texture2D(shadowtex, vec2(gl_TexCoord[0].s-xOffset, gl_TexCoord[0].t-yOffset));}
|
||||
else
|
||||
{shadowTexel = vec4 (0.0,0.0,0.0,0.0);}
|
||||
|
||||
texel = texture2D(texture, gl_TexCoord[0].st);
|
||||
|
||||
vec3 light_specular = vec3 (1.0, 1.0, 1.0);
|
||||
NdotL = dot(n, lightDir);
|
||||
|
||||
float intensity = length(diffuse_term);
|
||||
vec4 dawn = intensity * normalize (vec4 (1.0,0.4,0.4,1.0));
|
||||
vec4 diff_term = mix(dawn, diffuse_term, smoothstep(0.0, 0.2, NdotL));
|
||||
|
||||
intensity = length(light_specular);
|
||||
light_specular = mix(dawn.rgb, light_specular, smoothstep(0.0, 0.2, NdotL));
|
||||
|
||||
float specular_enhancement = 4.0 * (1.0 -smoothstep(0.0, 0.3,length(texel.rgb - vec3 (0.007,0.019, 0.078))));
|
||||
|
||||
if (NdotL > 0.0) {
|
||||
color += diffuse_term * NdotL * (1.0-shadowTexel.a);
|
||||
NdotHV = max(dot(n, halfVector), 0.0);
|
||||
if (gl_FrontMaterial.shininess > 0.0)
|
||||
specular.rgb = (gl_FrontMaterial.specular.rgb
|
||||
specular.rgb = (gl_FrontMaterial.specular.rgb * specular_enhancement
|
||||
* light_specular * (1.0-shadowTexel.a)
|
||||
* pow(NdotHV, gl_FrontMaterial.shininess));
|
||||
}
|
||||
|
@ -60,7 +76,7 @@ void main()
|
|||
// saturated. Clamping the color before modulating by the texture
|
||||
// is closer to what the OpenGL fixed function pipeline does.
|
||||
color = clamp(color, 0.0, 1.0);
|
||||
texel = texture2D(texture, gl_TexCoord[0].st);
|
||||
|
||||
fragColor = color * texel + specular;
|
||||
//fragColor = fragColor * (1.0 - 0.5 * shadowTexel.a);
|
||||
//fragColor = mix(fragColor, shadowTexel, shadowTexel.a);
|
||||
|
|
|
@ -5,11 +5,98 @@
|
|||
|
||||
|
||||
<name>earthview</name>
|
||||
<width>150</width>
|
||||
<height>50</height>
|
||||
<layout>vbox</layout>
|
||||
<default-padding>3</default-padding>
|
||||
<!--<width>150</width>
|
||||
<height>50</height>-->
|
||||
<modal>false</modal>
|
||||
|
||||
<button>
|
||||
<group>
|
||||
<layout>hbox</layout>
|
||||
<default-padding>1</default-padding>
|
||||
|
||||
<empty>
|
||||
<stretch>true</stretch>
|
||||
</empty>
|
||||
|
||||
<text>
|
||||
<label>Earthview Orbital Rendering</label>
|
||||
</text>
|
||||
|
||||
<empty>
|
||||
<stretch>true</stretch>
|
||||
</empty>
|
||||
|
||||
<button>
|
||||
<legend/>
|
||||
<key>Esc</key>
|
||||
<pref-width>16</pref-width>
|
||||
<pref-height>16</pref-height>
|
||||
<border>2</border>
|
||||
<binding>
|
||||
<command>dialog-close</command>
|
||||
</binding>
|
||||
</button>
|
||||
</group>
|
||||
|
||||
<hrule/>
|
||||
|
||||
<group>
|
||||
<layout>table</layout>
|
||||
|
||||
<text>
|
||||
<row>0</row>
|
||||
<col>0</col>
|
||||
<halign>right</halign>
|
||||
<label>Show cloud layer</label>
|
||||
</text>
|
||||
|
||||
<checkbox>
|
||||
<row>0</row>
|
||||
<col>1</col>
|
||||
<halign>left</halign>
|
||||
<property>/earthview/cloudsphere-flag</property>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
</checkbox>
|
||||
|
||||
<button>
|
||||
<row>1</row>
|
||||
<col>0</col>
|
||||
<legend>Start</legend>
|
||||
<equal>true</equal>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>earthview.start()</script>
|
||||
</binding>
|
||||
</button>
|
||||
|
||||
<button>
|
||||
<row>1</row>
|
||||
<col>1</col>
|
||||
<legend>Stop</legend>
|
||||
<equal>true</equal>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>earthview.stop()</script>
|
||||
</binding>
|
||||
</button>
|
||||
|
||||
<button>
|
||||
<row>1</row>
|
||||
<col>2</col>
|
||||
<legend>Cancel</legend>
|
||||
<equal>true</equal>
|
||||
<key>Esc</key>
|
||||
<binding>
|
||||
<command>dialog-close</command>
|
||||
</binding>
|
||||
</button>
|
||||
|
||||
</group>
|
||||
|
||||
<!--<button>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<legend>Start</legend>
|
||||
|
@ -40,6 +127,6 @@
|
|||
<binding>
|
||||
<command>dialog-close</command>
|
||||
</binding>
|
||||
</button>
|
||||
</button>-->
|
||||
|
||||
</PropertyList>
|
||||
|
|
|
@ -1324,6 +1324,10 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
<events type="string"/>
|
||||
</scenery>
|
||||
|
||||
<earthview>
|
||||
<cloudsphere-flag type="bool" userarchive="y">true</cloudsphere-flag>
|
||||
</earthview>
|
||||
|
||||
</PropertyList>
|
||||
|
||||
<!-- end of preferences.xml -->
|
||||
|
|
Loading…
Add table
Reference in a new issue