Changeset 4843 in orxonox.OLD for orxonox/trunk/src/lib/graphics/render2D/element_2d.cc
- Timestamp:
- Jul 12, 2005, 11:00:48 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/render2D/element_2d.cc
r4840 r4843 18 18 #include "element_2d.h" 19 19 #include "render_2d.h" 20 21 #include "graphics_engine.h" 22 #include "p_node.h" 20 23 21 24 using namespace std; … … 41 44 Render2D::getInstance()->unregisterElement2D(this); 42 45 } 46 47 48 /** 49 * this sets the position of the Element on the screen. 50 */ 51 void 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
Note: See TracChangeset
for help on using the changeset viewer.