Changeset 4799 in orxonox.OLD for orxonox/trunk/src/lib/graphics
- Timestamp:
- Jul 6, 2005, 3:55:22 PM (19 years ago)
- Location:
- orxonox/trunk/src/lib/graphics/importer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/importer/array.h
r4797 r4799 41 41 inline unsigned int getCount()const { return this->entryCount; }; 42 42 inline int getIndex(T* entry) const; 43 inline bool isFinalized() { return this->finalized; }43 inline bool isFinalized() const { return this->finalized; } 44 44 void debug() const ; 45 45 … … 104 104 // if ((array = (GLfloat*)malloc( entryCount* sizeof(GLfloat))) == NULL) 105 105 if (!(this->array = new GLfloat [this->entryCount])) 106 PRINTF( 1)("could not allocate %i data Blocks\n", this->entryCount);106 PRINTF(0)("could not allocate %i data Blocks\n", this->entryCount); 107 107 Entry* walker = this->firstEntry; 108 108 for (int i=0; i<this->entryCount; i++) -
orxonox/trunk/src/lib/graphics/importer/model.cc
r4798 r4799 225 225 void Model::draw () const 226 226 { 227 /* 227 228 PRINTF(4)("drawing the 3D-Models\n"); 228 229 ModelGroup* tmpGroup = this->firstGroup; … … 233 234 tmpGroup = tmpGroup->next; 234 235 } 236 */ 237 238 if(unlikely(this->triangles == NULL)) 239 return; 240 241 const GLfloat* pVertices = NULL; 242 243 glBegin(GL_TRIANGLES); 244 for( int i = 0; i < this->triangleCount; ++i) 245 { 246 pVertices = &this->vertices->getArray()[this->triangles[i].indexToVertices[0]]; 247 glVertex3f(pVertices[0], pVertices[1], pVertices[2]); 248 249 pVertices = &this->vertices->getArray()[this->triangles[i].indexToVertices[1]]; 250 glVertex3f(pVertices[0], pVertices[1], pVertices[2]); 251 252 pVertices = &this->vertices->getArray()[this->triangles[i].indexToVertices[2]]; 253 glVertex3f(pVertices[0], pVertices[1], pVertices[2]); 254 255 256 // glVertex3fv(&this->vertices->getArray()[this->triangles[i].indexToVertices[1]]); 257 // glVertex3fv(&this->vertices->getArray()[this->triangles[i].indexToVertices[2]]); 258 } 259 glEnd(); 235 260 } 236 261 … … 874 899 875 900 /* allocate memory for the new triangle structures */ 876 if( unlikely((this->triangles = new sTriangleExt[this->triangleCount]) == 0));901 if( (this->triangles = new sTriangleExt[this->triangleCount]) == NULL) 877 902 { 878 PRINTF( 2)("Could not allocate memory for triangle list\n");903 PRINTF(1)("Could not allocate memory for triangle list\n"); 879 904 return false; 880 905 } … … 907 932 this->triangles[index].indexToVertices[0] = (unsigned int)tmpElem->vertexNumber; 908 933 this->triangles[index].indexToTexCoor[0] = (unsigned int)tmpElem->texCoordNumber; 934 935 this->triangles[index + 1].indexToVertices[0] = (unsigned int)tmpElem->vertexNumber; 936 this->triangles[index + 1].indexToTexCoor[0] = (unsigned int)tmpElem->texCoordNumber; 909 937 tmpElem = tmpElem->next; 910 938 911 939 this->triangles[index].indexToVertices[1] = (unsigned int)tmpElem->vertexNumber; 912 940 this->triangles[index].indexToTexCoor[1] = (unsigned int)tmpElem->texCoordNumber; 941 942 this->triangles[index + 1].indexToVertices[1] = (unsigned int)tmpElem->vertexNumber; 943 this->triangles[index + 1].indexToTexCoor[1] = (unsigned int)tmpElem->texCoordNumber; 913 944 tmpElem = tmpElem->next; 914 945 915 946 this->triangles[index].indexToVertices[2] = (unsigned int)tmpElem->vertexNumber; 916 947 this->triangles[index].indexToTexCoor[2] = (unsigned int)tmpElem->texCoordNumber; 917 ++index;918 919 this->triangles[index].indexToVertices[0] = (unsigned int)tmpElem->vertexNumber;920 this->triangles[index].indexToTexCoor[0] = (unsigned int)tmpElem->texCoordNumber;921 948 tmpElem = tmpElem->next; 922 949 923 this->triangles[index].indexToVertices[1] = (unsigned int)tmpElem->vertexNumber; 924 this->triangles[index].indexToTexCoor[1] = (unsigned int)tmpElem->texCoordNumber; 925 tmpElem = tmpElem->next; 926 927 this->triangles[index].indexToVertices[2] = (unsigned int)tmpElem->vertexNumber; 928 this->triangles[index].indexToTexCoor[2] = (unsigned int)tmpElem->texCoordNumber; 929 ++index; 950 this->triangles[index + 1].indexToVertices[2] = (unsigned int)tmpElem->vertexNumber; 951 this->triangles[index + 1].indexToTexCoor[2] = (unsigned int)tmpElem->texCoordNumber; 952 953 index += 2; 930 954 } 955 tmpFace = tmpFace->next; 931 956 } 932 957 this->currentGroup = this->currentGroup->next; 933 958 } 959 return true; 934 960 } 935 961
Note: See TracChangeset
for help on using the changeset viewer.