]> git.mxchange.org Git - flightgear.git/blobdiff - src/Viewer/CameraGroup.hxx
Remove hard-coded lighting stage
[flightgear.git] / src / Viewer / CameraGroup.hxx
index 1bbc27bf06bd02b6ff13cb2f0d0d64ed3e99db29..0d40c0c37402470fdb0ac390977b11120fc2433c 100644 (file)
@@ -72,20 +72,14 @@ struct RenderStageInfo {
     bool resizable;
 };
 
-enum CameraKind {
-    MAIN_CAMERA,
-    FAR_CAMERA,
-    GEOMETRY_CAMERA,
-    SHADOW_CAMERA,
-    BLOOM_CAMERA_1,
-    BLOOM_CAMERA_2,
-    AO_CAMERA_1,
-    AO_CAMERA_2,
-    AO_CAMERA_3,
-    LIGHTING_CAMERA,
-    DISPLAY_CAMERA
-};
-typedef std::map<CameraKind,RenderStageInfo> CameraMap;
+extern const char* MAIN_CAMERA;
+extern const char* FAR_CAMERA;
+extern const char* GEOMETRY_CAMERA;
+extern const char* SHADOW_CAMERA;
+extern const char* LIGHTING_CAMERA;
+extern const char* DISPLAY_CAMERA;
+
+typedef std::map<std::string,RenderStageInfo> CameraMap;
 
 /** A wrapper around osg::Camera that contains some extra information.
  */
@@ -100,6 +94,8 @@ struct CameraInfo : public osg::Referenced
           bufferSize( new osg::Uniform("fg_BufferSize", osg::Vec2f() ) ),
           projInverse( new osg::Uniform( "fg_ProjectionMatrixInverse", osg::Matrixf() ) ),
           viewInverse( new osg::Uniform( "fg_ViewMatrixInverse",osg::Matrixf() ) ),
+          worldPosCart( new osg::Uniform( "fg_CameraPositionCart", osg::Vec3f() ) ),
+          worldPosGeod( new osg::Uniform( "fg_CameraPositionGeod", osg::Vec3f() ) ),
           view( new osg::Uniform( "fg_ViewMatrix",osg::Matrixf() ) ),
           du( new osg::Uniform( "fg_du",osg::Vec4() ) ),
           dv( new osg::Uniform( "fg_dv",osg::Vec4() ) )
@@ -138,12 +134,12 @@ struct CameraInfo : public osg::Referenced
     /** the camera objects
      */
     CameraMap cameras;
-    void addCamera( CameraKind k, osg::Camera* c, int si = -1, bool fs = false ) { cameras[k].camera = c; cameras[k].slaveIndex = si; cameras[k].fullscreen = fs; }
-    void addCamera( CameraKind k, osg::Camera* c, bool fs ) { cameras[k].camera = c; cameras[k].fullscreen = fs; }
-    void addCamera( CameraKind k, osg::Camera* c, float s ) { cameras[k].camera = c; cameras[k].scaleFactor = s; }
-    osg::Camera* getCamera(CameraKind k) const;
+    void addCamera( const std::string& k, osg::Camera* c, int si = -1, bool fs = false ) { cameras[k].camera = c; cameras[k].slaveIndex = si; cameras[k].fullscreen = fs; }
+    void addCamera( const std::string& k, osg::Camera* c, bool fs ) { cameras[k].camera = c; cameras[k].fullscreen = fs; }
+    void addCamera( const std::string& k, osg::Camera* c, float s, bool fs = false ) { cameras[k].camera = c; cameras[k].scaleFactor = s; cameras[k].fullscreen = fs; }
+    osg::Camera* getCamera(const std::string& k) const;
     int getMainSlaveIndex() const;
-    RenderStageInfo& getRenderStageInfo( CameraKind k ) { return cameras[k]; }
+    RenderStageInfo& getRenderStageInfo( const std::string& k ) { return cameras[k]; }
 
     /** the buffer objects
      */
@@ -158,6 +154,8 @@ struct CameraInfo : public osg::Referenced
     osg::ref_ptr<osg::Uniform> projInverse;
     osg::ref_ptr<osg::Uniform> viewInverse;
     osg::ref_ptr<osg::Uniform> view;
+    osg::ref_ptr<osg::Uniform> worldPosCart;
+    osg::ref_ptr<osg::Uniform> worldPosGeod;
     osg::ref_ptr<osg::Uniform> du;
     osg::ref_ptr<osg::Uniform> dv;