Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4158 in orxonox.OLD for orxonox/branches/md2_loader


Ignore:
Timestamp:
May 11, 2005, 12:32:36 AM (19 years ago)
Author:
patrick
Message:

orxonox/branches/md2_loader: now using the home brewed material class for the model - and it works just perfect! orxonox has a very powerfull material class./orxonox :D

Location:
orxonox/branches/md2_loader/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/md2_loader/src/lib/graphics/importer/abstract_model.h

    r4157 r4158  
    7777        char strName[255];                      // The name of the object
    7878        CVector3  *pVerts;                      // The object's vertices
    79         CVector3  *pNormals;            // The object's normals
    80         CVector2  *pTexVerts;           // The texture's UV coordinates
     79        CVector3  *pNormals;                    // The object's normals
     80        CVector2  *pTexVerts;                   // The texture's UV coordinates
    8181        tFace *pFaces;                          // The faces information of the object
    8282};
     
    203203      glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
    204204      glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);
    205       gluBuild2DMipmaps(GL_TEXTURE_2D, 3, image->w, image->h, GL_RGBA, GL_UNSIGNED_BYTE, image->pixels);       
     205      gluBuild2DMipmaps(GL_TEXTURE_2D, 3, image->w, image->h, GL_RGB, GL_UNSIGNED_BYTE, image->pixels);
    206206
    207207      SDL_FreeSurface(image);
  • orxonox/branches/md2_loader/src/lib/graphics/importer/md2Model.cc

    r4157 r4158  
    5656{
    5757  if( pModel->objectList.size() <= 0) return;
     58
     59  glEnable(GL_TEXTURE_2D);
     60  //glBindTexture(GL_TEXTURE_2D, this->diffuseTexture->getTexture());
    5861
    5962  t3DObject *pObject = &pModel->objectList[0];
     
    6972          glNormal3f(-pObject->pNormals[index].x, -pObject->pNormals[index].y, -pObject->pNormals[index].z);
    7073
    71           if( pObject->pTexVerts)
     74          if( likely(pObject->pTexVerts != NULL))
    7275            {
    73               glTexCoord2f(pObject->pTexVerts[ index2 ].x, pObject->pTexVerts[ index2 ].y);
     76              glTexCoord2f(pObject->pTexVerts[index2].x, pObject->pTexVerts[index2].y);
    7477            }
    75           glVertex3f(pObject->pVerts[ index ].x, pObject->pVerts[ index ].y, pObject->pVerts[ index ].z);
     78          glVertex3f(pObject->pVerts[index].x, pObject->pVerts[index].y, pObject->pVerts[index].z);
    7679        }
    7780    }
    7881  glEnd();
     82
     83  glDisable(GL_TEXTURE_2D);
    7984}
    8085
  • orxonox/branches/md2_loader/src/world_entities/test_entity.cc

    r4157 r4158  
    4545      this->model->materialList[i].texureId = i;
    4646    }
     47
     48  this->material = new Material("Sky");
     49  this->material->setDiffuseMap("../data/models/tris.pcx");
     50  this->material->setIllum(3);
     51  this->material->setAmbient(1.0, 1.0, 1.0);
    4752}
    4853
     
    7681  //this->model->draw();
    7782  /* TESTGING TESTING TESTING */
     83  this->material->select();
    7884  this->md2Model->draw(this->model);
    7985
  • orxonox/branches/md2_loader/src/world_entities/test_entity.h

    r4157 r4158  
    77class MD2Model;
    88struct t3DModel;
     9class Material;
    910
    1011class TestEntity : public WorldEntity
     
    2930
    3031  unsigned int* textureArray;
     32  Material* material;
    3133
    3234};
Note: See TracChangeset for help on using the changeset viewer.