Changeset 3542 in orxonox.OLD for orxonox/branches/levelloader/src/world_entities/environment.cc
- Timestamp:
- Mar 14, 2005, 9:58:58 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/levelloader/src/world_entities/environment.cc
r3499 r3542 26 26 27 27 28 CREATE_FACTORY(Environment); 28 29 29 30 Environment::Environment () : WorldEntity() … … 32 33 } 33 34 34 35 Environment::Environment ( TiXmlElement* root) 36 { 37 char* temp; 38 const char* string = grabParameter( root, "name"); 39 if( string == NULL) 40 { 41 PRINTF(1)("Environment is missing a proper 'name'\n"); 42 string = "Unknown"; 43 temp = new char[strlen(string + 2)]; 44 strcpy( temp, string); 45 this->setName( temp); 46 } 47 else 48 { 49 temp = new char[strlen(string + 2)]; 50 strcpy( temp, string); 51 this->setName( temp); 52 } 53 54 this->model = NULL; 55 string = grabParameter( root, "model"); 56 if( string != NULL) 57 this->model = new OBJModel( string); 58 else 59 { 60 PRINTF(1)("Environment is missing a proper 'model'\n"); 61 this->model = new OBJModel( "../data/models/reaplow.obj"); 62 } 63 if( this->model == NULL) 64 { 65 PRINTF(1)("Environment model '%s' could not be loaded\n", string); 66 } 67 68 double buff[3]; 69 70 string = grabParameter( root, "position"); 71 if( string != NULL && sscanf( string, "%f,%f,%f", &(buff[0]), &(buff[1]), &(buff[2])) == 3) 72 { 73 Vector* es = new Vector( buff[0], buff[1], buff[2]); 74 this->setAbsCoor(es); 75 delete es; 76 } 77 else 78 { 79 PRINTF(1)("Environment is missing a proper 'position'\n"); 80 Vector* es = new Vector(); 81 this->setAbsCoor(es); 82 delete es; 83 } 84 85 string = grabParameter( root, "orientation"); 86 if( string != NULL && sscanf( string, "%f,%f,%f", &(buff[0]), &(buff[1]), &(buff[2])) == 3) 87 { 88 Quaternion* qs = new Quaternion( buff[0], buff[1], buff[2]); 89 this->setAbsDir(qs); 90 delete qs; 91 } 92 else 93 { 94 PRINTF(1)("Environment is missing a proper 'orientation'\n"); 95 Quaternion* qs = new Quaternion (); 96 this->setAbsDir(qs); 97 delete qs; 98 } 99 } 35 100 36 101 Environment::~Environment ()
Note: See TracChangeset
for help on using the changeset viewer.