OpenCOVER
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
coCullVisitor.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 #ifndef COCULLVISITOR
9 #define COCULLVISITOR
10 
20 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
21  *
22  * This library is open source and may be redistributed and/or modified under
23  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
24  * (at your option) any later version. The full license is in LICENSE file
25  * included with this distribution, and on the openscenegraph.org website.
26  *
27  * This library is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * OpenSceneGraph Public License for more details.
31 */
32 
33 #include <util/coExport.h>
34 #include <osgUtil/CullVisitor>
35 
36 namespace opencover
37 {
46 class COVEREXPORT coCullVisitor : public osgUtil::CullVisitor
47 {
48 public:
49  typedef osg::Matrix::value_type value_type;
50 
51  coCullVisitor();
52  virtual ~coCullVisitor();
53 
54  virtual coCullVisitor *cloneType() const
55  {
56  return new coCullVisitor();
57  }
58 
59  virtual osg::Vec3 getEyePoint() const
60  {
61  return getEyeLocal();
62  }
63  virtual float getDistanceToEyePoint(const osg::Vec3 &pos, bool withLODScale) const;
64  virtual float getDistanceFromEyePoint(const osg::Vec3 &pos, bool withLODScale) const;
65 
66  // we do need our own version of apply and distance() for depth sorting to work correctly
67  virtual void apply(osg::Drawable &drawable);
68  virtual void apply(osg::Billboard &node);
69 
70  value_type computeNearestPointInFrustum(const osg::Matrix &matrix, const osg::Polytope::PlaneList &planes, const osg::Drawable &drawable);
71  value_type computeFurthestPointInFrustum(const osg::Matrix &matrix, const osg::Polytope::PlaneList &planes, const osg::Drawable &drawable);
72 
73  bool updateCalculatedNearFar(const osg::Matrix &matrix, const osg::BoundingBox &bb);
74 
75  bool updateCalculatedNearFar(const osg::Matrix &matrix, const osg::Drawable &drawable, bool isBillboard = false);
76 
77  void updateCalculatedNearFar(const osg::Vec3 &pos);
78 
79 protected:
82  {
83  return *this;
84  }
85 };
86 }
87 #endif
osg::Matrix::value_type value_type
Definition: coCullVisitor.h:49
coCullVisitor & operator=(const coCullVisitor &)
Definition: coCullVisitor.h:81
virtual osg::Vec3 getEyePoint() const
Definition: coCullVisitor.h:59
Definition: coCullVisitor.h:46
virtual coCullVisitor * cloneType() const
Definition: coCullVisitor.h:54