root/OpenSceneGraph/trunk/include/osg/ComputeBoundsVisitor @ 13041

Revision 13041, 1.6 kB (checked in by robert, 3 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
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
21namespace osg {
22
23class OSG_EXPORT ComputeBoundsVisitor : public osg::NodeVisitor
24{
25public:
26
27    ComputeBoundsVisitor(TraversalMode traversalMode = TRAVERSE_ALL_CHILDREN);
28
29    META_NodeVisitor("osg","ComputeBoundsVisitor")
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::Node& node);
40
41    void apply(osg::Transform& transform);
42
43    void apply(osg::Geode& geode);
44
45    inline void pushMatrix(osg::Matrix& matrix) { _matrixStack.push_back(matrix); }
46
47    inline void popMatrix() { _matrixStack.pop_back(); }
48
49    void applyDrawable(osg::Drawable* drawable);
50
51protected:
52
53    typedef std::vector<osg::Matrix> MatrixStack;
54
55    MatrixStack         _matrixStack;
56    osg::BoundingBox    _bb;
57};
58
59}
60
61#endif
Note: See TracBrowser for help on using the browser.