Changeset 2350
- Timestamp:
- Dec 7, 2008, 4:18:11 AM (16 years ago)
- Location:
- code/branches/objecthierarchy2/src/orxonox
- Files:
-
- 4 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy2/src/orxonox/GraphicsEngine.cc
r2087 r2350 77 77 singletonRef_s = this; 78 78 79 this->viewport_ = 0; 80 79 81 this->detailLevelParticle_ = 0; 80 82 -
code/branches/objecthierarchy2/src/orxonox/GraphicsEngine.h
r2087 r2350 72 72 static GraphicsEngine* getInstancePtr() { return singletonRef_s; } 73 73 74 inline void setViewport(Ogre::Viewport* viewport) 75 { this->viewport_ = viewport; } 76 inline Ogre::Viewport* getViewport() const 77 { return this->viewport_; } 78 74 79 private: 75 80 // don't mess with singletons 76 81 GraphicsEngine(GraphicsEngine&); 82 83 Ogre::Viewport* viewport_; //!< default full size viewport 77 84 78 85 // stats -
code/branches/objecthierarchy2/src/orxonox/OrxonoxPrereqs.h
r2254 r2350 114 114 class BlinkingBillboard; 115 115 class FadingBillboard; 116 class GlobalShader; 116 117 class Light; 117 118 class Backlight; … … 162 163 class Mesh; 163 164 class ParticleInterface; 165 class Shader; 164 166 template <class T> 165 167 class Timer; -
code/branches/objecthierarchy2/src/orxonox/gamestates/GSGraphics.cc
r2344 r2350 31 31 32 32 #include <fstream> 33 #include <OgreCompositorManager.h> 33 34 #include <OgreConfigFile.h> 34 35 #include <OgreFrameListener.h> … … 188 189 delete this->debugOverlay_; 189 190 191 // unload all compositors 192 Ogre::CompositorManager::getSingleton().removeAll(); 193 190 194 // destroy render window 191 195 RenderSystem* renderer = this->ogreRoot_->getRenderSystem(); … … 433 437 // create a full screen default viewport 434 438 this->viewport_ = this->renderWindow_->addViewport(0, 0); 439 440 if (this->graphicsEngine_) 441 this->graphicsEngine_->setViewport(this->viewport_); 435 442 } 436 443 -
code/branches/objecthierarchy2/src/orxonox/gamestates/GSLevel.cc
r2344 r2350 65 65 { 66 66 RegisterObject(GSLevel); 67 68 this->ccKeybind_ = 0; 69 this->ccTkeybind_ = 0; 70 this->ccSetTimeFactor_ = 0; 71 67 72 setConfigValues(); 68 73 } … … 142 147 { 143 148 // destroy console commands 144 delete this->ccKeybind_; 145 delete this->ccSetTimeFactor_; 146 delete this->ccTkeybind_; 149 if (this->ccKeybind_) 150 { 151 delete this->ccKeybind_; 152 this->ccKeybind_ = 0; 153 } 154 if (this->ccSetTimeFactor_) 155 { 156 delete this->ccSetTimeFactor_; 157 this->ccSetTimeFactor_ = 0; 158 } 159 if (this->ccTkeybind_) 160 { 161 delete this->ccTkeybind_; 162 this->ccTkeybind_ = 0; 163 } 147 164 148 165 // this call will delete every BaseObject! … … 159 176 160 177 if (this->radar_) 178 { 161 179 delete this->radar_; 180 this->radar_ = 0; 181 } 162 182 163 183 if (this->cameraManager_) 184 { 164 185 delete this->cameraManager_; 186 this->cameraManager_ = 0; 187 } 165 188 166 189 if (this->levelManager_) 190 { 167 191 delete this->levelManager_; 192 this->levelManager_ = 0; 193 } 168 194 169 195 if (this->playerManager_) 196 { 170 197 delete this->playerManager_; 198 this->playerManager_ = 0; 199 } 171 200 172 201 if (Core::showsGraphics()) … … 175 204 InputManager::getInstance().requestDestroyState("game"); 176 205 if (this->keyBinder_) 206 { 177 207 delete this->keyBinder_; 208 this->keyBinder_ = 0; 209 } 178 210 } 179 211 } -
code/branches/objecthierarchy2/src/orxonox/objects/CMakeLists.txt
r2254 r2350 3 3 EventDispatcher.cc 4 4 EventTarget.cc 5 GlobalShader.cc 5 6 Level.cc 6 7 Radar.cc -
code/branches/objecthierarchy2/src/orxonox/objects/items/Engine.cc
r2256 r2350 32 32 #include "core/CoreIncludes.h" 33 33 #include "core/XMLPort.h" 34 #include "objects/Scene.h" 34 35 #include "objects/worldentities/pawns/SpaceShip.h" 36 #include "tools/Shader.h" 35 37 36 38 namespace orxonox … … 59 61 this->accelerationUpDown_ = 0.0; 60 62 63 this->boostBlur_ = 0; 64 61 65 this->registerVariables(); 62 66 } … … 65 69 { 66 70 if (this->isInitialized() && this->ship_) 71 { 67 72 this->ship_->setEngine(0); 73 74 if (this->boostBlur_) 75 delete this->boostBlur_; 76 } 68 77 } 69 78 … … 178 187 this->ship_->setBoost(false); 179 188 this->ship_->setSteeringDirection(Vector3::ZERO); 189 190 if (!this->boostBlur_ && this->ship_->hasLocalController() && this->ship_->hasHumanController()) 191 { 192 this->boostBlur_ = new Shader(this->ship_->getScene()->getSceneManager()); 193 this->boostBlur_->setCompositor("Radial Blur"); 194 } 195 196 if (this->boostBlur_ && this->maxSpeedFront_ != 0 && this->boostFactor_ != 1) 197 this->boostBlur_->setParameter("Ogre/Compositor/Radial_Blur", 0, 0, "sampleStrength", 5.0f * clamp((-velocity.z - this->maxSpeedFront_) / ((this->boostFactor_ - 1) * this->maxSpeedFront_), 0.0f, 1.0f)); 198 } 199 200 void Engine::changedActivity() 201 { 202 SUPER(Engine, changedActivity); 203 204 if (this->boostBlur_) 205 this->boostBlur_->setVisible(this->isVisible()); 180 206 } 181 207 … … 188 214 if (ship->getEngine() != this) 189 215 ship->setEngine(this); 216 217 if (this->boostBlur_) 218 { 219 delete this->boostBlur_; 220 this->boostBlur_ = 0; 221 } 190 222 } 191 223 } -
code/branches/objecthierarchy2/src/orxonox/objects/items/Engine.h
r2256 r2350 48 48 49 49 virtual void tick(float dt); 50 virtual void changedActivity(); 50 51 51 52 virtual void addToSpaceShip(SpaceShip* ship); … … 124 125 float accelerationLeftRight_; 125 126 float accelerationUpDown_; 127 128 Shader* boostBlur_; 126 129 }; 127 130 } -
code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Backlight.cc
r2254 r2350 38 38 #include "core/XMLPort.h" 39 39 #include "objects/Scene.h" 40 #include "util/Exception.h" 40 41 41 42 namespace orxonox … … 59 60 if (Core::showsGraphics()) 60 61 { 61 assert(this->getScene()); 62 assert(this->getScene()->getSceneManager()); 63 assert(this->getScene()->getRootSceneNode()); 62 if (!this->getScene()) 63 ThrowException(AbortLoading, "Can't create Camera, no scene given."); 64 if (!this->getScene()->getSceneManager()) 65 ThrowException(AbortLoading, "Can't create Camera, no scene manager given."); 66 if (!this->getScene()->getRootSceneNode()) 67 ThrowException(AbortLoading, "Can't create Camera, no root scene node given."); 64 68 65 69 this->ribbonTrail_ = this->getScene()->getSceneManager()->createRibbonTrail(this->getNode()->getName()); -
code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Camera.cc
r2171 r2350 37 37 #include <OgreSceneNode.h> 38 38 #include <OgreViewport.h> 39 #include <OgreCompositorManager.h> 40 #include <OgreResource.h> 39 41 40 42 #include "util/Exception.h" … … 42 44 #include "core/ConfigValueIncludes.h" 43 45 #include "objects/Scene.h" 46 #include "tools/Shader.h" 44 47 #include "CameraManager.h" 45 48 … … 75 78 { 76 79 this->releaseFocus(); 80 this->getScene()->getSceneManager()->destroyCamera(this->camera_); 77 81 } 78 82 } … … 122 126 void Camera::setFocus(Ogre::Viewport* viewport) 123 127 { 128 // This workaround is needed to avoid weird behaviour with active compositors while 129 // switching the camera (like freezing the image) 130 // 131 // Last known Ogre version needing this workaround: 132 // 1.4.8 133 134 // deactivate all compositors 135 { 136 Ogre::ResourceManager::ResourceMapIterator iterator = Ogre::CompositorManager::getSingleton().getResourceIterator(); 137 while (iterator.hasMoreElements()) 138 Ogre::CompositorManager::getSingleton().setCompositorEnabled(viewport, iterator.getNext()->getName(), false); 139 } 140 124 141 this->bHasFocus_ = true; 125 142 viewport->setCamera(this->camera_); 143 144 // reactivate all visible compositors 145 { 146 for (ObjectList<Shader>::iterator it = ObjectList<Shader>::begin(); it != ObjectList<Shader>::end(); ++it) 147 it->updateVisibility(); 148 } 126 149 } 127 150 } -
code/branches/objecthierarchy2/src/orxonox/tools/CMakeLists.txt
r2131 r2350 3 3 Mesh.cc 4 4 ParticleInterface.cc 5 Shader.cc 5 6 TextureGenerator.cc 6 7 Timer.cc
Note: See TracChangeset
for help on using the changeset viewer.