Merge branch 'master' of gitorious.org:fg/fgdata
This commit is contained in:
commit
8d00f94aac
6 changed files with 123 additions and 50 deletions
|
@ -50,10 +50,10 @@
|
|||
<depth>
|
||||
<write-mask>false</write-mask>
|
||||
</depth>
|
||||
<alpha-test>
|
||||
<!--<alpha-test>
|
||||
<comparison>gequal</comparison>
|
||||
<reference type="float">0.03</reference>
|
||||
</alpha-test>
|
||||
</alpha-test>-->
|
||||
<cull-face><use>directional</use></cull-face>
|
||||
<polygon-mode>
|
||||
<front>point</front>
|
||||
|
|
|
@ -127,6 +127,10 @@ gui.Widget = {
|
|||
if( me._view != nil and me._view.update != nil )
|
||||
me._view.update(me);
|
||||
},
|
||||
visibilityChanged: func(visible)
|
||||
{
|
||||
me._view._root.setVisible(visible);
|
||||
},
|
||||
_setView: func(view)
|
||||
{
|
||||
me._view = view;
|
||||
|
|
|
@ -49,12 +49,18 @@ var parsesvg = func(group, path, options = nil)
|
|||
var stack = [group];
|
||||
var close_stack = []; # helper for check tag closing
|
||||
|
||||
var defs_stack = [];
|
||||
|
||||
var text = nil;
|
||||
var tspans = nil;
|
||||
|
||||
# lookup table for element ids (for <use> element)
|
||||
var id_dict = {};
|
||||
|
||||
# lookup table for mask and clipPath element ids
|
||||
var clip_dict = {};
|
||||
var cur_clip = nil;
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Create a new child an push it onto the stack
|
||||
var pushElement = func(type, id = nil)
|
||||
|
@ -64,6 +70,21 @@ var parsesvg = func(group, path, options = nil)
|
|||
|
||||
if( typeof(id) == 'scalar' and size(id) )
|
||||
id_dict[ id ] = stack[-1];
|
||||
|
||||
if( cur_clip != nil )
|
||||
{
|
||||
var rect = sprintf(
|
||||
"rect(%f, %f, %f, %f)",
|
||||
cur_clip['y'],
|
||||
cur_clip['x'] + cur_clip['width'],
|
||||
cur_clip['y'] + cur_clip['height'],
|
||||
cur_clip['x']
|
||||
);
|
||||
|
||||
stack[-1].set("clip", rect);
|
||||
stack[-1].set("clip-frame", canvas.Element.LOCAL);
|
||||
cur_clip = nil;
|
||||
}
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
|
@ -367,11 +388,46 @@ var parsesvg = func(group, path, options = nil)
|
|||
return;
|
||||
}
|
||||
|
||||
if( size(defs_stack) > 0 )
|
||||
{
|
||||
if( name == "mask" or name == "clipPath" )
|
||||
{
|
||||
append(defs_stack, {'type': name, 'id': attr['id']});
|
||||
}
|
||||
else if( name == "rect" )
|
||||
{
|
||||
foreach(var p; ["x", "y", "width", "height"])
|
||||
defs_stack[-1][p] = evalCSSNum(attr[p]);
|
||||
skip = level;
|
||||
}
|
||||
else
|
||||
{
|
||||
printlog(
|
||||
"info",
|
||||
"parsesvg: skipping unknown element in <defs>: <" ~ name ~ ">"
|
||||
);
|
||||
skip = level;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var style = parseStyle(attr['style']);
|
||||
|
||||
var clip_id = attr['clip-path'] or attr['mask'];
|
||||
if( clip_id != nil )
|
||||
{
|
||||
if( clip_id.starts_with("url(#")
|
||||
and clip_id[-1] == `)` )
|
||||
clip_id = substr(clip_id, 5, size(clip_id) - 5 - 1);
|
||||
|
||||
cur_clip = clip_dict[clip_id];
|
||||
if( cur_clip == nil )
|
||||
printlog("warn", "parsesvg: clip not found: " ~ clip_id);
|
||||
}
|
||||
|
||||
if( style['display'] == 'none' )
|
||||
{
|
||||
skip = level - 1;
|
||||
skip = level;
|
||||
return;
|
||||
}
|
||||
else if( name == "g" )
|
||||
|
@ -448,7 +504,10 @@ var parsesvg = func(group, path, options = nil)
|
|||
|
||||
var el_src = id_dict[ substr(ref, 1) ];
|
||||
if( el_src == nil )
|
||||
return printlog("info", "parsesvg: Reference to unknown element (" ~ ref ~ ")");
|
||||
return printlog(
|
||||
"warn",
|
||||
"parsesvg: Reference to unknown element (" ~ ref ~ ")"
|
||||
);
|
||||
|
||||
# Create new element and copy sub branch from source node
|
||||
pushElement(el_src._node.getName(), attr['id']);
|
||||
|
@ -457,6 +516,11 @@ var parsesvg = func(group, path, options = nil)
|
|||
# copying also overrides the id so we need to set it again
|
||||
stack[-1]._node.getNode("id").setValue(attr['id']);
|
||||
}
|
||||
else if( name == "defs" )
|
||||
{
|
||||
append(defs_stack, "defs");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
printlog("info", "parsesvg: skipping unknown element '" ~ name ~ "'");
|
||||
|
@ -482,11 +546,24 @@ var parsesvg = func(group, path, options = nil)
|
|||
|
||||
if( skip )
|
||||
{
|
||||
if( level <= skip )
|
||||
if( level < skip )
|
||||
skip = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if( size(defs_stack) > 0 )
|
||||
{
|
||||
if( name != "defs" )
|
||||
{
|
||||
var type = defs_stack[-1]['type'];
|
||||
if( type == "mask" or type == "clipPath" )
|
||||
clip_dict[defs_stack[-1]['id']] = defs_stack[-1];
|
||||
}
|
||||
|
||||
pop(defs_stack);
|
||||
return;
|
||||
}
|
||||
|
||||
if( size(close_stack) and (level + 1) == close_stack[-1] )
|
||||
popElement();
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ uniform float avisibility;
|
|||
uniform float hazeLayerAltitude;
|
||||
uniform float eye_alt;
|
||||
uniform float terminator;
|
||||
uniform float size;
|
||||
|
||||
varying vec3 relPos;
|
||||
varying vec2 rawPos;
|
||||
|
@ -140,8 +141,9 @@ void main()
|
|||
|
||||
transmission = fog_func(transmission_arg);
|
||||
float lightArg = terminator/100000.0;
|
||||
float attenuationScale = 1.0 + 3.0 * (1.0 -smoothstep(-15.0, 0.0, lightArg));
|
||||
float dist_att = exp(-0.3/attenuationScale/pixelSize);
|
||||
float attenuationScale = 1.0 + 20.0 * (1.0 -smoothstep(-15.0, 0.0, lightArg));
|
||||
//float dist_att = exp(-100.0/attenuationScale/size);
|
||||
float dist_att = exp(-dist/200.0/size/attenuationScale);
|
||||
|
||||
//vec4 texel = texture2D(texture,gl_TexCoord[0].st);
|
||||
vec4 texel = light_sprite(gl_TexCoord[0].st,transmission, noise);
|
||||
|
|
|
@ -20,7 +20,7 @@ void main()
|
|||
relPos = gl_Vertex.xyz - ep.xyz;
|
||||
rawPos = gl_Vertex.xy;
|
||||
float dist = length(relPos);
|
||||
float lightScale = size * size * size * size * size / 1000.0;
|
||||
float lightScale = size * size * size * size * size/ 500.0;
|
||||
pixelSize = min(size * size/25.0,lightScale/dist);
|
||||
gl_PointSize = 2.0 * pixelSize;
|
||||
}
|
||||
|
|
|
@ -363,47 +363,8 @@
|
|||
</enable>
|
||||
</text>
|
||||
|
||||
<checkbox>
|
||||
<row>5</row>
|
||||
<col>0</col>
|
||||
<colspan>3</colspan>
|
||||
<halign>left</halign>
|
||||
<label>Simplify far terrain (increases scenery load times)</label>
|
||||
<name>simplify-far</name>
|
||||
<property>/sim/rendering/terrain/simplifier/enabled-far</property>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
<object-name>simplify-far</object-name>
|
||||
</binding>
|
||||
</checkbox>
|
||||
|
||||
<checkbox>
|
||||
<row>6</row>
|
||||
<col>0</col>
|
||||
<colspan>3</colspan>
|
||||
<halign>left</halign>
|
||||
<label>Simplify all terrain (increases scenery load times)</label>
|
||||
<name>simplify-near</name>
|
||||
<property>/sim/rendering/terrain/simplifier/enabled-near</property>
|
||||
<enable>
|
||||
<property>/sim/rendering/terrain/simplifier/enabled-far</property>
|
||||
</enable>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
<object-name>simplify-near</object-name>
|
||||
</binding>
|
||||
</checkbox>
|
||||
|
||||
</group>
|
||||
|
||||
<button>
|
||||
<legend>Reload Scenery</legend>
|
||||
<binding>
|
||||
<command>reinit</command>
|
||||
<subsystem>tile-manager</subsystem>
|
||||
</binding>
|
||||
</button>
|
||||
|
||||
<group>
|
||||
<layout>vbox</layout>
|
||||
<stretch>1</stretch>
|
||||
|
@ -781,9 +742,23 @@
|
|||
<hrule/>
|
||||
|
||||
<button>
|
||||
<legend>Close</legend>
|
||||
<default>true</default>
|
||||
<key>Esc</key>
|
||||
<legend>OK</legend>
|
||||
<default>true</default>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
var reinit = 0;
|
||||
foreach (var p; reload_props) {
|
||||
if (reload_vals[p] != getprop(p)) {
|
||||
reinit = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (reinit) {
|
||||
fgcommand("reinit", props.Node.new({"subsystem": "tile-manager"}));
|
||||
}
|
||||
</script>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>dialog-close</command>
|
||||
</binding>
|
||||
|
@ -817,6 +792,21 @@
|
|||
setprop("/sim/gui/dialogs/rendering/shader-warning", 0);
|
||||
}
|
||||
}
|
||||
|
||||
var reload_props = [
|
||||
"/sim/rendering/materials-file",
|
||||
"/sim/rendering/random-buildings",
|
||||
"/sim/rendering/random-objects",
|
||||
"/sim/rendering/random-vegetation",
|
||||
"/sim/rendering/vegetation-density",
|
||||
"/sim/rendering/clouds3d-enable",
|
||||
"/sim/rendering/clouds3d-density"];
|
||||
|
||||
var reload_vals = {};
|
||||
foreach (var p; reload_props) {
|
||||
reload_vals[p] = getprop(p);
|
||||
}
|
||||
|
||||
</open>
|
||||
</nasal>
|
||||
</PropertyList>
|
||||
|
|
Loading…
Reference in a new issue