1
0
Fork 0
fgdata/Aircraft/c172p/Nasal/shadow.nas
Stuart Buchanan 60d7073794 Initial checking of c172p-detailed.
From https://github.com/Juanvvc/c172p-detailed.git

Commit df6b2c5f4f75d000c5f5ef9c6cc4446784348f20
2015-06-16 22:20:54 +01:00

84 lines
2.6 KiB
Text

# Copyright (C) 2015 wlbragg, onox
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#ALS shadow
props.Node.new({ "/sim/rendering/shadow":0 });
props.globals.initNode("/sim/rendering/shadow", 0, "INT");
#ALS Volume shadow
props.Node.new({ "/sim/rendering/shadow-volume":0 });
props.globals.initNode("/sim/rendering/shadow-volume", 0, "INT");
var check_required_version = func (required_version) {
var version = split(".", getprop("/sim/version/flightgear"));
forindex (var i; required_version) {
if (version[i] > required_version[i]) {
return 1;
}
elsif (version[i] < required_version[i]) {
return 0;
}
}
return 1;
};
var check_eligibility = func {
if (check_required_version([3, 5])) {
if (getprop("/sim/rendering/shaders/skydome")) {
return 1;
}
else {
gui.popupTip("Enable ALS for Shadow Volume", 5);
return 0;
}
}
else {
gui.popupTip("ALS Shadow Volumes require version 3.5 or greater", 5);
return 0;
}
}
var toggle_shadow_volume = func {
if (check_required_version([3, 5])) {
if (getprop("/sim/rendering/shaders/skydome")) {
if (getprop("/sim/rendering/shadow"))
setprop("/sim/rendering/shadow", !getprop("/sim/rendering/shadow"));
setprop("/sim/rendering/shadow-volume", !getprop("/sim/rendering/shadow-volume"));
}
else {
gui.popupTip("Enable ALS for Shadow Volume", 5);
}
}
else {
gui.popupTip("ALS Shadow Volumes require version 3.5 or greater", 5);
}
};
var toggle_shadow = func {
if (check_required_version([3, 4])) {
if (getprop("/sim/rendering/shaders/skydome")) {
if (getprop("/sim/rendering/shadow-volume"))
setprop("/sim/rendering/shadow-volume", !getprop("/sim/rendering/shadow-volume"));
setprop("/sim/rendering/shadow", !getprop("/sim/rendering/shadow"));
}
else {
gui.popupTip("Enable ALS for ALS Shadow", 5);
}
}
else {
gui.popupTip("ALS Shadow require version 3.4 or greater", 5);
}
};