]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/CameraGroup.hxx
NavDisplay: fix update lag when switching range or centre.
[flightgear.git] / src / Main / CameraGroup.hxx
index 79d0d33d4a0d7ddf84433769d44b842eea3e87f3..a74895e467f7946e155d1199815c559f30b8a950 100644 (file)
@@ -17,6 +17,7 @@
 #ifndef CAMERAGROUP_HXX
 #define CAMERAGROUP_HXX 1
 
+#include <map>
 #include <string>
 #include <vector>
 
@@ -24,6 +25,7 @@
 #include <osg/ref_ptr>
 #include <osg/Referenced>
 #include <osg/Node>
+#include <osg/TextureRectangle>
 
 // For osgUtil::LineSegmentIntersector::Intersections, which is a typedef.
 #include <osgUtil/LineSegmentIntersector>
@@ -50,9 +52,15 @@ struct CameraInfo : public osg::Referenced
 {
     CameraInfo(unsigned flags_, osg::Camera* camera_ = 0)
         : flags(flags_), camera(camera_), slaveIndex(-1), farSlaveIndex(-1),
-          x(0.0), y(0.0), width(0.0), height(0.0)
+          x(0.0), y(0.0), width(0.0), height(0.0),
+          physicalWidth(0), physicalHeight(0), bezelHeightTop(0),
+          bezelHeightBottom(0), bezelWidthLeft(0), bezelWidthRight(0),
+          relativeCameraParent(~0u)
     {
     }
+    /** The name as given in the config file.
+     */
+    std::string name;
     /** Properties of the camera. @see CameraGroup::Flags.
      */
     unsigned flags;
@@ -74,6 +82,23 @@ struct CameraInfo : public osg::Referenced
     double y;
     double width;
     double height;
+    /** Physical size parameters.
+     */
+    double physicalWidth;
+    double physicalHeight;
+    double bezelHeightTop;
+    double bezelHeightBottom;
+    double bezelWidthLeft;
+    double bezelWidthRight;
+    /** The parent camera for relative camera configurations.
+     */
+    unsigned relativeCameraParent;
+    /** The reference points in the parents projection space.
+     */
+    osg::Vec2d parentReference[2];
+    /** The reference points in the current projection space.
+     */
+    osg::Vec2d thisReference[2];
 };
 
 /** Update the OSG cameras from the camera info.
@@ -92,8 +117,11 @@ public:
         PROJECTION_ABSOLUTE = 0x2, /**< The projection is absolute. */
         ORTHO = 0x4,               /**< The projection is orthographic */
         GUI = 0x8,                 /**< Camera draws the GUI. */
-        DO_INTERSECTION_TEST = 0x10 /**< scene intersection tests this
+        DO_INTERSECTION_TEST = 0x10,/**< scene intersection tests this
                                        camera. */
+        FIXED_NEAR_FAR = 0x20,     /**< take the near far values in the
+                                      projection for real. */
+        ENABLE_MASTER_ZOOM = 0x40  /**< Can apply the zoom algorithm. */
     };
     /** Create a camera group associated with an osgViewer::Viewer.
      * @param viewer the viewer
@@ -178,6 +206,14 @@ public:
     /** Update camera properties after a resize event.
      */
     void resized();
+
+    void buildDistortionCamera(const SGPropertyNode* psNode,
+                               osg::Camera* camera);
+  
+    /**
+     * get aspect ratio of master camera's viewport
+     */
+    double getMasterAspectRatio() const;
 protected:
     CameraList _cameras;
     osg::ref_ptr<osgViewer::Viewer> _viewer;
@@ -186,6 +222,8 @@ protected:
     float _zNear;
     float _zFar;
     float _nearField;
+    typedef std::map<std::string, osg::ref_ptr<osg::TextureRectangle> > TextureMap;
+    TextureMap _textureTargets;
 };
 
 }