Changeset 1694 for code/branches/gui/src/orxonox/objects
- Timestamp:
- Sep 1, 2008, 10:20:24 PM (16 years ago)
- Location:
- code/branches/gui/src/orxonox/objects
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/orxonox/objects/Ambient.cc
r1653 r1694 44 44 #include "core/XMLPort.h" 45 45 #include "core/ConsoleCommand.h" 46 #include "Settings.h" 46 47 47 48 namespace orxonox … … 65 66 66 67 bool Ambient::create(){ 67 GraphicsEngine::getInstance().getLevelSceneManager()->setAmbientLight(ambientLight_); 68 return Synchronisable::create(); 68 if (Settings::showsGraphics()) 69 GraphicsEngine::getInstance().getLevelSceneManager()->setAmbientLight(ambientLight_); 70 return Synchronisable::create(); 69 71 } 70 72 71 73 void Ambient::registerAllVariables(){ 72 registerVar(&ambientLight_, sizeof(ColourValue), network::DATA);73 74 registerVar(&ambientLight_, sizeof(ColourValue), network::DATA); 75 74 76 } 75 77 76 78 void Ambient::setAmbientLight(const ColourValue& colour) 77 79 { 78 GraphicsEngine::getInstance().getLevelSceneManager()->setAmbientLight(colour); 79 ambientLight_=colour; 80 if (Settings::showsGraphics()) 81 GraphicsEngine::getInstance().getLevelSceneManager()->setAmbientLight(colour); 82 ambientLight_=colour; 80 83 } 81 84 82 85 /** 83 @brief XML loading and saving. 84 @param xmlelement The XML-element 85 @param loading Loading (true) or saving (false) 86 @return The XML-element 86 @brief 87 XML loading and saving. 88 @param 89 xmlelement The XML-element 90 @param 91 loading Loading (true) or saving (false) 92 @return 93 The XML-element 87 94 */ 88 95 void Ambient::XMLPort(Element& xmlelement, XMLPort::Mode mode) -
code/branches/gui/src/orxonox/objects/Skybox.cc
r1653 r1694 39 39 #include "core/Debug.h" 40 40 #include "core/XMLPort.h" 41 #include "Settings.h" 41 42 42 43 namespace orxonox … … 56 57 void Skybox::setSkybox(const std::string& skyboxname) 57 58 { 58 GraphicsEngine::getInstance().getLevelSceneManager()->setSkyBox(true, skyboxname); 59 if (Settings::showsGraphics()) 60 GraphicsEngine::getInstance().getLevelSceneManager()->setSkyBox(true, skyboxname); 59 61 } 60 62 … … 92 94 { 93 95 BaseObject::changedVisibility(); 94 GraphicsEngine::getInstance().getLevelSceneManager()->setSkyBox(this->isVisible(), this->skyboxSrc_); 96 if (Settings::showsGraphics()) 97 GraphicsEngine::getInstance().getLevelSceneManager()->setSkyBox(this->isVisible(), this->skyboxSrc_); 95 98 } 96 99 } -
code/branches/gui/src/orxonox/objects/SpaceShip.cc
r1625 r1694 49 49 50 50 #include "GraphicsEngine.h" 51 #include "Settings.h" 51 52 #include "RotatingProjectile.h" 52 53 #include "ParticleProjectile.h" … … 193 194 void SpaceShip::init() 194 195 { 195 // START CREATING THRUSTERS 196 this->tt1_ = new ParticleInterface("Orxonox/thruster1", LODParticle::low); 197 this->tt1_->createNewEmitter(); 198 this->tt1_->getAllEmitters()->setDirection(-this->getInitialDir()); 199 this->tt1_->getEmitter(0)->setPosition(Vector3(-15, 20, -1)); 200 this->tt1_->getEmitter(1)->setPosition(Vector3(-15, -20, -1)); 201 this->tt1_->setSpeedFactor(3.0); 202 203 Ogre::SceneNode* node2a = this->getNode()->createChildSceneNode(this->getName() + "particle2a"); 204 node2a->setInheritScale(false); 205 node2a->setScale(1, 1, 1); 206 tt1_->addToSceneNode(node2a); 207 208 this->tt2_ = new ParticleInterface("Orxonox/thruster2", LODParticle::normal); 209 this->tt2_->createNewEmitter(); 210 this->tt2_->getAllEmitters()->setDirection(Vector3(-1, 0, 0)); 211 this->tt2_->getEmitter(0)->setPosition(Vector3(-30, 40, -2)); 212 this->tt2_->getEmitter(1)->setPosition(Vector3(-30, -40, -2)); 213 214 Ogre::SceneNode* node2b = this->getNode()->createChildSceneNode(this->getName() + "particle2b"); 215 node2b->setInheritScale(false); 216 node2b->setScale(0.5, 0.5, 0.5); 217 tt2_->addToSceneNode(node2b); 218 219 this->leftThrusterFlare_.setBillboardSet("Flares/ThrusterFlare1", Vector3(-7.5, -10, -0.5)); 220 this->rightThrusterFlare_.setBillboardSet("Flares/ThrusterFlare1", Vector3(-7.5, 10, -0.5)); 221 222 Ogre::SceneNode* node2c = this->getNode()->createChildSceneNode(this->getName() + "particle2c"); 223 node2c->setInheritScale(false); 224 node2c->setScale(2, 2, 2); 225 node2c->attachObject(this->leftThrusterFlare_.getBillboardSet()); 226 node2c->attachObject(this->rightThrusterFlare_.getBillboardSet()); 227 // END CREATING THRUSTERS 228 229 // START CREATING BLINKING LIGHTS 230 this->redBillboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1); 231 this->greenBillboard_.setBillboardSet("Examples/Flare", ColourValue(0.0, 1.0, 0.0), 1); 232 233 this->redNode_ = this->getNode()->createChildSceneNode(this->getName() + "red", Vector3(0.3, 4.0, -0.3)); 234 this->redNode_->setInheritScale(false); 235 this->greenNode_ = this->getNode()->createChildSceneNode(this->getName() + "green", Vector3(0.3, -4.0, -0.3)); 236 this->greenNode_->setInheritScale(false); 237 238 this->redNode_->attachObject(this->redBillboard_.getBillboardSet()); 239 this->redNode_->setScale(0.3, 0.3, 0.3); 240 241 this->greenNode_->attachObject(this->greenBillboard_.getBillboardSet()); 242 this->greenNode_->setScale(0.3, 0.3, 0.3); 243 // END CREATING BLINKING LIGHTS 244 245 // START CREATING ADDITIONAL EFFECTS 246 this->backlight_ = new Backlight(this->maxSpeed_, 0.8); 247 this->attachObject(this->backlight_); 248 this->backlight_->setPosition(-2.35, 0, 0.2); 249 this->backlight_->setColour(this->getProjectileColour()); 250 251 this->smoke_ = new ParticleSpawner(); 252 this->smoke_->setParticle("Orxonox/smoke5", LODParticle::normal, 0, 0, 3); 253 this->attachObject(this->smoke_); 254 255 this->fire_ = new ParticleSpawner(); 256 this->fire_->setParticle("Orxonox/fire3", LODParticle::normal, 0, 0, 1); 257 this->attachObject(this->fire_); 258 // END CREATING ADDITIONAL EFFECTS 259 260 if (this->isExactlyA(Class(SpaceShip))) 261 { 262 // START of testing crosshair 263 this->crosshairNear_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1); 264 this->crosshairFar_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1); 265 266 this->chNearNode_ = this->getNode()->createChildSceneNode(this->getName() + "near", Vector3(50.0, 0.0, 0.0)); 267 this->chNearNode_->setInheritScale(false); 268 this->chFarNode_ = this->getNode()->createChildSceneNode(this->getName() + "far", Vector3(200.0, 0.0, 0.0)); 269 this->chFarNode_->setInheritScale(false); 270 271 this->chNearNode_->attachObject(this->crosshairNear_.getBillboardSet()); 272 this->chNearNode_->setScale(0.2, 0.2, 0.2); 273 274 this->chFarNode_->attachObject(this->crosshairFar_.getBillboardSet()); 275 this->chFarNode_->setScale(0.4, 0.4, 0.4); 276 // END of testing crosshair 196 if (Settings::showsGraphics()) 197 { 198 // START CREATING THRUSTERS 199 this->tt1_ = new ParticleInterface("Orxonox/thruster1", LODParticle::low); 200 this->tt1_->createNewEmitter(); 201 this->tt1_->getAllEmitters()->setDirection(-this->getInitialDir()); 202 this->tt1_->getEmitter(0)->setPosition(Vector3(-15, 20, -1)); 203 this->tt1_->getEmitter(1)->setPosition(Vector3(-15, -20, -1)); 204 this->tt1_->setSpeedFactor(3.0); 205 206 Ogre::SceneNode* node2a = this->getNode()->createChildSceneNode(this->getName() + "particle2a"); 207 node2a->setInheritScale(false); 208 node2a->setScale(1, 1, 1); 209 tt1_->addToSceneNode(node2a); 210 211 this->tt2_ = new ParticleInterface("Orxonox/thruster2", LODParticle::normal); 212 this->tt2_->createNewEmitter(); 213 this->tt2_->getAllEmitters()->setDirection(Vector3(-1, 0, 0)); 214 this->tt2_->getEmitter(0)->setPosition(Vector3(-30, 40, -2)); 215 this->tt2_->getEmitter(1)->setPosition(Vector3(-30, -40, -2)); 216 217 Ogre::SceneNode* node2b = this->getNode()->createChildSceneNode(this->getName() + "particle2b"); 218 node2b->setInheritScale(false); 219 node2b->setScale(0.5, 0.5, 0.5); 220 tt2_->addToSceneNode(node2b); 221 222 this->leftThrusterFlare_.setBillboardSet("Flares/ThrusterFlare1", Vector3(-7.5, -10, -0.5)); 223 this->rightThrusterFlare_.setBillboardSet("Flares/ThrusterFlare1", Vector3(-7.5, 10, -0.5)); 224 225 Ogre::SceneNode* node2c = this->getNode()->createChildSceneNode(this->getName() + "particle2c"); 226 node2c->setInheritScale(false); 227 node2c->setScale(2, 2, 2); 228 node2c->attachObject(this->leftThrusterFlare_.getBillboardSet()); 229 node2c->attachObject(this->rightThrusterFlare_.getBillboardSet()); 230 // END CREATING THRUSTERS 231 232 // START CREATING BLINKING LIGHTS 233 this->redBillboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1); 234 this->greenBillboard_.setBillboardSet("Examples/Flare", ColourValue(0.0, 1.0, 0.0), 1); 235 236 this->redNode_ = this->getNode()->createChildSceneNode(this->getName() + "red", Vector3(0.3, 4.0, -0.3)); 237 this->redNode_->setInheritScale(false); 238 this->greenNode_ = this->getNode()->createChildSceneNode(this->getName() + "green", Vector3(0.3, -4.0, -0.3)); 239 this->greenNode_->setInheritScale(false); 240 241 this->redNode_->attachObject(this->redBillboard_.getBillboardSet()); 242 this->redNode_->setScale(0.3, 0.3, 0.3); 243 244 this->greenNode_->attachObject(this->greenBillboard_.getBillboardSet()); 245 this->greenNode_->setScale(0.3, 0.3, 0.3); 246 // END CREATING BLINKING LIGHTS 247 248 // START CREATING ADDITIONAL EFFECTS 249 this->backlight_ = new Backlight(this->maxSpeed_, 0.8); 250 this->attachObject(this->backlight_); 251 this->backlight_->setPosition(-2.35, 0, 0.2); 252 this->backlight_->setColour(this->getProjectileColour()); 253 254 this->smoke_ = new ParticleSpawner(); 255 this->smoke_->setParticle("Orxonox/smoke5", LODParticle::normal, 0, 0, 3); 256 this->attachObject(this->smoke_); 257 258 this->fire_ = new ParticleSpawner(); 259 this->fire_->setParticle("Orxonox/fire3", LODParticle::normal, 0, 0, 1); 260 this->attachObject(this->fire_); 261 // END CREATING ADDITIONAL EFFECTS 262 263 if (this->isExactlyA(Class(SpaceShip))) 264 { 265 // START of testing crosshair 266 this->crosshairNear_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1); 267 this->crosshairFar_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1); 268 269 this->chNearNode_ = this->getNode()->createChildSceneNode(this->getName() + "near", Vector3(50.0, 0.0, 0.0)); 270 this->chNearNode_->setInheritScale(false); 271 this->chFarNode_ = this->getNode()->createChildSceneNode(this->getName() + "far", Vector3(200.0, 0.0, 0.0)); 272 this->chFarNode_->setInheritScale(false); 273 274 this->chNearNode_->attachObject(this->crosshairNear_.getBillboardSet()); 275 this->chNearNode_->setScale(0.2, 0.2, 0.2); 276 277 this->chFarNode_->attachObject(this->crosshairFar_.getBillboardSet()); 278 this->chFarNode_->setScale(0.4, 0.4, 0.4); 279 // END of testing crosshair 280 } 277 281 } 278 282 … … 414 418 this->cam_->tick(dt); 415 419 416 if (this->smoke_) 417 this->smoke_->setVisible(this->isVisible() && this->health_ < 40); 418 if (this->fire_) 419 this->fire_->setVisible(this->isVisible() && this->health_ < 20); 420 421 if (this->backlight_) 422 { // (there's already fire || we're to slow || we're moving backwards ) 423 if (this->health_ < 20 || this->getVelocity().squaredLength() < 150*150 || this->getVelocity().dotProduct(this->getInitialDir()) < 0) 424 this->backlight_->setActive(false); 425 else 426 this->backlight_->setActive(true); 427 } 428 429 if (this->redNode_ && this->greenNode_) 430 { 431 this->blinkTime_ += dt; 432 float redScale = 0.15 + 0.15 * sin(this->blinkTime_ * 10.0); 433 float greenScale = 0.15 - 0.15 * sin(this->blinkTime_ * 10.0); 434 this->redNode_->setScale(redScale, redScale, redScale); 435 this->greenNode_->setScale(greenScale, greenScale, greenScale); 420 if (Settings::showsGraphics()) 421 { 422 if (this->smoke_) 423 this->smoke_->setVisible(this->isVisible() && this->health_ < 40); 424 if (this->fire_) 425 this->fire_->setVisible(this->isVisible() && this->health_ < 20); 426 427 if (this->backlight_) 428 { // (there's already fire || we're to slow || we're moving backwards ) 429 if (this->health_ < 20 || this->getVelocity().squaredLength() < 150*150 || this->getVelocity().dotProduct(this->getInitialDir()) < 0) 430 this->backlight_->setActive(false); 431 else 432 this->backlight_->setActive(true); 433 } 434 435 if (this->redNode_ && this->greenNode_) 436 { 437 this->blinkTime_ += dt; 438 float redScale = 0.15 + 0.15 * sin(this->blinkTime_ * 10.0); 439 float greenScale = 0.15 - 0.15 * sin(this->blinkTime_ * 10.0); 440 this->redNode_->setScale(redScale, redScale, redScale); 441 this->greenNode_->setScale(greenScale, greenScale, greenScale); 442 } 436 443 } 437 444 -
code/branches/gui/src/orxonox/objects/SpaceShipAI.cc
r1608 r1694 39 39 #include "core/XMLPort.h" 40 40 #include "tools/ParticleInterface.h" 41 #include "Settings.h" 41 42 42 43 #define ACTION_INTERVAL 1.0f … … 102 103 newenemy->XMLPort(xmlelement, XMLPort::LoadObject); 103 104 104 ParticleSpawner* spawneffect = new ParticleSpawner("Orxonox/fairytwirl", LODParticle::normal, 2.0, 0, 0, newenemy->getOrth()); 105 spawneffect->setPosition(newenemy->getPosition() - newenemy->getOrth() * 50); 106 spawneffect->create(); 105 if (Settings::showsGraphics()) 106 { 107 ParticleSpawner* spawneffect = new ParticleSpawner("Orxonox/fairytwirl", LODParticle::normal, 2.0, 0, 0, newenemy->getOrth()); 108 spawneffect->setPosition(newenemy->getPosition() - newenemy->getOrth() * 50); 109 spawneffect->create(); 110 } 107 111 } 108 112 } … … 182 186 void SpaceShipAI::kill() 183 187 { 184 ParticleSpawner* explosion = new ParticleSpawner("Orxonox/BigExplosion1part1", LODParticle::low, 3.0); 185 explosion->setPosition(this->getPosition()); 186 explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true); 187 explosion->setScale(4); 188 explosion->create(); 189 190 explosion = new ParticleSpawner("Orxonox/BigExplosion1part2", LODParticle::normal, 3.0); 191 explosion->setPosition(this->getPosition()); 192 explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true); 193 explosion->setScale(4); 194 explosion->create(); 195 explosion = new ParticleSpawner("Orxonox/BigExplosion1part2", LODParticle::high, 3.0); 196 explosion->setPosition(this->getPosition()); 197 explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true); 198 explosion->setScale(4); 199 explosion->create(); 200 201 Vector3 ringdirection = Vector3(rnd(), rnd(), rnd()); 202 ringdirection.normalise(); 203 explosion = new ParticleSpawner("Orxonox/BigExplosion1part3", LODParticle::normal, 3.0, 0.5, 0, ringdirection); 204 explosion->setPosition(this->getPosition()); 205 explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true); 206 explosion->setScale(4); 207 explosion->create(); 208 explosion = new ParticleSpawner("Orxonox/BigExplosion1part3", LODParticle::high, 3.0, 0.5, 0, ringdirection); 209 explosion->setPosition(this->getPosition()); 210 explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true); 211 explosion->setScale(4); 212 explosion->create(); 188 if (Settings::showsGraphics()) 189 { 190 ParticleSpawner* explosion = new ParticleSpawner("Orxonox/BigExplosion1part1", LODParticle::low, 3.0); 191 explosion->setPosition(this->getPosition()); 192 explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true); 193 explosion->setScale(4); 194 explosion->create(); 195 196 explosion = new ParticleSpawner("Orxonox/BigExplosion1part2", LODParticle::normal, 3.0); 197 explosion->setPosition(this->getPosition()); 198 explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true); 199 explosion->setScale(4); 200 explosion->create(); 201 explosion = new ParticleSpawner("Orxonox/BigExplosion1part2", LODParticle::high, 3.0); 202 explosion->setPosition(this->getPosition()); 203 explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true); 204 explosion->setScale(4); 205 explosion->create(); 206 207 Vector3 ringdirection = Vector3(rnd(), rnd(), rnd()); 208 ringdirection.normalise(); 209 explosion = new ParticleSpawner("Orxonox/BigExplosion1part3", LODParticle::normal, 3.0, 0.5, 0, ringdirection); 210 explosion->setPosition(this->getPosition()); 211 explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true); 212 explosion->setScale(4); 213 explosion->create(); 214 explosion = new ParticleSpawner("Orxonox/BigExplosion1part3", LODParticle::high, 3.0, 0.5, 0, ringdirection); 215 explosion->setPosition(this->getPosition()); 216 explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true); 217 explosion->setScale(4); 218 explosion->create(); 219 } 213 220 214 221 delete this;
Note: See TracChangeset
for help on using the changeset viewer.