OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ComputeBoundsVisitor.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2  *
3  * This library is open source and may be redistributed and/or modified under
4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5  * (at your option) any later version. The full license is in LICENSE file
6  * included with this distribution, and on the openscenegraph.org website.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * OpenSceneGraph Public License for more details.
12 */
13 
14 #ifndef OSG_COMPUTEBOUNDSVISITOR
15 #define OSG_COMPUTEBOUNDSVISITOR 1
16 
17 #include <osg/NodeVisitor>
18 #include <osg/BoundingBox>
19 #include <osg/Polytope>
20 
21 namespace osg {
22 
24 {
25 public:
26 
27  ComputeBoundsVisitor(TraversalMode traversalMode = TRAVERSE_ALL_CHILDREN);
28 
30 
31  virtual void reset();
32 
33  osg::BoundingBox& getBoundingBox() { return _bb; }
34 
35  void getPolytope(osg::Polytope& polytope, float margin=0.1) const;
36 
37  void getBase(osg::Polytope& polytope, float margin=0.1) const;
38 
39  void apply(osg::Drawable& drawable);
40 
41  void apply(osg::Transform& transform);
42 
43  inline void pushMatrix(osg::Matrix& matrix) { _matrixStack.push_back(matrix); }
44 
45  inline void popMatrix() { _matrixStack.pop_back(); }
46 
47 
48  void applyBoundingBox(const osg::BoundingBox&);
49 
50  typedef std::vector<osg::Matrix> MatrixStack;
51 
52  const MatrixStack& getMatrixStack() const { return _matrixStack; }
53 
54 protected:
55  MatrixStack _matrixStack;
57 };
58 
59 }
60 
61 #endif
#define OSG_EXPORT
Definition: Export.h:43
osg::BoundingBox & getBoundingBox()
#define META_NodeVisitor(library, name)
Definition: NodeVisitor.h:49
const MatrixStack & getMatrixStack() const
std::vector< osg::Matrix > MatrixStack
void pushMatrix(osg::Matrix &matrix)
Definition: AlphaFunc.h:19