Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jul 12, 2005, 11:00:48 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: included libORXquadtree.a

Location:
orxonox/trunk/src/lib/graphics/render2D
Files:
2 edited

Legend:

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

    r4840 r4843  
    1818#include "element_2d.h"
    1919#include "render_2d.h"
     20
     21#include "graphics_engine.h"
     22#include "p_node.h"
    2023
    2124using namespace std;
     
    4144  Render2D::getInstance()->unregisterElement2D(this);
    4245}
     46
     47
     48/**
     49 * this sets the position of the Element on the screen.
     50 */
     51void Element2D::positioning()
     52{
     53  // setting the Position of this ELEM2D.
     54  Vector pos;
     55  if (this->bindNode)
     56  {
     57    GLdouble x = this->bindNode->getAbsCoor().x;
     58    GLdouble y = this->bindNode->getAbsCoor().y;
     59    GLdouble z = this->bindNode->getAbsCoor().z;
     60    GLdouble projectPos[3];
     61    gluProject(x, y, z, GraphicsEngine::modMat, GraphicsEngine::projMat, GraphicsEngine::viewPort, projectPos, projectPos+1, projectPos+2);
     62    pos.x = projectPos[0] + this->position2D[0];
     63    pos.y = GraphicsEngine::getInstance()->getResolutionY() - projectPos[1] + this->position2D[1];
     64    pos.z = projectPos[2];
     65  }
     66  else
     67  {
     68    pos.x = this->position2D[0];
     69    pos.y = this->position2D[1];
     70    pos.z = 0;
     71  }
     72
     73  glPushMatrix();
     74}
     75
  • orxonox/trunk/src/lib/graphics/render2D/element_2d.h

    r4840 r4843  
    1010
    1111// FORWARD DECLARATION
     12class PNode;
    1213
    1314//!< An enumerator defining the Depth of a 2D-element.
     
    1920  E2D_BELOW_ALL                        //!< Will be rendered below the 3D-scene. @todo make this work.
    2021} E2DLayer;
     22
     23
     24typedef enum
     25{
     26  ELEM2D_ALIGN_LEFT,
     27  ELEM2D_ALIGN_RIGHT,
     28  ELEM2D_ALIGN_CENTER,
     29  ELEM2D_ALIGN_SCREEN_CENTER
     30} ELEM2D_ALIGNMENT;
     31
    2132
    2233//! A class for ...
     
    3243
    3344
     45  void positioning();
    3446  virtual void draw() const = NULL;
    3547
     
    3951   E2DLayer           layer;
    4052
     53   ELEM2D_ALIGNMENT   alignment;
     54   PNode*             bindNode;         //!< a node over which to display this 2D-element
    4155};
    4256
Note: See TracChangeset for help on using the changeset viewer.