Changeset 10771 in orxonox.OLD for branches/presentation
- Timestamp:
- Jun 27, 2007, 7:01:08 PM (18 years ago)
- Location:
- branches/presentation/src
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/lib/collision_detection/aabb_tree_node.cc
r10698 r10771 882 882 883 883 /* DRAW SEPARATING PLANE */ 884 if( drawMode & DRAW_SEPARATING_PLANE || drawMode & DRAW_ALL)884 if( (drawMode & DRAW_SEPARATING_PLANE) || (drawMode & DRAW_ALL)) 885 885 { 886 886 if( !(drawMode & DRAW_SINGLE && depth != 0)) -
branches/presentation/src/lib/collision_detection/obb_tree_node.cc
r10618 r10771 782 782 783 783 /* DRAW POLYGONS */ 784 if( drawMode & DRAW_BV_POLYGON || drawMode & DRAW_ALL || drawMode & DRAW_BV_BLENDED)784 if(( drawMode & DRAW_BV_POLYGON) || (drawMode & DRAW_ALL) || (drawMode & DRAW_BV_BLENDED)) 785 785 { 786 786 if (top) … … 932 932 933 933 /* DRAW SEPARATING PLANE */ 934 if( drawMode & DRAW_SEPARATING_PLANE|| drawMode & DRAW_ALL)934 if( (drawMode & DRAW_SEPARATING_PLANE) || drawMode & DRAW_ALL) 935 935 { 936 936 if( !(drawMode & DRAW_SINGLE && depth != 0)) -
branches/presentation/src/lib/graphics/importer/static_model.cc
r10770 r10771 211 211 } 212 212 213 // printf("adding MP\n"); 213 214 214 this->addMountPoint( zAxis, yAxis, center, groupName); 215 // remove the group from the model list (mount points do not need to be drawn) 216 // std::vector<StaticModelData::Group>::iterator tmpIt = groupIt; 217 // groupIt++; 215 // remove the group from the model list (mount points do not need to be drawn) 216 // remoing item iterates greoupIt! 218 217 this->data->getGroups().erase(groupIt); 219 218 } -
branches/presentation/src/util/hud.cc
r10766 r10771 846 846 std::list<OrxGui::GLGuiEnergyWidgetVertical*>::iterator weaponWidget; 847 847 Vector2D pos = Vector2D(overlayWidth, 0.4*this->resY); 848 float largestWidgetSizeX = 0; 848 // float largestWidgetSizeX = 0; //unused variable 849 849 850 850 for (weaponWidget = this->weaponsWidgetsPrim.begin(); weaponWidget != this->weaponsWidgetsPrim.end(); weaponWidget++) -
branches/presentation/src/world_entities/projectiles/projectile_weapon.cc
r10749 r10771 147 147 } 148 148 149 149 /* 150 150 void ProjectileWeapon::collidesWith (WorldEntity* target, const Vector& location) 151 151 { … … 154 154 this->destroy(target); 155 155 } 156 156 */ 157 157 158 158 -
branches/presentation/src/world_entities/projectiles/projectile_weapon.h
r10618 r10771 59 59 virtual void destroy (WorldEntity* killer); 60 60 61 virtual void collidesWith (WorldEntity* target, const Vector& location); //!< collision handler; used against SpaceShip as most target will be61 // virtual void collidesWith (WorldEntity* target, const Vector& location); //!< collision handler; used against SpaceShip as most target will be 62 62 63 63 -
branches/presentation/src/world_entities/projectiles/test_bullet.cc
r10737 r10771 35 35 this->registerObject(this, TestBullet::_objectList); 36 36 37 this->loadModel("models/projectiles/orx-rocket.obj", . 3);37 this->loadModel("models/projectiles/orx-rocket.obj", .6); // FIXME model no longer avaiable 38 38 39 39 this->setMinEnergy(1); … … 170 170 this->getAbsDir().matrix (matrix); 171 171 glMultMatrixf((float*)matrix); 172 glScalef(2.0, 2.0, 2.0); 172 // glScalef(2.0, 2.0, 2.0); // no double rescale, changed size in modelloader 173 173 this->getModel()->draw(); 174 174 -
branches/presentation/src/world_entities/weapons/disruptor.cc
r10747 r10771 55 55 Disruptor::~Disruptor() 56 56 { 57 for (int i = 0; i < this->getBarrels(); i++)58 {59 delete [] this->shootAnim[i];60 delete [] this->objComp[i];61 }62 delete [] this->emissionPoint;63 64 delete [] this->shootAnim;65 delete [] this->objComp;66 67 57 } 68 58 … … 99 89 this->setBarrels(1); 100 90 this->setSegs(1); 101 this->activeBarrel = 0;102 91 92 this->setEmissionPoint(Vector(1.672, 0.0, 0.0) * this->getScaling()); 103 93 104 105 this->objComp = new PNode**[this->getBarrels()]; 106 this->emissionPoint = new PNode*[this->getBarrels()]; 107 this->shootAnim = new Animation3D**[this->getBarrels()]; 108 for (int i = 0; i < this->getBarrels(); i++) 109 { 110 this->objComp[i] = new PNode* [this->getSegs()]; 111 this->emissionPoint[i] = new PNode; 112 this->emissionPoint[i]->setParent(this); //Parenting emissionPoint to Weapon 113 this->emissionPoint[i]->setName("EmissionPoint"); 114 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 115 this->shootAnim[i] = new Animation3D* [this->getSegs()]; 116 for(int j = 0; j < this->getSegs(); j++) 117 { 118 this->objComp[i][j] = new PNode; 119 this->shootAnim[i][j] = new Animation3D(this->objComp[i][j]); 120 this->shootAnim[i][j]->setInfinity(ANIM_INF_CONSTANT); 121 } 122 } 123 124 this->emissionPoint[0]->setRelCoor(Vector(1.672, 0.0, 0.0) * this->getScaling()); 125 126 127 this->shootAnim[0][0]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL); 128 this->shootAnim[0][0]->addKeyFrame(Vector(-0.5, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.2, ANIM_LINEAR, ANIM_NULL); 94 this->getShootAnim(0, 0)->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL); 95 this->getShootAnim(0, 0)->addKeyFrame(Vector(-0.5, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.2, ANIM_LINEAR, ANIM_NULL); 129 96 // this->shootAnim[0][0]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL); 130 97 … … 158 125 pj->setVelocity((tmp.getNormalized())*130 + VECTOR_RAND(1)); 159 126 160 pj->setAbsCoor(this-> emissionPoint[this->activeBarrel]->getAbsCoor());127 pj->setAbsCoor(this->getEmissionPoint()); 161 128 pj->setAbsDir(this->getAbsDir()); 162 129 pj->activate(); 163 130 164 131 165 this-> shootAnim[0][0]->replay();132 this->getShootAnim(0, 0)->replay(); 166 133 } 167 134 … … 196 163 // Barrel 197 164 glPushMatrix(); 198 glTranslatef(this-> objComp[0][0]->getAbsCoor().x, this->objComp[0][0]->getAbsCoor().y, this->objComp[0][0]->getAbsCoor().z);165 glTranslatef(this->getObjCompx(0,0), this->getObjCompy(0,0), this->getObjCompz(0,0)); 199 166 static_cast<StaticModel*>(this->getModel())->draw(0); 200 167 glPopMatrix(); 168 201 169 glPopMatrix(); 202 170 } -
branches/presentation/src/world_entities/weapons/disruptor.h
r10698 r10771 34 34 35 35 private: 36 PNode*** objComp;37 Animation3D*** shootAnim;38 PNode** emissionPoint;39 36 40 int activeBarrel;41 42 // int leftRight;43 37 }; 44 38 -
branches/presentation/src/world_entities/weapons/heavy_blaster.cc
r10698 r10771 30 30 31 31 CREATE_FACTORY(HeavyBlaster); 32 // ObjectListDefinition(HeavyBlaster);33 34 32 35 33 … … 37 35 * Standard constructor 38 36 */ 39 HeavyBlaster::HeavyBlaster (int leftRight )37 HeavyBlaster::HeavyBlaster (int leftRight = W_RIGHT) 40 38 : Weapon() 41 39 { 42 // this->registerObject(this, HeavyBlaster::_objectList);43 40 44 41 this->init(leftRight); … … 61 58 HeavyBlaster::~HeavyBlaster() 62 59 { 63 for (int i = 0; i < this->getBarrels(); i++)64 {65 delete [] this->shootAnim[i];66 delete [] this->objComp[i];67 }68 delete [] this->emissionPoint;69 70 delete [] this->shootAnim;71 delete [] this->objComp;72 /*73 for(int j = 0; j < this->getSegs(); j++)74 {75 delete this->shootAnim[i][j];76 delete this->objComp[i][j];77 }78 delete this->shootAnim[i];79 delete this->objComp[i];80 delete this->emissionPoint[i];81 }*/82 83 // this->deconstr();84 // model will be deleted from WorldEntity-destructor85 60 } 86 61 … … 94 69 95 70 this->leftRight = leftRight; 96 //this->registerObject(this, HeavyBlaster::_objectList);97 98 // this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN);99 71 100 72 this->loadModel("models/guns/frag_cannon2.obj", .4); … … 108 80 this->setEnergyMax(500); 109 81 this->increaseEnergy(500); 110 //this->minCharge = 2;111 82 112 83 this->setActionSound(WA_SHOOT, "sounds/guns/laser.wav"); … … 120 91 this->setBarrels(3); 121 92 this->setSegs(2); 122 this->activeBarrel = 0; 123 124 125 126 this->objComp = new PNode**[this->getBarrels()]; 127 this->emissionPoint = new PNode*[this->getBarrels()]; 128 this->shootAnim = new Animation3D**[this->getBarrels()]; 129 for (int i = 0; i < this->getBarrels(); i++) 93 94 95 if (this->leftRight == W_LEFT) 130 96 { 131 this->objComp[i] = new PNode* [this->getSegs()]; 132 this->emissionPoint[i] = new PNode; 133 this->emissionPoint[i]->setParent(this); //Parenting emissionPoint to Weapons 134 this->emissionPoint[i]->setName("EmissionPoint"); 135 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 136 this->shootAnim[i] = new Animation3D* [this->getSegs()]; 137 for(int j = 0; j < this->getSegs(); j++) 138 { 139 this->objComp[i][j] = new PNode; 140 this->shootAnim[i][j] = new Animation3D(this->objComp[i][j]); 141 this->shootAnim[i][j]->setInfinity(ANIM_INF_CONSTANT); 142 } 143 } 144 145 if (this->leftRight == W_RIGHT) 146 { 147 this->emissionPoint[0]->setRelCoor(Vector(1.1, 0.14, 0.06)); 148 this->emissionPoint[1]->setRelCoor(Vector(1.1, -.06, 0.14)); 149 this->emissionPoint[2]->setRelCoor(Vector(1.1, 0.06, -.14)); 97 this->setEmissionPoint(Vector(1.1, 0.14, -.06), 0); 98 this->setEmissionPoint(Vector(1.1, -.06, -.14), 1); 99 this->setEmissionPoint(Vector(1.1, 0.06, 0.14), 2); 150 100 } 151 101 else { 152 this-> emissionPoint[0]->setRelCoor(Vector(1.1, 0.14, -.06));153 this-> emissionPoint[1]->setRelCoor(Vector(1.1, -.06, -.14));154 this-> emissionPoint[2]->setRelCoor(Vector(1.1, 0.06, 0.14));102 this->setEmissionPoint(Vector(1.1, 0.14, 0.06), 0); 103 this->setEmissionPoint(Vector(1.1, -.06, 0.14), 1); 104 this->setEmissionPoint(Vector(1.1, 0.06, -.14), 2); 155 105 } 156 106 157 107 158 108 for (int i = 0; i < this->getBarrels(); i++){ 159 this-> shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);160 this-> shootAnim[i][0]->addKeyFrame(Vector(-0.3, 0.0, 0.0), Quaternion(), 0.9, ANIM_LINEAR, ANIM_NULL);161 this-> shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.5, ANIM_LINEAR, ANIM_NULL);162 163 this-> shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL);164 this-> shootAnim[i][1]->addKeyFrame(Vector(-0.4, 0.0, 0.0), Quaternion(), 1.2, ANIM_LINEAR, ANIM_NULL);165 this-> shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.2, ANIM_LINEAR, ANIM_NULL);109 this->getShootAnim(i, 0)->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL); 110 this->getShootAnim(i, 0)->addKeyFrame(Vector(-0.3, 0.0, 0.0), Quaternion(), 0.9, ANIM_LINEAR, ANIM_NULL); 111 this->getShootAnim(i, 0)->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.5, ANIM_LINEAR, ANIM_NULL); 112 113 this->getShootAnim(i, 1)->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_NULL); 114 this->getShootAnim(i, 1)->addKeyFrame(Vector(-0.4, 0.0, 0.0), Quaternion(), 1.2, ANIM_LINEAR, ANIM_NULL); 115 this->getShootAnim(i, 1)->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.2, ANIM_LINEAR, ANIM_NULL); 166 116 } 167 117 … … 192 142 pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*130 + VECTOR_RAND(1)); 193 143 194 pj->setAbsCoor(this-> emissionPoint[this->activeBarrel]->getAbsCoor());144 pj->setAbsCoor(this->getEmissionPoint()); 195 145 pj->setAbsDir(this->getAbsDir()); 196 146 pj->activate(); … … 198 148 // initiate animation 199 149 for (int i = 0; i < this->getSegs(); i++) 200 this->shootAnim[this->activeBarrel][i]->replay(); 201 202 // switch barrel 203 this->activeBarrel = (this->activeBarrel + 1) % this->getBarrels(); 150 this->getShootAnim(this->getActiveBarrel(), i)->replay(); // FIXME needs clean up 151 152 this->cycleBarrel(); 204 153 } 205 154 … … 230 179 231 180 if (this->leftRight == W_LEFT) 232 glScalef(1.0, 1.0, -1.0); 233 234 static_cast<StaticModel*>(this->getModel())->draw(6);235 236 glPushMatrix();237 glTranslatef (this->objComp[0][0]->getAbsCoor().x, this->objComp[0][0]->getAbsCoor().y, this->objComp[0][0]->getAbsCoor().z);238 static_cast<StaticModel*>(this->getModel())->draw(2);239 glPopMatrix();240 241 glPushMatrix();242 glTranslatef (this->objComp[1][0]->getAbsCoor().x, this->objComp[1][0]->getAbsCoor().y, this->objComp[1][0]->getAbsCoor().z);243 static_cast<StaticModel*>(this->getModel())->draw(3);244 glPopMatrix();245 246 glPushMatrix();247 glTranslatef (this->objComp[2][0]->getAbsCoor().x, this->objComp[2][0]->getAbsCoor().y, this->objComp[2][0]->getAbsCoor().z);248 static_cast<StaticModel*>(this->getModel())->draw(1);249 glPopMatrix();250 251 glPushMatrix();252 glTranslatef (this->objComp[0][1]->getAbsCoor().x, this->objComp[0][1]->getAbsCoor().y, this->objComp[0][1]->getAbsCoor().z);253 static_cast<StaticModel*>(this->getModel())->draw(4);254 glPopMatrix();255 256 glPushMatrix();257 glTranslatef (this->objComp[1][1]->getAbsCoor().x, this->objComp[1][1]->getAbsCoor().y, this->objComp[1][1]->getAbsCoor().z);258 static_cast<StaticModel*>(this->getModel())->draw(5);259 glPopMatrix();260 261 glPushMatrix();262 glTranslatef (this->objComp[2][1]->getAbsCoor().x, this->objComp[2][1]->getAbsCoor().y, this->objComp[2][1]->getAbsCoor().z);263 static_cast<StaticModel*>(this->getModel())->draw(0);264 glPopMatrix();181 glScalef(1.0, 1.0, -1.0); //FIXME check weather this causes a slowdown... 182 183 static_cast<StaticModel*>(this->getModel())->draw(6); 184 185 glPushMatrix(); 186 glTranslatef (this->getObjCompx(0,0), this->getObjCompy(0,0), this->getObjCompz(0,0)); 187 static_cast<StaticModel*>(this->getModel())->draw(2); 188 glPopMatrix(); 189 190 glPushMatrix(); 191 glTranslatef (this->getObjCompx(1,0), this->getObjCompy(1,0), this->getObjCompz(1,0)); 192 static_cast<StaticModel*>(this->getModel())->draw(3); 193 glPopMatrix(); 194 195 glPushMatrix(); 196 glTranslatef (this->getObjCompx(2,0), this->getObjCompy(2,0), this->getObjCompz(2,0)); 197 static_cast<StaticModel*>(this->getModel())->draw(1); 198 glPopMatrix(); 199 200 glPushMatrix(); 201 glTranslatef (this->getObjCompx(0,1), this->getObjCompy(0,1), this->getObjCompz(0,1)); 202 static_cast<StaticModel*>(this->getModel())->draw(4); 203 glPopMatrix(); 204 205 glPushMatrix(); 206 glTranslatef (this->getObjCompx(1,1), this->getObjCompy(1,1), this->getObjCompz(1,1)); 207 static_cast<StaticModel*>(this->getModel())->draw(5); 208 glPopMatrix(); 209 210 glPushMatrix(); 211 glTranslatef (this->getObjCompx(2,1), this->getObjCompy(2,1), this->getObjCompz(2,1)); 212 static_cast<StaticModel*>(this->getModel())->draw(0); 213 glPopMatrix(); 265 214 266 215 glPopMatrix(); -
branches/presentation/src/world_entities/weapons/heavy_blaster.h
r10516 r10771 2 2 #define HEAVY_BLASTER_H 3 3 4 5 4 #include "weapon.h" 6 7 #define W_LEFT 08 #define W_RIGHT 19 5 10 6 /** … … 34 30 35 31 private: 36 PNode*** objComp;37 Animation3D*** shootAnim;38 PNode** emissionPoint;39 40 int activeBarrel;41 32 42 33 int leftRight; -
branches/presentation/src/world_entities/weapons/light_blaster.cc
r10698 r10771 53 53 { 54 54 55 for (int i = 0; i < this->getBarrels(); i++)56 {57 //delete [] this->shootAnim[i];58 delete [] this->objComp[i];59 }60 delete [] this->emissionPoint;61 //delete [] this->shootAnim;62 delete [] this->objComp;63 64 55 } 65 56 … … 93 84 94 85 this->setBarrels(3); 95 this->setSegs(1); 96 this->activeBarrel = 0; 86 this->setSegs(1); //could be left out 97 87 98 this->objComp = new PNode**[this->getBarrels()]; 99 this->emissionPoint = new PNode*[this->getBarrels()]; 100 // this->shootAnim = new Animation3D**[this->getBarrels()]; 101 for (int i = 0; i < this->getBarrels(); i++) 102 { 103 this->objComp[i] = new PNode* [this->getSegs()]; 104 this->emissionPoint[i] = new PNode; 105 this->emissionPoint[i]->setParent(this); 106 this->emissionPoint[i]->setName("EmissionPoint"); 107 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 108 for(int j = 0; j < this->getSegs(); j++) 109 { 110 this->objComp[i][j] = new PNode; 111 // this->shootAnim[i][j] = new Animation3D(this->objComp[i][j]); 112 // this->shootAnim[i][j]->setInfinity(ANIM_INF_CONSTANT); 113 } 114 } 115 116 this->emissionPoint[0]->setRelCoor(Vector(2.2, 0.0, 0.1)); 117 this->emissionPoint[1]->setRelCoor(Vector(2.2, -0.07, -0.05)); 118 this->emissionPoint[2]->setRelCoor(Vector(2.2, 0.07, -0.05)); 88 this->setEmissionPoint(Vector(2.2, 0.0, 0.1), 0); 89 this->setEmissionPoint(Vector(2.2, -0.07, -0.05), 1); 90 this->setEmissionPoint(Vector(2.2, 0.07, -0.05), 2); 119 91 120 92 // Animation3D* animation1 = this->getAnimation(WS_SHOOTING, this); … … 148 120 pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*180); 149 121 150 pj->setAbsCoor(this-> emissionPoint[this->activeBarrel]->getAbsCoor());122 pj->setAbsCoor(this->getEmissionPoint()); 151 123 pj->setAbsDir(this->getAbsDir()); 152 124 // pj->toList(OM_GROUP_01_PROJ); 153 125 pj->activate(); 154 126 155 // for (int i = 0; i < this->getSegs(); i++) 156 // this->shootAnim[this->activeBarrel][i]->replay(); 157 158 // switch barrel 159 this->activeBarrel = (this->activeBarrel + 1) % this->getBarrels(); 127 this->cycleBarrel(); 160 128 } 161 129 -
branches/presentation/src/world_entities/weapons/light_blaster.h
r10516 r10771 31 31 32 32 private: 33 PNode*** objComp;34 Animation3D*** shootAnim;35 33 36 PNode** emissionPoint;37 38 int activeBarrel;39 34 }; 40 35 -
branches/presentation/src/world_entities/weapons/medium_blaster.cc
r10698 r10771 54 54 MediumBlaster::~MediumBlaster() 55 55 { 56 // model will be deleted from WorldEntity-destructor57 for (int i = 0; i < this->getBarrels(); i++)58 {59 delete [] this->shootAnim[i];60 }61 delete [] this->shootAnim;62 56 } 63 57 … … 76 70 77 71 this->setStateDuration(WS_RELOADING, 0); 78 this->setStateDuration(WS_ACTIVATING, .5); //.5);79 this->setStateDuration(WS_DEACTIVATING, 1); // 1);72 this->setStateDuration(WS_ACTIVATING, .5); 73 this->setStateDuration(WS_DEACTIVATING, 1); 80 74 81 75 this->setEnergyMax(500); … … 94 88 this->setBarrels(1); 95 89 this->setSegs(2); 96 this->activeBarrel = 0;97 90 98 this->objComp = new PNode**[this->getBarrels()];99 this->emissionPoint = new PNode*[this->getBarrels()];100 this->shootAnim = new Animation3D**[this->getBarrels()];101 for (int i = 0; i < this->getBarrels(); i++)102 {103 this->objComp[i] = new PNode* [this->getSegs()];104 this->emissionPoint[i] = new PNode;105 this->emissionPoint[i]->setParent(this); //Parenting emissionPoint to Weapon106 this->emissionPoint[i]->setName("EmissionPoint");107 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);108 this->shootAnim[i] = new Animation3D* [this->getSegs()];109 for(int j = 0; j < this->getSegs(); j++)110 {111 this->objComp[i][j] = new PNode;112 this->shootAnim[i][j] = new Animation3D(this->objComp[i][j]);113 this->shootAnim[i][j]->setInfinity(ANIM_INF_CONSTANT);114 }115 }116 91 117 92 for (int i = 0; i < this->getBarrels(); i++){ 118 this-> shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL);119 this-> shootAnim[i][0]->addKeyFrame(Vector(-1.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL);120 this-> shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);93 this->getShootAnim(i, 0)->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL); 94 this->getShootAnim(i, 0)->addKeyFrame(Vector(-1.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL); 95 this->getShootAnim(i, 0)->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL); 121 96 122 this-> shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL);123 this-> shootAnim[i][1]->addKeyFrame(Vector(.5, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL);124 this-> shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);97 this->getShootAnim(i, 1)->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL); 98 this->getShootAnim(i, 1)->addKeyFrame(Vector(.5, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL); 99 this->getShootAnim(i, 1)->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL); 125 100 } 126 101 … … 131 106 animation3->setInfinity(ANIM_INF_CONSTANT); 132 107 133 this-> emissionPoint[0]->setRelCoor(Vector(3.9, 0.0, 0.0) * this->getScaling());108 this->setEmissionPoint(Vector(3.9, 0.0, 0.0) * this->getScaling()); 134 109 135 110 animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); … … 159 134 160 135 for (int i = 0; i < this->getSegs(); i++) 161 this-> shootAnim[this->activeBarrel][i]->replay();136 this->getShootAnim(this->getActiveBarrel(), i)->replay(); // FIXME needs clean up 162 137 } 163 138 … … 187 162 188 163 glPushMatrix(); 189 glTranslatef (this-> objComp[0][0]->getAbsCoor().x, this->objComp[0][0]->getAbsCoor().y, this->objComp[0][0]->getAbsCoor().z);164 glTranslatef (this->getObjCompx(0,0), this->getObjCompy(0,0), this->getObjCompz(0,0)); 190 165 static_cast<StaticModel*>(this->getModel())->draw(1); 191 166 glPopMatrix(); 192 167 193 168 glPushMatrix(); 194 glTranslatef (this-> objComp[0][1]->getAbsCoor().x, this->objComp[0][1]->getAbsCoor().y, this->objComp[0][1]->getAbsCoor().z);169 glTranslatef (this->getObjCompx(0,1), this->getObjCompy(0,1), this->getObjCompz(0,1)); 195 170 static_cast<StaticModel*>(this->getModel())->draw(2); 196 171 glPopMatrix(); -
branches/presentation/src/world_entities/weapons/medium_blaster.h
r10698 r10771 31 31 32 32 private: 33 PNode*** objComp;34 Animation3D*** shootAnim;35 PNode** emissionPoint;36 37 int activeBarrel;38 33 39 34 }; -
branches/presentation/src/world_entities/weapons/nadion_laser.cc
r10763 r10771 54 54 NadionLaser::~NadionLaser() 55 55 { 56 // model will be deleted from WorldEntity-destructor57 for (int i = 0; i < this->getBarrels(); i++)58 {59 delete [] this->shootAnim[i];60 }61 delete [] this->shootAnim;62 56 } 63 57 … … 92 86 93 87 94 this->setBarrels(1); 95 this->setSegs(1); 96 this->activeBarrel = 0; 88 this->setBarrels(1); // could be left out 89 this->setSegs(1); // could be left out 97 90 98 this->objComp = new PNode**[this->getBarrels()]; 99 this->emissionPoint = new PNode*[this->getBarrels()]; 100 this->shootAnim = new Animation3D**[this->getBarrels()]; 101 for (int i = 0; i < this->getBarrels(); i++) 102 { 103 this->objComp[i] = new PNode* [this->getSegs()]; 104 this->emissionPoint[i] = new PNode; 105 this->emissionPoint[i]->setParent(this); //Parenting emissionPoint to Weapon 106 this->emissionPoint[i]->setName("EmissionPoint"); 107 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 108 this->shootAnim[i] = new Animation3D* [this->getSegs()]; 109 for(int j = 0; j < this->getSegs(); j++) 110 { 111 this->objComp[i][j] = new PNode; 112 this->shootAnim[i][j] = new Animation3D(this->objComp[i][j]); 113 this->shootAnim[i][j]->setInfinity(ANIM_INF_CONSTANT); 114 } 115 } 116 117 this->emissionPoint[0]->setRelCoor(Vector(1.680, 0.0, 0.0) * this->getScaling()); 91 this->setEmissionPoint(Vector(1.680, 0.0, 0.0) * this->getScaling()); 118 92 119 93 Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this); … … 143 117 144 118 Vector dir = (this->getDefaultTarget()->getAbsCoor() - this->getAbsCoor()).getNormalized(); 119 //FIXME direction calculation is a mess, needs to be cleaned up 145 120 // HACK direction AbsDir calulation 146 121 Vector up = dir.cross(VECTOR_RAND(1)); -
branches/presentation/src/world_entities/weapons/nadion_laser.h
r10698 r10771 27 27 28 28 private: 29 PNode*** objComp;30 Animation3D*** shootAnim;31 PNode** emissionPoint;32 33 int activeBarrel;34 29 35 30 }; -
branches/presentation/src/world_entities/weapons/rf_cannon.cc
r10728 r10771 55 55 RFCannon::~RFCannon() 56 56 { 57 for (int i = 0; i < this->getBarrels(); i++)58 delete [] this->objComp[i];59 60 delete [] this->emissionPoint;61 delete [] this->objComp;62 57 } 63 58 … … 91 86 this->setBarrels(4); 92 87 this->setSegs(1); 93 this-> activeBarrel =(rand() % 4);88 this->setActiveBarrel(rand() % 4); 94 89 95 this->objComp = new PNode**[this->getBarrels()];96 this->emissionPoint = new PNode*[this->getBarrels()];97 for (int i = 0; i < this->getBarrels(); i++) {98 this->objComp[i] = new PNode* [this->getSegs()];99 this->emissionPoint[i] = new PNode;100 this->emissionPoint[i]->setParent(this);101 this->emissionPoint[i]->setName("EmissionPoint");102 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);103 for(int j = 0; j < this->getSegs(); j++) {104 this->objComp[i][j] = new PNode;105 }106 }107 90 108 this-> emissionPoint[0]->setRelCoor(Vector(4.1, 0.0, 0.75) * this->getScaling());109 this-> emissionPoint[1]->setRelCoor(Vector(4.1, 0.45, 0.0) * this->getScaling());110 this-> emissionPoint[2]->setRelCoor(Vector(4.1, 0.0, -0.75) * this->getScaling());111 this-> emissionPoint[3]->setRelCoor(Vector(4.1, -0.45, 0.0) * this->getScaling());91 this->setEmissionPoint(Vector(4.1, 0.0, 0.75) * this->getScaling(), 0); 92 this->setEmissionPoint(Vector(4.1, 0.45, 0.0) * this->getScaling(), 1); 93 this->setEmissionPoint(Vector(4.1, 0.0, -0.75) * this->getScaling(), 2); 94 this->setEmissionPoint(Vector(4.1, -0.45, 0.0) * this->getScaling(), 3); 112 95 113 96 Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this); … … 140 123 pj->setVelocity(this->getParent()->getVelocity() + (tmp.getNormalized())*190); 141 124 142 pj->setAbsCoor(this->emissionPoint[this->activeBarrel]->getAbsCoor()); 125 pj->setAbsCoor(this->getEmissionPoint()); 126 //FIXME pj needs a absDir 143 127 // pj->setAbsDir(this->getAbsDir()); 144 128 // pj->setAbsDir(Quaternion(tmp.getNormalized(), this->getParent()->getAbsDir().apply(Vector(0,1,0)))); … … 146 130 pj->activate(); 147 131 148 this-> activeBarrel = (this->activeBarrel + 1) % this->getBarrels();132 this->cycleBarrel(); 149 133 } 150 134 -
branches/presentation/src/world_entities/weapons/rf_cannon.h
r10698 r10771 29 29 30 30 private: 31 PNode*** objComp;32 Animation3D*** shootAnim;33 31 34 PNode** emissionPoint;35 36 int activeBarrel;37 32 }; 38 33 -
branches/presentation/src/world_entities/weapons/test_gun.h
r9869 r10771 31 31 * @todo this will be reset with mirror X/Y/Z 32 32 */ 33 #define W_LEFT 034 #define W_RIGHT 133 // #define W_LEFT 0 34 // #define W_RIGHT 1 35 35 36 36 -
branches/presentation/src/world_entities/weapons/weapon.cc
r10698 r10771 62 62 if (OrxSound::SoundSource::objectList().exists(this->soundSource)) 63 63 delete this->soundSource; 64 65 // for (int i = 0; i < MAX_BARRELS; i++) 66 // { 67 // delete [] this->shootAnim[i]; 68 // delete [] this->objComp[i]; 69 // } 70 // delete [] this->emissionPoint; 71 // delete [] this->shootAnim; 72 // delete [] this->objComp; 73 64 74 } 65 75 … … 121 131 this->soundSource = new OrxSound::SoundSource(this); //< Every Weapon has exacty one SoundSource 122 132 123 this->barrels = 1; 133 this->barrels = 1; // just to have an initial value 124 134 this->segs = 1; 135 this->activeBarrel = 0; 125 136 126 137 this->preferedSide = -1; 127 138 this->preferedSlot = -1; 128 129 this->shootAnim = new Animation3D**[this->getBarrels()]; 130 for (int i = 0; i < this->getBarrels(); i++) 131 this->shootAnim[i] = new Animation3D* [this->getSegs()]; 132 133 this->emissionPoint = new PNode*[this->barrels]; 134 for(int i = 0; i < this->barrels; i++){ 139 this->side = -1; 140 141 //!< forward initialisation of animation and emissionpoints 142 for (int i = 0; i < MAX_BARRELS; i++){ 135 143 this->emissionPoint[i] = new PNode; 136 144 this->emissionPoint[i]->setParent(this); //Parenting emissionPoint to Weapons 137 145 this->emissionPoint[i]->setName("EmissionPoint"); 138 146 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 147 for(int j = 0; j < MAX_SEGMENTS; j++) 148 { 149 this->objComp[i][j] = new PNode; 150 this->shootAnim[i][j] = new Animation3D(this->objComp[i][j]); 151 this->shootAnim[i][j]->setInfinity(ANIM_INF_CONSTANT); 152 } 139 153 } 140 154 … … 149 163 this->maxCharge = 1.0; //< The maximum charge is also one unit. 150 164 151 this->energy = 10 ; //< The secondary Buffer (before we have to reload)165 this->energy = 10.0; //< The secondary Buffer (before we have to reload) 152 166 this->energyMax = 10.0; //< How much energy can be carried 153 167 this->capability = WTYPE_ALL; //< The Weapon has all capabilities @see W_Capability. … … 176 190 LoadParam(root, "slot", this, Weapon, setPreferedSlot) 177 191 .describe("slot this weapon will be added"); 178 /*179 LoadParam(root, "emission-point", this, Weapon, setEmissionPoint)180 .describe("Sets the Point of emission of this weapon (1: EmmsionVector; 2: EmissionPoint)");*/181 192 182 193 LoadParam(root, "state-duration", this, Weapon, setStateDuration) … … 274 285 * sets the emissionPoint's relative position from the Weapon 275 286 * @param point the Point relative to the mass-point of the Weapon 287 * @param barrel (optional) define a specific barrel, default = 0 276 288 */ 277 289 void Weapon::setEmissionPoint(const Vector& point, int barrel) … … 280 292 } 281 293 282 void Weapon::setEmissionPoint(const Vector& point)283 {284 this->emissionPoint[0]->setRelCoor(point);285 }294 // void Weapon::setEmissionPoint(const Vector& point) 295 // { 296 // this->emissionPoint[0]->setRelCoor(point); 297 // } 286 298 287 299 /** -
branches/presentation/src/world_entities/weapons/weapon.h
r10707 r10771 20 20 21 21 #include "sound_buffer.h" 22 23 #define MAX_SEGMENTS 3 24 #define MAX_BARRELS 4 25 26 #define W_LEFT 0 27 #define W_RIGHT 1 22 28 23 29 // FORWARD DECLARATION … … 129 135 // EMISSION 130 136 /** keeping old functions*/ 131 void setEmissionPoint(const Vector& point, int barrel );132 void setEmissionPoint(const Vector& point);137 void setEmissionPoint(const Vector& point, int barrel = 0); 138 // void setEmissionPoint(const Vector& point); 133 139 /** @see void setEmissionPoint(const Vector& point); */ 134 inline void setEmissionPoint(float x, float y, float z, int barrel ) { this->setEmissionPoint(Vector(x, y, z), barrel); };135 inline void setEmissionPoint(float x, float y, float z) { this->setEmissionPoint(Vector(x, y, z)); };140 inline void setEmissionPoint(float x, float y, float z, int barrel = 0) { this->setEmissionPoint(Vector(x, y, z), barrel); }; 141 // inline void setEmissionPoint(float x, float y, float z) { this->setEmissionPoint(Vector(x, y, z)); }; 136 142 /** @returns the absolute Position of the EmissionPoint */ 137 143 inline const Vector& getEmissionPoint(int barrel) const { return this->emissionPoint[barrel]->getAbsCoor(); }; 138 inline const Vector& getEmissionPoint() const { return this->emissionPoint[ 0]->getAbsCoor(); };144 inline const Vector& getEmissionPoint() const { return this->emissionPoint[this->activeBarrel]->getAbsCoor(); }; 139 145 140 146 … … 182 188 inline void setBarrels(int barrels) { this->barrels = barrels; }; 183 189 inline void setSegs(int segs) { this->segs = segs; }; 184 185 // inline Animation3D* getShootAnim(int barrel, int seg) { return this->shootAnim[barrel][seg]; }; 186 // inline void setShootAnim(int barrel, int seg, PNode* component) { this->shootAnim[barrel][seg] = this->getAnimation(barrel, seg, component); }; 190 inline void setActiveBarrel(int ab) {this->activeBarrel = ab; }; 191 inline int getActiveBarrel() { return this->activeBarrel; }; 192 inline void cycleBarrel() { this->activeBarrel = (this->activeBarrel + 1) % this->barrels; }; 193 194 Animation3D* getShootAnim(int barrel, int seg) { return this->shootAnim[barrel][seg]; }; 195 // void setShootAnim(int barrel, int seg, PNode* component) { this->shootAnim[barrel][seg] = this->getAnimation(barrel, seg, component); }; 187 196 188 197 // void init2(); 189 void deconstr();198 // void deconstr(); 190 199 191 200 inline int getPreferedSide() { return this->preferedSide; } … … 194 203 inline void setEnergyWidgetInitialized(bool b) {this->isEnergyWidgetInitialized = b;}; 195 204 205 inline const Vector& getObjComp(int barrel, int seg) const { return this->objComp[barrel][seg]->getAbsCoor(); }; 206 inline const float getObjCompx(int barrel, int seg) const { return this->objComp[barrel][seg]->getAbsCoor().x; }; 207 inline const float getObjCompy(int barrel, int seg) const { return this->objComp[barrel][seg]->getAbsCoor().y; }; 208 inline const float getObjCompz(int barrel, int seg) const { return this->objComp[barrel][seg]->getAbsCoor().z; }; 196 209 197 210 protected: … … 264 277 OrxSound::SoundBuffer soundBuffers[WA_ACTION_COUNT]; //!< SoundBuffers for all actions @see WeaponAction. 265 278 266 PNode* * emissionPoint; //!< The point, where the projectiles are emitted. (this is coppled with the Weapon by default)279 PNode* emissionPoint[MAX_BARRELS]; //!< The point, where the projectiles are emitted. (this is coppled with the Weapon by default) 267 280 268 281 bool hideInactive; //!< Hides the Weapon if it is inactive … … 272 285 FastFactory* projectileFactory; //!< A factory, that produces and handles the projectiles. 273 286 274 int barrels; //!< # of barrels 275 int segs; //!< # of segments, one barrel has 276 Animation3D*** shootAnim; 287 int barrels; //!< # of barrels (max 4) 288 int segs; //!< # of segments, one barrel has (max 3) 289 int activeBarrel; 290 Animation3D* shootAnim[MAX_BARRELS][MAX_SEGMENTS]; 291 PNode* objComp[MAX_BARRELS][MAX_SEGMENTS]; 277 292 278 293 int preferedSlot; //!< prefered slot to add 279 294 int preferedSide; //!< prefered side (left/right) to be added 295 int side; //!< describes left/right orientation of the weapon. 280 296 281 297 }; -
branches/presentation/src/world_entities/world_entity.cc
r10770 r10771 54 54 55 55 SHELL_COMMAND(model, WorldEntity, loadModel) 56 ->describe("sets the Model of the WorldEntity")57 ->defaultValues("models/ships/fighter.obj", 1.0f);56 ->describe("sets the Model of the WorldEntity") 57 ->defaultValues("models/ships/fighter.obj", 1.0f); 58 58 59 59 SHELL_COMMAND(debugEntity, WorldEntity, debugWE);
Note: See TracChangeset
for help on using the changeset viewer.