Changeset 4955 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Jul 25, 2005, 3:48:55 PM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/coord/p_node.cc
r4870 r4955 626 626 { 627 627 glBegin(GL_LINE_STRIP); 628 glVertex3f( .5 , .5, -.5);629 glVertex3f( .5 , .5, .5);630 glVertex3f(-.5 , .5, .5);631 glVertex3f(-.5 , -.5, .5);632 glVertex3f( .5 , .5, -.5);633 glVertex3f( .5 , -.5, -.5);634 glVertex3f(-.5 , -.5, -.5);635 glVertex3f(-.5 , .5, -.5);628 glVertex3f( .5*size, .5*size, -.5*size); 629 glVertex3f( .5*size, .5*size, .5*size); 630 glVertex3f(-.5*size, .5*size, .5*size); 631 glVertex3f(-.5*size, -.5*size, .5*size); 632 glVertex3f( .5*size, .5*size, -.5*size); 633 glVertex3f( .5*size, -.5*size, -.5*size); 634 glVertex3f(-.5*size, -.5*size, -.5*size); 635 glVertex3f(-.5*size, .5*size, -.5*size); 636 636 glEnd(); 637 637 glBegin(GL_LINE_STRIP); 638 glVertex3f(-.5 , -.5, -.5);639 glVertex3f(-.5 , -.5, .5);640 glVertex3f( .5 , -.5, .5);641 glVertex3f( .5 , -.5, -.5);638 glVertex3f(-.5*size, -.5*size, -.5*size); 639 glVertex3f(-.5*size, -.5*size, .5*size); 640 glVertex3f( .5*size, -.5*size, .5*size); 641 glVertex3f( .5*size, -.5*size, -.5*size); 642 642 glEnd(); 643 643 glBegin(GL_LINES); 644 glVertex3f( .5 , -.5, .5);645 glVertex3f( .5 , .5, .5);646 glVertex3f(-.5 , -.5, .5);647 glVertex3f(-.5 , .5, .5);644 glVertex3f( .5*size, -.5*size, .5*size); 645 glVertex3f( .5*size, .5*size, .5*size); 646 glVertex3f(-.5*size, -.5*size, .5*size); 647 glVertex3f(-.5*size, .5*size, .5*size); 648 648 glEnd(); 649 649 } -
orxonox/trunk/src/lib/graphics/graphics_engine.cc
r4864 r4955 316 316 void GraphicsEngine::enter2DMode() 317 317 { 318 GraphicsEngine::storeMatrices();318 //GraphicsEngine::storeMatrices(); 319 319 SDL_Surface *screen = SDL_GetVideoSurface(); 320 320 … … 433 433 void GraphicsEngine::draw() const 434 434 { 435 GraphicsEngine::storeMatrices(); 435 436 Render2D::getInstance()->draw(E2D_ALL_LAYERS); 436 437 LightManager::getInstance()->draw(); -
orxonox/trunk/src/lib/graphics/render2D/render_2d.cc
r4862 r4955 114 114 /** 115 115 * renders all the Elements of the Render2D-engine 116 * @param layer the Layer to draw 116 117 */ 117 118 void Render2D::draw(unsigned int layer) const … … 137 138 drawLayer << 1; 138 139 } 139 140 140 GraphicsEngine::leave2DMode(); 141 141 -
orxonox/trunk/src/story_entities/world.cc
r4940 r4955 917 917 918 918 /* update tick the rest */ 919 TrackManager::getInstance()->tick(this->dtS);919 //TrackManager::getInstance()->tick(this->dtS); 920 920 this->localCamera->tick(this->dtS); 921 921 // tick the engines -
orxonox/trunk/src/world_entities/player.cc
r4954 r4955 46 46 47 47 //weapons: 48 Weapon* wpRight = new TestGun( 0);49 Weapon* wpLeft = new TestGun( 1);48 Weapon* wpRight = new TestGun(this->weaponMan, 0); 49 Weapon* wpLeft = new TestGun(this->weaponMan, 1); 50 50 51 51 this->weaponMan->addWeapon(wpRight); … … 80 80 81 81 //weapons: 82 Weapon* wpRight = new TestGun( 0);82 Weapon* wpRight = new TestGun(this->weaponMan, 0); 83 83 wpRight->setName("testGun Right"); 84 Weapon* wpLeft = new TestGun( 1);84 Weapon* wpLeft = new TestGun(this->weaponMan, 1); 85 85 wpLeft->setName("testGun Left"); 86 86 -
orxonox/trunk/src/world_entities/weapons/crosshair.cc
r4865 r4955 165 165 gluUnProject(position2D[0], 166 166 GraphicsEngine::getInstance()->getResolutionY()-position2D[1]-1, 167 .99, 167 .99, // z 168 168 GraphicsEngine::modMat, 169 169 GraphicsEngine::projMat, … … 183 183 void Crosshair::draw() const 184 184 { 185 GraphicsEngine::storeMatrices();186 187 188 189 190 185 // glBegin(GL_TRIANGLES); 191 186 // glColor3f(1,0,0); … … 194 189 // glVertex3f(objX, objY, objZ+1); 195 190 // glEnd(); 196 197 this->debugDraw(); 198 199 GraphicsEngine::enter2DMode(); 191 glPushMatrix(); 200 192 GLdouble pos[3]; 201 193 gluProject(this->getAbsCoor().x, … … 221 213 glVertex2f(size, size); 222 214 glEnd(); 223 224 GraphicsEngine::leave2DMode(); 225 } 215 glPopMatrix(); 216 217 } -
orxonox/trunk/src/world_entities/weapons/projectile.cc
r4948 r4955 91 91 void Projectile::setVelocity(const Vector &velocity) 92 92 { 93 Vector offsetVel = this->velocity = velocity; 94 offsetVel.normalize(); 95 this->velocity += (offsetVel * 50.0); 93 //Vector offsetVel = 94 this->velocity = velocity; 95 // offsetVel.normalize(); 96 //this->velocity += (offsetVel * 50.0); 96 97 } 97 98 -
orxonox/trunk/src/world_entities/weapons/test_gun.cc
r4953 r4955 26 26 #include "model.h" 27 27 #include "test_bullet.h" 28 #include "weapon_manager.h" 28 29 29 30 #include "state.h" … … 44 45 creates a new weapon 45 46 */ 46 TestGun::TestGun (int leftRight) 47 TestGun::TestGun (WeaponManager* weaponManager, int leftRight) 48 : Weapon(weaponManager) 47 49 { 48 50 this->setClassID(CL_TEST_GUN, "TestGun"); … … 158 160 Projectile* pj = dynamic_cast<Projectile*>(this->getProjectileFactory()->resurrect()); 159 161 162 PNode* target = this->getWeaponManager()->getFixedTarget(); 163 164 if (target != NULL) 165 { 166 target->debugDraw(); 167 Vector test = ((target->getAbsCoor() - this->getAbsCoor())*5); 168 pj->setVelocity(test/20.0);//this->getVelocity()); 169 } 170 else 171 pj->setVelocity(target->getVelocity()); 172 173 160 174 pj->setAbsCoor(this->getEmissionPoint()); 161 175 pj->setAbsDir(this->getAbsDir()); 162 pj->setVelocity(this->getVelocity());163 176 State::getWorldEntityList()->add(pj); 164 177 } … … 191 204 void TestGun::draw () 192 205 { 206 this->getWeaponManager()->getFixedTarget()->debugDraw(10); 207 193 208 /* draw gun body */ 194 209 glMatrixMode(GL_MODELVIEW); -
orxonox/trunk/src/world_entities/weapons/test_gun.h
r4953 r4955 29 29 { 30 30 public: 31 TestGun ( int leftRight);31 TestGun (WeaponManager* weaponManager, int leftRight); 32 32 virtual ~TestGun (); 33 33 -
orxonox/trunk/src/world_entities/weapons/weapon.cc
r4953 r4955 39 39 * creates a new weapon 40 40 */ 41 Weapon::Weapon ( )41 Weapon::Weapon (WeaponManager* weaponManager) 42 42 { 43 43 this->init(); 44 this->setWeaponManager(weaponManager); 44 45 } 45 46 … … 88 89 this->energy = .0; 89 90 this->energyMax = 10.0; 91 92 this->setWeaponManager(NULL); 90 93 } 91 94 -
orxonox/trunk/src/world_entities/weapons/weapon.h
r4953 r4955 24 24 // FORWARD DECLARATION 25 25 class Projectile; 26 class Weapon ;26 class WeaponManager; 27 27 class Animation3D; 28 28 class TiXmlElement; … … 72 72 public: 73 73 // INITIALISATION // 74 Weapon ( );74 Weapon (WeaponManager* weaponManager = NULL); 75 75 Weapon(const TiXmlElement* root); 76 76 virtual ~Weapon (); … … 85 85 /////////////////// 86 86 87 /** @param weaponManager sets the WeaponManager for this Weapon (NULL if free))*/ 88 inline void setWeaponManager(WeaponManager* weaponManager) { this->weaponManager = weaponManager; }; 89 /** @returns the WeaponManager of this Weapon (or NULL if it is free) */ 90 inline WeaponManager* getWeaponManager() const { return this->weaponManager; }; 87 91 88 92 /** @returns true if the Weapon is Active (this is used to check if the weapon must be drawn)*/ … … 199 203 ClassID projectile; //!< the projectile used for this weapon (since they should be generated via macro and the FastFactory, only the ClassID must be known.) 200 204 FastFactory* projectileFactory; //!< A factory, that produces and handles the projectiles. 205 206 WeaponManager* weaponManager; //!< The weaponManager this weapon is connected to. if NULL it is assumed, that the weapon is freely connected to an entity without a binding WeaponManager. 201 207 }; 202 208 -
orxonox/trunk/src/world_entities/weapons/weapon_manager.h
r4954 r4955 14 14 15 15 #include "p_node.h" 16 #include "crosshair.h" 16 17 17 18 // FORWARD DECLARATION 18 19 class PNode; 19 20 class Weapon; 20 class Crosshair;21 21 template <class T> class tAnimation; 22 22 … … 87 87 void removeWeapon(Weapon* weapon, int configID = -1); 88 88 89 90 89 91 void nextWeaponConfig(); 90 92 void previousWeaponConfig(); 91 93 void changeWeaponConfig(int weaponConfig); 92 94 95 /** @returns a fixed target namely the Crosshair's 3D position */ 96 inline PNode* getFixedTarget() { return this->crosshair; } 93 97 void fire(); 94 98
Note: See TracChangeset
for help on using the changeset viewer.