~ubuntu-branches/ubuntu/trusty/openscenegraph/trusty

« back to all changes in this revision

Viewing changes to OpenSceneGraph/include/osgSim/OpenFlightOptimizer

  • Committer: Bazaar Package Importer
  • Author(s): Cyril Brulebois
  • Date: 2008-07-29 04:34:38 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 lenny)
  • Revision ID: james.westby@ubuntu.com-20080729043438-no1h9h0dpsrlzp1y
* Non-maintainer upload.
* No longer try to detect (using /proc/cpuinfo when available) how many
  CPUs are available, fixing the FTBFS (due to -j0) on various platforms
  (Closes: #477353). The right way to do it is to support parallel=n in
  DEB_BUILD_OPTIONS (see Debian Policy §4.9.1), and adequate support has
  been implemented.
* Add patch to fix FTBFS due to the build system now refusing to handle
  whitespaces (Policy CMP0004 say the logs), thanks to Andreas Putzo who
  provided it (Closes: #482239):
   - debian/patches/fix-cmp0004-build-failure.dpatch
* Remove myself from Uploaders, as requested a while ago, done by Luk in
  his 2.2.0-2.1 NMU, which was never acknowledged.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
// OpenFlight� loader for OpenSceneGraph
15
 
//
16
 
//  Copyright (C) 2005-2006  Brede Johansen
17
 
//
18
 
 
19
 
#ifndef OSGSIM_OPENFLIGHTOPTIMIZER
20
 
#define OSGSIM_OPENFLIGHTOPTIMIZER
21
 
 
22
 
#include <osg/NodeVisitor>
23
 
#include <osg/Group>
24
 
#include <osg/Geometry>
25
 
 
26
 
#include <osgSim/Export>
27
 
 
28
 
namespace osgSim {
29
 
 
30
 
/** Flight optimizer
31
 
  */
32
 
class OSGSIM_EXPORT Optimizer
33
 
{
34
 
    public:
35
 
 
36
 
        Optimizer() {}
37
 
        virtual ~Optimizer() {}
38
 
 
39
 
        enum OptimizationOptions
40
 
        {
41
 
            TESSELLATE_POLYGON =         0x001,
42
 
            MERGE_GEODES =              0x002,
43
 
            MAKE_LIT =                  0x004,
44
 
            DEFAULT_OPTIMIZATIONS = TESSELLATE_POLYGON | MERGE_GEODES,
45
 
            ALL_OPTIMIZATIONS = TESSELLATE_POLYGON | MERGE_GEODES
46
 
        };
47
 
 
48
 
        
49
 
        /** Traverse the node and its subgraph with a series of optimization
50
 
          * visitors, specified by the OptimizationOptions.*/
51
 
        void optimize(osg::Node* node);
52
 
 
53
 
        /** Traverse the node and its subgraph with a series of optimization
54
 
          * visitors, specified by the OptimizationOptions.*/
55
 
        virtual void optimize(osg::Node* node, unsigned int options);
56
 
       
57
 
    protected:
58
 
 
59
 
    
60
 
    public:
61
 
 
62
 
        class OSGSIM_EXPORT TessellateVisitor : public osg::NodeVisitor
63
 
        {
64
 
            public:
65
 
 
66
 
                /// default to traversing all children.
67
 
                TessellateVisitor() :
68
 
                    osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
69
 
 
70
 
                virtual void apply(osg::Geode& geode);
71
 
 
72
 
            protected:
73
 
    
74
 
                bool hasPolygons(osg::Geometry& geometry);
75
 
 
76
 
        };
77
 
 
78
 
        class OSGSIM_EXPORT MakeLitVisitor : public osg::NodeVisitor
79
 
        {
80
 
            public:
81
 
 
82
 
                /// default to traversing all children.
83
 
                MakeLitVisitor() :
84
 
                    osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
85
 
 
86
 
                virtual void apply(osg::Geode& geode);
87
 
        };
88
 
 
89
 
 
90
 
        /** Combine geodes
91
 
          */
92
 
        class OSGSIM_EXPORT MergeGeodesVisitor : public osg::NodeVisitor
93
 
        {
94
 
            public:
95
 
 
96
 
                /// default to traversing all children.
97
 
                MergeGeodesVisitor() :
98
 
                    osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
99
 
 
100
 
                virtual void apply(osg::Group& group);
101
 
 
102
 
                void mergeGeodes(osg::Group& group);
103
 
 
104
 
            protected:
105
 
 
106
 
                bool mergeGeode(osg::Geode& lhs, osg::Geode& rhs);
107
 
 
108
 
        };
109
 
 
110
 
};
111
 
 
112
 
} // end namespace
113
 
 
114
 
#endif