Changeset 3206 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Dec 17, 2004, 8:08:12 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/debug.h
r3205 r3206 9 9 #define PRINTF1 \ 10 10 if (verbose >= 1 ) \ 11 printf ("%s:%d:", __FILE__, __LINE__); \ 12 if (verbose >= 1) printf 11 printf 13 12 #else 14 #define PRINTF1 13 #define PRINTF1 // 15 14 #endif 16 15 … … 18 17 #define PRINTF2 \ 19 18 if (verbose >= 2 ) \ 20 printf ("%s:%d:", __FILE__, __LINE__); \21 if (verbose >= 2) printf19 printf 20 22 21 #else 23 #define PRINTF2 22 #define PRINTF2 // 24 23 #endif 25 24 … … 27 26 #define PRINTF3 \ 28 27 if (verbose >= 3 ) \ 29 printf ("%s:%d:", __FILE__, __LINE__); \ 30 if (verbose >= 3) printf 28 printf 31 29 #else 32 #define PRINTF3 30 #define PRINTF3 // 33 31 #endif 34 32 … … 36 34 #define PRINTF4 \ 37 35 if (verbose >= 4 ) \ 38 printf ("%s:%d:", __FILE__, __LINE__); \ 39 if (verbose >= 4) printf 36 printf 40 37 #else 41 #define PRINTF4 38 #define PRINTF4 // 42 39 #endif 43 40 44 41 45 42 #else 46 #define PRINTF(x) 43 #define PRINTF(x) // 47 44 #endif 48 45 46 #define PRINTF0 \ 47 printf 49 48 50 49 #endif /* _DEBUG_H */ -
orxonox/trunk/src/importer/array.cc
r3195 r3206 30 30 Array::~Array() 31 31 { 32 if (verbose >= 2) 33 printf("deleting array\n"); 32 PRINTF(2)("deleting array\n"); 34 33 Entry* walker = this->firstEntry; 35 34 Entry* previous; … … 50 49 void Array::initializeArray () 51 50 { 52 if (verbose >= 2) 53 printf ("crating new Array\n"); 51 PRINTF(2)("crating new Array\n"); 54 52 this->firstEntry = new Entry; 55 53 this->firstEntry->next =NULL; … … 66 64 void Array::finalizeArray (void) 67 65 { 68 if (verbose >= 3) 69 printf ("Finalizing array. Length: %i\n", entryCount); 66 PRINTF(3)("Finalizing array. Length: %i\n", entryCount); 70 67 // if ((array = (GLfloat*)malloc( entryCount* sizeof(GLfloat))) == NULL) 71 if ( (this->array = new GLfloat [this->entryCount]) == NULL)72 printf("could not allocate %i data Blocks\n", this->entryCount);68 if (!(this->array = new GLfloat [this->entryCount])) 69 PRINTF(1)("could not allocate %i data Blocks\n", this->entryCount); 73 70 Entry* walker = this->firstEntry; 74 71 for (int i=0; i<this->entryCount; i++) … … 90 87 if (!this->finalized) 91 88 { 92 if (verbose >= 3) 93 printf ("adding new Entry to Array: %f\n", entry); 89 PRINTF(3)("adding new Entry to Array: %f\n", entry); 94 90 95 91 this->currentEntry->value = entry; … … 100 96 } 101 97 else 102 if (verbose >= 1) 103 printf ("adding failed, because list has been finalized\n"); 98 PRINTF(1)("adding failed, because list has been finalized\n"); 104 99 } 105 100 … … 136 131 void Array::debug () 137 132 { 138 printf("entryCount=%i, address=%p\n", this->entryCount, this->array);133 PRINTF(0)("entryCount=%i, address=%p\n", this->entryCount, this->array); 139 134 } -
orxonox/trunk/src/importer/framework.cc
r3205 r3206 63 63 { 64 64 // If an error is found, display a message, kill the GL and SDL screens (if they were created) and exit 65 printf("Could not initalize OpenGL :(\n\n");65 PRINTF(1)("Could not initalize OpenGL :(\n\n"); 66 66 wHandler.KillGLWindow(); 67 67 return 0; 68 68 } 69 69 70 printf ("%i, %i\n", wHandler.screen->w, wHandler.screen->h);70 PRINTF(2)("screensize: %i, %i\n", wHandler.screen->w, wHandler.screen->h); 71 71 if (argc>=3) 72 72 obj = new Object (argv[1], atof(argv[2])); … … 125 125 switch (event.type) { 126 126 case SDL_MOUSEMOTION: 127 if (verbose >=3) 128 printf("Mouse motion about %d,%d Pixels to (%d,%d).\n", 129 event.motion.xrel, event.motion.yrel, 130 event.motion.x, event.motion.y); 127 PRINTF(3)("Mouse motion about %d,%d Pixels to (%d,%d).\n", 128 event.motion.xrel, event.motion.yrel, 129 event.motion.x, event.motion.y); 131 130 // TRACKBALL 132 131 if (mouse1Down) -
orxonox/trunk/src/importer/material.cc
r3195 r3206 77 77 if (pName[0] == '\0') 78 78 { 79 if (verbose >=3) 80 printf("not Adding empty Path to the List.\n"); 79 PRINTF(3)("not Adding empty Path to the List.\n"); 81 80 return; 82 81 } … … 91 90 if (status.st_mode & S_IFDIR) 92 91 { 93 if (verbose >=2) 94 printf ("Adding Path %s to the PathList.\n", pName); 92 PRINTF(2)("Adding Path %s to the PathList.\n", pName); 95 93 PathList* tmpPathList = this; 96 94 while (tmpPathList->next) … … 99 97 } 100 98 else 101 if (verbose >=1) 102 printf ("You tried to add non-folder %s to a PathList.\n", tmpPName); 99 PRINTF(2)("You tried to add non-folder %s to a PathList.\n", tmpPName); 103 100 } 104 101 else 105 if (verbose >=1) 106 printf ("You tried to add non-existing folder %s to a PathList.\n", tmpPName); 102 PRINTF(2)("You tried to add non-existing folder %s to a PathList.\n", tmpPName); 107 103 delete []tmpPName; 108 104 } … … 135 131 Material::~Material() 136 132 { 137 if (verbose >= 2) 138 printf ("delete Material %s.\n", this->name); 133 PRINTF(2)("delete Material %s.\n", this->name); 139 134 if (this->name) 140 135 delete []this->name; … … 152 147 Material* Material::addMaterial(char* mtlName) 153 148 { 154 if (verbose >=2) 155 printf ("adding Material %s.\n", mtlName); 149 PRINTF(2)("adding Material %s.\n", mtlName); 156 150 Material* tmpMat = this; 157 151 while (tmpMat->nextMat != NULL) … … 169 163 void Material::init(void) 170 164 { 171 if (verbose >= 3) 172 printf ("initializing new Material.\n"); 165 PRINTF(2)("initializing new Material.\n"); 173 166 this->nextMat = NULL; 174 167 this->name =""; … … 200 193 Material* Material::search (char* mtlName) 201 194 { 202 if (verbose >=3) 203 printf ("Searching for material %s", mtlName); 195 PRINTF(2)("Searching for material %s", mtlName); 204 196 Material* searcher = this; 205 197 while (searcher != NULL) 206 198 { 207 if (verbose >= 3) 208 printf ("."); 199 PRINTF(2)("."); 209 200 if (!strcmp (searcher->getName(), mtlName)) 210 201 { 211 if (verbose >= 3) 212 printf ("found.\n"); 202 PRINTF(2)("found.\n"); 213 203 return searcher; 214 204 } 215 205 searcher = searcher->nextMat; 216 206 } 217 if (verbose >=3) 218 printf ("not found\n"); 207 PRINTF(2)("not found\n"); 219 208 return NULL; 220 209 } … … 258 247 void Material::setName (char* mtlName) 259 248 { 249 PRINTF(3)("setting Material Name to %s.\n", this->name); 260 250 this->name = new char [strlen(mtlName)+1]; 261 251 strcpy(this->name, mtlName); 262 if (verbose >= 3) 263 printf("setting Material Name to %s.\n", this->name); 264 265 // printf ("adding new Material: %s, %p\n", this->getName(), this); 266 267 } 252 } 253 268 254 /** 269 255 \returns The Name of The Material … … 280 266 void Material::setIllum (int illum) 281 267 { 282 if (verbose >= 3) 283 printf("setting illumModel of Material %s to %i\n", this->name, illum); 268 PRINTF(3)("setting illumModel of Material %s to %i\n", this->name, illum); 284 269 this->illumModel = illum; 285 270 // printf ("setting illumModel to: %i\n", illumModel); … … 301 286 void Material::setDiffuse (float r, float g, float b) 302 287 { 303 if (verbose >= 3) 304 printf ("setting Diffuse Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b); 288 PRINTF(3)("setting Diffuse Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b); 305 289 this->diffuse[0] = r; 306 290 this->diffuse[1] = g; … … 328 312 void Material::setAmbient (float r, float g, float b) 329 313 { 330 if (verbose >=3) 331 printf ("setting Ambient Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b); 314 PRINTF(3)("setting Ambient Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b); 332 315 this->ambient[0] = r; 333 316 this->ambient[1] = g; … … 354 337 void Material::setSpecular (float r, float g, float b) 355 338 { 356 if (verbose >= 3) 357 printf ("setting Specular Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b); 339 PRINTF(3)("setting Specular Color of Material %s to r=%f g=%f b=%f.\n", this->name, r, g, b); 358 340 this->specular[0] = r; 359 341 this->specular[1] = g; … … 395 377 void Material::setTransparency (float trans) 396 378 { 397 if (verbose >= 3) 398 printf ("setting Transparency of Material %s to %f.\n", this->name, trans); 379 PRINTF(3)("setting Transparency of Material %s to %f.\n", this->name, trans); 399 380 this->transparency = trans; 400 381 } … … 439 420 } 440 421 strcat(tmpName, texName); 441 printf("%s\n", tmpName);442 422 if (access (tmpName, F_OK) == 0) 443 423 return tmpName; … … 460 440 void Material::setDiffuseMap(char* dMap) 461 441 { 462 if (verbose>=2) 463 printf ("setting Diffuse Map %s\n", dMap); 442 PRINTF(3)("setting Diffuse Map %s\n", dMap); 464 443 465 444 // diffuseTextureSet = loadBMP(dMap, &diffuseTexture); … … 507 486 bool Material::loadTexToGL (Image* pImage, GLuint* texture) 508 487 { 509 if (verbose >=3) 510 printf ("Loading texture to OpenGL-Environment.\n"); 488 PRINTF(2)("Loading texture to OpenGL-Environment.\n"); 511 489 glGenTextures(1, texture); 512 490 glBindTexture(GL_TEXTURE_2D, *texture); … … 534 512 if(!map) 535 513 { 536 printf("IMG_Load: %s\n", IMG_GetError());514 PRINTF(1)("IMG_Load: %s\n", IMG_GetError()); 537 515 return false; 538 516 } … … 551 529 else 552 530 { 553 if (verbose >=1) 554 printf ("Image not Found: %s\n", imgNameWithPath); 531 PRINTF(1)("Image not Found: %s\n", imgNameWithPath); 555 532 return false; 556 533 } … … 571 548 if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".bmp", 4)) 572 549 { 573 if (verbose >=2) 574 printf ("Requested bmp-image. Trying to Import.\n"); 550 PRINTF(3)("Requested bmp-image. Trying to Import.\n"); 575 551 return this->loadBMP(imgNameWithPath, texture); 576 552 } … … 578 554 else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".jpg", 4) || !strncmp(imgNameWithPath+strlen(imgNameWithPath)-5, ".jpg", 5)) 579 555 { 580 if (verbose >=2) 581 printf ("Requested jpeg-image. Trying to Import\n"); 556 PRINTF(3)("Requested jpeg-image. Trying to Import\n"); 582 557 return this->loadJPG(imgNameWithPath, texture); 583 558 } 584 559 else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".tga", 4)) 585 560 { 586 if (verbose >=2) 587 printf ("Requested tga-image. Trying to Import\n"); 561 PRINTF(3)("Requested tga-image. Trying to Import\n"); 588 562 return this->loadTGA(imgNameWithPath, texture); 589 563 } 590 564 else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".png", 4)) 591 565 { 592 if (verbose >=2) 593 printf ("Requested png-image. Trying to Import\n"); 566 PRINTF(3)("Requested png-image. Trying to Import\n"); 594 567 return this->loadPNG(imgNameWithPath, texture); 595 568 } 596 569 else 597 570 { 598 if (verbose >=1) 599 printf ("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imgNameWithPath); 571 PRINTF(1)("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imgNameWithPath); 600 572 return false; 601 573 } … … 603 575 else 604 576 { 605 if (verbose >=1) 606 printf ("Image not Found: %s\n", imgNameWithPath); 577 PRINTF(1)("Image not Found: %s\n", imgNameWithPath); 607 578 return false; 608 579 } … … 627 598 if ((file = fopen(bmpName, "rb"))==NULL) 628 599 { 629 if (verbose >=1) 630 printf("File Not Found : %s\n",bmpName); 600 PRINTF(1)("File Not Found : %s\n",bmpName); 631 601 return false; 632 602 } … … 637 607 if ((i = fread(&pImage->width, 4, 1, file)) != 1) 638 608 { 639 if (verbose >=1) 640 printf("Error reading width from %s.\n", bmpName); 609 PRINTF(1)("Error reading width from %s.\n", bmpName); 641 610 return false; 642 611 } … … 644 613 if ((i = fread(&pImage->height, 4, 1, file)) != 1) 645 614 { 646 if (verbose>=1) 647 printf("Error reading height from %s.\n", bmpName); 615 PRINTF(1)("Error reading height from %s.\n", bmpName); 648 616 return false; 649 617 } … … 655 623 if ((fread(&planes, 2, 1, file)) != 1) 656 624 { 657 if (verbose>=1) 658 printf("Error reading planes from %s.\n", bmpName); 625 PRINTF(1)("Error reading planes from %s.\n", bmpName); 659 626 return false; 660 627 } 661 628 if (planes != 1) 662 629 { 663 if (verbose>=1) 664 printf("Planes from %s is not 1: %u\n", bmpName, planes); 630 PRINTF(1)("Planes from %s is not 1: %u\n", bmpName, planes); 665 631 return false; 666 632 } … … 669 635 if ((i = fread(&bpp, 2, 1, file)) != 1) 670 636 { 671 if (verbose>=1) 672 printf("Error reading bpp from %s.\n", bmpName); 637 PRINTF(1)("Error reading bpp from %s.\n", bmpName); 673 638 return false; 674 639 } 675 640 if (bpp != 24) 676 641 { 677 if (verbose>=1) 678 printf("Bpp from %s is not 24: %u\n", bmpName, bpp); 642 PRINTF(1)("Bpp from %s is not 24: %u\n", bmpName, bpp); 679 643 return false; 680 644 } … … 687 651 if (pImage->data == NULL) 688 652 { 689 if (verbose>=1) 690 printf("Error allocating memory for color-corrected image data"); 653 PRINTF(1)("Error allocating memory for color-corrected image data"); 691 654 return false; 692 655 } … … 694 657 if ((i = fread(pImage->data, size, 1, file)) != 1) 695 658 { 696 if (verbose>=1) 697 printf("Error reading image data from %s.\n", bmpName); 659 PRINTF(1)("Error reading image data from %s.\n", bmpName); 698 660 return false; 699 661 } … … 739 701 { 740 702 // Display an error message saying the file was not found, then return NULL 741 printf("Unable to load JPG File %s.\n", jpgName);703 PRINTF(1)("Unable to load JPG File %s.\n", jpgName); 742 704 return false; 743 705 } … … 817 779 return true; 818 780 #else /* HAVE_JPEGLIB_H */ 819 if (verbose >=1) 820 printf ("sorry, but you did not compile with jpeg-support.\nEither install SDL_image or jpeglib, and recompile to see the image\n"); 781 PRINTF(1)("sorry, but you did not compile with jpeg-support.\nEither install SDL_image or jpeglib, and recompile to see the image\n"); 821 782 return false; 822 783 #endif /* HAVE_JPEGLIB_H */ … … 844 805 if(fTGA == NULL) 845 806 { 846 printf("Error could not open texture file: %s\n", tgaName);807 PRINTF(1)("Error could not open texture file: %s\n", tgaName); 847 808 return false; 848 809 } … … 850 811 if(fread(&tgaHeader, sizeof(TGAHeader), 1, fTGA) == 0) 851 812 { 852 printf("Error could not read file header of %s\n", tgaName);813 PRINTF(1)("Error could not read file header of %s\n", tgaName); 853 814 if(fTGA != NULL) 854 815 { … … 872 833 else 873 834 { 874 printf("Error TGA file be type 2 or type 10\n");835 PRINTF(1)("Error TGA file be type 2 or type 10\n"); 875 836 if (fTGA) 876 837 fclose(fTGA); … … 901 862 if(fread(header, sizeof(header), 1, fTGA) == 0) 902 863 { 903 printf("Error could not read info header\n");864 PRINTF(1)("Error could not read info header\n"); 904 865 return false; 905 866 } … … 911 872 if((pImage->width <= 0) || (pImage->height <= 0) || ((pImage->bpp != 24) && (pImage->bpp !=32))) 912 873 { 913 printf("Error invalid texture information\n");874 PRINTF(1)("Error invalid texture information\n"); 914 875 return false; 915 876 } … … 930 891 if(pImage->data == NULL) 931 892 { 932 printf("Error could not allocate memory for image\n");893 PRINTF(1)("Error could not allocate memory for image\n"); 933 894 return false; 934 895 } … … 936 897 if(fread(pImage->data, 1, imageSize, fTGA) != imageSize) 937 898 { 938 printf("Error could not read image data\n");899 PRINTF(1)("Error could not read image data\n"); 939 900 if(pImage->data != NULL) 940 901 { … … 977 938 if(fread(header, sizeof(header), 1, fTGA) == 0) 978 939 { 979 printf("Error could not read info header\n");940 PRINTF(1)("Error could not read info header\n"); 980 941 return false; 981 942 } … … 993 954 if((pImage->width <= 0) || (pImage->height <= 0) || ((pImage->bpp != 24) && (pImage->bpp !=32))) 994 955 { 995 printf("Error Invalid pImage information\n");956 PRINTF(1)("Error Invalid pImage information\n"); 996 957 return false; 997 958 } … … 1003 964 if(pImage->data == NULL) 1004 965 { 1005 printf("Error could not allocate memory for image\n");966 PRINTF(1)("Error could not allocate memory for image\n"); 1006 967 return false; 1007 968 } … … 1013 974 if(fread(&chunkheader, sizeof(GLubyte), 1, fTGA) == 0) 1014 975 { 1015 printf("Error could not read RLE header\n");976 PRINTF(1)("Error could not read RLE header\n"); 1016 977 if(pImage->data != NULL) 1017 978 { … … 1031 992 if(fread(colorbuffer, 1, bytesPerPixel, fTGA) != bytesPerPixel) 1032 993 { 1033 printf("Error could not read image data\n");994 PRINTF(1)("Error could not read image data\n"); 1034 995 if(colorbuffer != NULL) 1035 996 { … … 1061 1022 if(currentpixel > pixelcount) 1062 1023 { 1063 printf("Error too many pixels read\n");1024 PRINTF(1)("Error too many pixels read\n"); 1064 1025 if(colorbuffer != NULL) 1065 1026 { … … 1083 1044 if(fread(colorbuffer, 1, bytesPerPixel, fTGA) != bytesPerPixel) // Attempt to read following color values 1084 1045 { 1085 printf("Error could not read from file");1046 PRINTF(1)("Error could not read from file"); 1086 1047 if(colorbuffer != NULL) 1087 1048 { … … 1114 1075 if(currentpixel > pixelcount) 1115 1076 { 1116 printf("Error too many pixels read\n");1077 PRINTF(1)("Error too many pixels read\n"); 1117 1078 if(colorbuffer != NULL) 1118 1079 { … … 1167 1128 if (png_sig_cmp(PNG_header, 0, 8) != 0) 1168 1129 { 1169 if (verbose >=2) 1170 printf ("Not Recognized as a pngFile\n"); 1130 PRINTF(2)("Not Recognized as a pngFile\n"); 1171 1131 fclose (PNG_file); 1172 1132 return 0; … … 1274 1234 return true; 1275 1235 #else /* HAVE_PNG_H */ 1276 if (verbose >=1) 1277 printf ("sorry, but you did not compile with png-support.\nEither install SDL_image or libpng, and recompile to see the image\n"); 1236 PRINTF(1)("sorry, but you did not compile with png-support.\nEither install SDL_image or libpng, and recompile to see the image\n"); 1278 1237 return false; 1279 1238 #endif /* HAVE_PNG_H */ -
orxonox/trunk/src/importer/object.cc
r3196 r3206 74 74 Object::~Object() 75 75 { 76 if (verbose >= 2) 77 printf ("Deleting display Lists.\n"); 76 PRINTF(2)("Deleting display Lists.\n"); 78 77 Group* walker = this->firstGroup; 79 78 while (walker != NULL) … … 92 91 delete []this->mtlFileName; 93 92 94 if (verbose >=2) 95 printf("Deleting Materials.\n"); 93 PRINTF(2)("Deleting Materials.\n"); 96 94 if (this->material) 97 95 delete this->material;
Note: See TracChangeset
for help on using the changeset viewer.