X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FMain%2FCameraGroup.hxx;h=79d0d33d4a0d7ddf84433769d44b842eea3e87f3;hb=fdbfd6fd0b789eecf2c532d048a75d15f8d35ad8;hp=e76f3a5fa57493864ff4249cd43a07f5e55c27dd;hpb=6f802959cef6ed5d00640c80b6209a994ff871b5;p=flightgear.git diff --git a/src/Main/CameraGroup.hxx b/src/Main/CameraGroup.hxx index e76f3a5fa..79d0d33d4 100644 --- a/src/Main/CameraGroup.hxx +++ b/src/Main/CameraGroup.hxx @@ -23,6 +23,7 @@ #include #include #include +#include // For osgUtil::LineSegmentIntersector::Intersections, which is a typedef. #include @@ -47,8 +48,9 @@ class GraphicsWindow; */ struct CameraInfo : public osg::Referenced { - CameraInfo(unsigned flags_, osg::Camera* camera_) - : flags(flags_), camera(camera_), slaveIndex(-1) + 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) { } /** Properties of the camera. @see CameraGroup::Flags. @@ -57,11 +59,27 @@ struct CameraInfo : public osg::Referenced /** the camera object */ osg::ref_ptr camera; + /** camera for rendering far field, if needed + */ + osg::ref_ptr farCamera; /** Index of this camera in the osgViewer::Viewer slave list. */ int slaveIndex; + /** index of far camera in slave list + */ + int farSlaveIndex; + /** Viewport parameters. + */ + double x; + double y; + double width; + double height; }; +/** Update the OSG cameras from the camera info. + */ +void updateCameras(const CameraInfo* info); + class CameraGroup : public osg::Referenced { public: @@ -103,7 +121,7 @@ public: * @param cameraNode the property node. * @return a CameraInfo object for the camera. */ - CameraInfo* buildCamera(const SGPropertyNode* cameraNode); + CameraInfo* buildCamera(SGPropertyNode* cameraNode); /** Create a camera from properties that will draw the GUI and add * it to the camera group. * @param cameraNode the property node. This can be 0, in which @@ -112,7 +130,7 @@ public: * this is 0, the window is determined from the property node. * @return a CameraInfo object for the GUI camera. */ - CameraInfo* buildGUICamera(const SGPropertyNode* cameraNode, + CameraInfo* buildGUICamera(SGPropertyNode* cameraNode, GraphicsWindow* window = 0); /** Update the view for the camera group. * @param position the world position of the view @@ -153,11 +171,21 @@ public: * @param the camera group property node. */ static CameraGroup* buildCameraGroup(osgViewer::Viewer* viewer, - const SGPropertyNode* node); + SGPropertyNode* node); + /** Set the cull mask on all non-GUI cameras + */ + void setCameraCullMasks(osg::Node::NodeMask nm); + /** Update camera properties after a resize event. + */ + void resized(); protected: CameraList _cameras; osg::ref_ptr _viewer; static osg::ref_ptr _defaultGroup; + // Near, far for the master camera if used. + float _zNear; + float _zFar; + float _nearField; }; }