Changeset 608
- Timestamp:
- Dec 18, 2007, 2:23:12 AM (17 years ago)
- Location:
- code/branches/FICN
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/bin/levels/sample.oxw
r600 r608 24 24 <!-- Keep a minimum distance of >100 to the object, otherwise the camara thinks it's in the object --> 25 25 <!-- the value has to negative, as we want the camara behind the object --> 26 <!-- 27 <Camera name="Camera" pos="0,50,-150" lookat="0,20,0" node="2OgreHeadNode" /> 28 --> 26 29 <world> 27 <SceneNode name="OgreHeadNode" pos="0,0,0" />28 <Camera name="Camera" pos="0,50,-150" lookat="0,20,0" node="OgreHeadNode" />29 30 <Ambient colourvalue="1,1,1" /> 30 31 <Skybox src="Orxonox/StarfieldSkyBox" /> 31 32 32 33 <SceneNode name="ShipNode" pos="0,0,0" node="OgreHeadNode" scale="10,10,10" yaw="-90" pitch="-90" /> 34 <BaseEntity name="TheShip" src="assf3.mesh" node="ShipNode" /> 33 <SpaceShip camera="true" position="0,0,0" scale="10" yaw="-90" pitch="-90" mesh="assf3.mesh" forward="500" rotateupdown="200" rotaterightleft="200" looprightleft="200" /> 35 34 36 35 <Model position="200,0,500" scale="10" mesh="assf3.mesh" yaw="-90" pitch="-90" /> … … 48 47 49 48 <!-- Unused at the moment --> 50 <SpaceshipSteeringObject node="OgreHeadNode" forward="500" rotateupdown="200" rotaterightleft="200" looprightleft="200" />49 <!-- <SpaceshipSteeringObject node="OgreHeadNode" forward="500" rotateupdown="200" rotaterightleft="200" looprightleft="200" /> --> 51 50 52 51 <scripts> -
code/branches/FICN/src/orxonox/CMakeLists.txt
r594 r608 28 28 objects/Entity.cc 29 29 objects/Camera.cc 30 objects/SpaceshipSteeringObject.cc30 # objects/SpaceshipSteeringObject.cc 31 31 objects/Model.cc 32 32 objects/Mesh.cc 33 33 objects/BaseEntity.cc 34 objects/SpaceShip.cc 35 objects/NPC.cc 34 36 ) 35 37 ELSE(WIN32) -
code/branches/FICN/src/orxonox/objects/CMakeLists.txt
r602 r608 13 13 Entity.cc 14 14 Camera.cc 15 SpaceshipSteeringObject.cc15 # SpaceshipSteeringObject.cc 16 16 Model.cc 17 17 Mesh.cc 18 SpaceShip.cc 18 19 NPC.cc 19 20 ) -
code/branches/FICN/src/orxonox/objects/Camera.cc
r560 r608 59 59 std::string node = xmlElem->Attribute("node"); 60 60 61 Ogre::SceneNode* sceneNode = (Ogre::SceneNode*)mgr->getRootSceneNode()-> getChild(node);61 Ogre::SceneNode* sceneNode = (Ogre::SceneNode*)mgr->getRootSceneNode()->createChildSceneNode(node); //getChild(node); 62 62 sceneNode->attachObject((Ogre::MovableObject*)cam); 63 63 -
code/branches/FICN/src/orxonox/orxonox.cc
r605 r608 61 61 #include "../audio/AudioManager.h" 62 62 63 #include "spaceship_steering.h"64 65 #include "particle/ParticleInterface.h"66 67 63 #include "hud/HUD.h" 68 64 … … 84 80 85 81 // put this in seperate Class or solve the problem in another fashion 86 class OrxListener : public FrameListener , public OIS::MouseListener82 class OrxListener : public FrameListener 87 83 { 88 84 public: 89 OrxListener(OIS::Keyboard *keyboard, OIS::Mouse *mouse, audio::AudioManager* auMan, SpaceshipSteering* steering, gameMode mode) 90 : mKeyboard(keyboard), mMouse(mouse) 85 OrxListener(OIS::Keyboard *keyboard, audio::AudioManager* auMan, gameMode mode) 91 86 { 92 93 87 mKeyboard = keyboard; 94 88 mode_=mode; 95 speed = 250;96 loop = 100;97 rotate = 10;98 mouseX = 0;99 mouseY = 0;100 maxMouseX = 0;101 minMouseX = 0;102 moved = false;103 104 steering_ = steering;105 106 steering_->brakeRotate(rotate*10);107 steering_->brakeLoop(loop);108 109 110 mMouse->setEventCallback(this);111 89 auMan_ = auMan; 112 90 } 91 113 92 bool frameStarted(const FrameEvent& evt) 114 93 { 115 116 94 auMan_->update(); 117 95 118 mKeyboard->capture();119 mMouse->capture();120 if (mKeyboard->isKeyDown(OIS::KC_UP) || mKeyboard->isKeyDown(OIS::KC_W))121 steering_->moveForward(speed);122 else123 steering_->moveForward(0);124 if(mKeyboard->isKeyDown(OIS::KC_DOWN) || mKeyboard->isKeyDown(OIS::KC_S))125 steering_->brakeForward(speed);126 else127 steering_->brakeForward(speed/10);128 if (mKeyboard->isKeyDown(OIS::KC_RIGHT) || mKeyboard->isKeyDown(OIS::KC_D))129 steering_->loopRight(loop);130 else131 steering_->loopRight(0);132 if (mKeyboard->isKeyDown(OIS::KC_LEFT) || mKeyboard->isKeyDown(OIS::KC_A))133 steering_->loopLeft(loop);134 else135 steering_->loopLeft(0);136 137 if(moved) {138 if (mouseY<=0)139 steering_->rotateUp(-mouseY*rotate);140 if (mouseY>0)141 steering_->rotateDown(mouseY*rotate);142 if (mouseX>0)143 steering_->rotateRight(mouseX*rotate);144 if (mouseX<=0)145 steering_->rotateLeft(-mouseX*rotate);146 mouseY = 0;147 mouseX = 0;148 moved = false;149 }150 else {151 steering_->rotateUp(0);152 steering_->rotateDown(0);153 steering_->rotateRight(0);154 steering_->rotateLeft(0);155 }156 157 steering_->tick(evt.timeSinceLastFrame);158 159 160 161 // scenemanager->spacehip->tick(evt.timesincelastframe);162 //if(mKeyboard->isKeyDown(OIS::KC_ESCAPE))163 //cout << "maximal MouseX: " << maxMouseX << "\tminMouseX: " << minMouseX << endl;164 96 if(mode_==PRESENTATION) 165 97 server_g->tick(evt.timeSinceLastFrame); 166 98 else if(mode_==CLIENT) 167 99 client_g->tick(evt.timeSinceLastFrame); 100 168 101 usleep(10); 102 103 mKeyboard->capture(); 169 104 return !mKeyboard->isKeyDown(OIS::KC_ESCAPE); 170 105 } 171 106 172 bool mouseMoved(const OIS::MouseEvent &e)173 {174 mouseX += e.state.X.rel;175 mouseY += e.state.Y.rel;176 if(mouseX>maxMouseX) maxMouseX = mouseX;177 if(mouseX<minMouseX) minMouseX = mouseX;178 //cout << "mouseX: " << mouseX << "\tmouseY: " << mouseY << endl;179 moved = true;180 return true;181 }182 183 bool mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id) { return true; }184 bool mouseReleased(const OIS::MouseEvent &e, OIS::MouseButtonID id) { return true; }185 186 107 private: 187 108 gameMode mode_; 188 float speed;189 float rotate;190 float loop;191 float mouseY;192 float mouseX;193 float maxMouseX;194 float minMouseX;195 bool moved;196 109 OIS::Keyboard *mKeyboard; 197 OIS::Mouse *mMouse;198 110 audio::AudioManager* auMan_; 199 SpaceshipSteering* steering_;200 111 }; 112 201 113 // init static singleton reference of Orxonox 202 114 Orxonox* Orxonox::singletonRef_ = NULL; … … 207 119 Orxonox::Orxonox() 208 120 { 209 ogre_ = new GraphicsEngine(); 210 dataPath_ = ""; 121 this->ogre_ = new GraphicsEngine(); 122 this->dataPath_ = ""; 123 this->loader_ = 0; 124 this->auMan_ = 0; 125 this->singletonRef_ = 0; 126 this->keyboard_ = 0; 127 this->mouse_ = 0; 128 this->inputManager_ = 0; 129 this->frameListener_ = 0; 130 this->root_ = 0; 211 131 } 212 132 … … 240 160 ar.checkArgument("ip", serverIp_, false); 241 161 if(ar.errorHandling()) die(); 242 243 162 if(mode == std::string("server")) 244 163 { … … 343 262 createRenderWindow(); 344 263 initializeResourceGroups(); 264 setupInputSystem(); 265 Factory::createClassHierarchy(); 345 266 createScene(); 346 267 setupScene(); 347 setupInputSystem();348 Factory::createClassHierarchy();349 268 createFrameListener(); 350 269 try{ … … 472 391 void Orxonox::setupScene() 473 392 { 474 SceneManager *mgr = ogre_->getSceneManager();475 476 477 SceneNode* node = (SceneNode*)mgr->getRootSceneNode()->getChild("OgreHeadNode");393 // SceneManager *mgr = ogre_->getSceneManager(); 394 395 396 // SceneNode* node = (SceneNode*)mgr->getRootSceneNode()->getChild("OgreHeadNode"); 478 397 // SceneNode *node = mgr->getRootSceneNode()->createChildSceneNode("OgreHeadNode", Vector3(0,0,0)); 479 398 480 481 steering_ = new SpaceshipSteering(500, 200, 200, 200);482 steering_->addNode(node);483 399 484 400 /* … … 489 405 e->addToSceneNode(node); 490 406 */ 491 492 particle::ParticleInterface *w = new particle::ParticleInterface(mgr,"schuss","Orxonox/schuss");493 w->particleSystem_->setParameter("local_space","true");494 w->newEmitter();495 w->setDirection(Vector3(0,0,1));496 w->setPositionOfEmitter(0, Vector3(10,10,0));497 w->setPositionOfEmitter(1, Vector3(-10,10,0));498 w->addToSceneNode(node);499 500 particle::ParticleInterface *tt = new particle::ParticleInterface(mgr,"twinthruster","Orxonox/engineglow");501 tt->particleSystem_->setParameter("local_space","true");502 tt->newEmitter();503 tt->setDirection(Vector3(0,0,-1));504 tt->setPositionOfEmitter(0, Vector3(20,-1,-15));505 tt->setPositionOfEmitter(1, Vector3(-20,-1,-15));506 tt->addToSceneNode(node);507 508 407 } 509 408 … … 542 441 543 442 //if(mode_!=CLIENT) // just a hack ------- remove this in future 544 frameListener_ = new OrxListener(keyboard_, mouse_, auMan_, steering_, mode_);443 frameListener_ = new OrxListener(keyboard_, auMan_, mode_); 545 444 ogre_->getRoot()->addFrameListener(frameListener_); 546 445 } -
code/branches/FICN/src/orxonox/orxonox.h
r599 r608 10 10 //#include <OgreSingleton.h> 11 11 #include <OgreSceneManager.h> 12 13 12 #include <OIS/OIS.h> 14 13 … … 29 28 PRESENTATION 30 29 }; 31 30 32 31 class OrxListener; 33 32 … … 42 41 inline SceneManager* getSceneManager() { return ogre_->getSceneManager(); }; 43 42 inline GraphicsEngine* getOgrePointer() { return ogre_; }; 44 inline SpaceshipSteering* getSteeringPointer() { return steering_; };45 43 inline audio::AudioManager* getAudioManagerPointer() { return auMan_; }; 44 inline OIS::Keyboard* getKeyboard() { return this->keyboard_; } 45 inline OIS::Mouse* getMouse() { return this->mouse_; } 46 46 47 private: 47 48 Orxonox(); … … 63 64 void createFrameListener(); 64 65 void startRenderLoop(); 66 65 67 private: 66 67 68 GraphicsEngine* ogre_; //!< our dearest graphics engine <3 68 69 std::string dataPath_; //!< path to data 69 70 loader::LevelLoader* loader_; //!< level loader builds the scene 70 71 audio::AudioManager* auMan_; //!< audio manager 71 SpaceshipSteering* steering_;72 72 static Orxonox* singletonRef_; 73 73 OIS::Keyboard* keyboard_; … … 76 76 OrxListener* frameListener_; 77 77 Ogre::Root* root_; 78 78 79 79 // this is used to identify the mode (server/client/...) we're in 80 80 gameMode mode_;
Note: See TracChangeset
for help on using the changeset viewer.