Changeset 9832 in orxonox.OLD for branches/new_class_id/src/lib/graphics
- Timestamp:
- Sep 26, 2006, 3:44:38 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib/graphics/importer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/graphics/importer/static_model.cc
r9830 r9832 37 37 */ 38 38 StaticModel::StaticModel(const std::string& modelName) 39 : data(new StaticModelData(modelName))39 : data(new StaticModelData(modelName)) 40 40 { 41 41 this->registerObject(this, StaticModel::_objectList); … … 43 43 this->setName(modelName); 44 44 } 45 46 StaticModel::StaticModel(const StaticModel& staticModel) 47 : data(staticModel.data) 48 { 49 this->registerObject(this, StaticModel::_objectList); 50 this->setName(staticModel.getName()); 51 this->updateBase(); 52 } 53 45 54 46 55 /** … … 60 69 } 61 70 71 StaticModel& StaticModel::operator=(const StaticModel& model) 72 { 73 this->data = model.data; 74 this->updateBase(); 75 return *this; 76 }; 77 78 62 79 /** 63 80 * @brief Finalizes an Object. This can be done outside of the Class. … … 66 83 { 67 84 data->finalize(); 85 this->updateBase(); 86 } 68 87 69 // write out the modelInfo data used for the collision detection! 70 this->pModelInfo.pVertices = &this->data->getVertices()[0]; 71 this->pModelInfo.numVertices = this->data->getVertices().size(); 72 this->pModelInfo.pNormals = &this->data->getNormals()[0]; 73 this->pModelInfo.numNormals = this->data->getNormals().size(); 74 this->pModelInfo.pTexCoor = &this->data->getTexCoords()[0]; 75 this->pModelInfo.numTexCoor = this->data->getTexCoords().size(); 76 77 this->pModelInfo.pTriangles = this->data->getTrianglesExt(); 78 this->pModelInfo.numTriangles = this->data->getTriangles().size(); 88 void StaticModel::acquireData(const StaticModelData::Pointer& data) 89 { 90 this->data = data; 91 this->updateBase(); 79 92 } 80 93 … … 92 105 return retVal; 93 106 } 107 108 void StaticModel::updateBase() 109 { 110 // write out the modelInfo data used for the collision detection! 111 this->pModelInfo.pVertices = &this->data->getVertices()[0]; 112 this->pModelInfo.numVertices = this->data->getVertices().size(); 113 this->pModelInfo.pNormals = &this->data->getNormals()[0]; 114 this->pModelInfo.numNormals = this->data->getNormals().size(); 115 this->pModelInfo.pTexCoor = &this->data->getTexCoords()[0]; 116 this->pModelInfo.numTexCoor = this->data->getTexCoords().size(); 117 118 this->pModelInfo.pTriangles = this->data->getTrianglesExt(); 119 this->pModelInfo.numTriangles = this->data->getTriangles().size(); 120 } 121 94 122 95 123 /** -
branches/new_class_id/src/lib/graphics/importer/static_model.h
r9831 r9832 24 24 { 25 25 ObjectListDeclaration(StaticModel); 26 26 public: 27 27 StaticModel(const std::string& modelName = ""); 28 StaticModel(const StaticModel& staticModel); 28 29 virtual ~StaticModel(); 29 30 30 StaticModel& operator=(const StaticModel& model) { this->data = model.data; return *this; };31 StaticModel& operator=(const StaticModel& model); 31 32 32 33 virtual void draw() const { data->draw(); }; … … 58 59 void finalize(); 59 60 60 void acquireData(const StaticModelData::Pointer& data) { this->data = data; };61 void acquireData(const StaticModelData::Pointer& data); 61 62 const StaticModelData::Pointer& dataPointer() const { return this->data; }; 62 63 … … 64 65 float getScaleFactor() const { return data->getScaleFactor(); } 65 66 66 67 protected: 67 68 void cubeModel(); 68 69 69 private: 70 StaticModelData::Pointer data; 70 private: 71 void updateBase(); 72 private: 73 StaticModelData::Pointer data; 71 74 }; 72 75
Note: See TracChangeset
for help on using the changeset viewer.