1
// Copyright (C) 2008 Tim Moore
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.
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.
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.
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.
30
class ViewPartitionNode : public osg::Group
34
ViewPartitionNode(const ViewPartitionNode& rhs,
35
const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
36
META_Node(flightgear, ViewPartitionNode);
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);
51
typedef std::vector< osg::ref_ptr<osg::Camera> > CameraList;
58
static const double nearCameraFar;