Changeset 3605 in orxonox.OLD for orxonox/branches/levelloader/src/lib/graphics/importer
- Timestamp:
- Mar 18, 2005, 11:52:15 AM (20 years ago)
- Location:
- orxonox/branches/levelloader/src/lib/graphics/importer
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/levelloader/src/lib/graphics/importer/Makefile.in
r3563 r3605 1 # Makefile.in generated by automake 1.8. 2from Makefile.am.1 # Makefile.in generated by automake 1.8.5 from Makefile.am. 2 2 # @configure_input@ 3 3 … … 42 42 subdir = src/lib/graphics/importer 43 43 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ 44 $(srcdir)/Makefile.in TODO44 $(srcdir)/Makefile.in 45 45 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 46 46 am__aclocal_m4_deps = $(top_srcdir)/configure.ac … … 50 50 CONFIG_HEADER = $(top_builddir)/config.h 51 51 CONFIG_CLEAN_FILES = 52 am__installdirs = $(DESTDIR)$(bindir)52 am__installdirs = "$(DESTDIR)$(bindir)" 53 53 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) 54 54 PROGRAMS = $(bin_PROGRAMS) … … 98 98 DEFS = @DEFS@ 99 99 DEPDIR = @DEPDIR@ 100 DOCUMENTATION_FALSE = @DOCUMENTATION_FALSE@ 101 DOCUMENTATION_TRUE = @DOCUMENTATION_TRUE@ 100 102 DOXYGEN = @DOXYGEN@ 101 103 DOXYGEN_FALSE = @DOXYGEN_FALSE@ … … 215 217 esac; \ 216 218 done; \ 217 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- gnusrc/lib/graphics/importer/Makefile'; \219 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/lib/graphics/importer/Makefile'; \ 218 220 cd $(top_srcdir) && \ 219 $(AUTOMAKE) -- gnusrc/lib/graphics/importer/Makefile221 $(AUTOMAKE) --foreign src/lib/graphics/importer/Makefile 220 222 .PRECIOUS: Makefile 221 223 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 237 239 install-binPROGRAMS: $(bin_PROGRAMS) 238 240 @$(NORMAL_INSTALL) 239 $(mkdir_p) $(DESTDIR)$(bindir)241 test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" 240 242 @list='$(bin_PROGRAMS)'; for p in $$list; do \ 241 243 p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ … … 243 245 ; then \ 244 246 f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ 245 echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \246 $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f|| exit 1; \247 echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ 248 $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ 247 249 else :; fi; \ 248 250 done … … 252 254 @list='$(bin_PROGRAMS)'; for p in $$list; do \ 253 255 f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ 254 echo " rm -f $(DESTDIR)$(bindir)/$$f"; \255 rm -f $(DESTDIR)$(bindir)/$$f; \256 echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ 257 rm -f "$(DESTDIR)$(bindir)/$$f"; \ 256 258 done 257 259 … … 330 332 $(AWK) ' { files[$$0] = 1; } \ 331 333 END { for (i in files) print i; }'`; \ 332 test -z "$(ETAGS_ARGS)$$tags$$unique" \ 333 || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 334 $$tags $$unique 334 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ 335 test -n "$$unique" || unique=$$empty_fix; \ 336 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 337 $$tags $$unique; \ 338 fi 335 339 ctags: CTAGS 336 340 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ … … 387 391 all-am: Makefile $(PROGRAMS) $(HEADERS) 388 392 installdirs: 389 $(mkdir_p) $(DESTDIR)$(bindir) 393 for dir in "$(DESTDIR)$(bindir)"; do \ 394 test -z "$$dir" || $(mkdir_p) "$$dir"; \ 395 done 390 396 install: install-am 391 397 install-exec: install-exec-am -
orxonox/branches/levelloader/src/lib/graphics/importer/array.cc
r3499 r3605 13 13 co-programmer: ... 14 14 */ 15 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER 15 17 16 18 #include "array.h" … … 30 32 Array::~Array() 31 33 { 32 PRINTF( 2)("deleting array\n");34 PRINTF(4)("deleting array\n"); 33 35 Entry* walker = this->firstEntry; 34 36 Entry* previous; … … 49 51 void Array::initializeArray () 50 52 { 51 PRINTF( 2)("crating new Array\n");53 PRINTF(4)("crating new Array\n"); 52 54 this->firstEntry = new Entry; 53 55 this->firstEntry->next =NULL; … … 64 66 void Array::finalizeArray (void) 65 67 { 66 PRINTF( 3)("Finalizing array. Length: %i\n", entryCount);68 PRINTF(4)("Finalizing array. Length: %i\n", entryCount); 67 69 // if ((array = (GLfloat*)malloc( entryCount* sizeof(GLfloat))) == NULL) 68 70 if (!(this->array = new GLfloat [this->entryCount])) … … 87 89 if (!this->finalized) 88 90 { 89 PRINTF( 3)("adding new Entry to Array: %f\n", entry);91 PRINTF(5)("adding new Entry to Array: %f\n", entry); 90 92 91 93 this->currentEntry->value = entry; … … 96 98 } 97 99 else 98 PRINTF( 1)("adding failed, because list has been finalized\n");100 PRINTF(2)("adding failed, because list has been finalized\n"); 99 101 } 100 102 … … 131 133 void Array::debug () 132 134 { 133 PRINT F(0)("entryCount=%i, address=%p\n", this->entryCount, this->array);135 PRINT(0)("entryCount=%i, address=%p\n", this->entryCount, this->array); 134 136 } -
orxonox/branches/levelloader/src/lib/graphics/importer/array.h
r3499 r3605 8 8 #ifndef _ARRAY_H 9 9 #define _ARRAY_H 10 11 extern int verbose; //!< will be obsolete soon12 10 13 11 #include "stdincl.h" -
orxonox/branches/levelloader/src/lib/graphics/importer/material.cc
r3499 r3605 15 15 */ 16 16 17 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER 18 17 19 #include "material.h" 18 20 19 21 #include "texture.h" 22 #include "debug.h" 20 23 #include <stdlib.h> 21 24 #include <string.h> … … 51 54 Material::~Material() 52 55 { 53 PRINTF( 2)("delete Material %s.\n", this->name);56 PRINTF(4)("delete Material %s.\n", this->name); 54 57 if (this->name) 55 58 delete []this->name; … … 67 70 Material* Material::addMaterial(char* mtlName) 68 71 { 69 PRINTF( 2)("adding Material %s.\n", mtlName);72 PRINTF(4)("adding Material %s.\n", mtlName); 70 73 Material* tmpMat = this; 71 74 while (tmpMat->nextMat != NULL) … … 83 86 void Material::init(void) 84 87 { 85 PRINTF( 2)("initializing new Material.\n");88 PRINTF(4)("initializing new Material.\n"); 86 89 this->nextMat = NULL; 87 90 this->name =""; … … 112 115 Material* Material::search(char* mtlName) 113 116 { 114 PRINTF( 2)("Searching for material %s", mtlName);117 PRINTF(5)("Searching for material %s", mtlName); 115 118 Material* searcher = this; 116 119 while (searcher != NULL) 117 120 { 118 PRINT( 2)(".");121 PRINT(5)("."); 119 122 if (!strcmp (searcher->getName(), mtlName)) 120 123 { 121 PRINT( 2)("found.\n");124 PRINT(5)("found.\n"); 122 125 return searcher; 123 126 } 124 127 searcher = searcher->nextMat; 125 128 } 126 PRINT(2)(" not found\n");129 PRINT(2)("material %s not found\n", mtlName); 127 130 return NULL; 128 131 } … … 153 156 154 157 if (this->diffuseTextureSet) 155 glBindTexture(GL_TEXTURE_2D, this->diffuseTexture->getTexture()); 158 { 159 glEnable(GL_TEXTURE_2D); 160 glBindTexture(GL_TEXTURE_2D, this->diffuseTexture->getTexture()); 161 } 156 162 else 157 glBindTexture(GL_TEXTURE_2D, 0); 158 163 { 164 glDisable(GL_TEXTURE_2D); 165 glBindTexture(GL_TEXTURE_2D, 0); 166 } 159 167 } 160 168 … … 166 174 void Material::setName (char* mtlName) 167 175 { 168 PRINTF( 3)("setting Material Name to %s.\n", this->name);176 PRINTF(4)("setting Material Name to %s.\n", this->name); 169 177 this->name = new char [strlen(mtlName)+1]; 170 178 strcpy(this->name, mtlName); … … 185 193 void Material::setIllum (int illum) 186 194 { 187 PRINTF( 3)("setting illumModel of Material %s to %i\n", this->name, illum);195 PRINTF(4)("setting illumModel of Material %s to %i\n", this->name, illum); 188 196 this->illumModel = illum; 189 // PRINTF(3)("setting illumModel to: %i\n", illumModel);190 197 } 191 198 /** … … 205 212 void Material::setDiffuse (float r, float g, float b) 206 213 { 207 PRINTF( 3)("setting Diffuse Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b);214 PRINTF(4)("setting Diffuse Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b); 208 215 this->diffuse[0] = r; 209 216 this->diffuse[1] = g; … … 231 238 void Material::setAmbient (float r, float g, float b) 232 239 { 233 PRINTF( 3)("setting Ambient Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b);240 PRINTF(4)("setting Ambient Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b); 234 241 this->ambient[0] = r; 235 242 this->ambient[1] = g; … … 256 263 void Material::setSpecular (float r, float g, float b) 257 264 { 258 PRINTF( 3)("setting Specular Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b);265 PRINTF(4)("setting Specular Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b); 259 266 this->specular[0] = r; 260 267 this->specular[1] = g; … … 296 303 void Material::setTransparency (float trans) 297 304 { 298 PRINTF( 3)("setting Transparency of Material %s to %f.\n", this->name, trans);305 PRINTF(4)("setting Transparency of Material %s to %f.\n", this->name, trans); 299 306 this->transparency = trans; 300 307 } … … 325 332 void Material::setDiffuseMap(char* dMap) 326 333 { 327 PRINTF( 3)("setting Diffuse Map %s\n", dMap);334 PRINTF(4)("setting Diffuse Map %s\n", dMap); 328 335 diffuseTexture = new Texture(); 329 336 this->diffuseTextureSet = diffuseTexture->loadImage(dMap); -
orxonox/branches/levelloader/src/lib/graphics/importer/material.h
r3499 r3605 9 9 #define _MATERIAL_H 10 10 11 12 13 extern int verbose; //!< will be obsolete soon.14 11 15 12 #if HAVE_CONFIG_H -
orxonox/branches/levelloader/src/lib/graphics/importer/model.cc
r3499 r3605 13 13 co-programmer: ... 14 14 */ 15 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER 15 17 16 18 #include "model.h" … … 80 82 Model::~Model(void) 81 83 { 82 PRINTF( 3)("Deleting Model ");84 PRINTF(4)("Deleting Model "); 83 85 if (this->name) 84 86 { 85 PRINT( 3)("%s\n", this->name);87 PRINT(4)("%s\n", this->name); 86 88 delete []this->name; 87 89 } 88 90 else 89 PRINT( 3)("\n");90 91 PRINTF( 3)("Deleting display Lists.\n");91 PRINT(4)("\n"); 92 93 PRINTF(4)("Deleting display Lists.\n"); 92 94 Group* walker = this->firstGroup; 93 95 while (walker != NULL) … … 99 101 } 100 102 101 PRINTF( 3)("Deleting Materials.\n");103 PRINTF(4)("Deleting Materials.\n"); 102 104 if (this->material) 103 105 delete this->material; … … 122 124 void Model::draw (void) const 123 125 { 124 PRINTF( 2)("drawing the 3D-Models\n");126 PRINTF(4)("drawing the 3D-Models\n"); 125 127 Group* walker = this->firstGroup; 126 128 while (walker != NULL) 127 129 { 128 PRINTF( 3)("Drawing model %s\n", walker->name);130 PRINTF(5)("Drawing model %s\n", walker->name); 129 131 glCallList (walker->listNumber); 130 132 walker = walker->next; … … 142 144 if (groupNumber >= this->groupCount) 143 145 { 144 PRINTF( 1)("You requested model number %i, but this File only contains of %i Models.\n", groupNumber-1, this->groupCount);146 PRINTF(2)("You requested model number %i, but this File only contains of %i Models.\n", groupNumber-1, this->groupCount); 145 147 return; 146 148 } 147 PRINTF( 2)("drawing the requested 3D-Models if found.\n");149 PRINTF(4)("drawing the requested 3D-Models if found.\n"); 148 150 Group* walker = this->firstGroup; 149 151 int counter = 0; … … 152 154 if (counter == groupNumber) 153 155 { 154 PRINTF( 2)("Drawing model number %i named %s\n", counter, walker->name);156 PRINTF(4)("Drawing model number %i named %s\n", counter, walker->name); 155 157 glCallList (walker->listNumber); 156 158 return; … … 159 161 walker = walker->next; 160 162 } 161 PRINTF( 1)("Model number %i in %s not Found.\n", groupNumber, this->name);163 PRINTF(2)("Model number %i in %s not Found.\n", groupNumber, this->name); 162 164 return; 163 165 … … 172 174 void Model::draw (char* groupName) const 173 175 { 174 PRINTF( 2)("drawing the requested 3D-Models if found.\n");176 PRINTF(4)("drawing the requested 3D-Models if found.\n"); 175 177 Group* walker = this->firstGroup; 176 178 while (walker != NULL) … … 178 180 if (!strcmp(walker->name, groupName)) 179 181 { 180 PRINTF( 2)("Drawing model %s\n", walker->name);182 PRINTF(4)("Drawing model %s\n", walker->name); 181 183 glCallList (walker->listNumber); 182 184 return; … … 184 186 walker = walker->next; 185 187 } 186 PRINTF( 1)("Model Named %s in %s not Found.\n", groupName, this->name);188 PRINTF(2)("Model Named %s in %s not Found.\n", groupName, this->name); 187 189 return; 188 190 } … … 204 206 bool Model::initialize (void) 205 207 { 206 PRINTF( 2)("new 3D-Model is being created\n");208 PRINTF(4)("new 3D-Model is being created\n"); 207 209 208 210 this->name = NULL; … … 243 245 bool Model::initGroup(Group* group) 244 246 { 245 PRINTF( 3)("Adding new Group\n");247 PRINTF(4)("Adding new Group\n"); 246 248 group->name = ""; 247 249 group->faceMode = -1; … … 277 279 bool Model::cleanup(void) 278 280 { 279 PRINTF( 3)("cleaning up the 3D-Model to save Memory.\n");281 PRINTF(4)("cleaning up the 3D-Model to save Memory.\n"); 280 282 281 283 if (this->vertices) … … 296 298 bool Model::cleanupGroup (Group* group) 297 299 { 298 PRINTF( 3)("Cleaning up group\n");300 PRINTF(5)("Cleaning up group\n"); 299 301 if (group->firstFace != NULL) 300 302 { … … 314 316 bool Model::cleanupFace (Face* face) 315 317 { 316 PRINTF( 3)("Cleaning up Face\n");318 PRINTF(5)("Cleaning up Face\n"); 317 319 318 320 if (face->materialString != NULL) … … 355 357 bool Model::addGroup (char* groupString) 356 358 { 357 PRINTF( 3)("Read Group: %s.\n", groupString);359 PRINTF(5)("Read Group: %s.\n", groupString); 358 360 if (this->groupCount != 0 && this->currentGroup->faceCount>0) 359 361 { … … 384 386 float subbuffer3; 385 387 sscanf (vertexString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3); 386 PRINTF( 3)("reading in a vertex: %f %f %f\n", &subbuffer1, &subbuffer2, &subbuffer3);388 PRINTF(5)("reading in a vertex: %f %f %f\n", &subbuffer1, &subbuffer2, &subbuffer3); 387 389 this->vertices->addEntry(subbuffer1*scaleFactor, subbuffer2*scaleFactor, subbuffer3*scaleFactor); 388 390 return true; … … 398 400 bool Model::addVertex(const float x, const float y, const float z) 399 401 { 400 PRINTF( 4)("reading in a vertex: %f %f %f\n", x, y, z);402 PRINTF(5)("reading in a vertex: %f %f %f\n", x, y, z); 401 403 this->vertices->addEntry(x*scaleFactor, y*scaleFactor, z*scaleFactor); 402 404 return true; … … 513 515 float subbuffer3; 514 516 sscanf (normalString, "%f %f %f", &subbuffer1, &subbuffer2, &subbuffer3); 515 PRINTF( 3)("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3);517 PRINTF(5)("found vertex-Normal %f, %f, %f\n", &subbuffer1,&subbuffer2,&subbuffer3); 516 518 this->normals->addEntry(subbuffer1, subbuffer2, subbuffer3); 517 519 return true; … … 544 546 float subbuffer2; 545 547 sscanf (vTextureString, "%f %f", &subbuffer1, &subbuffer2); 546 PRINTF( 3)("found vertex-Texture %f, %f\n", &subbuffer1, &subbuffer2);548 PRINTF(5)("found vertex-Texture %f, %f\n", &subbuffer1, &subbuffer2); 547 549 this->vTexture->addEntry(subbuffer1); 548 550 this->vTexture->addEntry(subbuffer2); … … 610 612 if ((this->currentGroup->listNumber = glGenLists(1)) == 0) 611 613 { 612 PRINTF( 1)("list could not be created for this Model\n");614 PRINTF(2)("glList could not be created for this Model\n"); 613 615 return false; 614 616 } … … 628 630 { 629 631 tmpMat->select(); 630 PRINTF( 2)("using material %s for coming Faces.\n", tmpFace->materialString);632 PRINTF(5)("using material %s for coming Faces.\n", tmpFace->materialString); 631 633 } 632 634 else 633 PRINTF( 1)("material %s not found.\n", tmpFace->materialString);635 PRINTF(2)("material %s not found.\n", tmpFace->materialString); 634 636 635 637 … … 646 648 647 649 this->currentGroup->faceMode = 3; 648 PRINTF( 3)("found triag.\n");650 PRINTF(5)("found triag.\n"); 649 651 } 650 652 … … 658 660 } 659 661 this->currentGroup->faceMode = 4; 660 PRINTF( 3)("found quad.\n");662 PRINTF(5)("found quad.\n"); 661 663 } 662 664 … … 666 668 glEnd(); 667 669 glBegin(GL_POLYGON); 668 PRINTF( 3)("Polygon with %i faces found.", tmpFace->vertexCount);670 PRINTF(5)("Polygon with %i faces found.", tmpFace->vertexCount); 669 671 this->currentGroup->faceMode = tmpFace->vertexCount; 670 672 } … … 698 700 bool Model::addGLElement (FaceElement* elem) 699 701 { 700 PRINTF( 3)("importing grafical Element to openGL.\n");702 PRINTF(5)("importing grafical Element to openGL.\n"); 701 703 702 704 if (elem->texCoordNumber != -1) … … 721 723 { 722 724 723 PRINTF( 2)("Normals are being calculated.\n");725 PRINTF(4)("Normals are being calculated.\n"); 724 726 725 727 Vector* normArray = new Vector [vertices->getCount()/3]; … … 778 780 { 779 781 normArray[i].normalize(); 780 PRINTF( 3)("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z);782 PRINTF(5)("Found Normale number %d: (%f; %f, %f).\n", i, normArray[i].x, normArray[i].y, normArray[i].z); 781 783 782 784 this->normals->addEntry(normArray[i].x, normArray[i].y, normArray[i].z); … … 881 883 //printf ("%f %f\n", vz, sin (vz)); 882 884 if (i==0.0) 883 printf("%f, %f\n", j/df*2.0*PI, cos(j/df*PI));885 PRINTF(0)("%f, %f\n", j/df*2.0*PI, cos(j/df*PI)); 884 886 } 885 887 } -
orxonox/branches/levelloader/src/lib/graphics/importer/objModel.cc
r3542 r3605 13 13 co-programmer: ... 14 14 */ 15 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER 15 17 16 18 #include "objModel.h" … … 86 88 bool OBJModel::importFile (const char* fileName) 87 89 { 88 PRINTF( 3)("preparing to read in file: %s\n", fileName);90 PRINTF(4)("preparing to read in file: %s\n", fileName); 89 91 90 92 … … 107 109 strncpy(this->objPath, fileName, name-fileName); 108 110 this->objPath[name-fileName] = '\0'; 109 if (verbose>=2) 110 if (strlen(objPath)> 0) 111 PRINTF(0)("Resolved file %s to folder: %s.\n", name, objPath); 112 else 113 PRINTF(0)("Resolved file %s.\n", name); 111 if (strlen(objPath)> 0) 112 PRINTF(5)("Resolved file %s to folder: %s.\n", name, objPath); 113 else 114 PRINTF(5)("Resolved file %s.\n", name); 114 115 115 116 this->setName(name); … … 144 145 return false; 145 146 } 146 PRINTF( 2)("Reading from opened file %s\n", fileName);147 PRINTF(4)("Reading from opened file %s\n", fileName); 147 148 char Buffer[10000]; 148 149 while(!OBJ_FILE->eof()) 149 150 { 150 151 OBJ_FILE->getline(Buffer, 10000); 151 PRINTF( 3)("Read input line: %s\n", Buffer);152 PRINTF(5)("Read input line: %s\n", Buffer); 152 153 153 154 … … 192 193 else if (!strncmp(Buffer, "s ", 2)) //! \todo smoothing groups have to be implemented 193 194 { 194 if (verbose >= 2) 195 PRINTF(2)("smoothing groups not supportet yet. line: %s\n", Buffer); 195 PRINTF(3)("smoothing groups not supportet yet. line: %s\n", Buffer); 196 196 } 197 197 } … … 221 221 222 222 223 PRINTF( 3)("Opening mtlFile: %s\n", fileName);223 PRINTF(4)("Opening mtlFile: %s\n", fileName); 224 224 225 225 ifstream* MTL_FILE = new ifstream (fileName); 226 226 if (MTL_FILE->fail()) 227 227 { 228 PRINTF( 1)("unable to open file: %s\n", fileName);228 PRINTF(2)("unable to open file: %s\n", fileName); 229 229 MTL_FILE->close(); 230 230 delete []fileName; … … 237 237 { 238 238 MTL_FILE->getline(Buffer, 500); 239 PRINTF( 4)("found line in mtlFile: %s\n", Buffer);239 PRINTF(5)("found line in mtlFile: %s\n", Buffer); 240 240 241 241 -
orxonox/branches/levelloader/src/lib/graphics/importer/texture.cc
r3499 r3605 17 17 */ 18 18 19 20 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER 19 21 20 22 #include "texture.h" … … 87 89 if (pName[0] == '\0') 88 90 { 89 PRINTF( 3)("not Adding empty Path to the List.\n");91 PRINTF(2)("not Adding empty Path to the List.\n"); 90 92 return; 91 93 } … … 99 101 if (status.st_mode & S_IFDIR) 100 102 { 101 PRINTF( 2)("Adding Path %s to the PathList.\n", pName);103 PRINTF(4)("Adding Path %s to the PathList.\n", pName); 102 104 PathList* tmpPathList = this; 103 105 while (tmpPathList->next) … … 193 195 bool Texture::loadTexToGL (Image* pImage) 194 196 { 195 PRINTF( 2)("Loading texture to OpenGL-Environment.\n");197 PRINTF(4)("Loading texture to OpenGL-Environment.\n"); 196 198 glGenTextures(1, &this->texture); 197 199 glBindTexture(GL_TEXTURE_2D, this->texture); … … 229 231 pImage->format = GL_RGBA; 230 232 231 PRINTF(0)("Bits Per Pixel: %d\n", pImage->bpp);232 233 if( !IMG_isPNG(SDL_RWFromFile(imgNameWithPath, "rb")) && !IMG_isJPG(SDL_RWFromFile(imgNameWithPath, "rb"))) 233 234 for (int i=0;i<map->h * map->w *3;i+=3) … … 249 250 else 250 251 { 251 PRINTF( 1)("Image not Found: %s\n", imgNameWithPath);252 PRINTF(2)("Image not Found: %s\n", imgNameWithPath); 252 253 return false; 253 254 } … … 268 269 if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".bmp", 4)) 269 270 { 270 PRINTF( 3)("Requested bmp-image. Trying to Import.\n");271 PRINTF(4)("Requested bmp-image. Trying to Import.\n"); 271 272 return this->loadBMP(imgNameWithPath); 272 273 } … … 274 275 else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".jpg", 4) || !strncmp(imgNameWithPath+strlen(imgNameWithPath)-5, ".jpg", 5)) 275 276 { 276 PRINTF( 3)("Requested jpeg-image. Trying to Import\n");277 PRINTF(4)("Requested jpeg-image. Trying to Import\n"); 277 278 return this->loadJPG(imgNameWithPath); 278 279 } 279 280 else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".tga", 4)) 280 281 { 281 PRINTF( 3)("Requested tga-image. Trying to Import\n");282 PRINTF(4)("Requested tga-image. Trying to Import\n"); 282 283 return this->loadTGA(imgNameWithPath); 283 284 } 284 285 else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".png", 4)) 285 286 { 286 PRINTF( 3)("Requested png-image. Trying to Import\n");287 PRINTF(4)("Requested png-image. Trying to Import\n"); 287 288 return this->loadPNG(imgNameWithPath); 288 289 } 289 290 else 290 291 { 291 PRINTF( 1)("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imgNameWithPath);292 PRINTF(2)("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imgNameWithPath); 292 293 return false; 293 294 } … … 295 296 else 296 297 { 297 PRINTF( 1)("Image not Found: %s\n", imgNameWithPath);298 PRINTF(2)("Image not Found: %s\n", imgNameWithPath); 298 299 return false; 299 300 } … … 316 317 if ((file = fopen(bmpName, "rb"))==NULL) 317 318 { 318 PRINTF( 1)("File Not Found : %s\n",bmpName);319 PRINTF(2)("File Not Found : %s\n",bmpName); 319 320 return false; 320 321 } … … 325 326 if ((i = fread(&pImage->width, 4, 1, file)) != 1) 326 327 { 327 PRINTF( 1)("Error reading width from %s.\n", bmpName);328 PRINTF(2)("Error reading width from %s.\n", bmpName); 328 329 return false; 329 330 } … … 331 332 if ((i = fread(&pImage->height, 4, 1, file)) != 1) 332 333 { 333 PRINTF( 1)("Error reading height from %s.\n", bmpName);334 PRINTF(2)("Error reading height from %s.\n", bmpName); 334 335 return false; 335 336 } … … 341 342 if ((fread(&planes, 2, 1, file)) != 1) 342 343 { 343 PRINTF( 1)("Error reading planes from %s.\n", bmpName);344 PRINTF(2)("Error reading planes from %s.\n", bmpName); 344 345 return false; 345 346 } … … 353 354 if ((i = fread(&bpp, 2, 1, file)) != 1) 354 355 { 355 PRINTF( 1)("Error reading bpp from %s.\n", bmpName);356 PRINTF(2)("Error reading bpp from %s.\n", bmpName); 356 357 return false; 357 358 } 358 359 if (bpp != 24) 359 360 { 360 PRINTF( 1)("Bpp from %s is not 24: %u\n", bmpName, bpp);361 PRINTF(2)("Bpp from %s is not 24: %u\n", bmpName, bpp); 361 362 return false; 362 363 } … … 369 370 if (pImage->data == NULL) 370 371 { 371 PRINTF( 1)("Error allocating memory for color-corrected image data");372 PRINTF(2)("Error allocating memory for color-corrected image data"); 372 373 return false; 373 374 } … … 375 376 if ((i = fread(pImage->data, size, 1, file)) != 1) 376 377 { 377 PRINTF( 1)("Error reading image data from %s.\n", bmpName);378 PRINTF(2)("Error reading image data from %s.\n", bmpName); 378 379 return false; 379 380 } … … 418 419 { 419 420 // Display an error message saying the file was not found, then return NULL 420 PRINTF( 1)("Unable to load JPG File %s.\n", jpgName);421 PRINTF(2)("Unable to load JPG File %s.\n", jpgName); 421 422 return false; 422 423 } … … 521 522 if(fTGA == NULL) 522 523 { 523 PRINTF( 1)("Error could not open texture file: %s\n", tgaName);524 PRINTF(2)("Error could not open texture file: %s\n", tgaName); 524 525 return false; 525 526 } … … 527 528 if(fread(&tgaHeader, sizeof(TGAHeader), 1, fTGA) == 0) 528 529 { 529 PRINTF( 1)("Error could not read file header of %s\n", tgaName);530 PRINTF(2)("Error could not read file header of %s\n", tgaName); 530 531 if(fTGA != NULL) 531 532 { … … 549 550 else 550 551 { 551 PRINTF( 1)("Error TGA file be type 2 or type 10\n");552 PRINTF(2)("Error TGA file be type 2 or type 10\n"); 552 553 if (fTGA) 553 554 fclose(fTGA); … … 576 577 if(fread(header, sizeof(header), 1, fTGA) == 0) 577 578 { 578 PRINTF( 1)("Error could not read info header\n");579 PRINTF(2)("Error could not read info header\n"); 579 580 return false; 580 581 } … … 586 587 if((pImage->width <= 0) || (pImage->height <= 0) || ((pImage->bpp != 24) && (pImage->bpp !=32))) 587 588 { 588 PRINTF( 1)("Error invalid texture information\n");589 PRINTF(2)("Error invalid texture information\n"); 589 590 return false; 590 591 } … … 605 606 if(pImage->data == NULL) 606 607 { 607 PRINTF( 1)("Error could not allocate memory for image\n");608 PRINTF(2)("Error could not allocate memory for image\n"); 608 609 return false; 609 610 } … … 611 612 if(fread(pImage->data, 1, imageSize, fTGA) != imageSize) 612 613 { 613 PRINTF( 1)("Error could not read image data\n");614 PRINTF(2)("Error could not read image data\n"); 614 615 if(pImage->data != NULL) 615 616 { … … 648 649 if(fread(header, sizeof(header), 1, fTGA) == 0) 649 650 { 650 PRINTF( 1)("Error could not read info header\n");651 PRINTF(2)("Error could not read info header\n"); 651 652 return false; 652 653 } … … 664 665 if((pImage->width <= 0) || (pImage->height <= 0) || ((pImage->bpp != 24) && (pImage->bpp !=32))) 665 666 { 666 PRINTF( 1)("Error Invalid pImage information\n");667 PRINTF(2)("Error Invalid pImage information\n"); 667 668 return false; 668 669 } … … 674 675 if(pImage->data == NULL) 675 676 { 676 PRINTF( 1)("Error could not allocate memory for image\n");677 PRINTF(2)("Error could not allocate memory for image\n"); 677 678 return false; 678 679 } … … 684 685 if(fread(&chunkheader, sizeof(GLubyte), 1, fTGA) == 0) 685 686 { 686 PRINTF( 1)("Error could not read RLE header\n");687 PRINTF(2)("Error could not read RLE header\n"); 687 688 if(pImage->data != NULL) 688 689 { … … 702 703 if(fread(colorbuffer, 1, bytesPerPixel, fTGA) != bytesPerPixel) 703 704 { 704 PRINTF( 1)("Error could not read image data\n");705 PRINTF(2)("Error could not read image data\n"); 705 706 if(colorbuffer != NULL) 706 707 { … … 732 733 if(currentpixel > pixelcount) 733 734 { 734 PRINTF( 1)("Error too many pixels read\n");735 PRINTF(2)("Error too many pixels read\n"); 735 736 if(colorbuffer != NULL) 736 737 { … … 754 755 if(fread(colorbuffer, 1, bytesPerPixel, fTGA) != bytesPerPixel) // Attempt to read following color values 755 756 { 756 PRINTF( 1)("Error could not read from file");757 PRINTF(2)("Error could not read from file"); 757 758 if(colorbuffer != NULL) 758 759 { … … 785 786 if(currentpixel > pixelcount) 786 787 { 787 PRINTF( 1)("Error too many pixels read\n");788 PRINTF(2)("Error too many pixels read\n"); 788 789 if(colorbuffer != NULL) 789 790 { -
orxonox/branches/levelloader/src/lib/graphics/importer/texture.h
r3499 r3605 10 10 #define _TEXTURE_H 11 11 12 #include "stdincl.h" 12 #include "glincl.h" 13 14 #include "debug.h" 15 13 16 #ifdef HAVE_SDL_SDL_IMAGE_H 14 17 #include <SDL/SDL_image.h> -
orxonox/branches/levelloader/src/lib/graphics/importer/windowHandler.h
r3499 r3605 7 7 #ifndef _WINDOWHANDLER_H 8 8 #define _WINDOWHANDLER_H 9 10 extern int verbose;11 9 12 10 #include "stdincl.h"
Note: See TracChangeset
for help on using the changeset viewer.