Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6172 in orxonox.OLD


Ignore:
Timestamp:
Dec 20, 2005, 1:56:59 AM (18 years ago)
Author:
patrick
Message:

christmas: framework update

Location:
branches/christmas_branche/src
Files:
5 edited

Legend:

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

    r6169 r6172  
    160160    this->animate();
    161161
    162   static sVec3D verticesList[MD2_MAX_VERTICES]; /* performance: created only once in a lifetime */
    163   this->processLighting();
    164   this->interpolate(verticesList);
     162   this->renderFrame();
    165163}
    166164
     
    171169 * FIXME
    172170 */
    173 void MD2Model::draw() const
    174 {
    175 //   glPushMatrix();
    176 
    177   this->renderFrame();
     171void MD2Model::draw()
     172{
     173
     174
     175
     176  //   glPushMatrix();
     177
     178  //this->renderFrame();
    178179
    179180//   glPopMatrix();
     
    184185  \brief this is an internal function to render this special frame selected by animate()
    185186*/
    186 void MD2Model::renderFrame() const
     187void MD2Model::renderFrame()
    187188{
    188189  static sVec3D verticesList[MD2_MAX_VERTICES]; /* performance: created only once in a lifetime */
     
    195196  glCullFace(GL_BACK);
    196197
     198  this->processLighting();
     199  this->interpolate(verticesList);
    197200
    198201  this->data->material->select();
  • branches/christmas_branche/src/lib/graphics/importer/md2Model.h

    r6170 r6172  
    143143  virtual ~MD2Model();
    144144
    145   virtual void draw() const;
     145  virtual void draw();
    146146
    147147  void setAnim(int type);
     
    160160  void processLighting();
    161161  void interpolate(sVec3D* verticesList);
    162   void renderFrame() const;
     162  void renderFrame();
    163163
    164164
  • branches/christmas_branche/src/world_entities/creatures/md2_creature.cc

    r6171 r6172  
    113113  PRINTF(4)("SPACESHIP INIT\n");
    114114
    115 //   EventHandler::getInstance()->grabEvents(true);
     115  EventHandler::getInstance()->grabEvents(true);
    116116
    117117  bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
     
    253253
    254254  if( likely(this->models[0] != NULL))
    255     ((MD2Model*)this->models[0])->tick(time);
     255     ((MD2Model*)this->models[0])->tick(time);
     256
     257
    256258
    257259
  • branches/christmas_branche/src/world_entities/space_ships/space_ship.cc

    r6169 r6172  
    112112  PRINTF(4)("SPACESHIP INIT\n");
    113113
    114   EventHandler::getInstance()->grabEvents(true);
     114//   EventHandler::getInstance()->grabEvents(true);
    115115
    116116  bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
  • branches/christmas_branche/src/world_entities/world_entity.cc

    r6169 r6172  
    105105  if (fileName != NULL)
    106106  {
    107     // search for the special character # in the LoadParam
     107   // search for the special character # in the LoadParam
    108108    if (strchr(fileName, '#') != NULL)
     109    {
     110      PRINTF(4)("Found # in %s... searching for LOD's\n", fileName);
     111      char* lodFile = new char[strlen(fileName)+1];
     112      strcpy(lodFile, fileName);
     113      char* depth = strchr(lodFile, '#');
     114      for (unsigned int i = 0; i < 5; i++)
    109115      {
    110         PRINTF(4)("Found # in %s... searching for LOD's\n", fileName);
    111         char* lodFile = new char[strlen(fileName)+1];
    112         strcpy(lodFile, fileName);
    113         char* depth = strchr(lodFile, '#');
    114         for (unsigned int i = 0; i < 5; i++)
    115           {
    116             *depth = 48+(int)i;
    117             printf("-------%s\n", lodFile);
    118             if (ResourceManager::isInDataDir(lodFile))
    119               this->loadModel(lodFile, scaling, i);
    120           }
    121           this->supportsLOD = true;
    122         return;
     116        *depth = 48+(int)i;
     117        printf("-------%s\n", lodFile);
     118        if (ResourceManager::isInDataDir(lodFile))
     119          this->loadModel(lodFile, scaling, i);
    123120      }
    124 
    125       if( strchr(fileName, '.obj') != NULL)
    126       {
    127         PRINTF(4)("fetching OBJ file: %s\n", fileName);
    128         if (scaling == 1.0)
    129           this->setModel((Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN), modelNumber);
    130         else
    131           this->setModel((Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN, &scaling), modelNumber);
    132 
    133         if( modelNumber == 0)
    134           this->buildObbTree(4);
    135       }
    136       else if( strchr(fileName, '.md2') != NULL)
    137       {
    138         PRINTF(4)("fetching MD2 file: %s\n", fileName);
     121      this->supportsLOD = true;
     122      return;
     123    }
     124
     125    if(strstr(fileName, ".obj"))
     126    {
     127      PRINTF(4)("fetching OBJ file: %s\n", fileName);
     128      if (scaling == 1.0)
     129        this->setModel((Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN), modelNumber);
     130      else
     131        this->setModel((Model*)ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN, &scaling), modelNumber);
     132
     133      if( modelNumber == 0)
     134        this->buildObbTree(4);
     135    }
     136    else if(strstr(fileName, ".md2"))
     137    {
     138      PRINTF(0)("fetching MD2 file: %s\n", fileName);
    139139//         MD2Model* m = (MD2Model*)ResourceManager::getInstance()->load(fileName, MD2, RP_CAMPAIGN);
    140         MD2Model* m = new MD2Model(fileName, "/home/boenzlip/orxonox/data/maps/santa_claus.pcx");
    141         m->debug();
     140      MD2Model* m = new MD2Model(fileName, "/home/boenzlip/orxonox/data/maps/santa_claus.pcx");
     141      m->debug();
     142      this->supportsLOD = false;
    142143        //this->setModel((Model*)ResourceManager::getInstance()->load(fileName, MD2, RP_CAMPAIGN), 0);
    143         this->setModel((Model*)m, 0);
    144       }
     144      this->setModel((Model*)m, 0);
     145    }
    145146  }
    146147  else
Note: See TracChangeset for help on using the changeset viewer.