Changeset 2804 in orxonox.OLD for orxonox/branches/importer
- Timestamp:
- Nov 11, 2004, 10:34:44 AM (20 years ago)
- Location:
- orxonox/branches/importer/importer
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/importer/importer/array.cc
r2760 r2804 12 12 void Array::createArray (unsigned int newArraySize) 13 13 { 14 if (verbose >= 2) 15 printf ("crating new Array of size %i\n", newArraySize); 14 16 array = new GLfloat [newArraySize]; 15 17 entryCount = -1; //0 means one entry … … 20 22 void Array::resizeArray (unsigned int newSize) 21 23 { 24 if (verbose >= 2) 25 printf ("Resizing Array to size %i\n", newSize); 22 26 GLfloat* newArray = new GLfloat [newSize]; 23 27 … … 34 38 void Array::finalizeArray (void) 35 39 { 40 if (verbose >= 3) 41 printf ("Finalizing array.\n"); 36 42 resizeArray (entryCount+1); 37 43 return; … … 41 47 void Array::addEntry (GLfloat entry) 42 48 { 49 if (verbose >= 3) 50 printf ("adding new Entry to Array: %f\n", entry); 43 51 entryCount++; 44 52 -
orxonox/branches/importer/importer/array.h
r2776 r2804 1 1 #ifndef _ARRAY_H 2 2 #define _ARRAY_H 3 4 extern int verbose; 3 5 4 6 #include <GL/gl.h> -
orxonox/branches/importer/importer/framework.cc
r2794 r2804 2 2 #include "object.h" 3 3 4 4 int verbose = 2; 5 5 WindowHandler wHandler; // Create an instance of the whandler basecode class 6 6 Object* obj; -
orxonox/branches/importer/importer/material.cc
r2780 r2804 17 17 Material* Material::addMaterial(char* mtlName) 18 18 { 19 if (verbose >=2) 20 printf ("adding Material %s\n", mtlName); 19 21 Material* newMat = new Material(mtlName); 20 22 Material* tmpMat = this; … … 30 32 void Material::init(void) 31 33 { 34 if (verbose >= 3) 35 printf ("initializing new Material\n"); 32 36 nextMat = NULL; 33 37 … … 42 46 void Material::setName (char* mtlName) 43 47 { 48 if (verbose >= 3) 49 printf("setting Material Name to %s", mtlName); 44 50 strcpy(name, mtlName); 45 51 // printf ("adding new Material: %s, %p\n", this->getName(), this); … … 54 60 void Material::setIllum (int illum) 55 61 { 62 if (verbose >= 3) 63 printf("setting illumModel of Material %s to %i", name, illum); 56 64 illumModel = illum; 57 65 // printf ("setting illumModel to: %i\n", illumModel); … … 64 72 void Material::setDiffuse (float r, float g, float b) 65 73 { 74 if (verbose >= 3) 75 printf ("setting Diffuse Color of Material %s to r=%f g=%f b=%f\n", name, r, g, b); 66 76 diffuse[0] = r; 67 77 diffuse[1] = g; … … 69 79 diffuse[3] = 1.0; 70 80 71 // printf ("setting Diffuse Color to r=%f g=%f b=%f\n", r, g, b);72 81 } 73 82 void Material::setDiffuse (char* rgb) … … 80 89 void Material::setAmbient (float r, float g, float b) 81 90 { 91 if (verbose >=3) 92 printf ("setting Ambient Color of Material %s to r=%f g=%f b=%f\n", name, r, g, b); 82 93 ambient[0] = r; 83 94 ambient[1] = g; 84 95 ambient[2] = b; 85 96 ambient[3] = 1.0; 86 // printf ("setting Ambient Color to r=%f g=%f b=%f\n", r, g, b);87 97 } 88 98 void Material::setAmbient (char* rgb) … … 95 105 void Material::setSpecular (float r, float g, float b) 96 106 { 107 if (verbose >= 3) 108 printf ("setting Specular Color of Material %s to r=%f g=%f b=%f\n", name, r, g, b); 97 109 specular[0] = r; 98 110 specular[1] = g; 99 111 specular[2] = b; 100 112 specular[3] = 1.0; 101 //printf ("setting Specular Color to r=%f g=%f b=%f\n", r, g, b); 102 } 113 } 103 114 void Material::setSpecular (char* rgb) 104 115 { … … 111 122 void Material::setTransparency (float trans) 112 123 { 124 if (verbose >= 3) 125 printf ("setting Transparency of Material %s to %f\n", name, trans); 113 126 transparency = trans; 114 127 } … … 123 136 Material* Material::search (char* mtlName) 124 137 { 138 if (verbose >=3) 139 printf ("Searching for material %s", mtlName); 125 140 Material* searcher = this; 126 141 while (searcher != NULL) 127 142 { 143 if (verbose >= 3) 144 printf ("."); 128 145 if (!strcmp (searcher->getName(), mtlName)) 129 return searcher; 146 { 147 if (verbose >= 3) 148 printf ("found.\n"); 149 return searcher; 150 } 130 151 searcher = searcher->nextMat; 131 152 } -
orxonox/branches/importer/importer/material.h
r2780 r2804 1 1 #ifndef _MATERIAL_H 2 2 #define _MATERIAL_H 3 4 extern int verbose; 5 3 6 #include <GL/gl.h> 4 7 #include <GL/glu.h> -
orxonox/branches/importer/importer/object.cc
r2794 r2804 22 22 bool Object::importFile (char* fileName) 23 23 { 24 objFile = fileName; 25 this->readFromObjFile (objFile); 24 if (verbose >=3) 25 printf("preparing to read in file: %s\n", fileName); 26 objFileName = fileName; 27 this->readFromObjFile (objFileName); 26 28 return true; 27 29 } … … 29 31 bool Object::initialize (void) 30 32 { 33 if (verbose >=3) 34 printf("new 3D-Object is being created\n"); 31 35 faceMode = -1; 32 36 if ( (listNumber = glGenLists(1)) == 0 ) … … 45 49 bool Object::finalize(void) 46 50 { 51 if (verbose >=3) 52 printf("finalizing the 3D-Object\n"); 47 53 glEndList(); 48 54 return true; … … 51 57 void Object::draw (void) 52 58 { 59 if (verbose >=3) 60 printf("drawing the 3D-Object\n"); 53 61 glCallList (listNumber); 54 62 } … … 60 68 if (!OBJ_FILE->is_open()) 61 69 { 62 printf ("unable to open file: %s\n", fileName); 70 if (verbose >=1) 71 printf ("unable to open .OBJ file: %s\n", fileName); 63 72 return false; 64 73 } 65 74 objFileName = fileName; 66 75 char Buffer[500]; 67 76 vertices = new Array(); … … 70 79 { 71 80 OBJ_FILE->getline(Buffer, 500); 72 // printf("%s\n", Buffer); 81 if (verbose >=4) 82 printf ("Read input line: %s\n",Buffer); 73 83 74 84 … … 125 135 char subbuffer3[20]; 126 136 sscanf (vertexString, "%s %s %s", subbuffer1, subbuffer2, subbuffer3); 137 if (verbose >= 3) 138 printf ("reading in a vertex: %s %s %s\n", subbuffer1, subbuffer2, subbuffer3); 127 139 vertices->addEntry(atof(subbuffer1), atof(subbuffer2), atof(subbuffer3)); 128 140 return true; … … 145 157 char subbuffer4[20] =""; 146 158 sscanf (faceString, "%s %s %s %s", subbuffer1, subbuffer2, subbuffer3, subbuffer4); 147 // printf("%s, %s, %s\n", subbuffer1,subbuffer2,subbuffer3);148 159 if (!strcmp(subbuffer4, "")) 149 160 { … … 156 167 157 168 faceMode = 3; 158 //printf ("triag: %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3); 169 if (verbose >=3) 170 printf ("found triag: %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3); 159 171 addGLElement(subbuffer1); 160 172 addGLElement(subbuffer2); … … 171 183 } 172 184 faceMode = 4; 173 // printf ("quad: %s, %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3, subbuffer4); 185 if (verbose >=3 ) 186 printf ("found quad: %s, %s, %s, %s\n", subbuffer1, subbuffer2, subbuffer3, subbuffer4); 174 187 addGLElement(subbuffer1); 175 188 addGLElement(subbuffer2); … … 191 204 normal[0] = '\0'; 192 205 normal ++; 193 206 if (verbose >= 4) 207 printf ("importing grafical Element.... including to openGL\n"); 194 208 //glArrayElement(atoi(vertex)-1); 195 209 glNormal3fv(normals->getArray() +(atoi(normal)-1)*3); … … 205 219 char subbuffer3[20]; 206 220 sscanf (normalString, "%s %s %s", subbuffer1, subbuffer2, subbuffer3); 207 // printf("%s, %s, %s\n", subbuffer1,subbuffer2,subbuffer3); 221 if (verbose >=3 ) 222 printf("found vertex-Normal %s, %s, %s\n", subbuffer1,subbuffer2,subbuffer3); 208 223 normals->addEntry(atof(subbuffer1), atof(subbuffer2), atof(subbuffer3)); 209 224 return true; … … 215 230 if (!MTL_FILE->is_open()) 216 231 { 217 printf ("unable to open file: %s\n", mtlFile); 232 if (verbose >= 1) 233 printf ("unable to open file: %s\n", mtlFile); 218 234 return false; 219 235 } 220 236 mtlFileName = mtlFile; 237 if (verbose >=2) 238 printf ("Opening mtlFile: %s\n", mtlFileName); 221 239 char Buffer[500]; 222 240 vertices = new Array(); … … 226 244 { 227 245 MTL_FILE->getline(Buffer, 500); 228 // printf("%s\n", Buffer); 246 if (verbose >= 4) 247 printf("found line in mtlFile: %s\n", Buffer); 229 248 230 249 … … 265 284 glEnd(); 266 285 faceMode = 0; 267 //printf ("%s\n", matString);268 // glColor3f((float)rand()/2000000000.0,(float)rand()/2000000000.0,(float)rand()/2000000000.0);286 if (verbose >= 2) 287 printf ("using material %s for coming Faces.\n", matString); 269 288 material->search(matString)->select(); 270 289 } -
orxonox/branches/importer/importer/object.h
r2794 r2804 8 8 #include "material.h" 9 9 #include <fstream.h> 10 11 extern int verbose; 10 12 11 13 class Object … … 30 32 Array* colors; 31 33 Array* normals; 32 char* objFile; 34 char* objFileName; 35 char* mtlFileName; 33 36 int faceMode; 34 37 bool readVertices; -
orxonox/branches/importer/importer/windowHandler.h
r2748 r2804 1 1 #ifndef _WINDOWHANDLER_H 2 2 #define _WINDOWHANDLER_H 3 4 extern int verbose; 3 5 4 6 #include <GL/gl.h>
Note: See TracChangeset
for help on using the changeset viewer.