Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation/src/orxonox/tools/Shader.h @ 2736

Last change on this file since 2736 was 2485, checked in by landauf, 16 years ago

Merged objecthierarchy2 into presentation branch

Couln't merge 2 lines in Gamestate.cc and a whole block of code in GSDedicated.cc (it seems like oli implemented in both branches something like a network-tick-limiter but with different approaches)

Not yet tested in network mode and with bots
The SpaceShips movement is also not yet fully adopted to the new physics (see Engine class)

  • Property svn:eol-style set to native
File size: 4.1 KB
RevLine 
[2350]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#ifndef _Shader_H__
30#define _Shader_H__
31
32#include "OrxonoxPrereqs.h"
33#include <OgrePrerequisites.h>
34#include <vector>
35#include <map>
36
37#include "objects/Tickable.h"
38
39namespace orxonox
40{
41    class _OrxonoxExport Shader : public Tickable
42    {
43        typedef std::pair<bool, void*>                  ParameterPointer;
44        typedef std::map<std::string, ParameterPointer> ParameterMap;
45        typedef std::vector<ParameterMap>               PassVector;
46        typedef std::vector<PassVector>                 TechniqueVector;
47        typedef std::map<std::string, TechniqueVector>  MaterialMap;
48
49        public:
50            Shader(Ogre::SceneManager* scenemanager = 0);
51            virtual ~Shader();
52
53            virtual void tick(float dt);
54
55            inline void setVisible(bool bVisible)
56            {
57                if (this->bVisible_ != bVisible)
58                {
59                    this->bVisible_ = bVisible;
60                    this->updateVisibility();
61                }
62            }
63            inline bool isVisible() const
64                { return this->bVisible_; }
65            void updateVisibility();
66
67            inline void setCompositor(const std::string& compositor)
68            {
69                if (this->compositor_ != compositor)
70                {
71                    this->compositor_ = compositor;
72                    this->changedCompositor();
73                }
74            }
75            inline const std::string& getCompositor() const
76                { return this->compositor_; }
77            void changedCompositor();
78
79            void setSceneManager(Ogre::SceneManager* scenemanager);
80            inline Ogre::SceneManager* getSceneManager() const
81                { return this->scenemanager_; }
82
83            void setParameter(const std::string& material, size_t technique, size_t pass, const std::string& parameter, float value);
84            void setParameter(const std::string& material, size_t technique, size_t pass, const std::string& parameter, int value);
85
86            static bool _setParameter(const std::string& material, size_t technique, size_t pass, const std::string& parameter, float value);
87            static bool _setParameter(const std::string& material, size_t technique, size_t pass, const std::string& parameter, int value);
88            static float getParameter(const std::string& material, size_t technique, size_t pass, const std::string& parameter);
89            static bool  getParameterIsFloat(const std::string& material, size_t technique, size_t pass, const std::string& parameter);
90            static bool  getParameterIsInt  (const std::string& material, size_t technique, size_t pass, const std::string& parameter);
91            static ParameterPointer* getParameterPointer(const std::string& material, size_t technique, size_t pass, const std::string& parameter);
92
93        private:
94            Ogre::SceneManager* scenemanager_;
95            Ogre::CompositorInstance* compositorInstance_;
96            bool bVisible_;
97            bool bLoadCompositor_;
98            bool bViewportInitialized_;
99            std::string compositor_;
100            std::string oldcompositor_;
[2358]101
[2350]102            static MaterialMap parameters_s;
103            static bool bLoadedCgPlugin_s;
104    };
105}
106
107#endif /* _Shader_H__ */
Note: See TracBrowser for help on using the repository browser.