Changeset 5382 in orxonox.OLD for trunk/src/lib/coord
- Timestamp:
- Oct 15, 2005, 8:22:30 PM (19 years ago)
- Location:
- trunk/src/lib/coord
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/coord/p_node.cc
r5372 r5382 235 235 } 236 236 237 237 238 /** 238 239 * @param absCoord set absolute coordinate … … 266 267 } 267 268 269 268 270 /** 269 271 * @param x x-coordinate. … … 287 289 someNode->shiftCoor(objectMovement); 288 290 289 elsewhere you would have to:291 otherwise you would have to: 290 292 PNode* someNode = ...; 291 293 Vector objectMovement = calculateShift(); … … 293 295 Vector newCoor = currentCoor + objectMovement; 294 296 someNode->setRelCoor(newCoor); 295 296 yea right... shorter...297 297 * 298 */298 */ 299 299 void PNode::shiftCoor (const Vector& shift) 300 300 { … … 405 405 * adds a child and makes this node to a parent 406 406 * @param child child reference 407 * @param parentMode on which changes the child should also change ist state408 *409 407 * use this to add a child to this node. 410 408 */ 411 void PNode::addChild (PNode* child , int parentMode)409 void PNode::addChild (PNode* child) 412 410 { 413 411 if( likely(child->parent != NULL)) … … 416 414 child->parent->children->remove(child); 417 415 } 418 child->parentMode = parentMode;419 416 child->parent = this; 420 417 this->children->add(child); … … 461 458 while( pn != NULL) 462 459 { 463 NullParent::getInstance()->addChild(pn , pn->getParentMode());460 NullParent::getInstance()->addChild(pn); 464 461 pn = iterator->nextElement(); 465 462 } … … 494 491 * @param bias the speed to iterate to this new Positions 495 492 */ 496 void PNode::softReparent(PNode* parentNode, float bias) 497 { 493 void PNode::setParentSoft(PNode* parentNode, float bias) 494 { 495 // return if the new parent and the old one match 498 496 if (this->parent == parentNode) 499 497 return; 500 498 499 // store the Valures to iterate to. 501 500 if (likely(this->toCoordinate == NULL)) 502 501 { … … 517 516 parentNode->addChild(this); 518 517 519 if (this->parentMode & PNODE_ROTATE_MOVEMENT )520 this-> setRelCoor(this->parent->getAbsDir().inverse().apply(tmpV - this->parent->getAbsCoor()));518 if (this->parentMode & PNODE_ROTATE_MOVEMENT && this->parent != NULL) 519 this->relCoordinate = this->parent->getAbsDir().inverse().apply(tmpV - this->parent->getAbsCoor()); 521 520 else 522 this-> setRelCoor(tmpV - parentNode->getAbsCoor());523 524 this->setRelDir(tmpQ / parentNode->getAbsDir());521 this->relCoordinate = tmpV - parentNode->getAbsCoor(); 522 523 this->relDirection = tmpQ / parentNode->getAbsDir(); 525 524 } 526 525 … … 530 529 * @param bias the speed to iterate to this new Positions 531 530 */ 532 void PNode::s oftReparent(const char* parentName, float bias)531 void PNode::setParentSoft(const char* parentName, float bias) 533 532 { 534 533 PNode* parentNode = dynamic_cast<PNode*>(ClassList::getObject(parentName, CL_PARENT_NODE)); 535 534 if (parentNode != NULL) 536 this->s oftReparent(parentNode, bias);535 this->setParentSoft(parentNode, bias); 537 536 } 538 537 … … 561 560 if (unlikely(this->toCoordinate != NULL)) 562 561 { 563 Vector moveVect = (*this->toCoordinate - this->getRelCoor()) *fabsf(dt)*bias; 564 562 Vector moveVect = (*this->toCoordinate - this->relCoordinate) *fabsf(dt)*bias; 565 563 if (likely(moveVect.len() >= PNODE_ITERATION_DELTA)) 566 564 { … … 701 699 displays the PNode at its position with its rotation as a cube. 702 700 */ 703 void PNode::debugDraw(unsigned int depth, float size, Vectorcolor) const701 void PNode::debugDraw(unsigned int depth, float size, const Vector& color) const 704 702 { 705 703 glMatrixMode(GL_MODELVIEW); -
trunk/src/lib/coord/p_node.h
r5356 r5382 96 96 97 97 98 void addChild (PNode* child , int parentingMode = PNODE_PARENT_MODE_DEFAULT);98 void addChild (PNode* child); 99 99 void addChild (const char* childName); 100 100 void removeChild (PNode* child); … … 106 106 PNode* getParent () const { return this->parent; }; 107 107 108 void s oftReparent(PNode* parentNode, float bias = 1.0);109 void s oftReparent(const char* parentName, float bias = 1.0);108 void setParentSoft(PNode* parentNode, float bias = 1.0); 109 void setParentSoft(const char* parentName, float bias = 1.0); 110 110 111 111 /** @param parentMode sets the parentingMode of this Node */ … … 118 118 119 119 void debug (unsigned int depth = 1, unsigned int level = 0) const; 120 void debugDraw(unsigned int depth = 1, float size = 1.0, Vectorcolor = Vector(1,1,1)) const;120 void debugDraw(unsigned int depth = 1, float size = 1.0, const Vector& color = Vector(1,1,1)) const; 121 121 122 122 … … 150 150 Vector velocity; //!< Saves the velocity. 151 151 152 Vector* toCoordinate; //!< a position to which to iterate. (This is used in conjunction with s oftReparent.and set*CoorSoft)153 Quaternion* toDirection; //!< a direction to which to iterate. (This is used in conjunction with s oftReparent and set*DirSoft)152 Vector* toCoordinate; //!< a position to which to iterate. (This is used in conjunction with setParentSoft.and set*CoorSoft) 153 Quaternion* toDirection; //!< a direction to which to iterate. (This is used in conjunction with setParentSoft and set*DirSoft) 154 154 float bias; //!< how fast to iterate to the given position (default is 1) 155 155
Note: See TracChangeset
for help on using the changeset viewer.