- Timestamp:
- Mar 15, 2005, 7:27:44 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/coord/null_parent.cc
r3554 r3565 40 40 printf("NullParent::NullParent() - making new NullParent, there can only be one..\n"); 41 41 this->parent = this; 42 this->mode = ALL;42 this->mode = PNODE_ALL; 43 43 this->setName("NullParent"); 44 44 } … … 49 49 singletonRef = this; 50 50 this->parent = this; 51 this->mode = ALL;51 this->mode = PNODE_ALL; 52 52 this->absCoordinate = *absCoordinate; 53 53 this->setName("NullParent"); -
orxonox/trunk/src/lib/coord/p_node.cc
r3560 r3565 301 301 use this to add a child to this node. 302 302 */ 303 void PNode::addChild (PNode* pNode, parentingMode mode)303 void PNode::addChild (PNode* pNode, int parentingMode) 304 304 { 305 305 if( pNode->parent != NULL ) … … 308 308 pNode->parent->children->remove(pNode); 309 309 } 310 pNode->mode = mode;310 pNode->mode = parentingMode; 311 311 pNode->parent = this; 312 312 this->children->add(pNode); … … 360 360 \param mode the mode of the bind-type. 361 361 */ 362 void PNode::setMode ( parentingMode mode)363 { 364 this->mode = mode;362 void PNode::setMode (int parentingMode) 363 { 364 this->mode = parentingMode; 365 365 } 366 366 … … 370 370 \return the mode of the bind-type. 371 371 */ 372 parentingModePNode::getMode()372 int PNode::getMode() 373 373 { 374 374 return this->mode; … … 411 411 PRINTF(2)("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z); 412 412 // printf("%s", this->objectName); 413 414 if( this->mode == MOVEMENT ) 413 printf("%d:", this->mode); 414 if(this->mode & PNODE_MOVEMENT ) 415 { 416 printf("4\n"); 417 if( this->bAbsCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 415 418 { 416 if( this->bAbsCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 419 /* if you have set the absolute coordinates this overrides all other changes */ 420 this->relCoordinate = this->absCoordinate - parent->getAbsCoor (); 421 } 422 else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 423 { 424 /*this is bad style... must be deleted later - just for testing*/ 425 if( this->parent == NULL) 417 426 { 418 /* if you have set the absolute coordinates this overrides all other changes */ 419 this->relCoordinate = this->absCoordinate - parent->getAbsCoor (); 427 this->absCoordinate = this->relCoordinate; 420 428 } 421 else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 422 { 423 /*this is bad style... must be deleted later - just for testing*/ 424 if( this->parent == NULL) 425 { 426 this->absCoordinate = this->relCoordinate; 427 } 428 else 429 this->absCoordinate = parent->getAbsCoor() + this->relCoordinate; /* update the current absCoordinate */ 430 } 429 else 430 this->absCoordinate = parent->getAbsCoor() + this->relCoordinate; /* update the current absCoordinate */ 431 431 } 432 433 if( this->mode == ROTATION || this->mode == ALL) 432 } 433 434 if( this->mode & PNODE_LOCAL_ROTATE) 435 { 436 printf("1\n"); 437 if( this->bAbsDirChanged /*&& this->timeStamp != DataTank::timeStamp*/) 434 438 { 435 if( this->bAbsDirChanged /*&& this->timeStamp != DataTank::timeStamp*/) 436 { 437 /* if you have set the absolute coordinates this overrides all other changes */ 438 this->relDirection = this->absDirection - parent->getAbsDir(); 439 } 440 else if( this->bRelDirChanged /*&& this->timeStamp != DataTank::timeStamp*/) 441 { 442 /* update the current absDirection - remember * means rotation around sth.*/ 443 this->absDirection = parent->getAbsDir() * this->relDirection; 444 } 439 /* if you have set the absolute coordinates this overrides all other changes */ 440 this->relDirection = this->absDirection - parent->getAbsDir(); 445 441 } 446 447 if( this->mode == ALL) 442 else if( this->bRelDirChanged /*&& this->timeStamp != DataTank::timeStamp*/) 448 443 { 449 if( this->bAbsCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 450 { 451 /* if you have set the absolute coordinates this overrides all other changes */ 452 this->relCoordinate = this->absCoordinate - parent->getAbsCoor (); 453 } 454 else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 455 { 456 /*this is bad style... must be deleted later - just for testing*/ 457 if( this->parent == NULL) 458 this->absCoordinate = this->relCoordinate; 459 else 460 this->absCoordinate = parent->getAbsCoor() + parent->getAbsDir().apply(this->relCoordinate); /* update the current absCoordinate */ 461 } 444 /* update the current absDirection - remember * means rotation around sth.*/ 445 this->absDirection = parent->getAbsDir() * this->relDirection; 462 446 } 463 464 447 } 448 449 if( this->mode & PNODE_ROTATE_MOVEMENT) 450 { 451 printf("2\n"); 452 if( this->bAbsCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 453 { 454 /* if you have set the absolute coordinates this overrides all other changes */ 455 this->relCoordinate = this->absCoordinate - parent->getAbsCoor (); 456 } 457 else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 458 { 459 /*this is bad style... must be deleted later - just for testing*/ 460 if( this->parent == NULL) 461 this->absCoordinate = this->relCoordinate; 462 else 463 this->absCoordinate = parent->getAbsCoor() + parent->getAbsDir().apply(this->relCoordinate); /* update the current absCoordinate */ 464 } 465 } 466 467 465 468 PNode* pn = this->children->enumerate(); 466 469 while( pn != NULL) -
orxonox/trunk/src/lib/coord/p_node.h
r3554 r3565 30 30 31 31 //! enumeration for the different translation-binding-types 32 typedef enum parentingMode {MOVEMENT = 0, ROTATION, ALL}; 32 //typedef enum parentingMode {PNODE_LOCAL_ROTATE, PNODE_ROTATE_MOVEMENT, PNODE_ALL, PNODE_MOVEMENT, PNODE_ROTATE_AND_MOVE}; 33 // linkage modes 34 #define PNODE_LOCAL_ROTATE 1 //!< Rotates all the children around their centers. 35 #define PNODE_ROTATE_MOVEMENT 2 //!< Moves all the children around the center of their parent, without the rotation around their own centers. 36 #define PNODE_MOVEMENT 4 //!< Moves all children along with the parent. 37 // special linkage modes 38 #define PNODE_ALL 3 //!< Moves all children around the center of their parent, and also rotates their centers 39 #define PNODE_ROTATE_AND_MOVE 5 //!< Rotates all children around their axis, and moves them as the Parent Moves, but does not rotate around the center of their parent. 40 33 41 //! The default mode of the translation-binding. 34 #define DEFAULT_MODE ALL42 #define DEFAULT_MODE PNODE_ALL 35 43 36 44 //! Patent Node is a Engine to calculate the position of an Object in respect to the position of its parent. … … 63 71 64 72 void addChild (PNode* pNode); 65 void addChild (PNode* pNode, parentingMode mode);73 void addChild (PNode* pNode, int parentingMode); 66 74 void removeChild (PNode* pNode); 67 75 void remove(); … … 71 79 void parentCoorChanged (); 72 80 void parentDirChanged (); 73 void setMode ( parentingMode mode);74 parentingModegetMode();81 void setMode (int parentingMode); 82 int getMode(); 75 83 76 84 virtual void update (); … … 99 107 Quaternion absDirection; //!< absolute direvtion in the world ( from (0,0,1) ) 100 108 101 parentingMode mode;//!< the mode of the binding109 int mode; //!< the mode of the binding 102 110 103 111 }; -
orxonox/trunk/src/story_entities/world.cc
r3564 r3565 226 226 this->skySphere->setName("SkySphere"); 227 227 this->localCamera->addChild(this->skySphere); 228 this->skySphere->setMode( MOVEMENT);228 this->skySphere->setMode(PNODE_MOVEMENT); 229 229 230 230 /*monitor progress*/ … … 254 254 //localCamera->setParent(TrackNode::getInstance()); 255 255 tn->addChild (this->localCamera); 256 myPlayer->setMode(PNODE_ROTATE_AND_MOVE); 256 257 //Vector* cameraOffset = new Vector (0, 5, -10); 257 258 Vector* cameraOffset = new Vector (-10, 5, 0); … … 305 306 glEndList(); 306 307 307 terrain = new Terrain(TERRAIN_ BENSCH);308 terrain = new Terrain(TERRAIN_DAVE); 308 309 this->spawn(terrain); 309 310 // LIGHT initialisation … … 584 585 this->display (); 585 586 586 for( int i = 0; i < 5000000; i++) {}587 // for( int i = 0; i < 5000000; i++) {} 587 588 /* \todo this is to slow down the program for openGl Software emulator computers, reimplement*/ 588 589 } … … 736 737 void World::spawn(WorldEntity* entity, PNode* parentNode, 737 738 Vector* relCoor, Quaternion* relDir, 738 parentingMode mode)739 int parentingMode) 739 740 { 740 741 this->nullParent = NullParent::getInstance(); -
orxonox/trunk/src/story_entities/world.h
r3559 r3565 54 54 void spawn (WorldEntity* entity, Vector* absCoor, Quaternion* absDir); 55 55 void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir, 56 parentingMode mode);56 int parentingMode); 57 57 58 58 -
orxonox/trunk/src/track_node.cc
r3556 r3565 37 37 NullParent::getInstance()->addChild(this); 38 38 this->trackManager = TrackManager::getInstance(); 39 this->setMode( ALL);39 this->setMode(PNODE_ALL); 40 40 } 41 41 … … 45 45 this->parent = NullParent::getInstance(); 46 46 this->trackManager = TrackManager::getInstance(); 47 this->setMode( ALL);47 this->setMode(PNODE_ALL); 48 48 this->absCoordinate = *absCoordinate; 49 49 } -
orxonox/trunk/src/world_entities/terrain.cc
r3564 r3565 10 10 11 11 ### File Specific: 12 main-programmer: ...12 main-programmer: Benjamin Grauer 13 13 co-programmer: ... 14 14 */
Note: See TracChangeset
for help on using the changeset viewer.