Changeset 5382 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Oct 15, 2005, 8:22:30 PM (19 years ago)
- Location:
- trunk/src/lib/graphics/render2D
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/render2D/element_2d.cc
r5378 r5382 555 555 * @param bias the speed to iterate to this new Positions 556 556 */ 557 void Element2D::s oftReparent2D(Element2D* parentNode, float bias)557 void Element2D::setParentSoft2D(Element2D* parentNode, float bias) 558 558 { 559 559 if (this->parent == parentNode) … … 578 578 parentNode->addChild2D(this); 579 579 580 if (this->parentMode & PNODE_ROTATE_MOVEMENT) 580 if (this->parentMode & PNODE_ROTATE_MOVEMENT) //! @todo implement this. 581 581 ;//this->setRelCoor(this->parent->getAbsDir().inverse().apply(tmpV - this->parent->getAbsCoor())); 582 582 else 583 this->setRelCoor2D(tmpV - parentNode->getAbsCoor2D()); 584 585 this->setRelDir2D(tmpQ - parentNode->getAbsDir2D()); 583 this->relCoordinate = (tmpV - parentNode->getAbsCoor2D()); 584 this->bRelCoorChanged = true; 585 586 this->relDirection = (tmpQ - parentNode->getAbsDir2D()); 587 this->bRelDirChanged = true; 586 588 } 587 589 … … 591 593 * @param bias the speed to iterate to this new Positions 592 594 */ 593 void Element2D::s oftReparent2D(const char* parentName, float bias)595 void Element2D::setParentSoft2D(const char* parentName, float bias) 594 596 { 595 597 Element2D* parentNode = dynamic_cast<Element2D*>(ClassList::getObject(parentName, CL_ELEMENT_2D)); 596 598 if (parentNode != NULL) 597 this->s oftReparent2D(parentNode, bias);599 this->setParentSoft2D(parentNode, bias); 598 600 } 599 601 … … 852 854 853 855 854 855 856 /////////////////// 856 857 // NullElement2D // -
trunk/src/lib/graphics/render2D/element_2d.h
r5378 r5382 155 155 Element2D* getParent () const { return this->parent; }; 156 156 157 void s oftReparent2D(Element2D* parentNode, float bias = 1.0);158 void s oftReparent2D(const char* parentName, float bias = 1.0);157 void setParentSoft2D(Element2D* parentNode, float bias = 1.0); 158 void setParentSoft2D(const char* parentName, float bias = 1.0); 159 159 160 160 /** @param parentMode sets the parentingMode of this Node */ … … 207 207 Vector lastAbsCoordinate; //!< this is used for speedcalculation, it stores the last coordinate 208 208 float prevRelDirection; //!< The last Relative Direciton from the last update-Cycle. 209 // float lastAbsDirection;210 209 211 210 Vector velocity; //!< Saves the velocity. 212 211 213 Vector* toCoordinate; //!< a position to which to iterate. (This is used in conjunction with s oftReparent.and set*CoorSoft)214 float* toDirection; //!< a direction to which to iterate. (This is used in conjunction with s oftReparent and set*DirSoft)212 Vector* toCoordinate; //!< a position to which to iterate. (This is used in conjunction with setParentSoft.and set*CoorSoft) 213 float* toDirection; //!< a direction to which to iterate. (This is used in conjunction with setParentSoft and set*DirSoft) 215 214 float bias; //!< how fast to iterate to the given position (default is 1) 216 215 -
trunk/src/lib/graphics/render2D/render_2d.cc
r5318 r5382 66 66 void Render2D::registerElement2D(Element2D* element2D) 67 67 { 68 this->element2DList[(int)log2(E2D_DEFAULT_LAYER)]->add(element2D); 68 if (likely(element2D != NULL)) 69 this->element2DList[(int)log2(E2D_DEFAULT_LAYER)]->add(element2D); 69 70 } 71 70 72 71 73 /** … … 88 90 void Render2D::moveToLayer(Element2D* element2D, E2D_LAYER to) 89 91 { 92 if (element2D == NULL) 93 return; 94 95 if (unlikely(pow(2, E2D_LAYER_COUNT ) > to)) 96 to = E2D_DEFAULT_LAYER; 90 97 if (element2D->getLayer() != to) 91 98 {
Note: See TracChangeset
for help on using the changeset viewer.