Changeset 4178 in orxonox.OLD for orxonox/branches/physics/src/world_entities
- Timestamp:
- May 13, 2005, 11:16:33 PM (20 years ago)
- Location:
- orxonox/branches/physics
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics
- Property svn:externals
-
old new 1 data http://svn.orxonox.ethz.ch/data 1
-
- Property svn:externals
-
orxonox/branches/physics/src/world_entities/camera.cc
r3953 r4178 139 139 if (tmpFovy > .001) 140 140 this->fovy += (this->toFovy - this->fovy) * dt; 141 Vector tmpPos = (this->toRelCoor - *this->getRelCoor()) * dt;141 Vector tmpPos = (this->toRelCoor - this->getRelCoor()) * dt; 142 142 if (tmpPos.len() >= .001) 143 143 { 144 tmpPos = tmpPos + *this->getRelCoor();144 tmpPos = tmpPos + this->getRelCoor(); 145 145 this->setRelCoor(tmpPos); 146 146 } -
orxonox/branches/physics/src/world_entities/environment.cc
r3739 r4178 30 30 { 31 31 this->model = (Model*) ResourceManager::getInstance()->load("cube", RP_LEVEL); 32 // this->model = new OBJModel("../data/models/fighter.obj");33 32 } 34 33 … … 50 49 void Environment::draw () 51 50 { 51 //this->getRelCoor().debug(); 52 52 53 glMatrixMode(GL_MODELVIEW); 53 54 glPushMatrix(); -
orxonox/branches/physics/src/world_entities/player.cc
r3953 r4178 1 2 3 1 /* 4 2 orxonox - the future of 3D-vertical-scrollers … … 31 29 32 30 using namespace std; 31 32 CREATE_FACTORY(Player); 33 33 34 34 /** … … 52 52 //weapons: 53 53 this->weaponMan = new WeaponManager(); 54 Weapon* wpRight = new TestGun(this, Vector(-2.6, 0.1, 3.0), Quaternion(), 0);54 Weapon* wpRight = new TestGun(this, Vector(-2.6, 0.1, 3.0), Quaternion(), 0); 55 55 Weapon* wpLeft = new TestGun(this, Vector(-2.6, 0.1, -3.0), Quaternion(), 1); 56 56 57 this->weaponMan->addWeapon(wpRight, W_CONFIG0 );58 this->weaponMan->addWeapon(wpLeft, W_CONFIG1 );57 this->weaponMan->addWeapon(wpRight, W_CONFIG0, W_SLOT0); 58 this->weaponMan->addWeapon(wpLeft, W_CONFIG1, W_SLOT1); 59 59 this->weaponMan->addWeapon(wpRight, W_CONFIG2); 60 60 this->weaponMan->addWeapon(wpLeft, W_CONFIG2); … … 74 74 } 75 75 76 /** 77 \brief creates a new Player from Xml Data 78 \param root the xml element containing player data 79 80 \todo add more parameters to load 81 */ 82 Player::Player(TiXmlElement* root) : WorldEntity(root) 83 { 84 this->weapons = new tList<Weapon>(); 85 this->activeWeapon = NULL; 86 /* 87 this is the debug player - actualy we would have to make a new 88 class derivated from Player for each player. for now, we just use 89 the player.cc for debug also 90 */ 91 travelSpeed = 15.0; 92 velocity = new Vector(); 93 bUp = bDown = bLeft = bRight = bAscend = bDescend = false; 94 bFire = false; 95 this->bWeaponChange = false; 96 acceleration = 10.0; 97 //weapons: 98 this->weaponMan = new WeaponManager(); 99 Weapon* wpRight = new TestGun(this, Vector(-2.6, 0.1, 3.0), Quaternion(), 0); 100 Weapon* wpLeft = new TestGun(this, Vector(-2.6, 0.1, -3.0), Quaternion(), 1); 101 102 this->weaponMan->addWeapon(wpRight, W_CONFIG0, W_SLOT0); 103 this->weaponMan->addWeapon(wpLeft, W_CONFIG1, W_SLOT1); 104 this->weaponMan->addWeapon(wpRight, W_CONFIG2); 105 this->weaponMan->addWeapon(wpLeft, W_CONFIG2); 106 } 76 107 77 108 /** … … 188 219 //orthDirection = orthDirection.cross (direction); 189 220 190 if( this->bUp && this->getRelCoor() ->x < 20)221 if( this->bUp && this->getRelCoor().x < 20) 191 222 accel = accel+(direction*acceleration); 192 if( this->bDown && this->getRelCoor() ->x > -5)223 if( this->bDown && this->getRelCoor().x > -5) 193 224 accel = accel-(direction*acceleration); 194 if( this->bLeft && TrackManager::getInstance()->getWidth() > -this->getRelCoor() ->z*2)225 if( this->bLeft && TrackManager::getInstance()->getWidth() > -this->getRelCoor().z*2) 195 226 accel = accel - (orthDirection*acceleration); 196 if( this->bRight && TrackManager::getInstance()->getWidth() > this->getRelCoor() ->z*2)227 if( this->bRight && TrackManager::getInstance()->getWidth() > this->getRelCoor().z*2) 197 228 accel = accel + (orthDirection*acceleration); 198 229 if( this->bAscend ) … … 230 261 { 231 262 PRINTF(3)("recieved command [%s]\n", cmd->cmd); 232 if( !strcmp( cmd->cmd, "up")) this->bUp = !cmd->bUp;233 if( !strcmp( cmd->cmd, "down")) this->bDown = !cmd->bUp;234 if( !strcmp( cmd->cmd, "left")) this->bLeft = !cmd->bUp;235 if( !strcmp( cmd->cmd, "right")) this->bRight = !cmd->bUp;236 if( !strcmp( cmd->cmd, "fire")) this->bFire = !cmd->bUp;237 if( !strcmp( cmd->cmd, "mode")) if(cmd->bUp) this->bWeaponChange = !this->bWeaponChange;238 } 263 if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_UP)) this->bUp = !cmd->bUp; 264 if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_DOWN)) this->bDown = !cmd->bUp; 265 if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_LEFT)) this->bLeft = !cmd->bUp; 266 if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_RIGHT)) this->bRight = !cmd->bUp; 267 if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_FIRE)) this->bFire = !cmd->bUp; 268 if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_NEXT_WEAPON)) if(cmd->bUp) this->bWeaponChange = !this->bWeaponChange; 269 } -
orxonox/branches/physics/src/world_entities/player.h
r3953 r4178 22 22 public: 23 23 Player(); 24 Player(TiXmlElement* root); 24 25 virtual ~Player(); 25 26 -
orxonox/branches/physics/src/world_entities/skybox.cc
r3953 r4178 28 28 29 29 #include "skybox.h" 30 30 31 #include "stdincl.h" 32 #include "factory.h" 31 33 32 34 #include "material.h" … … 36 38 //#include "world_entity.h" 37 39 40 CREATE_FACTORY(SkyBox); 38 41 39 42 using namespace std; … … 45 48 SkyBox::SkyBox(char* fileName) 46 49 { 50 this->preInit(); 51 this->postInit(); 52 } 53 54 SkyBox::SkyBox(TiXmlElement* root) : WorldEntity(root) 55 { 56 this->preInit(); 57 58 const char* string; 59 60 // Model Loading 61 string = grabParameter( root, "materialset"); 62 if( string != NULL) 63 this->setTexture(string, "jpg"); 64 else 65 { 66 PRINTF(0)("SkyBox is missing a proper 'MaterialSet'\n"); 67 } 68 if( this->skyModel == NULL) 69 { 70 PRINTF(0)("SkyBox model '%s' could not be loaded\n", string); 71 } 72 this->postInit(); 73 } 74 75 void SkyBox::preInit(void) 76 { 47 77 this->setClassName("SkyBox"); 78 this->skyModel = NULL; 48 79 this->material = new Material*[6]; 49 for (int i = 0; i < 6; i++)80 for (int i = 0; i < 6; i++) 50 81 { 51 82 this->material[i] = new Material(); … … 56 87 } 57 88 this->setMode(PNODE_MOVEMENT); 58 89 } 90 91 void SkyBox::postInit(void) 92 { 59 93 this->setSize(1900.0); 94 this->rebuild(); 60 95 } 61 96 … … 66 101 SkyBox::~SkyBox() 67 102 { 68 PRINTF(5)("Deleting the SkyBox\n"); 69 103 PRINTF(5)("Deleting SkyBox\n"); 70 104 for (int i = 0; i < 6; i++) 71 105 delete this->material[i]; … … 84 118 void SkyBox::setTexture(const char* name, const char* extension) 85 119 { 86 char* top = new char[strlen(name)+strlen(extension)+ 6];87 char* bottom = new char[strlen(name)+strlen(extension)+ 9];88 char* left = new char[strlen(name)+strlen(extension)+ 7];89 char* right = new char[strlen(name)+strlen(extension)+ 8];90 char* front = new char[strlen(name)+strlen(extension)+ 8];91 char* back = new char[strlen(name)+strlen(extension)+ 7];120 char* top = new char[strlen(name)+strlen(extension)+ 10]; 121 char* bottom = new char[strlen(name)+strlen(extension)+ 10]; 122 char* left = new char[strlen(name)+strlen(extension)+ 10]; 123 char* right = new char[strlen(name)+strlen(extension)+ 10]; 124 char* front = new char[strlen(name)+strlen(extension)+ 10]; 125 char* back = new char[strlen(name)+strlen(extension)+ 10]; 92 126 93 127 sprintf(top, "%s_top.%s", name, extension); … … 100 134 this->setTextures(top, bottom, left, right, front, back); 101 135 136 // deleted alocated memory of this function 102 137 delete []top; 103 138 delete []bottom; … … 125 160 this->material[4]->setDiffuseMap(front); 126 161 this->material[5]->setDiffuseMap(back); 127 128 this->rebuild();129 162 } 130 163 … … 135 168 { 136 169 this->size = size; 137 138 this->rebuild();139 170 } 140 171 … … 149 180 glTranslatef(r.x, r.y, r.z); 150 181 151 this-> model->draw();182 this->skyModel->draw(); 152 183 153 184 glPopMatrix(); … … 162 193 void SkyBox::rebuild() 163 194 { 164 if (this-> model)165 delete model;166 model = new Model();167 168 model->addVertex (-0.5*size, -0.5*size, 0.5*size);169 model->addVertex (0.5*size, -0.5*size, 0.5*size);170 model->addVertex (-0.5*size, 0.5*size, 0.5*size);171 model->addVertex (0.5*size, 0.5*size, 0.5*size);172 model->addVertex (-0.5*size, 0.5*size, -0.5*size);173 model->addVertex (0.5*size, 0.5*size, -0.5*size);174 model->addVertex (-0.5*size, -0.5*size, -0.5*size);175 model->addVertex (0.5*size, -0.5*size, -0.5*size);176 177 model->addVertexTexture (0.0, 0.0);178 model->addVertexTexture (1.0, 0.0);179 model->addVertexTexture (1.0, 1.0);180 model->addVertexTexture (0.0, 1.0);181 182 model->addVertexNormal (0.0, 0.0, 1.0);183 model->addVertexNormal (0.0, 1.0, 0.0);184 model->addVertexNormal (0.0, 0.0, -1.0);185 model->addVertexNormal (0.0, -1.0, 0.0);186 model->addVertexNormal (1.0, 0.0, 0.0);187 model->addVertexNormal (-1.0, 0.0, 0.0);188 189 model->setMaterial(material[0]);190 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 3,2,4, 4,3,4, 6,4,4, 5,1,4); // top191 model->setMaterial(material[1]);192 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 7,4,2, 8,1,2, 2,2,2, 1,3,2); // bottom193 model->setMaterial(material[2]);194 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,1,3, 2,2,3, 4,3,3, 3,4,3); // left195 model->setMaterial(material[3]);196 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 5,3,1, 6,4,1, 8,1,1, 7,2,1); // right197 model->setMaterial(material[4]);198 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,1,6, 8,2,6, 6,3,6, 4,4,6); // front199 model->setMaterial(material[5]);200 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 7,1,5, 1,2,5, 3,3,5, 5,4,5); // back195 if (this->skyModel) 196 delete skyModel; 197 skyModel = new Model(); 198 199 this->skyModel->addVertex (-0.5*size, -0.5*size, 0.5*size); 200 this->skyModel->addVertex (0.5*size, -0.5*size, 0.5*size); 201 this->skyModel->addVertex (-0.5*size, 0.5*size, 0.5*size); 202 this->skyModel->addVertex (0.5*size, 0.5*size, 0.5*size); 203 this->skyModel->addVertex (-0.5*size, 0.5*size, -0.5*size); 204 this->skyModel->addVertex (0.5*size, 0.5*size, -0.5*size); 205 this->skyModel->addVertex (-0.5*size, -0.5*size, -0.5*size); 206 this->skyModel->addVertex (0.5*size, -0.5*size, -0.5*size); 207 208 this->skyModel->addVertexTexture (0.0, 0.0); 209 this->skyModel->addVertexTexture (1.0, 0.0); 210 this->skyModel->addVertexTexture (1.0, 1.0); 211 this->skyModel->addVertexTexture (0.0, 1.0); 212 213 this->skyModel->addVertexNormal (0.0, 0.0, 1.0); 214 this->skyModel->addVertexNormal (0.0, 1.0, 0.0); 215 this->skyModel->addVertexNormal (0.0, 0.0, -1.0); 216 this->skyModel->addVertexNormal (0.0, -1.0, 0.0); 217 this->skyModel->addVertexNormal (1.0, 0.0, 0.0); 218 this->skyModel->addVertexNormal (-1.0, 0.0, 0.0); 219 220 this->skyModel->setMaterial(material[0]); 221 this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,1,3, 3,2,3, 5,3,3, 4,0,3); // top 222 this->skyModel->setMaterial(material[1]); 223 this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,3,1, 7,0,1, 1,1,1, 0,2,1); // bottom 224 this->skyModel->setMaterial(material[2]); 225 this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,2, 1,1,2, 3,2,2, 2,3,2); // left 226 this->skyModel->setMaterial(material[3]); 227 this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,2,0, 5,3,0, 7,0,0, 6,1,0); // right 228 this->skyModel->setMaterial(material[4]); 229 this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,0,5, 7,1,5, 5,2,5, 3,3,6); // front 230 this->skyModel->setMaterial(material[5]); 231 this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,4, 0,1,4, 2,2,4, 4,3,4); // back 201 232 202 model->finalize();203 } 233 this->skyModel->finalize(); 234 } -
orxonox/branches/physics/src/world_entities/skybox.h
r3807 r4178 22 22 public: 23 23 SkyBox(char* fileName = NULL); 24 SkyBox(TiXmlElement* root); 25 24 26 virtual ~SkyBox(); 27 28 void preInit(void); 29 void postInit(void); 30 25 31 26 32 void setSize(float size); … … 33 39 void rebuild(); 34 40 41 Model* skyModel; //!< A Model for the Sky. This must not be the same as the Model from WorldEntity, because it is not alocated through the ResourceManager. 35 42 Material **material; //!< Materials for the SkyBox. sorted by number (0-5) top, bottom, left, right, front, back 36 43 float size; //!< Size of the SkyBox. This should match the frustum maximum range. -
orxonox/branches/physics/src/world_entities/skysphere.cc
r3763 r4178 44 44 { 45 45 if (fileName == NULL) 46 this->initialize(" ../data/pictures/sky-replace.jpg");46 this->initialize("pictures/sky-replace.jpg"); 47 47 else 48 48 this->initialize(fileName); -
orxonox/branches/physics/src/world_entities/terrain.cc
r3677 r4178 77 77 void Terrain::init(void) 78 78 { 79 80 81 79 this->setClassName ("Terrain"); 80 81 this->objectList = 0; 82 82 } 83 83 … … 98 98 glMultMatrixf((float*)matrix); 99 99 100 if (objectList) 101 glCallList(objectList); 102 else if (model) 103 model->draw(); 104 // this->model->draw(); 100 if (this->objectList) 101 glCallList(this->objectList); 102 else if (this->model) 103 this->model->draw(); 105 104 glPopMatrix(); 106 105 } -
orxonox/branches/physics/src/world_entities/test_gun.cc
r3953 r4178 49 49 this->objectComponent1 = new PNode(); 50 50 this->animation1 = new Animation3D(this->objectComponent1); 51 parent->addChild(this->objectComponent1, PNODE_ALL); 51 this->animation2 = new Animation3D(this); 52 this->animation3 = new Animation3D(this); 53 //parent->addChild(this->objectComponent1, PNODE_ALL); 54 this->addChild(this->objectComponent1, PNODE_ALL); 52 55 53 56 this->animation1->setInfinity(ANIM_INF_CONSTANT); 54 // ANIM_LINEAR was ANIM_NEG_EXP 57 this->animation2->setInfinity(ANIM_INF_CONSTANT); 58 this->animation3->setInfinity(ANIM_INF_CONSTANT); 55 59 if( this->leftRight == W_LEFT) 56 60 { 57 61 this->projectileOffset = Vector(1.0, 0.0, -0.35); 58 62 59 this->animation1->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR); 60 this->animation1->addKeyFrame(Vector(-3.0, 0.1, 3.0), Quaternion(), 0.5, ANIM_LINEAR); 61 this->animation1->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR); 63 this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 64 this->animation1->addKeyFrame(Vector(-0.4, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 65 this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT); 66 67 this->animation2->addKeyFrame(Vector(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 68 this->animation2->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 69 70 this->animation3->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 71 this->animation3->addKeyFrame(Vector(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 62 72 } 63 73 else if( this->leftRight == W_RIGHT) … … 65 75 this->projectileOffset = Vector(1.0, 0.0, 0.5); 66 76 67 this->animation1->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR); 68 this->animation1->addKeyFrame(Vector(-3.0, 0.1, -2.5), Quaternion(), 0.5, ANIM_LINEAR); 69 this->animation1->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR); 77 this->objectComponent1->setRelCoor(Vector(0,0,0.35)); 78 this->animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 79 this->animation1->addKeyFrame(Vector(-0.4, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 80 this->animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT); 81 82 this->animation2->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 83 this->animation2->addKeyFrame(Vector(-2.6, 0.1, -3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 84 85 this->animation3->addKeyFrame(Vector(-2.6, 0.1, -3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 86 this->animation3->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 70 87 } 88 71 89 } 72 90 … … 89 107 */ 90 108 void TestGun::activate() 91 {} 109 { 110 this->animation2->replay(); 111 } 92 112 93 113 … … 100 120 */ 101 121 void TestGun::deactivate() 102 {} 122 { 123 this->animation3->replay(); 124 } 103 125 104 126 -
orxonox/branches/physics/src/world_entities/weapon.cc
r3953 r4178 110 110 void WeaponManager::nextWeaponConf() 111 111 { 112 PRINTF(4)("Changing weapon configuration: from %i\n", this->currConfID); 113 114 Weapon* w; 115 for(int i = 0; i < W_MAX_SLOTS; ++i) 116 { 117 w = this->configs[this->currConfID].slots[i]; 118 if( w != NULL) w->deactivate(); 119 } 120 int i; 112 PRINTF(4)("Changing weapon configuration: from %i to next\n", this->currConfID); 113 114 int i, lastConfID; 115 lastConfID = this->currConfID; 121 116 for(i = this->currConfID + 1; i < W_MAX_CONFIGS && !this->configs[i].bUsed; ++i); 122 117 if( i == W_MAX_CONFIGS) this->currConfID = W_CONFIG0; 123 118 else this->currConfID = i; 124 PRINTF(4)("\tto %i\n", this->currConfID); 125 126 for(int i = 0; i < W_MAX_SLOTS; ++i) 127 { 128 w = this->configs[this->currConfID].slots[i]; 129 if( w != NULL) w->activate(); 119 120 121 Weapon *w1, *w2; 122 for(int j = 0; j < W_MAX_SLOTS; ++j) 123 { 124 w1 = this->configs[lastConfID].slots[j]; 125 w2 = this->configs[this->currConfID].slots[j]; 126 127 if( w1 == w2) 128 { 129 printf("no need for change\n"); 130 } 131 else 132 { 133 if( w1 != NULL ) 134 { 135 w1->deactivate(); 136 printf("deactivating %i,%i\n", j,lastConfID); 137 } 138 if( w2 != NULL) 139 { 140 w2->activate(); 141 printf("activating %i,%i\n", j, this->currConfID); 142 } 143 } 130 144 } 131 145 } -
orxonox/branches/physics/src/world_entities/world_entity.cc
r3832 r4178 30 30 /** 31 31 \brief standard constructor 32 33 Every derived contructor HAS to call the previous one supplying the isFree parameter. This is necessary to distunguish 34 between free and bound entities. The difference between them is simply the fact that the movement of a free entity is 35 not bound to the track of a world. Use this to implement projectile or effect classes that do not have to travel along the track. 36 To specify an entity to be free or bound set the default parameter in the declaration of the constructor. 37 Theoretically you should never have to call the constructor of an Entity directly, for it is called by the spawn() function of the World 38 class. So if you want to create a new entity at any time, call World::spawn(). It will handle everything that is necessary. 39 */ 40 WorldEntity::WorldEntity (bool isFree) : bFree(isFree) 32 */ 33 WorldEntity::WorldEntity () 41 34 { 42 35 this->setClassName ("WorldEntity"); … … 47 40 48 41 /** 42 \brief Loads the WordEntity-specific Part of any derived Class 43 */ 44 WorldEntity::WorldEntity(TiXmlElement* root) 45 { 46 // Name Setup 47 char* temp; 48 const char* string; 49 string = grabParameter( root, "name"); 50 if( string == NULL) 51 { 52 PRINTF(2)("WorldEntity is missing a proper 'name'\n"); 53 string = "Unknown"; 54 temp = new char[strlen(string + 2)]; 55 strcpy( temp, string); 56 this->setName( temp); 57 } 58 else 59 { 60 temp = new char[strlen(string + 2)]; 61 strcpy( temp, string); 62 this->setName( temp); 63 } 64 // Model Loading 65 this->model = NULL; 66 string = grabParameter( root, "model"); 67 if( string != NULL) 68 this->model = (Model*)ResourceManager::getInstance()->load(string, OBJ, RP_CAMPAIGN); 69 else 70 { 71 PRINTF(2)("WorldEntity is missing a proper 'model'\n"); 72 this->model = NULL; 73 } 74 if( this->model == NULL) 75 { 76 PRINTF(2)("WorldEntity model '%s' could not be loaded\n", string); 77 } 78 this->bDraw = true; 79 } 80 81 /** 49 82 \brief standard destructor 50 83 */ … … 73 106 {} 74 107 75 76 /**77 \brief query whether the WorldEntity in question is free78 \return true if the WorldEntity is free or false if it isn't79 */80 bool WorldEntity::isFree ()81 {82 return bFree;83 }84 108 85 109 /** -
orxonox/branches/physics/src/world_entities/world_entity.h
r3799 r4178 23 23 24 24 public: 25 WorldEntity (bool isFree = false); 25 WorldEntity (void); 26 WorldEntity(TiXmlElement* root); 26 27 virtual ~WorldEntity (); 27 28 … … 32 33 //void removeAbility(Ability* ability); 33 34 void setDrawable (bool bDraw); 34 bool isFree ();35 35 void setCharacterAttributes(CharacterAttributes* charAttr); 36 36 CharacterAttributes* getCharacterAttributes(); … … 52 52 53 53 private: 54 const bool bFree; //!< If the entity is free.55 54 bool bCollide; //!< If it should be considered for the collisiontest. 56 55 bool bDraw; //!< If it should be visible.
Note: See TracChangeset
for help on using the changeset viewer.