]> git.mxchange.org Git - simgear.git/blob - simgear/scene/model/BVHPageNodeOSG.hxx
Work around apparent OSG 3.2.0 normal binding bug.
[simgear.git] / simgear / scene / model / BVHPageNodeOSG.hxx
1 // Copyright (C) 2008 - 2012  Mathias Froehlich - Mathias.Froehlich@web.de
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Library General Public
5 // License as published by the Free Software Foundation; either
6 // version 2 of the License, or (at your option) any later version.
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 GNU
11 // Library 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
18 #ifndef BVHPageNodeOSG_hxx
19 #define BVHPageNodeOSG_hxx
20
21 #include "../../bvh/BVHPageNode.hxx"
22
23 #include <osg/ref_ptr>
24 #include <osg/Referenced>
25
26 namespace simgear {
27
28 class BVHPageNodeOSG : public BVHPageNode {
29 public:
30     BVHPageNodeOSG(const std::string& name, const SGSphered& boundingSphere,
31                    const osg::ref_ptr<const osg::Referenced>& options);
32     BVHPageNodeOSG(const std::vector<std::string>& nameList,
33                    const SGSphered& boundingSphere,
34                    const osg::ref_ptr<const osg::Referenced>& options);
35     virtual ~BVHPageNodeOSG();
36     
37     virtual BVHPageRequest* newRequest();
38
39     void setBoundingSphere(const SGSphered& sphere);
40
41     static SGSharedPtr<BVHNode>
42     load(const std::string& name, const osg::ref_ptr<const osg::Referenced>& options);
43
44 protected:
45     virtual SGSphered computeBoundingSphere() const;
46     virtual void invalidateBound();
47
48 private:
49     class _NodeVisitor;
50     class _Request;
51
52     /// The submodels apropriate for intersection tests.
53     std::vector<std::string> _modelList;
54     /// The bounding sphere as given by the lod node.
55     SGSphered _boundingSphere;
56     /// The osg loader options that are active for this subtree
57     osg::ref_ptr<const osg::Referenced> _options;
58 };
59
60 }
61
62 #endif