]> git.mxchange.org Git - simgear.git/blob - simgear/scene/util/SGSceneFeatures.hxx
Modified Files:
[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 class SGSceneFeatures : public SGReferenced {
28 public:
29   static SGSceneFeatures* instance();
30
31   void setEnablePointSpriteLights(bool enable)
32   { _pointSpriteLights = enable; }
33   bool getEnablePointSpriteLights(unsigned contextId) const
34   {
35     if (!_pointSpriteLights)
36       return false;
37     return getHavePointSprites(contextId);
38   }
39
40   void setEnableDistanceAttenuationLights(bool enable)
41   { _distanceAttenuationLights = enable; }
42   bool getEnableDistanceAttenuationLights(unsigned contextId) const
43   {
44     if (!_distanceAttenuationLights)
45       return false;
46     return getHavePointParameters(contextId);
47   }
48
49   void setEnableShaderLights(bool enable)
50   { _shaderLights = enable; }
51   bool getEnableShaderLights(unsigned contextId) const
52   {
53     if (!_shaderLights)
54       return false;
55     return getHaveShaderPrograms(contextId);
56   }
57
58 protected:  
59   bool getHavePointSprites(unsigned contextId) const;
60   bool getHaveFragmentPrograms(unsigned contextId) const;
61   bool getHaveVertexPrograms(unsigned contextId) const;
62   bool getHaveShaderPrograms(unsigned contextId) const;
63   bool getHavePointParameters(unsigned contextId) const;
64
65 private:
66   SGSceneFeatures();
67   SGSceneFeatures(const SGSceneFeatures&);
68   SGSceneFeatures& operator=(const SGSceneFeatures&);
69
70   bool _shaderLights;
71   bool _pointSpriteLights;
72   bool _distanceAttenuationLights;
73 };
74
75 #endif