| [2908] | 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 |  *      Reto Grieder | 
|---|
 | 24 |  *      Benjamin Knecht <beni_at_orxonox.net>, (C) 2007 | 
|---|
 | 25 |  *   Co-authors: | 
|---|
 | 26 |  *      Felix Schulthess | 
|---|
 | 27 |  * | 
|---|
 | 28 |  */ | 
|---|
 | 29 |  | 
|---|
 | 30 | /** | 
|---|
 | 31 | @file | 
|---|
 | 32 | @brief | 
|---|
 | 33 |     Implementation of an partial interface to Ogre. | 
|---|
 | 34 | */ | 
|---|
 | 35 |  | 
|---|
 | 36 | #include "OrxonoxStableHeaders.h" | 
|---|
 | 37 | #include "GraphicsEngine.h" | 
|---|
 | 38 |  | 
|---|
 | 39 | #include <OgreRenderWindow.h> | 
|---|
 | 40 |  | 
|---|
 | 41 | #include "core/CoreIncludes.h" | 
|---|
 | 42 | #include "core/ConfigValueIncludes.h" | 
|---|
 | 43 | #include "util/Debug.h" | 
|---|
 | 44 |  | 
|---|
 | 45 | #include "tools/ParticleInterface.h" | 
|---|
 | 46 |  | 
|---|
 | 47 | namespace orxonox | 
|---|
 | 48 | { | 
|---|
 | 49 |     //SetConsoleCommand(GraphicsEngine, printScreen, true).setKeybindMode(KeybindMode::OnPress); | 
|---|
 | 50 |  | 
|---|
 | 51 |     GraphicsEngine* GraphicsEngine::singletonRef_s = 0; | 
|---|
 | 52 |  | 
|---|
 | 53 |     /** | 
|---|
 | 54 |     @brief | 
|---|
 | 55 |         Returns the singleton instance. | 
|---|
 | 56 |     @return | 
|---|
 | 57 |         The only instance of GraphicsEngine. | 
|---|
 | 58 |     */ | 
|---|
 | 59 |     /*static*/ GraphicsEngine& GraphicsEngine::getInstance() | 
|---|
 | 60 |     { | 
|---|
 | 61 |         assert(singletonRef_s); | 
|---|
 | 62 |         return *singletonRef_s; | 
|---|
 | 63 |     } | 
|---|
 | 64 |  | 
|---|
 | 65 |     /** | 
|---|
 | 66 |     @brief | 
|---|
 | 67 |         Non-initialising constructor. | 
|---|
 | 68 |     */ | 
|---|
 | 69 |     GraphicsEngine::GraphicsEngine() | 
|---|
 | 70 | //        : root_(0) | 
|---|
 | 71 | //        , renderWindow_(0) | 
|---|
 | 72 | //        , viewport_(0) | 
|---|
 | 73 |     { | 
|---|
 | 74 |         RegisterObject(GraphicsEngine); | 
|---|
 | 75 |  | 
|---|
 | 76 |         assert(singletonRef_s == 0); | 
|---|
 | 77 |         singletonRef_s = this; | 
|---|
 | 78 |  | 
|---|
 | 79 |         this->viewport_ = 0; | 
|---|
 | 80 |  | 
|---|
 | 81 |         this->detailLevelParticle_ = 0; | 
|---|
 | 82 |  | 
|---|
 | 83 |         this->setConfigValues(); | 
|---|
 | 84 |         CCOUT(4) << "Constructed" << std::endl; | 
|---|
 | 85 |     } | 
|---|
 | 86 |  | 
|---|
 | 87 |     void GraphicsEngine::setConfigValues() | 
|---|
 | 88 |     { | 
|---|
 | 89 |         SetConfigValue(detailLevelParticle_, 2).description("O: off, 1: low, 2: normal, 3: high").callback(this, &GraphicsEngine::detailLevelParticleChanged); | 
|---|
 | 90 |     } | 
|---|
 | 91 |  | 
|---|
 | 92 |     void GraphicsEngine::detailLevelParticleChanged() | 
|---|
 | 93 |     { | 
|---|
 | 94 |         for (ObjectList<ParticleInterface>::iterator it = ObjectList<ParticleInterface>::begin(); it; ++it) | 
|---|
 | 95 |             it->detailLevelChanged(this->detailLevelParticle_); | 
|---|
 | 96 |     } | 
|---|
 | 97 |  | 
|---|
 | 98 |     /** | 
|---|
 | 99 |     @brief | 
|---|
 | 100 |         Destroys all the Ogre related objects | 
|---|
 | 101 |     */ | 
|---|
 | 102 |     GraphicsEngine::~GraphicsEngine() | 
|---|
 | 103 |     { | 
|---|
 | 104 |         singletonRef_s = 0; | 
|---|
 | 105 |     } | 
|---|
 | 106 | } | 
|---|