]> git.mxchange.org Git - flightgear.git/blobdiff - src/Cockpit/od_gauge.hxx
Linux fix.
[flightgear.git] / src / Cockpit / od_gauge.hxx
index 7c4ee00edb5889976e4976f11e4a3f6ae2e64cfe..cd22107ca4ba663d0828408cccc752b43f82dc4c 100644 (file)
@@ -1,14 +1,6 @@
 // Owner Drawn Gauge helper class
 //
-// Written by Harald JOHNSEN, started May 2005.
-//
-// Copyright (C) 2005  Harald JOHNSEN - hjohnsen@evc.net
-//
-// Ported to OSG by Tim Moore - Jun 2007
-//
-// Heavily modified to be usable for the 2d Canvas by Thomas Geymayer - April 2012
-// Supports now multisampling/mipmapping, usage of the stencil buffer and placing
-// the texture in the scene by certain filter criteria
+// Moved to SimGear by Thomas Geymayer - October 2012
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
 #define _OD_GAUGE_HXX
 
 #include <Canvas/canvas_fwd.hpp>
-#include <Canvas/placement.hxx>
 
-#include <osg/NodeCallback>
-#include <osg/Group>
-
-namespace osg {
-  class Camera;
-  class Texture2D;
-}
+#include <simgear/canvas/ODGauge.hxx>
+#include <simgear/canvas/CanvasPlacement.hxx>
 
 class SGPropertyNode;
 
 /**
- * Owner Drawn Gauge helper class.
+ * Owner Drawn Gauge helper class
  */
-class FGODGauge
+class FGODGauge:
+  public simgear::canvas::ODGauge
 {
   public:
     FGODGauge();
     virtual ~FGODGauge();
 
-    /**
-     * Set the size of the render target.
-     *
-     * @param size_x    X size
-     * @param size_y    Y size. Defaults to size_x if not specified
-     */
-    void setSize(int size_x, int size_y = -1);
-
-    /**
-     * Set the size of the viewport
-     *
-     * @param width
-     * @param height    Defaults to width if not specified
-     */
-    void setViewSize(int width, int height = -1);
-
-    /**
-     * DEPRECATED
-     *
-     * Get size of squared texture
-     */
-    int size() const { return _size_x; }
-    
-    /**
-     * Set whether to use image coordinates or not.
-     *
-     * Default: origin == center of texture
-     * Image Coords: origin == top left corner
-     */
-    void useImageCoords(bool use = true);
-
-    /**
-     * Enable/Disable using a stencil buffer
-     */
-    void useStencil(bool use = true);
-
-    /**
-     * Set sampling parameters for mipmapping and coverage sampling
-     * antialiasing.
-     *
-     * @note color_samples is not allowed to be higher than coverage_samples
-     *
-     */
-    void setSampling( bool mipmapping,
-                      int coverage_samples = 0,
-                      int color_samples = 0 );
-
-    /**
-     * Enable/Disable updating the texture (If disabled the contents of the
-     * texture remains with the outcome of the last rendering pass)
-     */
-    void setRender(bool render);
-
-    /**
-     * 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
@@ -118,8 +46,8 @@ class FGODGauge
      * @return A list of groups which override the given texture
      */
     static
-    canvas::Placements set_texture( const char * name,
-                                    osg::Texture2D* new_texture );
+    simgear::canvas::Placements set_texture( const char * name,
+                                             osg::Texture2D* new_texture );
 
     /**
      * Replace an opengl texture name inside the aircraft scene graph.
@@ -136,41 +64,10 @@ class FGODGauge
      * @return A list of groups which override the given texture
      */
     static
-    canvas::Placements set_texture( const SGPropertyNode* placement,
-                                    osg::Texture2D* new_texture,
-                                    osg::NodeCallback* cull_callback = 0 );
-
-    /**
-     * Get the OSG camera for drawing this gauge.
-     */
-    osg::Camera* getCamera() const { return camera.get(); }
-
-    osg::Texture2D* getTexture() const { return texture.get(); }
-    //void setTexture(osg::Texture2D* t) { texture = t; }
-
-    // Real initialization function. Bad name.
-    void allocRT(osg::NodeCallback* camera_cull_callback = 0);
-
-  private:
-    int _size_x,
-        _size_y,
-        _view_width,
-        _view_height;
-    bool _use_image_coords,
-         _use_stencil,
-         _use_mipmapping;
-
-    // Multisampling parameters
-    int  _coverage_samples,
-         _color_samples;
-
-    bool rtAvailable;
-    osg::ref_ptr<osg::Camera> camera;
-    osg::ref_ptr<osg::Texture2D> texture;
-
-    void updateCoordinateFrame();
-    void updateStencil();
-    void updateSampling();
+    simgear::canvas::Placements
+    set_texture( SGPropertyNode* placement,
+                 osg::Texture2D* new_texture,
+                 osg::NodeCallback* cull_callback = 0 );
 
 };