~ubuntu-branches/ubuntu/precise/flightgear/precise

« back to all changes in this revision

Viewing changes to src/Main/ViewPartitionNode.hxx

  • Committer: Bazaar Package Importer
  • Author(s): Ove Kaaven
  • Date: 2011-01-30 15:46:35 UTC
  • mfrom: (3.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110130154635-rlynmg9n5hzxq5xe
Tags: 2.0.0-3
* Recommend fgfs-aircraft-base and fgfs-models-base.
  Closes. #610276.
* Added note about scenery SharedModels.tgz to README.Debian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright (C) 2008  Tim Moore
2
 
//
3
 
// This program is free software; you can redistribute it and/or
4
 
// modify it under the terms of the GNU General Public License as
5
 
// published by the Free Software Foundation; either version 2 of the
6
 
// License, or (at your option) any later version.
7
 
//
8
 
// This program is distributed in the hope that it will be useful, but
9
 
// WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
 
// General Public License for more details.
12
 
//
13
 
// You should have received a copy of the GNU General Public License
14
 
// along with this program; if not, write to the Free Software
15
 
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
16
 
 
17
 
#ifndef VIEWPARTITIONNODE_HXX
18
 
#define VIEWPARTITIONNODE_HXX 1
19
 
// The ViewPartitionNode splits the viewing frustum inherited from a
20
 
// camera higher in the scene graph (usually the Viewer master or
21
 
// slave camera) into 3 parts: from the parent near plane to a
22
 
// intermediate far plane (100m), then out to the current visibility,
23
 
// and then beyond where background stuff is rendered. The depth
24
 
// buffer and depth testing are disabled for the background.
25
 
 
26
 
#include <osg/Camera>
27
 
#include <osg/Group>
28
 
#include <osg/Matrix>
29
 
 
30
 
class ViewPartitionNode : public osg::Group
31
 
{
32
 
public:
33
 
    ViewPartitionNode();
34
 
    ViewPartitionNode(const ViewPartitionNode& rhs,
35
 
                      const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
36
 
    META_Node(flightgear, ViewPartitionNode);
37
 
 
38
 
    /** Catch child management functions so the Cameras can be informed
39
 
        of added or removed children. */
40
 
    virtual bool addChild(osg::Node *child);
41
 
    virtual bool insertChild(unsigned int index, osg::Node *child);
42
 
    virtual bool removeChildren(unsigned int pos, unsigned int numRemove = 1);
43
 
    virtual bool setChild(unsigned int i, osg::Node *node);
44
 
    virtual void traverse(osg::NodeVisitor &nv);
45
 
    void setVisibility(double vis) { visibility = vis; }
46
 
    double getVisibility() const { return visibility; }
47
 
    static void makeNewProjMat(osg::Matrixd& oldProj, double znear, double zfar,
48
 
                               osg::Matrixd& projection);
49
 
protected:
50
 
 
51
 
    typedef std::vector< osg::ref_ptr<osg::Camera> > CameraList;
52
 
    CameraList cameras;
53
 
    enum CameraNum {
54
 
        FAR_CAMERA = 0,
55
 
        NEAR_CAMERA = 1
56
 
    };
57
 
    double visibility;
58
 
    static const double nearCameraFar;
59
 
};
60
 
#endif