1
0
Fork 0

Merge branch 'master' of \New Git\fgdata

This commit is contained in:
Vivian Meazza 2010-08-29 21:29:37 +01:00
commit 311e44c78c
37 changed files with 2024 additions and 273 deletions

View file

@ -11,7 +11,7 @@
# Global API. Automatically selects the right walker for the current view.
# NOTE: Coordinates are always 3 component lists: [x, y, z].
# NOTE: Coordinates are always 3 component lists: [x, y, z] in meters.
# The coordinate system is the same as the main 3d model one.
# X - back, Y - right and Z - up.
@ -58,10 +58,17 @@ var active_walker = func {
# Class for a moving view.
#
# CONSTRUCTOR:
# walker.new(<view name>, <constraints>);
# walker.new(<view name>, <constraints>, <managers>);
#
# view name ... The name of the view : string
# constraints ... The movement constraints : constraint hash
# Determines where the view can go.
# managers ... Optional list of custom managers. A manager is a
# a hash that contains an update function of the type
# func(walker instance). The update function
# of each manager will be called as the last part of
# each walker update. Intended for controlling a
# a 3d model or similar.
#
# METHODS:
# active() : bool
@ -82,7 +89,7 @@ var active_walker = func {
# get_eye_height() : int (meter)
#
# set_constraints(constraints)
# get_constraints() : contraint hash
# get_constraints() : constraint hash
#
# EXAMPLE:
# var constraint =
@ -95,10 +102,11 @@ var active_walker = func {
# walk view should not have any other view manager.
#
var walker = {
new : func (view_name, constraints = nil) {
new : func (view_name, constraints = nil, managers = nil) {
var obj = { parents : [walker] };
obj.view = view.views[view.indexof(view_name)];
obj.constraints = constraints;
obj.managers = managers;
obj.position = [
obj.view.getNode("config/z-offset-m").getValue(),
obj.view.getNode("config/x-offset-m").getValue(),
@ -108,7 +116,6 @@ var walker = {
obj.view.getNode("config/heading-offset-deg").getValue();
obj.speed_fwd = 0.0;
obj.speed_side = 0.0;
obj.id = 0;
obj.isactive = 0;
obj.eye_height = 1.60;
obj.goal_height = obj.position[2] + obj.eye_height;
@ -135,7 +142,7 @@ var walker = {
me.position[2] = pos[2];
},
get_pos : func {
return me.position;
return [me.position[0], me.position[1], me.position[2]];
},
set_eye_height : func (h) {
me.eye_height = h;
@ -157,13 +164,11 @@ var walker = {
me.last_time = getprop("/sim/time/elapsed-sec") - 0.0001;
me.update();
me.position[2] = me.goal_height;
settimer(func { me._loop_(me.id); }, 0.0);
},
stop : func {
me.isactive = 0;
me.id += 1;
},
# Internals.
# The update function is called by the view manager when the view is active.
update : func {
var t = getprop("/sim/time/elapsed-sec");
var dt = t - me.last_time;
@ -173,11 +178,11 @@ var walker = {
me.heading = cur.getNode("heading-offset-deg").getValue();
me.position[0] -=
me.speed_fwd * dt * math.cos(me.heading * RAD) +
me.speed_side * dt * math.sin(me.heading * RAD);
me.speed_fwd * dt * math.cos(me.heading * TO_RAD) +
me.speed_side * dt * math.sin(me.heading * TO_RAD);
me.position[1] -=
me.speed_fwd * dt * math.sin(me.heading * RAD) -
me.speed_side * dt * math.cos(me.heading * RAD);
me.speed_fwd * dt * math.sin(me.heading * TO_RAD) -
me.speed_side * dt * math.cos(me.heading * TO_RAD);
var cur_height = me.position[2];
if (me.constraints != nil) {
@ -198,19 +203,23 @@ var walker = {
cur.getNode("x-offset-m").setValue(me.position[1]);
cur.getNode("y-offset-m").setValue(me.position[2]);
if (me.managers != nil) {
foreach(var m; me.managers) {
m.update(me);
}
}
me.last_time = t;
return 0.0;
},
_loop_ : func (id) {
if (me.id != id) return;
me.update();
settimer(func { me._loop_(id); }, 0.0);
}
};
###############################################################################
# Constraint classes.
# Constraint classes. Determines where the view can walk.
# Assumes that the constraints are convex.
# The union of two constraints.
# c1, c2 - the constraints : constraint
# NOTE: Assumes that the constraints are convex.
var unionConstraint = {
new : func (c1, c2) {
var obj = { parents : [unionConstraint] };
@ -236,6 +245,7 @@ var unionConstraint = {
};
# Build a unionConstraint hierarchy from a list of constraints.
# cs - list of constraints : [constraint]
var makeUnionConstraint = func (cs) {
if (size(cs) < 2) return cs[0];
@ -247,8 +257,8 @@ var makeUnionConstraint = func (cs) {
}
# Mostly aligned plane sloping along the X axis.
# minp - the X,Y minimum point
# maxp - the X,Y maximum point
# minp - the X,Y minimum point : position (meter)
# maxp - the X,Y maximum point : position (meter)
var slopingYAlignedPlane = {
new : func (minp, maxp) {
var obj = { parents : [slopingYAlignedPlane] };
@ -270,8 +280,8 @@ var slopingYAlignedPlane = {
# Action constraint
# Triggers an action when entering or exiting the constraint.
# contraint - the area in question.
# on_enter - function that is called when the walker enters the area.
# constraint - the area in question : constraint
# on_enter() - function that is called when the walker enters the area.
# on_exit(x, y) - function that is called when the walker leaves the area.
# x and y are <0, 0 or >0 depending on in which direction(s)
# the walker left the constraint.
@ -305,11 +315,49 @@ var actionConstraint = {
}
};
###############################################################################
# Manager classes.
# JSBSim pointmass manager.
# Moves a pointmass representing the crew member together with the view.
# CONSTRUCTOR:
# JSBSimPointmass.new(<pointmass index>);
#
# pointmass index ... The index of the pointmass : int
# offsets ... [x, y ,z] position in meter of the origin of the
# JSBSim structural frame in the 3d model frame.
#
# NOTE: Only supports aligned frames (yet).
#
var JSBSimPointmass = {
new : func (index, offsets = nil) {
var base = props.globals.getNode("fdm/jsbsim/inertia");
var prefix = "pointmass-location-";
var postfix = "-inches[" ~ index ~"]";
var obj = { parents : [JSBSimPointmass] };
obj.pos_ft =
[
base.getNode(prefix ~ "X" ~ postfix),
base.getNode(prefix ~ "Y" ~ postfix),
base.getNode(prefix ~ "Z" ~ postfix)
];
obj.offset = (offsets == nil) ? [0.0, 0.0, 0.0] : offsets;
return obj;
},
update : func (walker) {
var pos = walker.get_pos();
pos[2] += walker.get_eye_height()/2;
forindex (var i; pos) {
me.pos_ft[i].setValue((pos[i] - me.offset[i])*M2FT*12);
}
}
};
###############################################################################
# Module implementation below
var RAD = math.pi/180;
var DEG = 180/math.pi;
var TO_RAD = math.pi/180;
var TO_DEG = 180/math.pi;
var walkers = {};

View file

@ -385,7 +385,7 @@
<!-- Stage #2 drives the elevator-trim to achieve the desired climb rate. -->
<pid-controller>
<name>Altitude Hold (Altimeter based) Stage 2</name>
<name>AGL Hold (Altimeter based) Stage 2</name>
<debug>false</debug>
<enable>
<prop>/autopilot/locks/altitude</prop>

View file

@ -11,11 +11,12 @@
<internal-format>normalized</internal-format>
</texture>
<texture n="3">
<image>Textures/Terrain/cropcolors.png</image>
<image>Textures/Terrain/crop-colors.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>mirror</wrap-s>
<internal-format>normalized</internal-format>
</texture>
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level>
</parameters>
<technique n="9">
<predicate>
@ -98,6 +99,11 @@
<type>sampler-1d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>snowlevel</name>
<type>float</type>
<value><use>snow-level</use></value>
</uniform>
</pass>
</technique>
</PropertyList>

109
Effects/cropgrass.eff Normal file
View file

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>Effects/cropgrass</name>
<inherits-from>Effects/terrain-default</inherits-from>
<parameters>
<texture n="2">
<image>Textures/Terrain/cropgrass.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="3">
<image>Textures/Terrain/cropgrass-colors.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>mirror</wrap-s>
<internal-format>normalized</internal-format>
</texture>
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level>
</parameters>
<technique n="9">
<predicate>
<and>
<property>/sim/rendering/crop-shader</property>
<property>/sim/rendering/shader-effects</property>
<or>
<less-equal>
<value type="float">2.0</value>
<glversion/>
</less-equal>
<and>
<extension-supported>GL_ARB_shader_objects</extension-supported>
<extension-supported>GL_ARB_shading_language_100</extension-supported>
<extension-supported>GL_ARB_vertex_shader</extension-supported>
<extension-supported>GL_ARB_fragment_shader</extension-supported>
</and>
</or>
</and>
</predicate>
<pass>
<lighting>true</lighting>
<!-- Use material values that are either inherited from the
terrain-default effect or supplied by an effect derived
from this one e.g., one created in the materials library. -->
<material>
<ambient><use>material/ambient</use></ambient>
<diffuse><use>material/diffuse</use></diffuse>
<specular><use>material/specular</use></specular>
<color-mode>ambient-and-diffuse</color-mode>
</material>
<blend><use>transparent</use></blend>
<alpha-test><use>transparent</use></alpha-test>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<render-bin>
<bin-number><use>render-bin/bin-number</use></bin-number>
<bin-name><use>render-bin/bin-name</use></bin-name>
</render-bin>
<texture-unit>
<unit>0</unit>
<type>noise</type>
</texture-unit>
<texture-unit>
<unit>1</unit>
<image><use>texture[2]/image</use></image>
<filter><use>texture[2]/filter</use></filter>
<wrap-s><use>texture[2]/wrap-s</use></wrap-s>
<wrap-t><use>texture[2]/wrap-t</use></wrap-t>
<internal-format>
<use>texture[2]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>2</unit>
<type>1d</type>
<image><use>texture[3]/image</use></image>
<filter><use>texture[3]/filter</use></filter>
<wrap-s><use>texture[3]/wrap-s</use></wrap-s>
<internal-format>
<use>texture[3]/internal-format</use>
</internal-format>
</texture-unit>
<program>
<vertex-shader>Shaders/crop.vert</vertex-shader>
<fragment-shader>Shaders/crop.frag</fragment-shader>
</program>
<uniform>
<name>NoiseTex</name>
<type>sampler-3d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>SampleTex</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>ColorsTex</name>
<type>sampler-1d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>snowlevel</name>
<type>float</type>
<value><use>snow-level</use></value>
</uniform>
</pass>
</technique>
</PropertyList>

205
Effects/forest.eff Normal file
View file

@ -0,0 +1,205 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>Effects/forest</name>
<inherits-from>Effects/terrain-default</inherits-from>
<parameters>
<texture n="2">
<image>Textures/Terrain/rock.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="3">
<image>Textures/Terrain/forest-colors.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>mirror</wrap-s>
<internal-format>normalized</internal-format>
</texture>
<texture n="4">
<image>Textures/Terrain/forest.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="5">
<image>Textures.high/Terrain/forest-relief.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level>
<depth-factor type="float">0.04</depth-factor>
<canopy-height type="float">15.0</canopy-height>
<quality-level><use>/sim/rendering/quality-level</use></quality-level>
<!-- sets the season color -->
<season-red type="float">0.12</season-red>
<season-green type="float">0.86</season-green>
<season-blue type="float">0.22</season-blue>
<!-- end season color -->
</parameters>
<generate>
<tangent type="int">6</tangent>
<binormal type="int">7</binormal>
</generate>
<technique n="9">
<predicate>
<and>
<property>/sim/rendering/crop-shader</property>
<property>/sim/rendering/shader-effects</property>
<or>
<less-equal>
<value type="float">2.0</value>
<glversion/>
</less-equal>
<and>
<extension-supported>GL_ARB_shader_objects</extension-supported>
<extension-supported>GL_ARB_shading_language_100</extension-supported>
<extension-supported>GL_ARB_vertex_shader</extension-supported>
<extension-supported>GL_ARB_fragment_shader</extension-supported>
</and>
</or>
</and>
</predicate>
<pass>
<lighting>true</lighting>
<!-- Use material values that are either inherited from the
terrain-default effect or supplied by an effect derived
from this one e.g., one created in the materials library. -->
<material>
<ambient><use>material/ambient</use></ambient>
<diffuse><use>material/diffuse</use></diffuse>
<specular><use>material/specular</use></specular>
<color-mode>ambient-and-diffuse</color-mode>
</material>
<blend><use>transparent</use></blend>
<alpha-test><use>transparent</use></alpha-test>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<render-bin>
<bin-number><use>render-bin/bin-number</use></bin-number>
<bin-name><use>render-bin/bin-name</use></bin-name>
</render-bin>
<texture-unit>
<unit>0</unit>
<type>noise</type>
</texture-unit>
<texture-unit>
<unit>1</unit>
<image><use>texture[2]/image</use></image>
<filter><use>texture[2]/filter</use></filter>
<wrap-s><use>texture[2]/wrap-s</use></wrap-s>
<wrap-t><use>texture[2]/wrap-t</use></wrap-t>
<internal-format>
<use>texture[2]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>3</unit>
<type>1d</type>
<image><use>texture[3]/image</use></image>
<filter><use>texture[3]/filter</use></filter>
<wrap-s><use>texture[3]/wrap-s</use></wrap-s>
<internal-format>
<use>texture[3]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>2</unit>
<image><use>texture[4]/image</use></image>
<filter><use>texture[4]/filter</use></filter>
<wrap-s><use>texture[4]/wrap-s</use></wrap-s>
<wrap-t><use>texture[4]/wrap-t</use></wrap-t>
<internal-format>
<use>texture[4]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>5</unit>
<image><use>texture[5]/image</use></image>
<filter><use>texture[5]/filter</use></filter>
<wrap-s><use>texture[5]/wrap-s</use></wrap-s>
<wrap-t><use>texture[5]/wrap-t</use></wrap-t>
<internal-format>
<use>texture[5]/internal-format</use>
</internal-format>
</texture-unit>
<program>
<vertex-shader>Shaders/forest.vert</vertex-shader>
<fragment-shader>Shaders/forest.frag</fragment-shader>
<attribute>
<name>tangent</name>
<index>6</index>
</attribute>
<attribute>
<name>binormal</name>
<index>7</index>
</attribute>
</program>
<uniform>
<name>NoiseTex</name>
<type>sampler-3d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>SampleTex</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>SampleTex2</name>
<type>sampler-2d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>ColorsTex</name>
<type>sampler-1d</type>
<value type="int">3</value>
</uniform>
<uniform>
<name>NormalTex</name>
<type>sampler-2d</type>
<value type="int">5</value>
</uniform>
<uniform>
<name>depth_factor</name>
<type>float</type>
<value><use>depth-factor</use></value>
</uniform>
<uniform>
<name>snowlevel</name>
<type>float</type>
<value><use>snow-level</use></value>
</uniform>
<uniform>
<name>quality_level</name>
<type>float</type>
<value><use>quality-level</use></value>
</uniform>
<uniform>
<name>red</name>
<type>float</type>
<value><use>season-red</use></value>
</uniform>
<uniform>
<name>green</name>
<type>float</type>
<value><use>season-green</use></value>
</uniform>
<uniform>
<name>blue</name>
<type>float</type>
<value><use>season-blue</use></value>
</uniform>
<uniform>
<name>alpha</name>
<type>float</type>
<value>0.0</value>
</uniform>
</pass>
</technique>
</PropertyList>

205
Effects/glacier.eff Normal file
View file

@ -0,0 +1,205 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>Effects/glacier</name>
<inherits-from>Effects/terrain-default</inherits-from>
<parameters>
<texture n="2">
<image>Textures/Terrain/rock.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="3">
<image>Textures/Terrain/forest-colors.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>mirror</wrap-s>
<internal-format>normalized</internal-format>
</texture>
<texture n="4">
<image>Textures/Terrain/forest.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="5">
<image>Textures.high/Terrain/forest-relief.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level>
<depth-factor type="float">0.01</depth-factor>
<canopy-height type="float">15.0</canopy-height>
<quality-level><use>/sim/rendering/quality-level</use></quality-level>
<!-- sets the season color -->
<season-red type="float">0.12</season-red>
<season-green type="float">0.86</season-green>
<season-blue type="float">0.22</season-blue>
<!-- end season color -->
</parameters>
<generate>
<tangent type="int">6</tangent>
<binormal type="int">7</binormal>
</generate>
<technique n="9">
<predicate>
<and>
<property>/sim/rendering/crop-shader</property>
<property>/sim/rendering/shader-effects</property>
<or>
<less-equal>
<value type="float">2.0</value>
<glversion/>
</less-equal>
<and>
<extension-supported>GL_ARB_shader_objects</extension-supported>
<extension-supported>GL_ARB_shading_language_100</extension-supported>
<extension-supported>GL_ARB_vertex_shader</extension-supported>
<extension-supported>GL_ARB_fragment_shader</extension-supported>
</and>
</or>
</and>
</predicate>
<pass>
<lighting>true</lighting>
<!-- Use material values that are either inherited from the
terrain-default effect or supplied by an effect derived
from this one e.g., one created in the materials library. -->
<material>
<ambient><use>material/ambient</use></ambient>
<diffuse><use>material/diffuse</use></diffuse>
<specular><use>material/specular</use></specular>
<color-mode>ambient-and-diffuse</color-mode>
</material>
<blend><use>transparent</use></blend>
<alpha-test><use>transparent</use></alpha-test>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<render-bin>
<bin-number><use>render-bin/bin-number</use></bin-number>
<bin-name><use>render-bin/bin-name</use></bin-name>
</render-bin>
<texture-unit>
<unit>0</unit>
<type>noise</type>
</texture-unit>
<texture-unit>
<unit>1</unit>
<image><use>texture[2]/image</use></image>
<filter><use>texture[2]/filter</use></filter>
<wrap-s><use>texture[2]/wrap-s</use></wrap-s>
<wrap-t><use>texture[2]/wrap-t</use></wrap-t>
<internal-format>
<use>texture[2]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>3</unit>
<type>1d</type>
<image><use>texture[3]/image</use></image>
<filter><use>texture[3]/filter</use></filter>
<wrap-s><use>texture[3]/wrap-s</use></wrap-s>
<internal-format>
<use>texture[3]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>2</unit>
<image><use>texture[4]/image</use></image>
<filter><use>texture[4]/filter</use></filter>
<wrap-s><use>texture[4]/wrap-s</use></wrap-s>
<wrap-t><use>texture[4]/wrap-t</use></wrap-t>
<internal-format>
<use>texture[4]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>5</unit>
<image><use>texture[5]/image</use></image>
<filter><use>texture[5]/filter</use></filter>
<wrap-s><use>texture[5]/wrap-s</use></wrap-s>
<wrap-t><use>texture[5]/wrap-t</use></wrap-t>
<internal-format>
<use>texture[5]/internal-format</use>
</internal-format>
</texture-unit>
<program>
<vertex-shader>Shaders/forest.vert</vertex-shader>
<fragment-shader>Shaders/forest.frag</fragment-shader>
<attribute>
<name>tangent</name>
<index>6</index>
</attribute>
<attribute>
<name>binormal</name>
<index>7</index>
</attribute>
</program>
<uniform>
<name>NoiseTex</name>
<type>sampler-3d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>SampleTex</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>SampleTex2</name>
<type>sampler-2d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>ColorsTex</name>
<type>sampler-1d</type>
<value type="int">3</value>
</uniform>
<uniform>
<name>NormalTex</name>
<type>sampler-2d</type>
<value type="int">5</value>
</uniform>
<uniform>
<name>depth_factor</name>
<type>float</type>
<value><use>depth-factor</use></value>
</uniform>
<uniform>
<name>snowlevel</name>
<type>float</type>
<value><use>snow-level</use></value>
</uniform>
<uniform>
<name>quality_level</name>
<type>float</type>
<value><use>quality-level</use></value>
</uniform>
<uniform>
<name>red</name>
<type>float</type>
<value><use>season-red</use></value>
</uniform>
<uniform>
<name>green</name>
<type>float</type>
<value><use>season-green</use></value>
</uniform>
<uniform>
<name>blue</name>
<type>float</type>
<value><use>season-blue</use></value>
</uniform>
<uniform>
<name>alpha</name>
<type>float</type>
<value>0.0</value>
</uniform>
</pass>
</technique>
</PropertyList>

205
Effects/herbtundra.eff Normal file
View file

@ -0,0 +1,205 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>Effects/herbtundra</name>
<inherits-from>Effects/terrain-default</inherits-from>
<parameters>
<texture n="2">
<image>Textures/Terrain/rock.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="3">
<image>Textures/Terrain/forest-colors.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>mirror</wrap-s>
<internal-format>normalized</internal-format>
</texture>
<texture n="4">
<image>Textures/Terrain/forest.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="5">
<image>Textures.high/Terrain/forest-relief.png</image>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level>
<depth-factor type="float">0.01</depth-factor>
<canopy-height type="float">15.0</canopy-height>
<!-- sets the season color -->
<season-red type="float">0.12</season-red>
<season-green type="float">0.86</season-green>
<season-blue type="float">0.22</season-blue>
<!-- end season color -->
<quality-level><use>/sim/rendering/quality-level</use></quality-level>
</parameters>
<generate>
<tangent type="int">6</tangent>
<binormal type="int">7</binormal>
</generate>
<technique n="9">
<predicate>
<and>
<property>/sim/rendering/crop-shader</property>
<property>/sim/rendering/shader-effects</property>
<or>
<less-equal>
<value type="float">2.0</value>
<glversion/>
</less-equal>
<and>
<extension-supported>GL_ARB_shader_objects</extension-supported>
<extension-supported>GL_ARB_shading_language_100</extension-supported>
<extension-supported>GL_ARB_vertex_shader</extension-supported>
<extension-supported>GL_ARB_fragment_shader</extension-supported>
</and>
</or>
</and>
</predicate>
<pass>
<lighting>true</lighting>
<!-- Use material values that are either inherited from the
terrain-default effect or supplied by an effect derived
from this one e.g., one created in the materials library. -->
<material>
<ambient><use>material/ambient</use></ambient>
<diffuse><use>material/diffuse</use></diffuse>
<specular><use>material/specular</use></specular>
<color-mode>ambient-and-diffuse</color-mode>
</material>
<blend><use>transparent</use></blend>
<alpha-test><use>transparent</use></alpha-test>
<shade-model>smooth</shade-model>
<cull-face>back</cull-face>
<render-bin>
<bin-number><use>render-bin/bin-number</use></bin-number>
<bin-name><use>render-bin/bin-name</use></bin-name>
</render-bin>
<texture-unit>
<unit>0</unit>
<type>noise</type>
</texture-unit>
<texture-unit>
<unit>1</unit>
<image><use>texture[2]/image</use></image>
<filter><use>texture[2]/filter</use></filter>
<wrap-s><use>texture[2]/wrap-s</use></wrap-s>
<wrap-t><use>texture[2]/wrap-t</use></wrap-t>
<internal-format>
<use>texture[2]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>3</unit>
<type>1d</type>
<image><use>texture[3]/image</use></image>
<filter><use>texture[3]/filter</use></filter>
<wrap-s><use>texture[3]/wrap-s</use></wrap-s>
<internal-format>
<use>texture[3]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>2</unit>
<image><use>texture[4]/image</use></image>
<filter><use>texture[4]/filter</use></filter>
<wrap-s><use>texture[4]/wrap-s</use></wrap-s>
<wrap-t><use>texture[4]/wrap-t</use></wrap-t>
<internal-format>
<use>texture[4]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>5</unit>
<image><use>texture[5]/image</use></image>
<filter><use>texture[5]/filter</use></filter>
<wrap-s><use>texture[5]/wrap-s</use></wrap-s>
<wrap-t><use>texture[5]/wrap-t</use></wrap-t>
<internal-format>
<use>texture[5]/internal-format</use>
</internal-format>
</texture-unit>
<program>
<vertex-shader>Shaders/forest.vert</vertex-shader>
<fragment-shader>Shaders/forest.frag</fragment-shader>
<attribute>
<name>tangent</name>
<index>6</index>
</attribute>
<attribute>
<name>binormal</name>
<index>7</index>
</attribute>
</program>
<uniform>
<name>NoiseTex</name>
<type>sampler-3d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>SampleTex</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>SampleTex2</name>
<type>sampler-2d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>ColorsTex</name>
<type>sampler-1d</type>
<value type="int">3</value>
</uniform>
<uniform>
<name>NormalTex</name>
<type>sampler-2d</type>
<value type="int">5</value>
</uniform>
<uniform>
<name>depth_factor</name>
<type>float</type>
<value><use>depth-factor</use></value>
</uniform>
<uniform>
<name>snowlevel</name>
<type>float</type>
<value><use>snow-level</use></value>
</uniform>
<uniform>
<name>quality_level</name>
<type>float</type>
<value><use>quality-level</use></value>
</uniform>
<uniform>
<name>red</name>
<type>float</type>
<value><use>season-red</use></value>
</uniform>
<uniform>
<name>green</name>
<type>float</type>
<value><use>season-green</use></value>
</uniform>
<uniform>
<name>blue</name>
<type>float</type>
<value><use>season-blue</use></value>
</uniform>
<uniform>
<name>alpha</name>
<type>float</type>
<value>0.0</value>
</uniform>
</pass>
</technique>
</PropertyList>

View file

@ -1,4 +1,20 @@
<?xml version="1.0" ?>
<!--
This file is part of FlightGear, the free flight simulator
http://www.flightgear.org/
Copyright (C) 2010 Curtis L. Olson - http://www.flightgear.org/~curt
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-->
<!--
Cloud shapes and layers. See Docs/README.3DClouds for details.

View file

@ -0,0 +1,41 @@
<?xml version="1.0" ?>
<!--
This file is part of FlightGear, the free flight simulator
http://www.flightgear.org/
Copyright (C) 2009 Torsten Dreyer, Torsten (at) t3r _dot_ de
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-->
<PropertyList>
<params>
<from>environment/metar/clouds/layer[0]/elevation-ft</from>
<to>/environment/clouds/layer[0]/elevation-ft</to>
</params>
<name>MetarController:clouds:altitude_interpolate</name>
<type>noise-spike</type>
<max-rate-of-change>8.333</max-rate-of-change>
<enable>
<condition>
<property>/environment/metar/valid</property>
<greater-than>
<property alias="../../../../params/from"/>
<value>-9000</value>
</greater-than>
<greater-than>
<property alias="../../../../params/to"/>
<value>-9000</value>
</greater-than>
</condition>
</enable>
<input alias="../params/from"/>
<output alias="../params/to"/>
</PropertyList>

View file

@ -0,0 +1,43 @@
<?xml version="1.0" ?>
<!--
This file is part of FlightGear, the free flight simulator
http://www.flightgear.org/
Copyright (C) 2009 Torsten Dreyer, Torsten (at) t3r _dot_ de
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-->
<PropertyList>
<params>
<from>environment/metar/clouds/layer[0]/elevation-ft</from>
<to>/environment/clouds/layer[0]/elevation-ft</to>
</params>
<name>MetarController:clouds:altitude_set</name>
<type>gain</type>
<gain>1.0</gain>
<enable>
<condition>
<property>/environment/metar/valid</property>
<or>
<less-than>
<property alias="../../../../../params/from"/>
<value>-9000</value>
</less-than>
<less-than>
<property alias="../../../../../params/to"/>
<value>-9000</value>
</less-than>
</or>
</condition>
</enable>
<input alias="../params/from"/>
<output alias="../params/to"/>
</PropertyList>

View file

@ -0,0 +1,37 @@
<?xml version="1.0" ?>
<!--
This file is part of FlightGear, the free flight simulator
http://www.flightgear.org/
Copyright (C) 2009 Torsten Dreyer, Torsten (at) t3r _dot_ de
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-->
<PropertyList>
<params>
<from>/environment/metar/clouds/layer[0]/coverage-type</from>
<to>environment/clouds/layer[0]/coverage-type</to>
</params>
<name>MetarController:clouds:coverage</name>
<type>gain</type>
<gain>1.0</gain>
<enable>
<condition>
<property>/environment/metar/valid</property>
<not-equals>
<property alias="../../../../params/from"/>
<property alias="../../../../params/to"/>
</not-equals>
</condition>
</enable>
<input alias="../params/from"/>
<output alias="../params/to"/>
</PropertyList>

View file

@ -0,0 +1,29 @@
<?xml version="1.0" ?>
<!--
This file is part of FlightGear, the free flight simulator
http://www.flightgear.org/
Copyright (C) 2009 Torsten Dreyer, Torsten (at) t3r _dot_ de
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-->
<PropertyList>
<name>MetarController:clouds:thickness</name>
<enable>
<condition>
<property>/environment/metar/valid</property>
</condition>
</enable>
<input>/environment/metar/clouds/layer[0]/thickness-ft</input>
<output>/environment/clouds/layer[0]/thickness-ft</output>
<type>noise-spike</type>
<max-rate-of-change>8.3333</max-rate-of-change>
</PropertyList>

223
Environment/environment.xml Normal file
View file

@ -0,0 +1,223 @@
<?xml version="1.0" ?>
<!--
This file is part of FlightGear, the free flight simulator
http://www.flightgear.org/
Copyright (C) 2010 Curtis L. Olson - http://www.flightgear.org/~curt
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-->
<PropertyList>
<weather-scenarios>
<scenario>
<name>Disabled</name>
<description>METAR weather generation is disabled. Use 'Weather Conditions' and 'Clouds' dialogs to setup your weather.</description>
</scenario>
<scenario>
<name>Live data</name>
<description>Fetch live weather data for your nearest airport from noaa.gov. You need a working internet connection.</description>
</scenario>
<scenario>
<name>Manual input</name>
<description>Enter your favorite METAR weather in the textbox below. A valid METAR syntax is required.</description>
</scenario>
<scenario>
<name>Fair weather</name>
<metar>XXXX 012345Z 15003KT 12SM SCT041 FEW200 20/08 Q1015 NOSIG</metar>
<description>A lovely day for trip to your favorite 100$ hamburger airfield</description>
</scenario>
<scenario>
<name>Thunderstorm</name>
<metar>XXXX 012345Z 15012G25KT 4000 TSRA FEW030CB SCT035TCU 27/24 Q0995</metar>
<description>A hot and damp summer day with thunderstorms developing in the afternoon.
Be prepared for reduction of visibility in showers and strong gusts
near thunderstorms</description>
</scenario>
<scenario>
<name>Stormy Monday</name>
<metar>XXXX 012345Z 28035G50KT 250V300 9999 TSRA SCT022CB BKN030 13/09 Q1005</metar>
<description>You're out for an adventure? Gusty winds blowing from the west
and isolated thunderstorms should be avoided. Fasten your seatbelt!</description>
</scenario>
<scenario>
<name>Marginal VFR</name>
<metar>XXXX 012345Z 23010KT 5000 SHRA SCT012 BKN018 OVC060 15/11 Q1010</metar>
<description>After the storm - limited visibility and some showers.
Go or No-Go?</description>
</scenario>
<scenario>
<name>CAT I minimum</name>
<metar>XXXX 012345Z 15015KT 0800 -RA BKN002 OVC004 08/06 Q0990</metar>
<description>If you just got your IFR rating, this is what you are allowed to do. But can you?</description>
</scenario>
<scenario>
<name>CAT II minimum</name>
<metar>XXXX 012345Z 15010KT 0400 -RA BKN001 OVC002 08/06 Q0990</metar>
<description>With just a 1/4 mile visibility and clouds at 100ft, you don't see much of the runway until
seconds before touchdown. Trust your instruments to stay alive.</description>
</scenario>
<scenario>
<name>CAT IIIb minimum</name>
<metar>XXXX 012345Z VRB01KT 0100 FG OVC001 OVC002 02/02 Q0990</metar>
<description>This is expert level. You will barely see the taxiway from the cockpit, even if you are
on ground. Fog and light drizzle, freezing level at 1000ft.</description>
</scenario>
</weather-scenarios>
<weather-scenario>Fair weather</weather-scenario>
<config>
<boundary-transition-ft>500</boundary-transition-ft>
<boundary>
<entry>
<elevation-ft>0</elevation-ft>
<wind-from-heading-deg>270</wind-from-heading-deg>
<wind-speed-kt>3</wind-speed-kt>
<visibility-m>16093.44</visibility-m>
<pressure-sea-level-inhg>29.92</pressure-sea-level-inhg>
<temperature-degc>15.0</temperature-degc>
<dewpoint-degc>5.0</dewpoint-degc>
<turbulence>
<factor>0.2</factor>
<magnitude-norm>0.0</magnitude-norm>
<rate-hz>1.0</rate-hz>
</turbulence>
<wind-heading-change-deg>0</wind-heading-change-deg>
<wind-speed-change-rel>0</wind-speed-change-rel>
</entry>
<entry>
<elevation-ft>500</elevation-ft>
<wind-from-heading-deg>280</wind-from-heading-deg>
<wind-speed-kt>6</wind-speed-kt>
<turbulence>
<factor>1.0</factor>
<magnitude-norm>0.1</magnitude-norm>
<rate-hz>1.0</rate-hz>
</turbulence>
<wind-heading-change-deg>5</wind-heading-change-deg>
<wind-speed-change-rel>0.3</wind-speed-change-rel>
</entry>
</boundary>
<aloft>
<entry>
<elevation-ft>3000</elevation-ft>
<wind-from-heading-deg>300</wind-from-heading-deg>
<wind-speed-kt>10</wind-speed-kt>
<visibility-m>16093.44</visibility-m>
<pressure-sea-level-inhg>29.92</pressure-sea-level-inhg>
<turbulence>
<factor>0.5</factor>
<magnitude-norm>0.05</magnitude-norm>
<rate-hz>1.0</rate-hz>
</turbulence>
<wind-heading-change-deg>25</wind-heading-change-deg>
<wind-speed-change-rel>1</wind-speed-change-rel>
</entry>
<entry>
<elevation-ft>6000</elevation-ft>
<wind-from-heading-deg>310</wind-from-heading-deg>
<wind-speed-kt>20</wind-speed-kt>
<turbulence>
<factor>0.0</factor>
<magnitude-norm>0.0</magnitude-norm>
<rate-hz>1.0</rate-hz>
</turbulence>
<wind-heading-change-deg>30</wind-heading-change-deg>
<wind-speed-change-rel>1.2</wind-speed-change-rel>
</entry>
<entry>
<elevation-ft>9000</elevation-ft>
<wind-from-heading-deg>320</wind-from-heading-deg>
<wind-speed-kt>30</wind-speed-kt>
<wind-heading-change-deg>35</wind-heading-change-deg>
<wind-speed-change-rel>1.3</wind-speed-change-rel>
</entry>
<entry>
<elevation-ft>30000</elevation-ft>
<wind-from-heading-deg>330</wind-from-heading-deg>
<wind-speed-kt>50</wind-speed-kt>
<wind-heading-change-deg>35</wind-heading-change-deg>
<wind-speed-change-rel>1.3</wind-speed-change-rel>
</entry>
<entry>
<elevation-ft>40000</elevation-ft>
<wind-from-heading-deg>340</wind-from-heading-deg>
<wind-speed-kt>70</wind-speed-kt>
<wind-heading-change-deg>35</wind-heading-change-deg>
<wind-speed-change-rel>1.3</wind-speed-change-rel>
</entry>
</aloft>
</config>
<clouds>
<layer n="0">
<coverage>clear</coverage>
<elevation-ft>-9999</elevation-ft>
<thickness-ft>600</thickness-ft>
<transition-ft>150</transition-ft>
<span-m>40000</span-m>
</layer>
<layer n="1">
<coverage>clear</coverage>
<elevation-ft>-9999</elevation-ft>
<thickness-ft>65</thickness-ft>
<transition-ft>25</transition-ft>
<span-m>40000</span-m>
</layer>
<layer n="2">
<coverage>clear</coverage>
<elevation-ft>-9999</elevation-ft>
<span-m>40000</span-m>
</layer>
<layer n="3">
<coverage>clear</coverage>
<elevation-ft>-9999</elevation-ft>
<span-m>40000</span-m>
</layer>
<layer n="4">
<coverage>clear</coverage>
<elevation-ft>-9999</elevation-ft>
<span-m>40000</span-m>
</layer>
</clouds>
<cloudlayers include="cloudlayers.xml"/>
<params>
<real-world-weather-fetch type="bool">false</real-world-weather-fetch>
<metar-max-age-min type="long">240</metar-max-age-min>
<metar-updates-environment type="bool">true</metar-updates-environment>
<control-fdm-atmosphere type="bool">true</control-fdm-atmosphere>
<contrail-altitude>30000</contrail-altitude>
</params>
<wildfire>
<enabled type="bool" userarchive="y">false</enabled>
<share-events type="bool" userarchive="y">false</share-events>
<save-on-exit type="bool" userarchive="y">false</save-on-exit>
<restore-on-startup type="bool" userarchive="y">false</restore-on-startup>
<fire-on-crash type="bool" userarchive="y">false</fire-on-crash>
<report-score type="bool" userarchive="y">false</report-score>
<data type="string"/>
</wildfire>
</PropertyList>

View file

@ -0,0 +1,111 @@
<?xml version="1.0" ?>
<!--
This file is part of FlightGear, the free flight simulator
http://www.flightgear.org/
Copyright (C) 2009 Torsten Dreyer, Torsten (at) t3r _dot_ de
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-->
<!--
Interpolate the values of /environment/interpolated/* over time
and write the results to /environment/*, the environment of our
aircraft
All filters are enabled on /environment/config/enabled=true
-->
<PropertyList>
<filter>
<name>EnvironmentInterpolator:temperature-sea-level-degc</name>
<enable>
<condition>
<property>/environment/config/enabled</property>
</condition>
</enable>
<input>/environment/config/interpolated/temperature-sea-level-degc</input>
<output>/environment/temperature-sea-level-degc</output>
<type>noise-spike</type>
<max-rate-of-change>0.1667</max-rate-of-change>
</filter>
<filter>
<name>EnvironmentInterpolator:dewpoint-sea-level-degc</name>
<enable>
<condition>
<property>/environment/config/enabled</property>
</condition>
</enable>
<input>/environment/config/interpolated/dewpoint-sea-level-degc</input>
<output>/environment/dewpoint-sea-level-degc</output>
<type>noise-spike</type>
<max-rate-of-change>0.1667</max-rate-of-change>
</filter>
<filter>
<!--
transfer the interpolated QNH to the global environment
limit the rate of change to approx 1hpa/sec
-->
<name>EnvironmentInterpolator:pressure-sea-level-inhg</name>
<type>noise-spike</type>
<max-rate-of-change>0.03</max-rate-of-change>
<enable>
<condition>
<property>/environment/config/enabled</property>
</condition>
</enable>
<input>/environment/config/interpolated/pressure-sea-level-inhg</input>
<output>/environment/pressure-sea-level-inhg</output>
</filter>
<filter>
<name>EnvironmentInterpolator:visibility-m</name>
<enable>
<condition>
<property>/environment/config/enabled</property>
</condition>
</enable>
<input>/environment/config/interpolated/visibility-m</input>
<output>/environment/visibility-m</output>
<type>exponential</type>
<filter-time>10</filter-time>
</filter>
<!--
filter the wind vector by filtering the cartesian representation
-->
<filter>
<name>EnvironmentInterpolator:wind-from-north</name>
<enable>
<condition>
<property>/environment/config/enabled</property>
</condition>
</enable>
<input>/environment/config/interpolated/wind-from-north-fps</input>
<output>/environment/wind-from-north-fps</output>
<type>exponential</type>
<filter-time>5</filter-time>
</filter>
<filter>
<name>EnvironmentInterpolator:wind-from-east</name>
<enable>
<condition>
<property>/environment/config/enabled</property>
</condition>
</enable>
<input>/environment/config/interpolated/wind-from-east-fps</input>
<output>/environment/wind-from-east-fps</output>
<type>exponential</type>
<filter-time>5</filter-time>
</filter>
</PropertyList>

View file

@ -0,0 +1,36 @@
<?xml version="1.0" ?>
<!--
This file is part of FlightGear, the free flight simulator
http://www.flightgear.org/
Copyright (C) 2009 Torsten Dreyer, Torsten (at) t3r _dot_ de
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-->
<PropertyList>
<name>MetarController:layer:wind-from-heading-deg</name>
<type>gain</type>
<gain>1.0</gain>
<enable>
<condition>
<property>/environment/metar/valid</property>
</condition>
</enable>
<input>
<property>/environment/config/boundary/entry[0]/wind-from-heading-deg</property>
<offset>/environment/config/boundary/entry[1]/wind-heading-change-deg</offset>
</input>
<output>/environment/config/boundary/entry[1]/wind-from-heading-deg</output>
<period>
<min>0</min>
<max>360</max>
</period>
</PropertyList>

View file

@ -0,0 +1,39 @@
<?xml version="1.0" ?>
<!--
This file is part of FlightGear, the free flight simulator
http://www.flightgear.org/
Copyright (C) 2009 Torsten Dreyer, Torsten (at) t3r _dot_ de
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-->
<PropertyList>
<name>MetarController:layer:wind-speed-kt</name>
<type>gain</type>
<gain>1.0</gain>
<enable>
<condition>
<property>/environment/metar/valid</property>
</condition>
</enable>
<input>
<expression>
<product>
<property>/environment/config/boundary/entry[0]/wind-speed-kt</property>
<sum>
<property>/environment/config/boundary/entry[1]/wind-speed-change-rel</property>
<value>1.0</value>
</sum>
</product>
</expression>
</input>
<output>/environment/config/boundary/entry[1]/wind-speed-kt</output>
</PropertyList>

View file

@ -0,0 +1,375 @@
<?xml version="1.0" ?>
<!--
This file is part of FlightGear, the free flight simulator
http://www.flightgear.org/
Copyright (C) 2009 Torsten Dreyer, Torsten (at) t3r _dot_ de
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-->
<!--
Interpolate the METAR weather values over time and write
the environment values in /environment/config/*
All filters are enabled if /environment/metar/valid=true
-->
<PropertyList>
<filter>
<!--
transfer the METAR QNH to the interpolation controller
limit the rate of change to approx 0.01hpa/sec
-->
<name>MetarController:pressure-sea-level-inhg</name>
<type>noise-spike</type>
<max-rate-of-change>0.0003</max-rate-of-change>
<enable>
<condition>
<property>/environment/metar/valid</property>
</condition>
</enable>
<input>/environment/metar/pressure-sea-level-inhg</input>
<output>/environment/config/boundary/entry/pressure-sea-level-inhg</output>
<output>/environment/config/aloft/entry/pressure-sea-level-inhg</output>
</filter>
<filter>
<!--
transfer the sea-level temperature to each layer of
interpolation controller. We have no idea here about
the temperature gradient, so just assume ISA.
-->
<name>MetarController:temperature-sea-level-degc</name>
<type>noise-spike</type>
<max-rate-of-change>0.01667</max-rate-of-change>
<enable>
<condition>
<property>/environment/metar/valid</property>
</condition>
</enable>
<input>/environment/metar/temperature-sea-level-degc</input>
<output>/environment/config/boundary/entry[0]/temperature-sea-level-degc</output>
<output>/environment/config/boundary/entry[1]/temperature-sea-level-degc</output>
<output>/environment/config/aloft/entry[0]/temperature-sea-level-degc</output>
<output>/environment/config/aloft/entry[1]/temperature-sea-level-degc</output>
<output>/environment/config/aloft/entry[2]/temperature-sea-level-degc</output>
<output>/environment/config/aloft/entry[3]/temperature-sea-level-degc</output>
<output>/environment/config/aloft/entry[4]/temperature-sea-level-degc</output>
</filter>
<filter>
<!--
transfer the sea-level temperature to each layer of
interpolation controller.
-->
<name>MetarController:dewpoint-sea-level-degc</name>
<type>noise-spike</type>
<max-rate-of-change>0.01667</max-rate-of-change>
<enable>
<condition>
<property>/environment/metar/valid</property>
</condition>
</enable>
<input>/environment/metar/dewpoint-sea-level-degc</input>
<output>/environment/config/boundary/entry[0]/dewpoint-sea-level-degc</output>
<output>/environment/config/boundary/entry[1]/dewpoint-sea-level-degc</output>
<output>/environment/config/aloft/entry[0]/dewpoint-sea-level-degc</output>
<output>/environment/config/aloft/entry[1]/dewpoint-sea-level-degc</output>
<output>/environment/config/aloft/entry[2]/dewpoint-sea-level-degc</output>
<output>/environment/config/aloft/entry[3]/dewpoint-sea-level-degc</output>
<output>/environment/config/aloft/entry[4]/dewpoint-sea-level-degc</output>
</filter>
<filter>
<!--
transfer the sea-level temperature to each layer of
interpolation controller. We are not very creative here and
use the same visibility for all layers but top three which
are left untouched.
-->
<name>MetarController:visibility-m</name>
<type>exponential</type>
<filter-time>30</filter-time>
<enable>
<condition>
<property>/environment/metar/valid</property>
</condition>
</enable>
<input>/environment/metar/min-visibility-m</input>
<output>/environment/config/boundary/entry[0]/visibility-m</output>
<output>/environment/config/boundary/entry[1]/visibility-m</output>
<output>/environment/config/aloft/entry[0]/visibility-m</output>
<output>/environment/config/aloft/entry[1]/visibility-m</output>
</filter>
<!-- split the wind vector into it's components -->
<filter>
<name>MetarController:wind-from-north-kt</name>
<type>exponential</type>
<filter-time>30</filter-time>
<enable>
<condition>
<property>/environment/metar/valid</property>
</condition>
</enable>
<input>
<expression>
<cos>
<product>
<property>/environment/metar/base-wind-dir-deg</property>
<value>0.0174533</value>
</product>
</cos>
</expression>
<scale>/environment/metar/base-wind-speed-kt</scale>
</input>
<output>/environment/metar/base-wind-from-north-kt</output>
</filter>
<filter>
<name>MetarController:wind-from-east-kt</name>
<type>exponential</type>
<filter-time>30</filter-time>
<enable>
<condition>
<property>/environment/metar/valid</property>
</condition>
</enable>
<input>
<expression>
<sin>
<product>
<property>/environment/metar/base-wind-dir-deg</property>
<value>0.0174533</value>
</product>
</sin>
</expression>
<scale>/environment/metar/base-wind-speed-kt</scale>
</input>
<output>/environment/metar/base-wind-from-east-kt</output>
</filter>
<filter>
<name>MetarController::wind-speed-kt</name>
<enable>
<condition>
<property>/environment/metar/valid</property>
</condition>
</enable>
<input>
<expression>
<!-- pythagoras in markup language -->
<sqrt>
<sum>
<product>
<property>/environment/metar/base-wind-from-east-kt</property>
<property>/environment/metar/base-wind-from-east-kt</property>
</product>
<product>
<property>/environment/metar/base-wind-from-north-kt</property>
<property>/environment/metar/base-wind-from-north-kt</property>
</product>
</sum>
</sqrt>
</expression>
</input>
<output>/environment/config/boundary/entry[0]/wind-speed-kt</output>
<type>gain</type>
<gain>1.0</gain>
</filter>
<filter>
<name>MetarController:wind-from-heading-deg</name>
<enable>
<condition>
<property>/environment/metar/valid</property>
</condition>
</enable>
<input>
<expression>
<atan2>
<property>/environment/metar/base-wind-from-east-kt</property>
<property>/environment/metar/base-wind-from-north-kt</property>
</atan2>
</expression>
</input>
<output>/environment/config/boundary/entry[0]/wind-from-heading-deg</output>
<type>gain</type>
<gain>57.3</gain> <!-- radians to degree -->
<period>
<min>0</min>
<max>360</max>
</period>
</filter>
<!-- Adjust the wind-vector for the layers -->
<!-- TODO: handle variable winds -->
<filter include="layer-heading-offset.xml"/>
<filter include="layer-heading-offset.xml">
<input>
<offset>/environment/config/aloft/entry[0]/wind-heading-change-deg</offset>
</input>
<output>/environment/config/aloft/entry[0]/wind-from-heading-deg</output>
</filter>
<filter include="layer-heading-offset.xml">
<input>
<offset>/environment/config/aloft/entry[1]/wind-heading-change-deg</offset>
</input>
<output>/environment/config/aloft/entry[1]/wind-from-heading-deg</output>
</filter>
<filter include="layer-heading-offset.xml">
<input>
<offset>/environment/config/aloft/entry[2]/wind-heading-change-deg</offset>
</input>
<output>/environment/config/aloft/entry[2]/wind-from-heading-deg</output>
</filter>
<filter include="layer-heading-offset.xml">
<input>
<offset>/environment/config/aloft/entry[3]/wind-heading-change-deg</offset>
</input>
<output>/environment/config/aloft/entry[3]/wind-from-heading-deg</output>
</filter>
<filter include="layer-heading-offset.xml">
<input>
<offset>/environment/config/aloft/entry[4]/wind-heading-change-deg</offset>
</input>
<output>/environment/config/aloft/entry[4]/wind-from-heading-deg</output>
</filter>
<filter include="layer-speed-change.xml"/>
<filter include="layer-speed-change.xml">
<input>
<offset>/environment/config/aloft/entry[0]/wind-speed-change-rel</offset>
</input>
<output>/environment/config/aloft/entry[0]/wind-speed-kt</output>
</filter>
<filter include="layer-speed-change.xml">
<input>
<offset>/environment/config/aloft/entry[1]/wind-speed-change-rel</offset>
</input>
<output>/environment/config/aloft/entry[1]/wind-speed-kt</output>
</filter>
<filter include="layer-speed-change.xml">
<input>
<offset>/environment/config/aloft/entry[2]/wind-speed-change-rel</offset>
</input>
<output>/environment/config/aloft/entry[2]/wind-speed-kt</output>
</filter>
<filter include="layer-speed-change.xml">
<input>
<offset>/environment/config/aloft/entry[3]/wind-speed-change-rel</offset>
</input>
<output>/environment/config/aloft/entry[3]/wind-speed-kt</output>
</filter>
<filter include="layer-speed-change.xml">
<input>
<offset>/environment/config/aloft/entry[4]/wind-speed-change-rel</offset>
</input>
<output>/environment/config/aloft/entry[4]/wind-speed-kt</output>
</filter>
<!-- Clouds -->
<!-- don't interpolate to/from altitude -9999 -->
<filter include="clouds-altitude-set.xml"/>
<filter include="clouds-altitude-set.xml">
<params>
<from>/environment/metar/clouds/layer[1]/elevation-ft</from>
<to>/environment/clouds/layer[1]/elevation-ft</to>
</params>
</filter>
<filter include="clouds-altitude-set.xml">
<params>
<from>/environment/metar/clouds/layer[2]/elevation-ft</from>
<to>/environment/clouds/layer[2]/elevation-ft</to>
</params>
</filter>
<filter include="clouds-altitude-set.xml">
<params>
<from>/environment/metar/clouds/layer[3]/elevation-ft</from>
<to>/environment/clouds/layer[3]/elevation-ft</to>
</params>
</filter>
<filter include="clouds-altitude-set.xml">
<params>
<from>/environment/metar/clouds/layer[4]/elevation-ft</from>
<to>/environment/clouds/layer[4]/elevation-ft</to>
</params>
</filter>
<filter include="clouds-altitude-interpolate.xml"/>
<filter include="clouds-altitude-interpolate.xml">
<params>
<from>/environment/metar/clouds/layer[1]/elevation-ft</from>
<to>/environment/clouds/layer[1]/elevation-ft</to>
</params>
</filter>
<filter include="clouds-altitude-interpolate.xml">
<params>
<from>/environment/metar/clouds/layer[2]/elevation-ft</from>
<to>/environment/clouds/layer[2]/elevation-ft</to>
</params>
</filter>
<filter include="clouds-altitude-interpolate.xml">
<params>
<from>/environment/metar/clouds/layer[3]/elevation-ft</from>
<to>/environment/clouds/layer[3]/elevation-ft</to>
</params>
</filter>
<filter include="clouds-altitude-interpolate.xml">
<params>
<from>/environment/metar/clouds/layer[4]/elevation-ft</from>
<to>/environment/clouds/layer[4]/elevation-ft</to>
</params>
</filter>
<filter include="clouds-thickness.xml"/>
<filter include="clouds-thickness.xml">
<input>/environment/metar/clouds/layer[1]/thickness-ft</input>
<output>/environment/clouds/layer[1]/thickness-ft</output>
</filter>
<filter include="clouds-thickness.xml">
<input>/environment/metar/clouds/layer[2]/thickness-ft</input>
<output>/environment/clouds/layer[2]/thickness-ft</output>
</filter>
<filter include="clouds-thickness.xml">
<input>/environment/metar/clouds/layer[3]/thickness-ft</input>
<output>/environment/clouds/layer[3]/thickness-ft</output>
</filter>
<filter include="clouds-thickness.xml">
<input>/environment/metar/clouds/layer[4]/thickness-ft</input>
<output>/environment/clouds/layer[4]/thickness-ft</output>
</filter>
<filter include="clouds-coverage.xml"/>
<filter include="clouds-coverage.xml">
<params>
<from>/environment/metar/clouds/layer[1]/coverage-type</from>
<to>environment/clouds/layer[1]/coverage-type</to>
</params>
</filter>
<filter include="clouds-coverage.xml">
<params>
<from>/environment/metar/clouds/layer[2]/coverage-type</from>
<to>environment/clouds/layer[2]/coverage-type</to>
</params>
</filter>
<filter include="clouds-coverage.xml">
<params>
<from>/environment/metar/clouds/layer[3]/coverage-type</from>
<to>environment/clouds/layer[3]/coverage-type</to>
</params>
</filter>
<filter include="clouds-coverage.xml">
<params>
<from>/environment/metar/clouds/layer[4]/coverage-type</from>
<to>environment/clouds/layer[4]/coverage-type</to>
</params>
</filter>
</PropertyList>

View file

@ -27,6 +27,7 @@
READ ALLOW $FG_ROOT/*
READ ALLOW $FG_HOME/*
READ ALLOW $FG_AIRCRAFT/*
WRITE ALLOW /tmp/*.xml
WRITE ALLOW $FG_HOME/*.sav

View file

@ -606,7 +606,7 @@ var overlay_update = {
return m;
},
add: func(path, prop, callback = nil) {
var path = string.normpath(getprop("/sim/fg-root") ~ '/' ~ path) ~ '/';
var path = path ~ '/';
me.data[path] = [me.root.initNode(prop, ""), "",
typeof(callback) == "func" ? callback : func nil];
return me;

View file

@ -287,7 +287,7 @@ var Dialog = {
me.close();
me.prop.removeChildren();
io.read_properties(getprop("/sim/fg-root") ~ "/" ~ me.path, me.prop);
io.read_properties(me.path, me.prop);
var n = me.prop.getNode("name");
if (n == nil)
@ -373,7 +373,9 @@ var OverlaySelector = {
var m = Dialog.new(data.getNode("dialog", 1), "gui/dialogs/overlay-select.xml", name);
m.parents = [OverlaySelector, Dialog];
m.dir = string.normpath(getprop("/sim/fg-root") ~ '/' ~ dir) ~ '/';
# resolve the path in FG_ROOT, and --fg-aircraft dir, etc
m.dir = resolvepath(dir) ~ "/";
var relpath = func(p) substr(p, p[0] == `/`);
m.nameprop = relpath(nameprop);
m.sortprop = relpath(sortprop or nameprop);

View file

@ -235,11 +235,26 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
var pattern = f[2];
foreach (var p; subvec(f, 3))
pattern ~= " " ~ p;
if (substr(pattern, 0, 9) == "$FG_ROOT/")
pattern = root ~ "/" ~ substr(pattern, 9);
elsif (substr(pattern, 0, 9) == "$FG_HOME/")
pattern = home ~ "/" ~ substr(pattern, 9);
append(f[0] == "READ" ? read_rules : write_rules, [pattern, f[1] == "ALLOW"]);
var rules = f[0] == "READ" ? read_rules : write_rules;
var allow = (f[1] == "ALLOW");
if (substr(pattern, 0, 13) == "$FG_AIRCRAFT/") {
var p = substr(pattern, 13);
var sim = props.globals.getNode("/sim");
foreach (var c; sim.getChildren("fg-aircraft")) {
pattern = c.getValue() ~ "/" ~ p;
append(rules, [pattern, allow]);
printlog("info", "IORules: appending ", pattern);
}
} else {
if (substr(pattern, 0, 9) == "$FG_ROOT/")
pattern = root ~ "/" ~ substr(pattern, 9);
elsif (substr(pattern, 0, 9) == "$FG_HOME/")
pattern = home ~ "/" ~ substr(pattern, 9);
append(rules, [pattern, allow]);
printlog("info", "IORules: appending ", pattern);
}
}
close(file);
return path;

View file

@ -468,7 +468,7 @@ var dialog = func {
#
var load = func(file, index = 0) {
props.globals.getNode("/sim/tutorials", 1).removeChild("tutorial", index);
io.read_properties(getprop("/sim/fg-root") ~ "/" ~ file, "/sim/tutorials/tutorial[" ~ index ~ "]/");
io.read_properties(file, "/sim/tutorials/tutorial[" ~ index ~ "]/");
}

View file

@ -4,25 +4,20 @@ varying vec4 rawpos;
varying vec4 ecPosition;
varying vec3 VNormal;
varying vec3 Normal;
varying vec4 constantColor;
uniform sampler3D NoiseTex;
uniform sampler2D SampleTex;
uniform sampler1D ColorsTex;
const float scale = 1.0;
uniform float snowlevel; // From /sim/rendering/snow-level-m
const vec4 red = vec4(1.0, 0.0, 0.0, 1.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 1.0);
const vec4 blue = vec4(0.0, 0.0, 1.0, 1.0);
const vec4 yellow = vec4(1.0, 1.0, 0.0, 1.0);
const float scale = 1.0;
#define BLA 1
#define BLA2 0
void main (void)
{
const float snowlevel=2000.0;
vec4 basecolor = texture2D(SampleTex, rawpos.xy*0.000144);
basecolor = texture1D(ColorsTex, basecolor.r+0.00);
@ -54,13 +49,15 @@ void main (void)
// good
vec4 c1;
c1 = basecolor * vec4(smoothstep(0.0, 1.15, n), smoothstep(0.0, 1.2, n), smoothstep(0.1, 1.3, n), 1.0);
//"steep = gray"
c1 = mix(vec4(n-0.42, n-0.44, n-0.51, 1.0), c1, smoothstep(0.970, 0.990, abs(normalize(Normal).z)+nvL[2]*1.3));
//"snow"
c1 = mix(c1, clamp(n+nvL[2]*4.1+vec4(0.1, 0.1, nvL[2]*2.2, 1.0), 0.7, 1.0), smoothstep(snowlevel+300.0, snowlevel+360.0, (rawpos.z)+nvL[1]*3000.0));
vec3 diffuse = gl_Color.rgb * max(0.0, dot(VNormal, gl_LightSource[0].position.xyz));
vec4 ambient_light = constantColor + gl_LightSource[0].diffuse * vec4(diffuse, 1.0);
vec4 ambient_light = gl_LightSource[0].diffuse * vec4(diffuse, 1.0);
c1 *= ambient_light;
vec4 finalColor = c1;

View file

@ -1,23 +1,19 @@
#version 120
varying vec4 rawpos;
varying vec4 ecPosition;
varying vec3 VNormal;
varying vec3 Normal;
varying vec4 constantColor;
centroid varying vec4 ipos;
varying vec4 rawpos;
varying vec4 ecPosition;
varying vec3 VNormal;
varying vec3 Normal;
void main(void)
{
gl_TexCoord[0] = gl_MultiTexCoord0;
rawpos = gl_Vertex;
ipos = gl_Vertex;
rawpos = gl_Vertex;
ecPosition = gl_ModelViewMatrix * gl_Vertex;
VNormal = normalize(gl_NormalMatrix * gl_Normal);
Normal = normalize(gl_Normal);
gl_FrontColor = gl_Color;
constantColor = gl_FrontMaterial.emission
+ gl_Color * (gl_LightModel.ambient + gl_LightSource[0].ambient);
gl_FrontColor = gl_Color;
gl_Position = ftransform();
}

188
Shaders/forest.frag Normal file
View file

@ -0,0 +1,188 @@
#version 120
varying vec4 rawpos;
varying vec4 ecPosition;
varying vec3 VTangent;
varying vec3 VBinormal;
varying vec3 VNormal;
varying vec3 Normal;
varying float bump;
uniform sampler3D NoiseTex;
uniform sampler2D SampleTex;
uniform sampler1D ColorsTex;
uniform sampler2D SampleTex2;
uniform sampler2D NormalTex;
uniform float depth_factor;
uniform float red, green, blue, alpha;
uniform float quality_level; // From /sim/rendering/quality-level
uniform float snowlevel; // From /sim/rendering/snow-level-m
const float scale = 1.0;
int linear_search_steps = 10;
float ray_intersect(sampler2D reliefMap, vec2 dp, vec2 ds)
{
float size = 1.0 / float(linear_search_steps);
float depth = 0.0;
float best_depth = 1.0;
for(int i = 0; i < linear_search_steps - 1; ++i)
{
depth += size;
float t = texture2D(reliefMap, dp + ds * depth).a;
if(best_depth > 0.996)
if(depth >= t)
best_depth = depth;
}
depth = best_depth;
const int binary_search_steps = 5;
for(int i = 0; i < binary_search_steps; ++i)
{
size *= 0.5;
float t = texture2D(reliefMap, dp + ds * depth).a;
if(depth >= t)
{
best_depth = depth;
depth -= 2.0 * size;
}
depth += size;
}
return(best_depth);
}
void main (void)
{
if ( quality_level >= 3.5 ) {
linear_search_steps = 20;
}
vec2 uv, dp, ds;
vec3 N;
float d;
if ( bump > 0.9 && quality_level >= 2.0 )
{
vec3 V = normalize(ecPosition.xyz);
float a = dot(VNormal, -V);
vec2 s = vec2(dot(V, VTangent), dot(V, VBinormal));
s *= depth_factor / a;
ds = s;
dp = gl_TexCoord[0].st;
d = ray_intersect(NormalTex, dp, ds);
uv = dp + ds * d;
N = texture2D(NormalTex, uv).xyz * 2.0 - 1.0;
}
else
{
uv = gl_TexCoord[0].st;
N = vec3(0.0, 0.0, 1.0);
}
vec4 basecolor = texture2D(SampleTex, rawpos.xy*0.000344);
vec4 basecolor2 = texture2D(SampleTex2, rawpos.xy*0.000144);
basecolor = texture1D(ColorsTex, basecolor.r+0.0);
vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.01*scale);
vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale);
float vegetationlevel = (rawpos.z)+nvL[2]*3000.0;
float fogFactor;
float fogCoord = ecPosition.z;
const float LOG2 = 1.442695;
fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2);
float biasFactor = exp2(-0.00000002 * fogCoord * fogCoord * LOG2);
float n=0.06;
n += nvL[0]*0.4;
n += nvL[1]*0.6;
n += nvL[2]*2.0;
n += nvL[3]*4.0;
n += noisevec[0]*0.1;
n += noisevec[1]*0.4;
n += noisevec[2]*0.8;
n += noisevec[3]*2.1;
n = mix(0.6, n, biasFactor);
vec4 c1;
c1 = basecolor * vec4(smoothstep(-1.3, 0.5, n), smoothstep(-1.3, 0.5, n), smoothstep(-2.0, 0.9, n), 0.0);
vec4 c2;
c2 = basecolor2 * vec4(smoothstep(-1.3, 0.5, n), smoothstep(-1.3, 0.5, n), smoothstep(-2.0, 0.9, n), 0.0);
N = normalize(N.x * VTangent + N.y * VBinormal + N.z * VNormal);
vec3 l = gl_LightSource[0].position.xyz;
vec3 diffuse;
//draw floor where !steep, and another blurb for smoothing transitions
vec4 c3, c4, c5, c3a, c4a, c5a;
float subred = 1.0 - red; float subgreen = 1.0 - green; float subblue = 1.0 - blue;
c3 = mix(vec4(n-subred, n-subgreen, -n-subblue, 0.0), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.3));
c4 = mix(vec4(n-subred, n-subgreen-0.6, -n-subblue, 0.0), c1, smoothstep(0.990, 0.890, abs(normalize(Normal).z)+nvL[2]*0.9));
c4a = mix(vec4(n-subred+0.12, n-subgreen-0.52, -n-subblue, 0.3), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.32));
c5 = mix(c3, c4, 1.0);
c5a = mix(c3, c4a, 1.0);
if (vegetationlevel <= 2200) {
c1 = mix(c2, c5, clamp(0.65, n*0.1, 0.5));
diffuse = gl_Color.rgb * max(0.7, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
}
if (vegetationlevel > 2200 && vegetationlevel < 2300) {
c1 = mix(c2, c5, clamp(0.65, n*0.5, 0.35));
diffuse = gl_Color.rgb * max(0.7, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
}
if (vegetationlevel >= 2300 && vegetationlevel < 2480) {
c1 = mix(c2, c5a, clamp(0.65, n*0.5, 0.30));
diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
}
if (vegetationlevel >= 2480 && vegetationlevel < 2530) {
c1 = mix(c2, c5a, clamp(0.65, n*0.5, 0.20));
diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
}
if (vegetationlevel >= 2530 && vegetationlevel < 2670) {
c1 = mix(c2, c5, clamp(0.65, n*0.5, 0.10));
diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
}
if (vegetationlevel >= 2670) {
c1 = mix(c2, c5, clamp(0.0, n*0.1, 0.4));
diffuse = gl_Color.rgb * max(0.85, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
}
//adding snow and permanent snow/glacier
if (vegetationlevel > snowlevel || vegetationlevel > 3100) {
c3 = mix(vec4(n+1.0, n+1.0, n+1.0, 0.0), c1, smoothstep(0.990, 0.965, abs(normalize(Normal).z)+nvL[2]*1.3));
c4 = mix(vec4(n+1.0, n+1.0, n+1.0, 0.0), c1, smoothstep(0.990, 0.965, abs(normalize(Normal).z)+nvL[2]*0.9));
c5 = mix(c3, c4, 1.0);
c1 = mix(c1, c5, clamp(0.65, n*0.5, 0.6));
diffuse = gl_Color.rgb * max(0.8, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz));
}
vec4 ambient_light = gl_LightSource[0].diffuse * vec4(diffuse, 0.0);
c1 *= ambient_light;
vec4 finalColor = c1;
if(gl_Fog.density == 1.0)
fogFactor=1.0;
gl_FragColor = mix(gl_Fog.color,finalColor, fogFactor);
}

28
Shaders/forest.vert Normal file
View file

@ -0,0 +1,28 @@
varying vec4 rawpos;
varying vec4 ecPosition;
varying vec3 VNormal;
varying vec3 VTangent;
varying vec3 VBinormal;
varying vec3 Normal;
varying vec4 constantColor;
varying float bump;
attribute vec3 tangent;
attribute vec3 binormal;
void main(void)
{
rawpos = gl_Vertex;
ecPosition = gl_ModelViewMatrix * rawpos;
Normal = normalize(gl_Normal);
VNormal = gl_NormalMatrix * gl_Normal;
VTangent = gl_NormalMatrix * tangent;
VBinormal = gl_NormalMatrix * binormal;
bump = 1.0;
gl_FrontColor = gl_Color;
constantColor = gl_FrontMaterial.emission
+ gl_FrontColor * (gl_LightModel.ambient + gl_LightSource[0].ambient);
gl_Position = ftransform();
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
}

View file

@ -101,7 +101,7 @@ void main (void)
ambient_light = constantColor + gl_LightSource[0].diffuse * shadow_factor * vec4(diffuse, 1.0);
float emission_factor = (1.0 - smoothstep(0.15, 0.25, reflectance)) * emis;
vec4 tc = texture2D(BaseTex, uv);
emission_factor *= 0.5*pow(tc.r+0.8*tc.g+0.2*tc.b, 2) -0.2;
emission_factor *= 0.5*pow(tc.r+0.8*tc.g+0.2*tc.b, 2.0) -0.2;
ambient_light += (emission_factor * vec4(night_color, 0.0));
float fogFactor;

View file

Before

Width:  |  Height:  |  Size: 208 B

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 717 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

BIN
Textures/Terrain/forest.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 852 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 690 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 852 KiB

View file

@ -708,7 +708,7 @@ Shared parameters for various materials.
</condition>
<name>EvergreenBroadCover</name>
<name>EvergreenForest</name>
<effect>Effects/landmass</effect>
<effect>Effects/forest</effect>
<texture>Terrain/forest1a.png</texture>
<texture>Terrain/forest1b.png</texture>
<texture>Terrain/forest1c.png</texture>
@ -720,7 +720,7 @@ Shared parameters for various materials.
<tree-varieties>8</tree-varieties>
<tree-range-m alias="/params/forest/tree-range-m"/>
<tree-height-m>25.0</tree-height-m>
<tree-width-m>15.0</tree-width-m>
<tree-width-m>18.0</tree-width-m>
<rolling-friction>1</rolling-friction>
<bumpiness>1</bumpiness>
</material>
@ -732,7 +732,7 @@ Shared parameters for various materials.
<value>summer</value>
</equals>
</condition>
<effect>Effects/landmass</effect>
<effect>Effects/forest</effect>
<name>DeciduousBroadCover</name>
<name>DeciduousForest</name>
<name>Bog</name>
@ -759,7 +759,7 @@ Shared parameters for various materials.
<value>summer</value>
</equals>
</condition>
<effect>Effects/landmass</effect>
<effect>Effects/forest</effect>
<name>MixedForestCover</name>
<name>MixedForest</name>
<name>RainForest</name>
@ -786,7 +786,7 @@ Shared parameters for various materials.
<value>summer</value>
</equals>
</condition>
<effect>Effects/landmass</effect>
<effect>Effects/forest</effect>
<name>EvergreenNeedleCover</name>
<name>WoodedTundraCover</name>
<texture>Terrain/evergreen.png</texture>
@ -810,7 +810,7 @@ Shared parameters for various materials.
<value>summer</value>
</equals>
</condition>
<effect>Effects/landmass</effect>
<effect>Effects/forest</effect>
<name>DeciduousNeedleCover</name>
<texture>Terrain/dec_evergreen.png</texture>
<xsize>1000</xsize>
@ -1200,7 +1200,7 @@ Shared parameters for various materials.
</equals>
</condition>
<name>HerbTundraCover</name>
<effect>Effects/landmass-nowood</effect>
<effect>Effects/herbtundra</effect>
<texture>Terrain/herbtundra.png</texture>
<texture>Terrain/herbtundra2.png</texture>
<texture>Terrain/herbtundra3.png</texture>
@ -1474,7 +1474,7 @@ Shared parameters for various materials.
<value>summer</value>
</equals>
</condition>
<effect>Effects/crop</effect>
<effect>Effects/cropgrass</effect>
<name>CropGrassCover</name>
<name>CropGrass</name>
<texture>Terrain/cropgrass1.png</texture>
@ -2383,6 +2383,7 @@ Shared parameters for various materials.
<material>
<name>Glacier</name>
<name>PolarIce</name>
<effect>Effects/glacier</effect>
<texture>Terrain/glacier1.png</texture>
<texture>Terrain/glacier2.png</texture>
<texture>Terrain/glacier3.png</texture>

View file

@ -663,212 +663,7 @@ Started September 2000 by David Megginson, david@megginson.com
<!-- Environment -->
<environment>
<weather-scenarios>
<scenario>
<name>Disabled</name>
<description>METAR weather generation is disabled. Use 'Weather Conditions' and 'Clouds' dialogs to setup your weather.</description>
</scenario>
<scenario>
<name>Live data</name>
<description>Fetch live weather data for your nearest airport from noaa.gov. You need a working internet connection.</description>
</scenario>
<scenario>
<name>Manual input</name>
<description>Enter your favorite METAR weather in the textbox below. A valid METAR syntax is required.</description>
</scenario>
<scenario>
<name>Fair weather</name>
<metar>XXXX 012345Z 15003KT 12SM SCT041 FEW200 20/08 Q1015 NOSIG</metar>
<description>A lovely day for trip to your favorite 100$ hamburger airfield</description>
</scenario>
<scenario>
<name>Thunderstorm</name>
<metar>XXXX 012345Z 15012G25KT 4000 TSRA FEW030CB SCT035TCU 27/24 Q0995</metar>
<description>A hot and damp summer day with thunderstorms developing in the afternoon.
Be prepared for reduction of visibility in showers and strong gusts
near thunderstorms</description>
</scenario>
<scenario>
<name>Stormy Monday</name>
<metar>XXXX 012345Z 28035G50KT 9999 TSRA SCT022CB BKN030 13/09 Q1005</metar>
<description>You're out for an adventure? Gusty winds blowing from the west
and isolated thunderstorms should be avoided. Fasten your seatbelt!</description>
</scenario>
<scenario>
<name>Marginal VFR</name>
<metar>XXXX 012345Z 23010KT 5000 SHRA SCT012 BKN018 OVC060 15/11 Q1010</metar>
<description>After the storm - limited visibility and some showers.
Go or No-Go?</description>
</scenario>
<scenario>
<name>CAT I minimum</name>
<metar>XXXX 012345Z 15015KT 0800 -RA BKN002 OVC004 08/06 Q0990</metar>
<description>If you just got your IFR rating, this is what you are allowed to do. But can you?</description>
</scenario>
<scenario>
<name>CAT II minimum</name>
<metar>XXXX 012345Z 15010KT 0400 -RA BKN001 OVC002 08/06 Q0990</metar>
<description>With just a 1/4 mile visibility and clouds at 100ft, you don't see much of the runway until
seconds before touchdown. Trust your instruments to stay alive.</description>
</scenario>
<scenario>
<name>CAT IIIb minimum</name>
<metar>XXXX 012345Z VRB01KT 0100 FG OVC001 OVC002 02/02 Q0990</metar>
<description>This is expert level. You will barely see the taxiway from the cockpit, even if you are
on ground. Fog and light drizzle, freezing level at 1000ft.</description>
</scenario>
</weather-scenarios>
<weather-scenario>Fair weather</weather-scenario>
<config>
<boundary-transition-ft>500</boundary-transition-ft>
<boundary>
<entry>
<elevation-ft>0</elevation-ft>
<wind-from-heading-deg>270</wind-from-heading-deg>
<wind-speed-kt>3</wind-speed-kt>
<visibility-m>16093.44</visibility-m>
<pressure-sea-level-inhg>29.92</pressure-sea-level-inhg>
<temperature-degc>15.0</temperature-degc>
<dewpoint-degc>5.0</dewpoint-degc>
<turbulence>
<factor>0.2</factor>
<magnitude-norm>0.0</magnitude-norm>
<rate-hz>1.0</rate-hz>
</turbulence>
<wind-heading-change-deg>0</wind-heading-change-deg>
<wind-speed-change-rel>0</wind-speed-change-rel>
</entry>
<entry>
<elevation-ft>500</elevation-ft>
<wind-from-heading-deg>280</wind-from-heading-deg>
<wind-speed-kt>6</wind-speed-kt>
<turbulence>
<factor>1.0</factor>
<magnitude-norm>0.1</magnitude-norm>
<rate-hz>1.0</rate-hz>
</turbulence>
<wind-heading-change-deg>5</wind-heading-change-deg>
<wind-speed-change-rel>0.3</wind-speed-change-rel>
</entry>
</boundary>
<aloft>
<entry>
<elevation-ft>3000</elevation-ft>
<wind-from-heading-deg>300</wind-from-heading-deg>
<wind-speed-kt>10</wind-speed-kt>
<visibility-m>16093.44</visibility-m>
<pressure-sea-level-inhg>29.92</pressure-sea-level-inhg>
<!-- <temperature-degc>15.0</temperature-degc> -->
<!-- <dewpoint-degc>5.0</dewpoint-degc> -->
<turbulence>
<factor>0.5</factor>
<magnitude-norm>0.05</magnitude-norm>
<rate-hz>1.0</rate-hz>
</turbulence>
<wind-heading-change-deg>25</wind-heading-change-deg>
<wind-speed-change-rel>1</wind-speed-change-rel>
</entry>
<entry>
<elevation-ft>6000</elevation-ft>
<wind-from-heading-deg>310</wind-from-heading-deg>
<wind-speed-kt>20</wind-speed-kt>
<turbulence>
<factor>0.0</factor>
<magnitude-norm>0.0</magnitude-norm>
<rate-hz>1.0</rate-hz>
</turbulence>
<wind-heading-change-deg>30</wind-heading-change-deg>
<wind-speed-change-rel>1.2</wind-speed-change-rel>
</entry>
<entry>
<elevation-ft>9000</elevation-ft>
<wind-from-heading-deg>320</wind-from-heading-deg>
<wind-speed-kt>30</wind-speed-kt>
<wind-heading-change-deg>35</wind-heading-change-deg>
<wind-speed-change-rel>1.3</wind-speed-change-rel>
</entry>
<entry>
<elevation-ft>30000</elevation-ft>
<wind-from-heading-deg>330</wind-from-heading-deg>
<wind-speed-kt>50</wind-speed-kt>
<wind-heading-change-deg>35</wind-heading-change-deg>
<wind-speed-change-rel>1.3</wind-speed-change-rel>
</entry>
<entry>
<elevation-ft>40000</elevation-ft>
<wind-from-heading-deg>340</wind-from-heading-deg>
<wind-speed-kt>70</wind-speed-kt>
<wind-heading-change-deg>35</wind-heading-change-deg>
<wind-speed-change-rel>1.3</wind-speed-change-rel>
</entry>
</aloft>
</config>
<clouds>
<status>true</status>
<layer n="0">
<coverage>clear</coverage>
<elevation-ft>4000</elevation-ft>
<thickness-ft>600</thickness-ft>
<transition-ft>150</transition-ft>
<span-m>40000</span-m>
</layer>
<layer n="1">
<coverage>clear</coverage>
<elevation-ft>19500</elevation-ft>
<thickness-ft>65</thickness-ft>
<transition-ft>25</transition-ft>
<span-m>40000</span-m>
</layer>
<layer n="2">
<coverage>clear</coverage>
<span-m>40000</span-m>
</layer>
<layer n="3">
<coverage>clear</coverage>
<span-m>40000</span-m>
</layer>
<layer n="5">
<coverage>clear</coverage>
<span-m>40000</span-m>
</layer>
</clouds>
<cloudlayers include="cloudlayers.xml"/>
<params>
<real-world-weather-fetch type="bool">false</real-world-weather-fetch>
<metar-max-age-min type="long">240</metar-max-age-min>
<metar-updates-environment type="bool">true</metar-updates-environment>
<control-fdm-atmosphere type="bool">true</control-fdm-atmosphere>
<contrail-altitude>30000</contrail-altitude>
</params>
<wildfire>
<enabled type="bool" userarchive="y">false</enabled>
<share-events type="bool" userarchive="y">false</share-events>
<save-on-exit type="bool" userarchive="y">false</save-on-exit>
<restore-on-startup type="bool" userarchive="y">false</restore-on-startup>
<fire-on-crash type="bool" userarchive="y">false</fire-on-crash>
<report-score type="bool" userarchive="y">false</report-score>
<data type="string"/>
</wildfire>
</environment>
<environment include="Environment/environment.xml"/>
<controls>
<flight>