]> git.mxchange.org Git - simgear.git/blob - simgear/scene/util/SGSceneFeatures.hxx
accomodate changes to osgDB::DatabasePager interface
[simgear.git] / simgear / scene / util / SGSceneFeatures.hxx
1 /* -*-c++-*-
2  *
3  * Copyright (C) 2006-2007 Mathias Froehlich 
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18  * MA 02110-1301, USA.
19  *
20  */
21
22 #ifndef SG_SCENE_FEATURES_HXX
23 #define SG_SCENE_FEATURES_HXX
24
25 #include <simgear/structure/SGReferenced.hxx>
26
27 namespace osg { class Texture; }
28
29 class SGSceneFeatures : public SGReferenced {
30 public:
31   static SGSceneFeatures* instance();
32
33   enum TextureCompression {
34     DoNotUseCompression,
35     UseARBCompression,
36     UseDXT1Compression,
37     UseDXT3Compression,
38     UseDXT5Compression
39   };
40
41   void setTextureCompression(TextureCompression textureCompression)
42   { _textureCompression = textureCompression; }
43   TextureCompression getTextureCompression() const
44   { return _textureCompression; }
45   void setTextureCompression(osg::Texture* texture) const;
46
47   void setEnablePointSpriteLights(bool enable)
48   { _pointSpriteLights = enable; }
49   bool getEnablePointSpriteLights(unsigned contextId) const
50   {
51     if (!_pointSpriteLights)
52       return false;
53     return getHavePointSprites(contextId);
54   }
55
56   void setEnableDistanceAttenuationLights(bool enable)
57   { _distanceAttenuationLights = enable; }
58   bool getEnableDistanceAttenuationLights(unsigned contextId) const
59   {
60     if (!_distanceAttenuationLights)
61       return false;
62     return getHavePointParameters(contextId);
63   }
64
65   void setEnableShaderLights(bool enable)
66   { _shaderLights = enable; }
67   bool getEnableShaderLights(unsigned contextId) const
68   {
69     if (!_shaderLights)
70       return false;
71     return getHaveShaderPrograms(contextId);
72   }
73   
74   void setTextureFilter(int max) 
75   { _textureFilter = max; }
76   int getTextureFilter() const
77   { return _textureFilter; }
78
79 protected:
80   bool getHavePointSprites(unsigned contextId) const;
81   bool getHaveFragmentPrograms(unsigned contextId) const;
82   bool getHaveVertexPrograms(unsigned contextId) const;
83   bool getHaveShaderPrograms(unsigned contextId) const;
84   bool getHavePointParameters(unsigned contextId) const;
85
86 private:
87   SGSceneFeatures();
88   SGSceneFeatures(const SGSceneFeatures&);
89   SGSceneFeatures& operator=(const SGSceneFeatures&);
90
91   TextureCompression _textureCompression;
92   bool _shaderLights;
93   bool _pointSpriteLights;
94   bool _distanceAttenuationLights;
95   int  _textureFilter;
96 };
97
98 #endif