20,741
edits
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
{{DeQuote}} | {{DeQuote}} | ||
[[File:Draw-masks-via-canvas.png|thumb|FlightGear [[Draw masks]] GUI dialog procedurally created by the [[Canvas]] system.s]] | |||
[[File:Property-browser-with-draw-masks-shown.png|thumb|Property browser with draw masks shown]] | [[File:Property-browser-with-draw-masks-shown.png|thumb|Property browser with draw masks shown]] | ||
Line 17: | Line 18: | ||
}} | }} | ||
}} | }} | ||
<syntaxhighlight lang="nasal"> | |||
var (width,height) = (320,160); | |||
var title = 'Draw Masks'; | |||
var window = canvas.Window.new([width,height],"dialog").set('title',title); | |||
window.del = func() | |||
{ | |||
print("Cleaning up window:",title,"\n"); | |||
call(canvas.Window.del, [], me); | |||
}; | |||
# adding a canvas to the new window and setting up background colors/transparency | |||
var myCanvas = window.createCanvas().set("background", canvas.style.getColor("bg_color")); | |||
# creating the top-level/root group which will contain all other elements/group | |||
var root = myCanvas.createGroup(); | |||
var drawMasks = props.globals.getNode("/sim/rendering/draw-mask").getChildren(); | |||
# create a new layout | |||
window.Layout = canvas.VBoxLayout.new(); | |||
# assign it to the Canvas | |||
myCanvas.setLayout(window.Layout); | |||
foreach(var mask; drawMasks) { | |||
(func() { | |||
var m = mask; | |||
# print("Found mask:", mask.getName(), "=", mask.getValue() ); | |||
var checkbox = canvas.gui.widgets.CheckBox.new(root, canvas.style, {wordWrap: 0}) | |||
.setText( "render " ~ m.getName() ) | |||
.listen("toggled", func(e) { | |||
setprop(m.getPath(), e.detail.checked); | |||
}) | |||
.setChecked( m.getValue() ); | |||
window.Layout.addItem(checkbox); | |||
}) (); | |||
} | |||
</syntaxhighlight> | |||
{{FGCquote|1= There's so called "draw-masks" which are property-controlled switches for enabling/disabling rendering of certain scene details, including 1) scenery/terrain, 2) aircraft, 3) models, 4) clouds.This can be used for troubleshooting performance issues - you can basically toggle individual scene graphs on/off, to see if/how performance is affected.For example, if performance improves dramatically by disabling the terrain, you are mainly affected scenery complexity.Equally, disabling the (main) aircraft, will tell you if it's the complexity of the 777 3D model (cockpit). |2= {{cite web | url = http://forum.flightgear.org/viewtopic.php?p=225846#p225846 | title = <nowiki>Re: FlightGear 3.2 with B777 running extremely slow</nowiki> | author = <nowiki>Hooray</nowiki> | date = Nov 29th, 2014 }}}} | {{FGCquote|1= There's so called "draw-masks" which are property-controlled switches for enabling/disabling rendering of certain scene details, including 1) scenery/terrain, 2) aircraft, 3) models, 4) clouds.This can be used for troubleshooting performance issues - you can basically toggle individual scene graphs on/off, to see if/how performance is affected.For example, if performance improves dramatically by disabling the terrain, you are mainly affected scenery complexity.Equally, disabling the (main) aircraft, will tell you if it's the complexity of the 777 3D model (cockpit). |2= {{cite web | url = http://forum.flightgear.org/viewtopic.php?p=225846#p225846 | title = <nowiki>Re: FlightGear 3.2 with B777 running extremely slow</nowiki> | author = <nowiki>Hooray</nowiki> | date = Nov 29th, 2014 }}}} |