Changeset 4843 in orxonox.OLD for orxonox/trunk/src/lib/graphics
- Timestamp:
- Jul 12, 2005, 11:00:48 PM (19 years ago)
- 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 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 -
orxonox/trunk/src/lib/graphics/render2D/element_2d.h
r4840 r4843 10 10 11 11 // FORWARD DECLARATION 12 class PNode; 12 13 13 14 //!< An enumerator defining the Depth of a 2D-element. … … 19 20 E2D_BELOW_ALL //!< Will be rendered below the 3D-scene. @todo make this work. 20 21 } E2DLayer; 22 23 24 typedef enum 25 { 26 ELEM2D_ALIGN_LEFT, 27 ELEM2D_ALIGN_RIGHT, 28 ELEM2D_ALIGN_CENTER, 29 ELEM2D_ALIGN_SCREEN_CENTER 30 } ELEM2D_ALIGNMENT; 31 21 32 22 33 //! A class for ... … … 32 43 33 44 45 void positioning(); 34 46 virtual void draw() const = NULL; 35 47 … … 39 51 E2DLayer layer; 40 52 53 ELEM2D_ALIGNMENT alignment; 54 PNode* bindNode; //!< a node over which to display this 2D-element 41 55 }; 42 56
Note: See TracChangeset
for help on using the changeset viewer.