Changeset 7711 in orxonox.OLD for trunk/src/lib/graphics/importer
- Timestamp:
- May 18, 2006, 11:44:21 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/static_model.cc
r7676 r7711 196 196 this->buildTriangleList(); 197 197 198 // write out the modelInfo data used for the collision detection! 198 199 this->pModelInfo.pVertices = &this->vertices[0]; 199 200 this->pModelInfo.pNormals = &this->normals[0]; … … 805 806 this->buildVertexNormals(); 806 807 807 int index = 0; //!< the counter for the triangle array808 ModelFaceElement* tmpElem; //!< the temporary faceelement reference809 ModelFace* tmpFace; //!< the temporary face referece808 int index = 0; //!< the counter for the triangle array 809 ModelFaceElement* tmpElem; //!< the temporary faceelement reference 810 ModelFace* tmpFace; //!< the temporary face referece 810 811 811 812 bool warned = false; 813 814 this->pModelInfo.numTriangles = 0; 812 815 813 816 /* count the number of triangles */ … … 819 822 while( tmpFace != NULL) 820 823 { 821 822 824 /* if its a triangle just add it to the list */ 823 if( tmpFace->vertexCount == 3) 824 { 825 if( tmpFace->vertexCount == 3){ 825 826 ++this->pModelInfo.numTriangles; 826 827 } /* if the polygon is a quad */ 827 else if( tmpFace->vertexCount == 4) 828 { 828 else if( tmpFace->vertexCount == 4) { 829 829 this->pModelInfo.numTriangles += 2; 830 830 } 831 else if( tmpFace->vertexCount > 4) 832 { 833 if (!warned) 834 { 831 else if( tmpFace->vertexCount > 4) { 832 if (!warned) { 835 833 PRINTF(2)("This model (%s) got over 4 vertices per face <=> conflicts in the CD engine!\n", this->getName()); 836 834 warned = true; 837 835 } 838 //exit(0);839 836 } 840 837 tmpFace = tmpFace->next; … … 859 856 while( this->currentGroup != NULL) 860 857 { 861 // Putting Faces to GL862 858 tmpFace = this->currentGroup->firstFace; 863 859 while( tmpFace != NULL) … … 870 866 for( int j = 0; j < 3; ++j) 871 867 { 872 this->pModelInfo.pTriangles[index].indexToVertices[j] = (unsigned int)tmpElem->vertexNumber /* * 3 */;873 this->pModelInfo.pTriangles[index].indexToNormals[j] = (unsigned int)tmpElem->normalNumber /* * 3 */;874 this->pModelInfo.pTriangles[index].indexToTexCoor[j] = (unsigned int)tmpElem->texCoordNumber /* * 3 */;868 this->pModelInfo.pTriangles[index].indexToVertices[j] = (unsigned int)tmpElem->vertexNumber * 3 ; 869 this->pModelInfo.pTriangles[index].indexToNormals[j] = (unsigned int)tmpElem->normalNumber * 3 ; 870 this->pModelInfo.pTriangles[index].indexToTexCoor[j] = (unsigned int)tmpElem->texCoordNumber * 3 ; 875 871 tmpElem = tmpElem->next; 872 876 873 } 877 874 ++index; … … 880 877 { 881 878 882 this->pModelInfo.pTriangles[index].indexToVertices[0] = (unsigned int)tmpElem->vertexNumber ;883 this->pModelInfo.pTriangles[index].indexToNormals[0] = (unsigned int)tmpElem->normalNumber ;884 this->pModelInfo.pTriangles[index].indexToTexCoor[0] = (unsigned int)tmpElem->texCoordNumber ;885 886 this->pModelInfo.pTriangles[index + 1].indexToVertices[0] = (unsigned int)tmpElem->vertexNumber ;887 this->pModelInfo.pTriangles[index + 1].indexToNormals[0] = (unsigned int)tmpElem->normalNumber ;888 this->pModelInfo.pTriangles[index + 1].indexToTexCoor[0] = (unsigned int)tmpElem->texCoordNumber ;879 this->pModelInfo.pTriangles[index].indexToVertices[0] = (unsigned int)tmpElem->vertexNumber * 3; 880 this->pModelInfo.pTriangles[index].indexToNormals[0] = (unsigned int)tmpElem->normalNumber * 3; 881 this->pModelInfo.pTriangles[index].indexToTexCoor[0] = (unsigned int)tmpElem->texCoordNumber * 3; 882 883 this->pModelInfo.pTriangles[index + 1].indexToVertices[0] = (unsigned int)tmpElem->vertexNumber * 3; 884 this->pModelInfo.pTriangles[index + 1].indexToNormals[0] = (unsigned int)tmpElem->normalNumber * 3; 885 this->pModelInfo.pTriangles[index + 1].indexToTexCoor[0] = (unsigned int)tmpElem->texCoordNumber * 3; 889 886 tmpElem = tmpElem->next; 890 887 891 this->pModelInfo.pTriangles[index].indexToVertices[1] = (unsigned int)tmpElem->vertexNumber ;892 this->pModelInfo.pTriangles[index].indexToNormals[1] = (unsigned int)tmpElem->normalNumber ;893 this->pModelInfo.pTriangles[index].indexToTexCoor[1] = (unsigned int)tmpElem->texCoordNumber ;888 this->pModelInfo.pTriangles[index].indexToVertices[1] = (unsigned int)tmpElem->vertexNumber * 3; 889 this->pModelInfo.pTriangles[index].indexToNormals[1] = (unsigned int)tmpElem->normalNumber * 3; 890 this->pModelInfo.pTriangles[index].indexToTexCoor[1] = (unsigned int)tmpElem->texCoordNumber * 3; 894 891 tmpElem = tmpElem->next; 895 892 896 this->pModelInfo.pTriangles[index].indexToVertices[2] = (unsigned int)tmpElem->vertexNumber ;897 this->pModelInfo.pTriangles[index].indexToNormals[2] = (unsigned int)tmpElem->normalNumber ;898 this->pModelInfo.pTriangles[index].indexToTexCoor[2] = (unsigned int)tmpElem->texCoordNumber ;899 900 this->pModelInfo.pTriangles[index + 1].indexToVertices[2] = (unsigned int)tmpElem->vertexNumber ;901 this->pModelInfo.pTriangles[index + 1].indexToNormals[2] = (unsigned int)tmpElem->normalNumber ;902 this->pModelInfo.pTriangles[index + 1].indexToTexCoor[2] = (unsigned int)tmpElem->texCoordNumber ;893 this->pModelInfo.pTriangles[index].indexToVertices[2] = (unsigned int)tmpElem->vertexNumber * 3; 894 this->pModelInfo.pTriangles[index].indexToNormals[2] = (unsigned int)tmpElem->normalNumber * 3; 895 this->pModelInfo.pTriangles[index].indexToTexCoor[2] = (unsigned int)tmpElem->texCoordNumber * 3; 896 897 this->pModelInfo.pTriangles[index + 1].indexToVertices[2] = (unsigned int)tmpElem->vertexNumber * 3; 898 this->pModelInfo.pTriangles[index + 1].indexToNormals[2] = (unsigned int)tmpElem->normalNumber * 3; 899 this->pModelInfo.pTriangles[index + 1].indexToTexCoor[2] = (unsigned int)tmpElem->texCoordNumber * 3; 903 900 tmpElem = tmpElem->next; 904 901 905 this->pModelInfo.pTriangles[index + 1].indexToVertices[1] = (unsigned int)tmpElem->vertexNumber ;906 this->pModelInfo.pTriangles[index + 1].indexToNormals[1] = (unsigned int)tmpElem->normalNumber ;907 this->pModelInfo.pTriangles[index + 1].indexToTexCoor[1] = (unsigned int)tmpElem->texCoordNumber ;902 this->pModelInfo.pTriangles[index + 1].indexToVertices[1] = (unsigned int)tmpElem->vertexNumber * 3; 903 this->pModelInfo.pTriangles[index + 1].indexToNormals[1] = (unsigned int)tmpElem->normalNumber * 3; 904 this->pModelInfo.pTriangles[index + 1].indexToTexCoor[1] = (unsigned int)tmpElem->texCoordNumber * 3; 908 905 909 906 index += 2;
Note: See TracChangeset
for help on using the changeset viewer.