X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FInstrumentation%2Fod_gauge.hxx;h=2c957d42977fcf06f88471240a8a67d97de4ca0f;hb=61812ef4b88f5aa74e9cc0630c84d6fc6b4a51cd;hp=926fbe8a4a3e4b7e989b7d8f2212009d7d27e8f3;hpb=68f248879cb15562c7b026445f83caf8f2842ae9;p=flightgear.git diff --git a/src/Instrumentation/od_gauge.hxx b/src/Instrumentation/od_gauge.hxx index 926fbe8a4..2c957d429 100644 --- a/src/Instrumentation/od_gauge.hxx +++ b/src/Instrumentation/od_gauge.hxx @@ -4,6 +4,8 @@ // // Copyright (C) 2005 Harald JOHNSEN - hjohnsen@evc.net // +// Ported to OSG by Tim Moore - Jun 2007 +// // 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 @@ -16,19 +18,18 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // #ifndef _OD_GAUGE_HXX #define _OD_GAUGE_HXX +#include +#include -#include #include -class RenderTexture; - /** * Owner Drawn Gauge helper class. */ @@ -41,50 +42,39 @@ public: virtual void init (); virtual void update (double dt); - /** - * Start the rendering of the RTT context. - * @param viewSize size of the destination texture - */ - void beginCapture(int viewSize); - /** - * Start the rendering of the RTT context. - */ - void beginCapture(void); - /** - * Clear the background. - */ - void Clear(void); - /** - * Finish rendering and save the buffer to a texture. - * @param texID name of a gl texture - */ - void endCapture(GLuint texID); - /** - * Set the size of the destination texture. - * @param viewSize size of the destination texture - */ void setSize(int viewSize); + /** * Say if we can render to a texture. * @return true if rtt is available */ bool serviceable(void); + /** * 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 */ - void set_texture(const char * name, GLuint new_texture); + void set_texture(const char * name, osg::Texture2D* new_texture); + + /** + * 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); private: int textureWH; - RenderTexture *rt; bool rtAvailable; + osg::ref_ptr camera; + osg::ref_ptr texture; - void allocRT(void); - void set2D(void); - void set3D(void); }; #endif // _OD_GAUGE_HXX