Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5382 in orxonox.OLD for trunk/src/lib/graphics/render2D


Ignore:
Timestamp:
Oct 15, 2005, 8:22:30 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: fixed a reparenting bug
made the naming more compliant

Location:
trunk/src/lib/graphics/render2D
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/render2D/element_2d.cc

    r5378 r5382  
    555555 * @param bias the speed to iterate to this new Positions
    556556 */
    557 void Element2D::softReparent2D(Element2D* parentNode, float bias)
     557void Element2D::setParentSoft2D(Element2D* parentNode, float bias)
    558558{
    559559  if (this->parent == parentNode)
     
    578578  parentNode->addChild2D(this);
    579579
    580   if (this->parentMode & PNODE_ROTATE_MOVEMENT)
     580  if (this->parentMode & PNODE_ROTATE_MOVEMENT) //! @todo implement this.
    581581    ;//this->setRelCoor(this->parent->getAbsDir().inverse().apply(tmpV - this->parent->getAbsCoor()));
    582582  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;
    586588}
    587589
     
    591593 * @param bias the speed to iterate to this new Positions
    592594 */
    593 void Element2D::softReparent2D(const char* parentName, float bias)
     595void Element2D::setParentSoft2D(const char* parentName, float bias)
    594596{
    595597  Element2D* parentNode = dynamic_cast<Element2D*>(ClassList::getObject(parentName, CL_ELEMENT_2D));
    596598  if (parentNode != NULL)
    597     this->softReparent2D(parentNode, bias);
     599    this->setParentSoft2D(parentNode, bias);
    598600}
    599601
     
    852854
    853855
    854 
    855856///////////////////
    856857// NullElement2D //
  • trunk/src/lib/graphics/render2D/element_2d.h

    r5378 r5382  
    155155    Element2D* getParent () const { return this->parent; };
    156156
    157     void softReparent2D(Element2D* parentNode, float bias = 1.0);
    158     void softReparent2D(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);
    159159
    160160    /** @param parentMode sets the parentingMode of this Node */
     
    207207    Vector                  lastAbsCoordinate;  //!< this is used for speedcalculation, it stores the last coordinate
    208208    float                   prevRelDirection;   //!< The last Relative Direciton from the last update-Cycle.
    209 //  float                   lastAbsDirection;
    210209
    211210    Vector                  velocity;           //!< Saves the velocity.
    212211
    213     Vector*                 toCoordinate;       //!< a position to which to iterate. (This is used in conjunction with softReparent.and set*CoorSoft)
    214     float*                  toDirection;        //!< a direction to which to iterate. (This is used in conjunction with softReparent 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)
    215214    float                   bias;               //!< how fast to iterate to the given position (default is 1)
    216215
  • trunk/src/lib/graphics/render2D/render_2d.cc

    r5318 r5382  
    6666void Render2D::registerElement2D(Element2D* element2D)
    6767{
    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);
    6970}
     71
    7072
    7173/**
     
    8890void Render2D::moveToLayer(Element2D* element2D, E2D_LAYER to)
    8991{
     92  if (element2D == NULL)
     93    return;
     94
     95  if (unlikely(pow(2, E2D_LAYER_COUNT ) > to))
     96    to = E2D_DEFAULT_LAYER;
    9097  if (element2D->getLayer() != to)
    9198  {
Note: See TracChangeset for help on using the changeset viewer.