Changeset 2758 in orxonox.OLD for orxonox/branches/importer
- Timestamp:
- Nov 9, 2004, 2:01:18 AM (20 years ago)
- Location:
- orxonox/branches/importer/importer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/importer/importer/array.cc
r2754 r2758 5 5 createArray (2000); 6 6 } 7 Array::Array ( int arraySize)7 Array::Array (unsigned int arraySize) 8 8 { 9 9 createArray (arraySize); 10 10 } 11 11 12 void Array::createArray ( int newArraySize)12 void Array::createArray (unsigned int newArraySize) 13 13 { 14 14 array = new GLfloat [newArraySize]; … … 18 18 } 19 19 20 void Array::resizeArray ( int newSize)20 void Array::resizeArray (unsigned int newSize) 21 21 { 22 GLfloat* newArray = new GLfloat [newSize];22 GLfloat* newArray = new GLfloat [newSize]; 23 23 24 24 for (int i=0; i<=entryCount; i++) 25 25 newArray[i] = array[i]; 26 26 27 delete array;27 delete [] array; 28 28 array = newArray; 29 arraySize = newSize; 29 30 30 31 return; … … 33 34 void Array::finalizeArray (void) 34 35 { 35 resizeArray (entryCount );36 resizeArray (entryCount+1); 36 37 return; 37 38 } … … 42 43 entryCount++; 43 44 44 if (entryCount > =arraySize)45 if (entryCount > arraySize) 45 46 resizeArray(arraySize+2000); 46 47 … … 61 62 return array; 62 63 } 64 65 66 67 void Array::debug () 68 { 69 printf ("arraySize=%i, entryCount=%i, address=%p\n", arraySize, entryCount, array); 70 } -
orxonox/branches/importer/importer/array.h
r2754 r2758 5 5 public: 6 6 Array (); 7 Array ( int arraySize);7 Array (unsigned int arraySize); 8 8 9 void createArray ( int newArraySize);10 void resizeArray ( int newSize);9 void createArray (unsigned int newArraySize); 10 void resizeArray (unsigned int newSize); 11 11 void finalizeArray (void); 12 12 void addEntry (GLfloat entry); … … 15 15 GLfloat* getArray (); 16 16 17 void debug(void); 17 18 private: 18 19 GLfloat* array; 19 int arraySize;20 int entryCount;20 unsigned int arraySize; 21 unsigned int entryCount; 21 22 22 23 }; -
orxonox/branches/importer/importer/object.cc
r2757 r2758 17 17 glArrayElement(1); 18 18 glArrayElement(2); 19 glArrayElement(3); 20 glArrayElement(4); 21 glArrayElement(5); 22 23 19 24 20 25 … … 46 51 while (fscanf (OBJ_FILE, "%s", Buffer) != EOF) 47 52 { 48 printf ("%s\n",Buffer);53 // printf ("%s\n",Buffer); 49 54 50 55 // case we read it is a vertex … … 54 59 { 55 60 fscanf (OBJ_FILE, "%s", Buffer); 56 printf ("float: %f\n", atof(Buffer));61 //printf ("float: %f\n", atof(Buffer)); 57 62 vertices->addEntry(atof(Buffer)); 58 63 } 59 64 } 60 65 } 61 //vertices->addEntry(0,0,0);62 // vertices->addEntry(0,1,0);63 // vertices->addEntry(1,0,1);66 vertices->addEntry(0,0,0); 67 vertices->addEntry(0,-1,0); 68 vertices->addEntry(-1,0,-1); 64 69 vertices->finalizeArray(); 65 for (int i=0;i<= 10;i++)70 for (int i=0;i<=20;i++) 66 71 printf("%f\n",vertices->getArray()[i]); 67 72 fclose (OBJ_FILE);
Note: See TracChangeset
for help on using the changeset viewer.