Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6191 in orxonox.OLD for branches


Ignore:
Timestamp:
Dec 20, 2005, 3:24:14 PM (19 years ago)
Author:
patrick
Message:

christmas: the texture gets loaded now and is loadable

Location:
branches/christmas_branche/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/christmas_branche/src/lib/graphics/importer/md2Model.cc

    r6188 r6191  
    121121  currVec = &this->data->pVertices[this->data->numVertices * this->animationState.currentFrame];
    122122  nextVec = &this->data->pVertices[this->data->numVertices * this->animationState.nextFrame];
    123   PRINTF(0)("current frame nr %i, next frame nr %i\n", this->animationState.currentFrame, this->animationState.nextFrame);
    124 
    125123
    126124  for( int i = 0; i < this->data->numVertices; ++i)
     
    215213        }
    216214
    217 
    218215      for(; i > 0; i--, pCommands += 3) /* down counting for loop, next 3 gl commands */
    219216        {
     
    242239//   glEnable(GL_CULL_FACE);
    243240//   glCullFace(GL_BACK);
    244 
     241//
    245242//   this->processLighting();
    246243//   this->interpolate(/*verticesList*/);
     
    352349  this->numTexCoor = 0;
    353350
    354   this->scaleFactor = 1.0f;
    355 //   this->scaleFactor = 0.2f;
     351//   this->scaleFactor = 1.0f;
     352  this->scaleFactor = 0.2f;
    356353
    357354  this->fileName = NULL;
     
    448445  for(int i = 0; i < this->numFrames; ++i)
    449446    {
    450       printf("==============vertex loading for frame %i/%i========\n", i, this->numFrames);
    451447      frame = (sFrame*)(buffer + this->header->frameSize * i);
    452448      pVertex = this->pVertices + this->numVertices  * i;
     
    460456           pVertex[j][2] = (-1.0 * (frame->pVertices[j].v[1] * frame->scale[1] + frame->translate[1])) * this->scaleFactor;
    461457
    462 //            pVertex[j][0] = ((frame->pVertices[j].v[0] /** frame->scale[0]*/ )/* + frame->translate[0]*/ );
    463 //            pVertex[j][2] = (-1.0f * (frame->pVertices[j].v[2] /** frame->scale[2]*/) /*+ frame->translate[2]*/);
    464 //            pVertex[j][1] = ((frame->pVertices[j].v[1] /** frame->scale[1]*/ /*+ frame->translate[1]*/));
    465 
    466 
    467           printf("vertex %i/%i: (%f, %f, %f)\n", j, this->numVertices, pVertex[j][0], pVertex[j][1], pVertex[j][2]);
     458          //printf("vertex %i/%i: (%f, %f, %f)\n", j, this->numVertices, pVertex[j][0], pVertex[j][1], pVertex[j][2]);
    468459
    469460          pNormals[j] = frame->pVertices[j].lightNormalIndex;
  • branches/christmas_branche/src/lib/graphics/importer/md2Model.h

    r6188 r6191  
    6969typedef struct
    7070{
    71   unsigned char             v[3];                 //!< the vector of the vertex
     71  unsigned char    v[3];                 //!< the vector of the vertex
    7272  unsigned char    lightNormalIndex;     //!< the index of the light normal
    7373} sVertex;
  • branches/christmas_branche/src/subprojects/importer/importer.cc

    r6184 r6191  
    4545      obj = new OBJModel (argv[1], atof(argv[2]));
    4646    else if( strstr(argv[1], ".md2") != NULL)
     47    {
    4748      obj = new MD2Model(argv[1], argv[2]);
     49      ((MD2Model*)obj)->tick(0.1f);
     50    }
    4851  }
    4952  else if (argc>=2)
     
    5154    if( strstr(argv[1], ".obj") != NULL)
    5255      obj = new OBJModel(argv[1]);
    53     else if( strstr(argv[1], ".md2") != NULL)
     56    else if( strstr(argv[1], ".md2") != NULL) {
    5457      obj = new MD2Model(argv[1], "fake_texture.bad");
     58      obj = new MD2Model(argv[1], argv[2]);
     59      ((MD2Model*)obj)->tick(0.1f);
     60    }
    5561  }
    5662  else
  • branches/christmas_branche/src/world_entities/world_entity.cc

    r6187 r6191  
    8585  static_cast<PNode*>(this)->loadParams(root);
    8686
     87  LoadParam(root, "md2texture", this, WorldEntity, loadMD2Texture)
     88      .describe("the fileName of the texture, that should be loaded onto this world-entity. (must be relative to the data-dir)")
     89      .defaultValues(1, NULL);
     90
    8791  // Model Loading
    8892  LoadParam(root, "model", this, WorldEntity, loadModel)
    8993      .describe("the fileName of the model, that should be loaded onto this world-entity. (must be relative to the data-dir)")
    9094      .defaultValues(3, NULL, 1.0f, 0);
    91 
    92 }
     95}
     96
    9397
    9498/**
     
    135139      PRINTF(4)("fetching MD2 file: %s\n", fileName);
    136140//         MD2Model* m = (MD2Model*)ResourceManager::getInstance()->load(fileName, MD2, RP_CAMPAIGN);
    137       Model* m = new MD2Model(fileName, "md2_fake_texture.bad");
     141      Model* m = new MD2Model(fileName, this->md2TextureFileName);
    138142        //this->setModel((Model*)ResourceManager::getInstance()->load(fileName, MD2, RP_CAMPAIGN), 0);
    139143      this->setModel(m, 0);
  • branches/christmas_branche/src/world_entities/world_entity.h

    r6179 r6191  
    3636  void setModel(Model* model, unsigned int modelNumber = 0);
    3737  Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; };
     38
     39  inline void loadMD2Texture(const char* fileName) { this->md2TextureFileName = fileName; }
    3840
    3941  bool buildObbTree(unsigned int depth);
     
    7981 private:
    8082  std::vector<Model*>     models;             //!< The model that should be loaded for this entity.
     83  const char*             md2TextureFileName; //!< the file name of the md2 model texture, only if this
    8184  BVTree*                 obbTree;            //!< this is the obb tree reference needed for collision detection
    8285
Note: See TracChangeset for help on using the changeset viewer.