// 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, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#include "FGMagRibbon.hxx"
-#include "../steam.hxx"
FGMagRibbon::FGMagRibbon (int w, int h)
{
FGCroppedTexture texture("Aircraft/Instruments/Textures/compass-ribbon.rgb");
setTexture(texture);
+ _magcompass_node =
+ fgGetNode("/instrumentation/magnetic-compass/indicated-heading-deg",
+ true);
}
void
-FGMagRibbon::draw ()
+FGMagRibbon::draw (osg::State& state)
{
- double heading = FGSteam::get_MH_deg();
+ double heading = _magcompass_node->getDoubleValue();
double xoffset, yoffset;
while (heading >= 360.0) {
// Adjust to put the number in the centre
xoffset -= 0.25;
- FGCroppedTexture &t = getTexture();
- t.setCrop(xoffset, yoffset, xoffset + 0.5, yoffset + 0.25);
- FGTexturedLayer::draw();
+ FGCroppedTexture *t = getTexture();
+ t->setCrop(xoffset, yoffset, xoffset + 0.5, yoffset + 0.25);
+
+ static osg::ref_ptr<osg::StateSet> stateSet = new osg::StateSet;
+ stateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
+
+ state.pushStateSet(stateSet.get());
+ state.apply();
+
+ FGTexturedLayer::draw(state);
+
+ state.popStateSet();
+ state.apply();
}
// end of FGMagRibbon.cxx