]> git.mxchange.org Git - flightgear.git/blobdiff - src/Viewer/renderer.hxx
VoiceSynthesizer: add some test/debug properties
[flightgear.git] / src / Viewer / renderer.hxx
index fa089bc8031ba1ae0174605394569bbf09dcb8bd..6f560672491b4ddadf2b9bf2364e830d0ebe327d 100644 (file)
@@ -10,6 +10,8 @@
 #include <osg/Matrix>
 #include <osg/Vec3>
 
+#include "renderingpipeline.hxx"
+
 namespace osg
 {
 class Camera;
@@ -40,6 +42,7 @@ class CameraGroup;
 }
 
 class SGSky;
+class SGUpdateVisitor;
 
 class FGRenderer {
 
@@ -59,8 +62,7 @@ public:
   
     /** Just pick into the scene and return the pick callbacks on the way ...
      */
-    bool pick( std::vector<SGSceneryPick>& pickList,
-               const osgGA::GUIEventAdapter* ea );
+    bool pick( std::vector<SGSceneryPick>& pickList, const osg::Vec2& windowPos);
 
     /** Get and set the OSG Viewer object, if any.
      */
@@ -115,16 +117,21 @@ public:
     SGSky* getSky() const { return _sky; }
 
        void setPlanes( double zNear, double zFar );
-    
-    /**
-     * inform the renderer when the global (2D) panel is changed
-     */
-    void panelChanged();
+
 protected:
     osg::ref_ptr<osgViewer::Viewer> viewer;
     osg::ref_ptr<flightgear::FGEventHandler> eventHandler;
-    SGPropertyNode_ptr _scenery_loaded,_scenery_override;
-    SGPropertyNode_ptr _skyblend, _splash_alpha;
+    
+    osg::ref_ptr<osg::FrameStamp> _frameStamp;
+    osg::ref_ptr<SGUpdateVisitor> _updateVisitor;
+    osg::ref_ptr<osg::Group> _viewerSceneRoot;
+    osg::ref_ptr<osg::Group> _deferredRealRoot;
+    osg::ref_ptr<osg::Group> _root;
+    
+    SGPropertyNode_ptr _scenery_loaded, _position_finalized;
+    
+    
+    SGPropertyNode_ptr _splash_alpha;
     SGPropertyNode_ptr _point_sprites, _enhanced_lighting, _distance_attenuation;
     SGPropertyNode_ptr _textures;
     SGPropertyNode_ptr _cloud_status, _visibility_m; 
@@ -134,13 +141,31 @@ protected:
     SGTimeStamp _splash_time;
     SGSky* _sky;
     bool _classicalRenderer;
+    std::string _renderer;
     int _shadowMapSize;
     size_t _numCascades;
     float _cascadeFar[4];
+    bool _useColorForDepth;
+
+    typedef std::vector<SGPropertyChangeListener*> SGPropertyChangeListenerVec;
+    SGPropertyChangeListenerVec _listeners;
+    
+    flightgear::CameraInfo* buildCameraFromRenderingPipeline(FGRenderingPipeline* rpipe, flightgear::CameraGroup* cgroup, unsigned flags, osg::Camera* camera,
+                                        const osg::Matrix& view, const osg::Matrix& projection, osg::GraphicsContext* gc);
+
+    void buildBuffers(FGRenderingPipeline* rpipe, flightgear::CameraInfo* info);
+    void buildStage(flightgear::CameraInfo* info, FGRenderingPipeline::Stage* stage, flightgear::CameraGroup* cgroup, osg::Camera* mainCamera, const osg::Matrix& view, const osg::Matrix& projection, osg::GraphicsContext* gc);
+    osg::Node* buildPass(flightgear::CameraInfo* info, FGRenderingPipeline::Pass* pass);
+    osg::Node* buildLightingSkyCloudsPass(FGRenderingPipeline::Pass* pass);
+    osg::Node* buildLightingLightsPass(flightgear::CameraInfo* info, FGRenderingPipeline::Pass* pass);
+
+    osg::Camera* buildDeferredGeometryCamera( flightgear::CameraInfo* info, osg::GraphicsContext* gc, const std::string& name, const FGRenderingPipeline::AttachmentList& attachments );
+    osg::Camera* buildDeferredShadowCamera( flightgear::CameraInfo* info, osg::GraphicsContext* gc, const std::string& name, const FGRenderingPipeline::AttachmentList& attachments );
+    osg::Camera* buildDeferredLightingCamera( flightgear::CameraInfo* info, osg::GraphicsContext* gc, const FGRenderingPipeline::Stage* stage );
+    osg::Camera* buildDeferredFullscreenCamera( flightgear::CameraInfo* info, osg::GraphicsContext* gc, const FGRenderingPipeline::Stage* stage );
+    osg::Camera* buildDeferredFullscreenCamera( flightgear::CameraInfo* info, const FGRenderingPipeline::Pass* pass );
+    void buildDeferredDisplayCamera( osg::Camera* camera, flightgear::CameraInfo* info, const FGRenderingPipeline::Stage* stage, osg::GraphicsContext* gc );
 
-    osg::Camera* buildDeferredGeometryCamera( flightgear::CameraInfo* info, osg::GraphicsContext* gc );
-    osg::Camera* buildDeferredShadowCamera( flightgear::CameraInfo* info, osg::GraphicsContext* gc );
-    osg::Camera* buildDeferredLightingCamera( flightgear::CameraInfo* info, osg::GraphicsContext* gc );
     void updateShadowCascade(const flightgear::CameraInfo* info, osg::Camera* camera, osg::Group* grp, int idx, double left, double right, double bottom, double top, double zNear, double f1, double f2);
     osg::Vec3 getSunDirection() const;
     osg::ref_ptr<osg::Uniform> _ambientFactor;
@@ -152,6 +177,15 @@ protected:
     osg::ref_ptr<osg::Uniform> _fogDensity;
     osg::ref_ptr<osg::Uniform> _shadowNumber;
     osg::ref_ptr<osg::Uniform> _shadowDistances;
+    osg::ref_ptr<osg::Uniform> _depthInColor;
+
+    osg::ref_ptr<FGRenderingPipeline> _pipeline;
+    
+    void addChangeListener(SGPropertyChangeListener* l, const char* path);
+    
+    void updateSky();
+  
+    void setupRoot();
 };
 
 bool fgDumpSceneGraphToFile(const char* filename);