Changeset 10480 in orxonox.OLD for trunk/src/world_entities/cameraman.cc
- Timestamp:
- Jan 29, 2007, 1:53:29 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/cameraman.cc
r10476 r10480 82 82 83 83 84 85 84 void CameraMan::createCam(const TiXmlElement* root) 86 85 { 87 //Camera* newCamera=new Camera(root);88 86 this->cameras.push_back(new Camera(root)); 89 // cameras[cameras.size()-1]->target->detach();90 87 cameras[cameras.size()-1]->setClipRegion(nearClip, farClip); 91 92 } 93 94 void CameraMan::setCam(int cameraNo) 88 } 89 90 91 92 93 void CameraMan::setCam(unsigned int cameraNo) 95 94 { 96 95 if (cameraNo<cameras.size()) … … 106 105 if(object != NULL) 107 106 { 108 Camera* currentCam = dynamic_cast<Camera*>(object) ; 109 110 this->setCam(currentCam); 107 this->setCam(dynamic_cast<Camera*>(object)); 111 108 return; 112 109 } … … 120 117 { 121 118 PRINTF(0)("trying to add a zero camera! uiuiui!\n"); 122 } 119 return; 120 } 121 123 122 this->currentCam = camera; 124 123 … … 141 140 142 141 142 void CameraMan::changeCurrTarget(const std::string& className, const std::string& objectName) 143 { 144 BaseObject* object = ObjectListBase::getBaseObject(className, objectName); 145 if( object != NULL && object->isA(PNode::staticClassID())) 146 { 147 currentCam->lookAt(dynamic_cast<PNode*>(object)); 148 State::setCamera(this->currentCam, dynamic_cast<CameraTarget*>(object)); 149 } 150 } 151 152 void CameraMan::atachCurrTarget(PNode* target) 153 { 154 currentCam->target->atach(target); 155 State::setCamera(this->currentCam, dynamic_cast<CameraTarget*>(target)); 156 157 } 158 159 void CameraMan::atachCurrCameraToWorldEntity(const std::string& className, const std::string& targetEntity) 160 { 161 BaseObject* object = ObjectListBase::getBaseObject(className, targetEntity); 162 163 if(object != NULL && object->isA(PNode::staticClassID())) 164 { 165 this->atachCurrTarget(dynamic_cast<PNode*>(object)); 166 return; 167 } 168 169 printf("ERROR CAMERAMANAGER: Couldn't set camera to: %s %s \n", className.c_str(),targetEntity.c_str() ); 170 } 171 172 173 174 void CameraMan::detachCurrCamera() 175 { 176 currentCam->target->detach(); 177 } 178 179 180 181 void CameraMan::jumpCurrCam(float x, float y, float z) 182 { 183 currentCam->target->jump(x, y, z); 184 } 185 186 void CameraMan::togglFade() 187 { 188 if( this->fadeToBlack) 189 fadeToBlack->toggleFade(); 190 } 191 192 void CameraMan::initFadeBlack() 193 { 194 if( this->fadeToBlack) 195 fadeToBlack->initFadeBlack(); 196 } 197 198 143 199 void CameraMan::moveCam(int x, int y, int z, int camNo) 144 200 { … … 164 220 { 165 221 dynamic_cast<Camera*>(newCam)->lookAt(dynamic_cast<PNode*>(object)); 166 this->setCam( dynamic_cast<Camera*>(newCam));167 222 State::setCamera( dynamic_cast<Camera*>(newCam), dynamic_cast<CameraTarget*>(object)); 168 223 } 169 }170 171 void CameraMan::changeCurrTarget(const std::string& className, const std::string& objectName)172 {173 BaseObject* object = ObjectListBase::getBaseObject(className, objectName);174 if( object != NULL && object->isA(PNode::staticClassID()))175 {176 currentCam->lookAt(dynamic_cast<PNode*>(object));177 State::setCamera(this->currentCam, dynamic_cast<CameraTarget*>(object));178 }179 }180 181 void CameraMan::atachCurrTarget(PNode* target)182 {183 currentCam->target->atach(target);184 State::setCamera(this->currentCam, dynamic_cast<CameraTarget*>(target));185 186 }187 188 void CameraMan::atachCurrCameraToWorldEntity(const std::string& className, const std::string& targetEntity)189 {190 BaseObject* object = ObjectListBase::getBaseObject(className, targetEntity);191 192 if(object != NULL)193 {194 this->atachCurrTarget(dynamic_cast<PNode*>(object));195 //State::setCamera(this->currentCam, dynamic_cast<CameraTarget*>(object));196 return;197 }198 199 printf("ERROR CAMERAMANAGER: Couldn't set camera to: %s %s \n", className.c_str(),targetEntity.c_str() );200 224 } 201 225 … … 206 230 BaseObject* targetCam = ObjectListBase::getBaseObject("Camera", cameraName); 207 231 208 if(object != NULL && targetCam != NULL) 209 { 210 dynamic_cast<Camera*>(targetCam)->target->atach(dynamic_cast<PNode*>(object)); 211 State::setCamera(this->currentCam, dynamic_cast<CameraTarget*>(object)); 212 return; 213 } 214 215 printf("ERROR CAMERAMANAGER: Couldn't set camera %s to: %s %s \n", cameraName.c_str(), className.c_str(),targetEntity.c_str() ); 216 } 217 218 219 void CameraMan::detachCurrCamera() 220 { 221 currentCam->target->detach(); 222 } 232 if( object != NULL && targetCam != NULL && object->isA(PNode::staticClassID()) ) 233 { 234 dynamic_cast<Camera*>(targetCam)->target->atach(dynamic_cast<PNode*>(object)); 235 State::setCamera(dynamic_cast<Camera*>(targetCam), dynamic_cast<CameraTarget*>(object)); 236 return; 237 } 238 239 printf("ERROR CAMERAMANAGER: Couldn't set camera %s to: %s %s \n", cameraName.c_str(), className.c_str(),targetEntity.c_str() ); 240 } 241 242 223 243 224 244 void CameraMan::jumpCam(int x, int y, int z, int camNo) … … 234 254 this->farClip=farCli; 235 255 236 for( int i = 0; i < this->cameras.size(); i++)256 for(unsigned int i = 0; i < this->cameras.size(); i++) 237 257 cameras[i]->setClipRegion(nearCli, farCli); 238 258 } 239 259 240 241 void CameraMan::jumpCurrCam(float x, float y, float z)242 {243 currentCam->target->jump(x, y, z);244 }245 246 247 248 249 void CameraMan::togglFade()250 {251 if( this->fadeToBlack)252 fadeToBlack->toggleFade();253 }254 255 void CameraMan::initFadeBlack()256 {257 if( this->fadeToBlack)258 fadeToBlack->initFadeBlack();259 }260 260 261 261
Note: See TracChangeset
for help on using the changeset viewer.