Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 15, 2005, 7:13:23 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/2d-recalc: some recalculations.. do not know it i will continue with this, as has certain disadvantages over the old approach… maybe later

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2d-recalc/src/lib/graphics/render2D/element_2d.cc

    r5380 r5381  
    111111  this->setActiveness(true);
    112112  this->setAlignment(E2D_ALIGN_NONE);
    113   this->layer = E2D_TOP;
     113  this->layer = E2D_DEFAULT_LAYER;
    114114  this->bindNode = NULL;
    115115
     
    254254/**
    255255 * sets a node, this 2D-Element should be shown upon
    256  * @param bindNode the name of the Node (should be existing)
     256 * @param bindNode the name of the Node (should already be existing)
    257257 */
    258258void Element2D::setBindNode(const char* bindNode)
     
    280280
    281281/**
    282  * sets the relative coordinate of the Element2D to its Parent
    283  * @param x the x coordinate
    284  * @param y the y coordinate
    285  * @param z the z coordinate
    286  */
    287 void Element2D::setRelCoor2D (float x, float y, float z)
    288 {
    289   this->setRelCoor2D(Vector(x,y,z));
    290 }
    291 
    292 /**
    293282 * sets the Relative coordinate to the parent in Pixels
    294283 * @param x the relCoord X
     
    299288  this->setRelCoor2D(Vector((float)x/(float)GraphicsEngine::getInstance()->getResolutionX(),
    300289                     (float)y/(float)GraphicsEngine::getInstance()->getResolutionY(),
    301                      0
    302                            ));
     290                     0 ));
    303291}
    304292
     
    332320
    333321/**
    334  * set relative coordinates smoothely
    335  * @param x x-relative coordinates to its parent
    336  * @param y y-relative coordinates to its parent
    337  * @param z z-relative coordinates to its parent
    338  * @see  void PNode::setRelCoorSoft (const Vector&, float)
    339  */
    340 void Element2D::setRelCoorSoft2D(float x, float y, float depth, float bias)
    341 {
    342   this->setRelCoorSoft2D(Vector(x, y, depth), bias);
     322 * @returns the Relative coordinate of the Element2D in pixels (as float-Vector)
     323 */
     324Vector Element2D::getRelCoor2Dpx() const
     325{
     326  return Vector(this->prevRelCoordinate.x * (float)GraphicsEngine::getInstance()->getResolutionX(),
     327                this->prevRelCoordinate.y * (float)GraphicsEngine::getInstance()->getResolutionY(),
     328                0);
    343329}
    344330
     
    374360
    375361/**
    376  * @param x x-coordinate.
    377  * @param y y-coordinate.
    378  * @param z z-coordinate.
    379  * @see void PNode::setAbsCoor (const Vector& absCoord)
    380  */
    381 void Element2D::setAbsCoor2D (float x, float y, float depth)
    382 {
    383   this->setAbsCoor2D(Vector(x, y, depth));
    384 }
    385 
    386 /**
    387362 * @param x x-coordinate in Pixels
    388363 * @param y y-coordinate in Pixels
     
    398373
    399374/**
     375 * @returns the absolute coordinate of the Element2D in pixels (as float-Vector)
     376 */
     377Vector Element2D::getAbsCoor2Dpx() const
     378{
     379  return Vector(this->absCoordinate.x * (float)GraphicsEngine::getInstance()->getResolutionX(),
     380                this->absCoordinate.y * (float)GraphicsEngine::getInstance()->getResolutionY(),
     381                0);
     382}
     383
     384/**
    400385 *  shift coordinate ralative
    401386 * @param shift shift vector
     
    407392  this->relCoordinate += shift;
    408393  this->bRelCoorChanged = true;
    409 
    410394}
    411395
     
    684668    PRINTF(5)("Element2D::update - %s - (%f, %f, %f)\n", this->getName(), this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
    685669
    686 
     670    // update the direction
    687671    if( this->parentMode & E2D_PARENT_LOCAL_ROTATE && this->bRelDirChanged)
    688672    {
    689       /* update the current absDirection - remember * means rotation around sth.*/
    690673      this->prevRelDirection = this->relDirection;
    691674      this->absDirection = this->relDirection + parent->getAbsDir2D();;
    692675    }
    693 
    694676
    695677    if (this->alignment == E2D_ALIGN_SCREEN_CENTER && this->bRelCoorChanged)
     
    700682      this->absCoordinate.z = 0.0;
    701683    }
    702     else if (this->bindNode)
     684    // align at the bindNode.
     685    else if (unlikely(this->bindNode != NULL))
    703686    {
    704687      GLdouble projectPos[3];
     
    715698      this->absCoordinate.y = projectPos[1]/(float)GraphicsEngine::getInstance()->getResolutionY() + this->relCoordinate.y;
    716699      this->absCoordinate.z = projectPos[2] + this->relCoordinate.z;
     700      //! @todo check for corectness.
     701      //       printf("%f, %f, %f\n", this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
    717702    }
    718703    else
Note: See TracChangeset for help on using the changeset viewer.