Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8353 in orxonox.OLD for branches/bsp_model


Ignore:
Timestamp:
Jun 14, 2006, 1:07:17 AM (18 years ago)
Author:
patrick
Message:

bsp: worldentities now are able to load md3 models. but md3 models are not yet implemented:D coming soon

Location:
branches/bsp_model/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_data.cc

    r8351 r8353  
    7777{
    7878  FILE *pFile;                            //file stream
    79   char* buffer;                           //buffer for frame data
    80 
    81 
    82   sFrame* frame;                          //temp frame
    83   sVec3D *pVertex;
    84   int* pNormals;
     79//  char* buffer;                           //buffer for frame data
    8580
    8681
     
    9691      return false;
    9792    }
    98   this->header = new MD2Header;
    99   fread(this->header, 1, sizeof(MD2Header), pFile);
     93  this->header = new MD3Header;
     94  fread(this->header, 1, sizeof(MD3Header), pFile);
    10095  /* check for the header version: make sure its a md2 file :) */
    10196  if( unlikely(this->header->version != MD2_VERSION) && unlikely(this->header->ident != MD2_IDENT))
     
    10499      return false;
    105100    }
     101
     102
    106103
    107104#if 0
     
    157154#endif
    158155
    159   delete [] buffer;
     156  //delete [] buffer;
    160157  fclose(pFile);
    161158
     
    216213
    217214}
     215
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_data.h

    r8351 r8353  
    4747
    4848//! This holds the header information that is read in at the beginning of the file: id software definition
    49 struct MD2Header
     49struct MD3Header
    5050{
    5151   int ident;                           //!< This is used to identify the file
    5252   int version;                         //!< The version number of the file (Must be 8)
    5353
    54    int skinWidth;                       //!< The skin width in pixels
    55    int skinHeight;                      //!< The skin height in pixels
    56    int frameSize;                       //!< The size in bytes the frames are
     54   char filename[68];                   //!< The filename of the model
    5755
    58    int numSkins;                        //!< The number of skins associated with the model
    59    int numVertices;                     //!< The number of vertices (constant for each frame)
    60    int numTexCoords;                    //!< The number of texture coordinates
    61    int numTriangles;                    //!< The number of faces (polygons)
    62    int numGlCommands;                   //!< The number of gl commands
    63    int numFrames;                       //!< The number of animation frames
    64 
    65    int offsetSkins;                     //!< The offset in the file for the skin data
    66    int offsetTexCoords;                 //!< The offset in the file for the texture data
    67    int offsetTriangles;                 //!< The offset in the file for the face data
    68    int offsetFrames;                    //!< The offset in the file for the frames data
    69    int offsetGlCommands;                //!< The offset in the file for the gl commands data
    70    int offsetEnd;                       //!< The end of the file offset
     56   int boneFrameNum;                    //!< number of frames
     57   int tagNum;                          //!< number of tags
     58   int meshNum;                         //!< number of mesh
     59   int maxTexNum;                       //!< number of texture
     60   int boneFrameStart;                  //!< start of bone frames
     61   int tagStart;                        //!< start of the tag
     62   int meshStart;                       //!< mesh start
     63   int fileSize;                        //!< file size
    7164};
    7265
     
    9992  std::string        fileName;              //!< file name of the model File
    10093  std::string        skinFileName;          //!< file name of the skin file
    101   MD2Header*         header;                //!< the header file
     94  MD3Header*         header;                //!< the header file
    10295
    10396  sVec3D*            pVertices;             //!< pointer to the vertices data block
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_model.cc

    r8351 r8353  
    2525   * md3 model
    2626   */
    27   MD3Model::MD3Model(FILE *pFile, int dataOffset)
    28   {}
     27  MD3Model::MD3Model(std::string filename, float scaling)
     28  {
     29
     30  }
    2931
    3032
  • branches/bsp_model/src/lib/graphics/importer/md3/md3_model.h

    r8351 r8353  
    1010
    1111#include <string>
     12#include "model.h"
    1213
    1314
     
    1920{
    2021
    21 class MD3Model
     22class MD3Model : public Model
    2223{
    2324
    2425  public:
    25     MD3Model(FILE *pFile, int dataOffset);
     26    MD3Model(std::string filename, float scaling);
    2627    ~MD3Model();
    2728
  • branches/bsp_model/src/world_entities/world_entity.cc

    r8346 r8353  
    2222#include "model.h"
    2323#include "md2/md2Model.h"
     24#include "md3/md3_model.h"
     25
    2426#include "util/loading/resource_manager.h"
    2527#include "util/loading/load_param.h"
     
    199201        this->buildObbTree(obbTreeDepth);
    200202    }
     203    else if(fileName.find(".md3") != std::string::npos)
     204    {
     205      PRINTF(4)("fetching MD3 file: %s\n", fileName.c_str());
     206      Model* m = new md3::MD3Model(fileName, this->scaling);
     207      this->setModel(m, 0);
     208
     209//       if( m != NULL)
     210//         this->buildObbTree(obbTreeDepth);
     211    }
    201212  }
    202213  else
Note: See TracChangeset for help on using the changeset viewer.