Changeset 5381 in orxonox.OLD for branches/2d-recalc/src/lib/graphics/render2D/element_2d.cc
- Timestamp:
- Oct 15, 2005, 7:13:23 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2d-recalc/src/lib/graphics/render2D/element_2d.cc
r5380 r5381 111 111 this->setActiveness(true); 112 112 this->setAlignment(E2D_ALIGN_NONE); 113 this->layer = E2D_ TOP;113 this->layer = E2D_DEFAULT_LAYER; 114 114 this->bindNode = NULL; 115 115 … … 254 254 /** 255 255 * 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) 257 257 */ 258 258 void Element2D::setBindNode(const char* bindNode) … … 280 280 281 281 /** 282 * sets the relative coordinate of the Element2D to its Parent283 * @param x the x coordinate284 * @param y the y coordinate285 * @param z the z coordinate286 */287 void Element2D::setRelCoor2D (float x, float y, float z)288 {289 this->setRelCoor2D(Vector(x,y,z));290 }291 292 /**293 282 * sets the Relative coordinate to the parent in Pixels 294 283 * @param x the relCoord X … … 299 288 this->setRelCoor2D(Vector((float)x/(float)GraphicsEngine::getInstance()->getResolutionX(), 300 289 (float)y/(float)GraphicsEngine::getInstance()->getResolutionY(), 301 0 302 )); 290 0 )); 303 291 } 304 292 … … 332 320 333 321 /** 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 */ 324 Vector Element2D::getRelCoor2Dpx() const 325 { 326 return Vector(this->prevRelCoordinate.x * (float)GraphicsEngine::getInstance()->getResolutionX(), 327 this->prevRelCoordinate.y * (float)GraphicsEngine::getInstance()->getResolutionY(), 328 0); 343 329 } 344 330 … … 374 360 375 361 /** 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 /**387 362 * @param x x-coordinate in Pixels 388 363 * @param y y-coordinate in Pixels … … 398 373 399 374 /** 375 * @returns the absolute coordinate of the Element2D in pixels (as float-Vector) 376 */ 377 Vector 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 /** 400 385 * shift coordinate ralative 401 386 * @param shift shift vector … … 407 392 this->relCoordinate += shift; 408 393 this->bRelCoorChanged = true; 409 410 394 } 411 395 … … 684 668 PRINTF(5)("Element2D::update - %s - (%f, %f, %f)\n", this->getName(), this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z); 685 669 686 670 // update the direction 687 671 if( this->parentMode & E2D_PARENT_LOCAL_ROTATE && this->bRelDirChanged) 688 672 { 689 /* update the current absDirection - remember * means rotation around sth.*/690 673 this->prevRelDirection = this->relDirection; 691 674 this->absDirection = this->relDirection + parent->getAbsDir2D();; 692 675 } 693 694 676 695 677 if (this->alignment == E2D_ALIGN_SCREEN_CENTER && this->bRelCoorChanged) … … 700 682 this->absCoordinate.z = 0.0; 701 683 } 702 else if (this->bindNode) 684 // align at the bindNode. 685 else if (unlikely(this->bindNode != NULL)) 703 686 { 704 687 GLdouble projectPos[3]; … … 715 698 this->absCoordinate.y = projectPos[1]/(float)GraphicsEngine::getInstance()->getResolutionY() + this->relCoordinate.y; 716 699 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); 717 702 } 718 703 else
Note: See TracChangeset
for help on using the changeset viewer.