Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2804 in orxonox.OLD


Ignore:
Timestamp:
Nov 11, 2004, 10:34:44 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/importer: added heavy logging

Location:
orxonox/branches/importer/importer
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/importer/importer/array.cc

    r2760 r2804  
    1212void Array::createArray (unsigned int newArraySize)
    1313{
     14  if (verbose >= 2)
     15    printf ("crating new Array of size %i\n", newArraySize);
    1416  array = new GLfloat [newArraySize];
    1517  entryCount = -1; //0 means one entry
     
    2022void Array::resizeArray (unsigned int newSize)
    2123{
     24  if (verbose >= 2)
     25    printf ("Resizing Array to size %i\n", newSize); 
    2226  GLfloat* newArray = new GLfloat [newSize];
    2327 
     
    3438void Array::finalizeArray (void)
    3539{
     40  if (verbose >= 3)
     41    printf ("Finalizing array.\n"); 
    3642  resizeArray (entryCount+1);
    3743  return;
     
    4147void Array::addEntry (GLfloat entry)
    4248{
     49  if (verbose >= 3)
     50    printf ("adding new Entry to Array: %f\n", entry);
    4351  entryCount++;
    4452
  • orxonox/branches/importer/importer/array.h

    r2776 r2804  
    11#ifndef _ARRAY_H
    22#define _ARRAY_H
     3
     4extern int verbose;
    35
    46#include <GL/gl.h>
  • orxonox/branches/importer/importer/framework.cc

    r2794 r2804  
    22#include "object.h"
    33
    4 
     4int verbose = 2;
    55WindowHandler wHandler;  // Create an instance of the whandler basecode class
    66Object* obj;
  • orxonox/branches/importer/importer/material.cc

    r2780 r2804  
    1717Material* Material::addMaterial(char* mtlName)
    1818{
     19  if (verbose >=2)
     20    printf ("adding Material %s\n", mtlName);
    1921  Material* newMat = new Material(mtlName);
    2022  Material* tmpMat = this;
     
    3032void Material::init(void)
    3133{
     34  if (verbose >= 3)
     35    printf ("initializing new Material\n");
    3236  nextMat = NULL;
    3337
     
    4246void Material::setName (char* mtlName)
    4347{
     48  if (verbose >= 3)
     49    printf("setting Material Name to %s", mtlName);
    4450  strcpy(name, mtlName);
    4551  //  printf ("adding new Material: %s, %p\n", this->getName(), this);
     
    5460void Material::setIllum (int illum)
    5561{
     62  if (verbose >= 3)
     63    printf("setting illumModel of Material %s to %i", name, illum);
    5664  illumModel = illum;
    5765  //  printf ("setting illumModel to: %i\n", illumModel);
     
    6472void Material::setDiffuse (float r, float g, float b)
    6573{
     74  if (verbose >= 3)
     75    printf ("setting Diffuse Color of Material %s to r=%f g=%f b=%f\n", name, r, g, b);
    6676  diffuse[0] = r;
    6777  diffuse[1] = g;
     
    6979  diffuse[3] = 1.0;
    7080
    71   //  printf ("setting Diffuse Color to r=%f g=%f b=%f\n", r, g, b);
    7281}
    7382void Material::setDiffuse (char* rgb)
     
    8089void Material::setAmbient (float r, float g, float b)
    8190{
     91  if (verbose >=3)
     92    printf ("setting Ambient Color of Material %s to r=%f g=%f b=%f\n", name, r, g, b);
    8293  ambient[0] = r;
    8394  ambient[1] = g;
    8495  ambient[2] = b;
    8596  ambient[3] = 1.0;
    86   //  printf ("setting Ambient Color to r=%f g=%f b=%f\n", r, g, b);
    8797}
    8898void Material::setAmbient (char* rgb)
     
    95105void Material::setSpecular (float r, float g, float b)
    96106{
     107  if (verbose >= 3)
     108    printf ("setting Specular Color of Material %s to r=%f g=%f b=%f\n", name, r, g, b);
    97109  specular[0] = r;
    98110  specular[1] = g;
    99111  specular[2] = b;
    100112  specular[3] = 1.0;
    101   //printf ("setting Specular Color to r=%f g=%f b=%f\n", r, g, b);
    102 }
     113 }
    103114void Material::setSpecular (char* rgb)
    104115{
     
    111122void Material::setTransparency (float trans)
    112123{
     124  if (verbose >= 3)
     125    printf ("setting Transparency of Material %s to %f\n", name, trans);
    113126  transparency = trans;
    114127}
     
    123136Material* Material::search (char* mtlName)
    124137{
     138  if (verbose >=3)
     139    printf ("Searching for material %s", mtlName);
    125140  Material* searcher = this;
    126141  while (searcher != NULL)
    127142    {
     143      if (verbose >= 3)
     144        printf (".");
    128145      if (!strcmp (searcher->getName(), mtlName))
    129         return searcher;
     146        {
     147          if (verbose >= 3)
     148            printf ("found.\n");
     149          return searcher;
     150        }
    130151      searcher = searcher->nextMat;
    131152    }
  • orxonox/branches/importer/importer/material.h

    r2780 r2804  
    11#ifndef _MATERIAL_H
    22#define _MATERIAL_H
     3
     4extern int verbose;
     5
    36#include <GL/gl.h>
    47#include <GL/glu.h>
  • orxonox/branches/importer/importer/object.cc

    r2794 r2804  
    2222bool Object::importFile (char* fileName)
    2323{
    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);
    2628  return true;
    2729}
     
    2931bool Object::initialize (void)
    3032{
     33  if (verbose >=3)
     34    printf("new 3D-Object is being created\n");
    3135  faceMode = -1;
    3236  if ( (listNumber = glGenLists(1)) == 0 )
     
    4549bool Object::finalize(void)
    4650{
     51  if (verbose >=3)
     52    printf("finalizing the 3D-Object\n");
    4753  glEndList();
    4854  return true;
     
    5157void Object::draw (void)
    5258{
     59  if (verbose >=3)
     60    printf("drawing the 3D-Object\n");
    5361  glCallList (listNumber);
    5462}
     
    6068  if (!OBJ_FILE->is_open())
    6169    {
    62       printf ("unable to open file: %s\n", fileName);
     70      if (verbose >=1)
     71        printf ("unable to open .OBJ file: %s\n", fileName);
    6372      return false;
    6473    }
    65  
     74  objFileName = fileName;
    6675  char Buffer[500];
    6776  vertices = new Array();
     
    7079    {
    7180      OBJ_FILE->getline(Buffer, 500);
    72       //      printf("%s\n", Buffer);
     81      if (verbose >=4)
     82        printf ("Read input line: %s\n",Buffer);
    7383     
    7484
     
    125135  char subbuffer3[20];
    126136  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);
    127139  vertices->addEntry(atof(subbuffer1), atof(subbuffer2), atof(subbuffer3));
    128140  return true;
     
    145157  char subbuffer4[20] ="";
    146158  sscanf (faceString, "%s %s %s %s", subbuffer1, subbuffer2, subbuffer3, subbuffer4);
    147   //  printf("%s, %s, %s\n", subbuffer1,subbuffer2,subbuffer3);
    148159  if (!strcmp(subbuffer4, ""))
    149160    {
     
    156167     
    157168      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);
    159171      addGLElement(subbuffer1);
    160172      addGLElement(subbuffer2);
     
    171183        }
    172184      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);
    174187      addGLElement(subbuffer1);
    175188      addGLElement(subbuffer2);
     
    191204  normal[0] = '\0';
    192205  normal ++;
    193  
     206  if (verbose >= 4)
     207    printf ("importing grafical Element.... including to openGL\n");
    194208  //glArrayElement(atoi(vertex)-1);
    195209  glNormal3fv(normals->getArray() +(atoi(normal)-1)*3);
     
    205219  char subbuffer3[20];
    206220  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);
    208223  normals->addEntry(atof(subbuffer1), atof(subbuffer2), atof(subbuffer3));
    209224  return true;
     
    215230  if (!MTL_FILE->is_open())
    216231    {
    217       printf ("unable to open file: %s\n", mtlFile);
     232      if (verbose >= 1)
     233        printf ("unable to open file: %s\n", mtlFile);
    218234      return false;
    219235    }
    220  
     236  mtlFileName = mtlFile;
     237  if (verbose >=2)
     238    printf ("Opening mtlFile: %s\n", mtlFileName);
    221239  char Buffer[500];
    222240  vertices = new Array();
     
    226244    {
    227245      MTL_FILE->getline(Buffer, 500);
    228       //      printf("%s\n", Buffer);
     246      if (verbose >= 4)
     247        printf("found line in mtlFile: %s\n", Buffer);
    229248     
    230249
     
    265284    glEnd();
    266285  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);
    269288  material->search(matString)->select();
    270289}
  • orxonox/branches/importer/importer/object.h

    r2794 r2804  
    88#include "material.h"
    99#include <fstream.h>
     10
     11extern int verbose;
    1012
    1113class Object
     
    3032  Array* colors;
    3133  Array* normals;
    32   char* objFile;
     34  char* objFileName;
     35  char* mtlFileName;
    3336  int faceMode;
    3437  bool readVertices;
  • orxonox/branches/importer/importer/windowHandler.h

    r2748 r2804  
    11#ifndef _WINDOWHANDLER_H
    22#define _WINDOWHANDLER_H
     3
     4extern int verbose;
    35
    46#include <GL/gl.h>
Note: See TracChangeset for help on using the changeset viewer.