Changeset 10393 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- Jan 26, 2007, 7:36:16 PM (18 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/cameraman.cc
r10390 r10393 29 29 addMethod("changeCurrTarget", Executor2<CameraMan, lua_State*,const std::string&,const std::string&>(&CameraMan::changeCurrTarget)) 30 30 ->addMethod("changeTarget", Executor3<CameraMan, lua_State*, int, const std::string&,const std::string&>(&CameraMan::changeTarget)) 31 ->addMethod("setCam era", Executor1<CameraMan, lua_State*, int>(&CameraMan::setCam))31 ->addMethod("setCam", Executor1<CameraMan, lua_State*, const std::string&>(&CameraMan::setCam)) 32 32 ->addMethod("togglFade", Executor0<CameraMan, lua_State*>(&CameraMan::togglFade)) 33 33 ->addMethod("getCurrCameraCoorX", Executor0ret<CameraMan, lua_State*,float>(&CameraMan::getCurrCameraCoorX)) … … 60 60 LOAD_PARAM_START_CYCLE(root, object); 61 61 { 62 this->createCam( root);62 this->createCam(object); 63 63 } 64 64 LOAD_PARAM_END_CYCLE(object); 65 65 66 67 68 69 66 } 70 67 … … 72 69 void CameraMan::createCam(const TiXmlElement* root) 73 70 { 74 // Camera* newCamera=new Camera();71 //Camera* newCamera=new Camera(root); 75 72 this->cameras.push_back(new Camera(root)); 76 73 cameras[cameras.size()-1]->target->detach(); … … 93 90 } 94 91 92 void CameraMan::setCam(const std::string& camName) 93 { 94 BaseObject* object = ObjectListBase::getBaseObject("Camera", camName); 95 96 if(object != NULL) 97 { 98 currentCam = dynamic_cast<Camera*>(object) ; 99 100 if( ! this->cameraIsInVector(currentCam) ) 101 this->cameras.push_back(currentCam); 102 103 State::setCamera(currentCam, currentCam->getTarget()); 104 OrxSound::SoundEngine::getInstance()->setListener(currentCam); 105 this->fadeToBlack->setParent(this->currentCam); 106 this->fadeToBlack->setRelCoor(3., 0., 0.); 107 108 } 109 110 } 111 95 112 96 113 … … 160 177 161 178 179 bool CameraMan::cameraIsInVector(Camera* camera) 180 { 181 182 for(std::vector<Camera*>::const_iterator it = cameras.begin(); it != cameras.end(); it++ ) 183 { 184 if( (*it) == camera) 185 { 186 return true; 187 } 188 } 189 return false; 190 191 192 } 193 194 162 195 //how to get a class fkt pointer 163 196 -
trunk/src/world_entities/cameraman.h
r10390 r10393 21 21 CameraMan(const TiXmlElement* root = NULL); 22 22 void setCam(int CameraNo); 23 void setCam(const std::string& camName); 23 24 void createCam(const TiXmlElement* root); 24 25 void moveCam(int x, int y, int z, int camNo); … … 36 37 virtual void loadParams(const TiXmlElement* root); 37 38 38 /// P olling (to be used in scripts)39 /// POLLING 39 40 float getCurrCameraCoorX(){ return this->currentCam->getAbsCoorX(); } 40 41 float getCurrCameraCoorY(){ return this->currentCam->getAbsCoorY(); } 41 42 float getCurrCameraCoorZ(){ return this->currentCam->getAbsCoorZ(); } 43 bool cameraIsInVector(Camera* camera); 42 44 43 45 };
Note: See TracChangeset
for help on using the changeset viewer.