Changeset 6782 in orxonox.OLD for branches/network/src/lib/graphics/render2D
- Timestamp:
- Jan 26, 2006, 7:43:44 PM (19 years ago)
- Location:
- branches/network/src/lib/graphics/render2D
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/lib/graphics/render2D/billboard.cc
r6781 r6782 11 11 ### File Specific: 12 12 main-programmer: Patrick Boenzli 13 co-programmer: ...14 13 */ 15 14 16 15 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON 17 16 18 #include " image_entity.h"17 #include "billboard.h" 19 18 20 19 #include "load_param.h" … … 25 24 #include "glincl.h" 26 25 #include "state.h" 26 #include "p_node.h" 27 27 28 28 … … 39 39 { 40 40 this->init(); 41 this->loadParams(root); 41 42 if( root) 43 this->loadParams(root); 42 44 } 43 45 … … 64 66 this->setSize(GraphicsEngine::getInstance()->getResolutionX()/10.0, GraphicsEngine::getInstance()->getResolutionY()/10.0); 65 67 66 this->setBindNode(this);67 this->material = new Material ;68 //this->setBindNode(this); 69 this->material = new Material(); 68 70 this->setTexture("pictures/error_texture.png"); 69 71 } 70 72 71 73 74 /** 75 * load params 76 * @param root TiXmlElement object 77 */ 72 78 void Billboard::loadParams(const TiXmlElement* root) 73 79 { 74 PNode::loadParams(root);75 76 80 LoadParam(root, "texture", this, Billboard, setTexture) 77 81 .describe("the texture-file to load onto the Billboard"); … … 79 83 LoadParam(root, "size", this, Billboard, setSize) 80 84 .describe("the size of the Billboard in Pixels"); 81 82 LoadParam(root, "rotation-speed", this, Billboard, setRotationSpeed)83 .describe("the Speed with which the Billboard should rotate");84 85 86 85 } 87 86 … … 107 106 108 107 109 /** this turns on/off the billboarding of this WorldEntity110 * 111 * This means that the image will always look in the direction of the Player108 /** 109 * attaches this billboard to a parent 110 * @param pNode node to attach to 112 111 */ 113 void Billboard:: toggleBillboard()112 void Billboard::attachTo(PNode* pNode) 114 113 { 115 this-> bBillboarding = !this->bBillboarding;114 this->source->setParent(pNode); 116 115 } 117 116 … … 151 150 { 152 151 glPushMatrix(); 152 153 153 glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0); 154 this->material->select(); 154 155 155 //glRotatef(this->getAbsDir2D(), 0,0,1);156 this->material->select();157 156 glBegin(GL_TRIANGLE_STRIP); 158 157 glTexCoord2f(0, 0); … … 165 164 glVertex2f(this->getSizeX2D(), this->getSizeY2D()); 166 165 glEnd(); 166 167 167 glPopMatrix(); 168 169 168 } -
branches/network/src/lib/graphics/render2D/billboard.h
r6781 r6782 7 7 #define _BILLBOARD_H 8 8 9 #include "p_node.h" 9 10 10 #include "element_2d.h" 11 #include "event_listener.h"12 11 13 12 #include "vector.h" … … 32 31 void setSize(float sizeX, float sizeY); 33 32 void setTexture(const char* textureFile); 34 /** @param rotationSpeed the speed at what the crosshair should rotate */ 35 void setRotationSpeed(float rotationSpeed) { this->rotationSpeed = rotationSpeed; }; 36 void toggleBillboard(); 33 void attachTo(PNode* pnode); 37 34 38 35 virtual void tick(float dt);
Note: See TracChangeset
for help on using the changeset viewer.