Changeset 4793 in orxonox.OLD for orxonox/trunk/src/lib/graphics
- Timestamp:
- Jul 6, 2005, 12:50:31 PM (19 years ago)
- Location:
- orxonox/trunk/src/lib/graphics/importer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/importer/array.h
r4792 r4793 155 155 156 156 157 157 /** 158 \brief gets back the index of the entry in the array. value check 159 \param entry: the entry to look up 160 \returns the index in the array, -1 if not found 161 */ 158 162 template<class T> 159 163 int Array<T>::getIndex(T* entry) const … … 164 168 for(int i = 0; i < this->entryCount; ++i) 165 169 { 166 if( unlikely( entry == &this->array[i]))170 if( unlikely(*entry == this->array[i])) 167 171 return i; 168 172 } -
orxonox/trunk/src/lib/graphics/importer/model.cc
r4791 r4793 12 12 main-programmer: Benjamin Grauer 13 13 co-programmer: ... 14 15 2005-07-06: (Patrick) added new function buildTriangleList() 14 16 */ 15 17 … … 817 819 bool Model::buildTriangleList() 818 820 { 819 821 /* make sure, that all the arrays are finalized */ 822 this->vertices->finalizeArray(); 823 this->vTexture->finalizeArray(); 824 if( normals->getCount() == 0) // vertices-Array must be built for this 825 this->buildVertexNormals(); 826 this->normals->finalizeArray(); 827 828 if( unlikely((this->triangles = new sTriangle[this->vertices->getCount()]) == 0)); 829 { 830 PRINTF(2)("Could not allocate memory for triangle list\n"); 831 return false; 832 } 833 834 int i = 0; //!< the counter for the triangle array 835 ModelFaceElement* tmpElem; //!< the temporary face element 836 837 /* now iterate through all groups and build up the triangle list */ 838 this->currentGroup = this->firstGroup; 839 while( this->currentGroup != NULL) 840 { 841 // Putting Faces to GL 842 ModelFace* tmpFace = this->currentGroup->firstFace; 843 while (tmpFace != NULL) 844 { 845 tmpElem = tmpFace->firstElem; 846 847 /* if its a triangle just add it to the list */ 848 if (tmpFace->vertexCount == 3) 849 { 850 for(int j = 0; j < 3; ++j) 851 { 852 //this->triangles[i].indexToVertices[j] = this->vertices->getIndex(tmpElem); 853 tmpElem = tmpElem->next; 854 } 855 } 856 857 ModelFaceElement* tmpElem = tmpFace->firstElem; 858 while (tmpElem != NULL) 859 { 860 // PRINTF(2)("%s\n", tmpElem->value); 861 this->addGLElement(tmpElem); 862 tmpElem = tmpElem->next; 863 } 864 tmpFace = tmpFace->next; 865 } 866 glEnd(); 867 glEndList(); 868 869 this->currentGroup = this->currentGroup->next; 870 } 820 871 } 821 872 -
orxonox/trunk/src/lib/graphics/importer/model.h
r4791 r4793 7 7 #define _MODEL_H 8 8 9 #include "abstract_model.h" 9 10 #include "base_object.h" 10 11 #include "material.h" … … 17 18 template<class T> class Array; 18 19 template<class T> class tList; 20 19 21 20 22 //! an enumerator fot the different Model Types. … … 176 178 Array<GLfloat>* normals; //!< The Array that handles the Normals. 177 179 Array<GLfloat>* vTexture; //!< The Array that handles the VertexTextureCoordinates. 180 sTriangle* triangles; //!< The Array of triangles in the abstract_model.h style 178 181 179 182 ModelGroup* firstGroup; //!< The first of all groups.
Note: See TracChangeset
for help on using the changeset viewer.