2005-10-08 11:55:18 +00:00
|
|
|
// Owner Drawn Gauge helper class
|
|
|
|
//
|
|
|
|
// Written by Harald JOHNSEN, started May 2005.
|
|
|
|
//
|
|
|
|
// Copyright (C) 2005 Harald JOHNSEN - hjohnsen@evc.net
|
|
|
|
//
|
2007-06-24 07:57:45 +00:00
|
|
|
// Ported to OSG by Tim Moore - Jun 2007
|
|
|
|
//
|
2005-10-08 11:55:18 +00:00
|
|
|
// 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, write to the Free Software
|
2006-02-21 01:16:04 +00:00
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2005-10-08 11:55:18 +00:00
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef _OD_GAUGE_HXX
|
|
|
|
#define _OD_GAUGE_HXX
|
|
|
|
|
2007-06-24 07:57:45 +00:00
|
|
|
#include <osg/Camera>
|
2006-10-29 19:30:21 +00:00
|
|
|
#include <osg/Texture2D>
|
2005-10-08 11:55:18 +00:00
|
|
|
|
|
|
|
#include <simgear/structure/subsystem_mgr.hxx>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Owner Drawn Gauge helper class.
|
|
|
|
*/
|
|
|
|
class FGODGauge : public SGSubsystem {
|
|
|
|
|
|
|
|
public:
|
|
|
|
FGODGauge ( SGPropertyNode *node );
|
|
|
|
FGODGauge();
|
2009-05-06 18:55:20 +00:00
|
|
|
virtual ~FGODGauge();
|
2005-10-08 11:55:18 +00:00
|
|
|
virtual void init ();
|
|
|
|
virtual void update (double dt);
|
|
|
|
|
|
|
|
void setSize(int viewSize);
|
2007-06-24 07:57:45 +00:00
|
|
|
|
2005-10-08 11:55:18 +00:00
|
|
|
/**
|
|
|
|
* Say if we can render to a texture.
|
|
|
|
* @return true if rtt is available
|
|
|
|
*/
|
|
|
|
bool serviceable(void);
|
2007-06-24 07:57:45 +00:00
|
|
|
|
2005-10-08 11:55:18 +00:00
|
|
|
/**
|
|
|
|
* Replace an opengl texture name inside the aircraft scene graph.
|
|
|
|
* This is to replace a static texture by a dynamic one
|
|
|
|
* @param name texture filename
|
|
|
|
* @param new_texture dynamic texture to replace the old one
|
|
|
|
*/
|
2006-10-29 19:30:21 +00:00
|
|
|
void set_texture(const char * name, osg::Texture2D* new_texture);
|
2005-10-08 11:55:18 +00:00
|
|
|
|
2007-06-24 07:57:45 +00:00
|
|
|
/**
|
|
|
|
* Get the OSG camera for drawing this gauge.
|
|
|
|
*/
|
|
|
|
osg::Camera* getCamera() { return camera.get(); }
|
|
|
|
|
|
|
|
osg::Texture2D* getTexture() { return texture.get(); }
|
|
|
|
void setTexture(osg::Texture2D* t) { texture = t; }
|
|
|
|
|
|
|
|
// Real initialization function. Bad name.
|
|
|
|
void allocRT(void);
|
|
|
|
|
2005-10-08 11:55:18 +00:00
|
|
|
private:
|
|
|
|
int textureWH;
|
|
|
|
bool rtAvailable;
|
2007-06-24 07:57:45 +00:00
|
|
|
osg::ref_ptr<osg::Camera> camera;
|
|
|
|
osg::ref_ptr<osg::Texture2D> texture;
|
2005-10-08 11:55:18 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _OD_GAUGE_HXX
|