Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10052 in orxonox.OLD


Ignore:
Timestamp:
Dec 13, 2006, 12:22:11 AM (17 years ago)
Author:
patrick
Message:

integrating loading to we

Location:
branches/mount_points/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/mount_points/src/lib/graphics/importer/oif/object_information_file.cc

    r10051 r10052  
    2121
    2222
     23
    2324/**
    2425 * standard constructor
     26 */
     27ObjectInformationFile::ObjectInformationFile()
     28{
     29}
     30
     31/**
     32 *  constructor
    2533 * @todo this constructor is not jet implemented - do it
    2634*/
    27 ObjectInformationFile::ObjectInformationFile()
     35ObjectInformationFile::ObjectInformationFile(const std::string& fileName)
    2836{
    29   this->data = ResourceOIF("adsf").data;
     37  // load the oif file
     38  this->data = ResourceOIF(fileName).data;
    3039
    3140}
  • branches/mount_points/src/lib/graphics/importer/oif/object_information_file.h

    r10051 r10052  
    77#define _OBJECT_INFORMATION_FILE_H
    88
    9 #include "vertex_array_model.h"
     9#include "base_object.h"
    1010
    1111#include "count_pointer.h"
     
    2929
    3030//! A class for object informations
    31 class ObjectInformationFile : public VertexArrayModel
     31class ObjectInformationFile : BaseObject
    3232{
    3333
    3434public:
    3535  ObjectInformationFile();
     36  ObjectInformationFile(const std::string& fileName);
    3637  virtual ~ObjectInformationFile();
    3738
  • branches/mount_points/src/lib/graphics/importer/oif/resource_oif.cc

    r10051 r10052  
    77
    88
    9 ResourceOIF::ResourceOIF(const std::string& modelName, const Resources::KeepLevel& keepLevel)
     9ResourceOIF::ResourceOIF(const std::string& fileName, const Resources::KeepLevel& keepLevel)
    1010    : Resource(&ResourceOIF::type)
    1111{
    12   Resources::StorePointer* ptr = this->acquireResource(loadString(modelName));
     12  Resources::StorePointer* ptr = this->acquireResource(fileName);
    1313
    1414  if (ptr)
    1515  {
    16     PRINTF(0)("FOUND OIF: %s\n", modelName.c_str());
     16    PRINTF(0)("FOUND OIF: %s\n", fileName.c_str());
    1717    //this->acquireData(static_cast<ResourceOIF::OIFResourcePointer*>(ptr)->ptr());
    1818  }
    1919  else
    2020  {
    21     PRINTF(0)("NOT FOUND OIF: %s\n", modelName.c_str());
     21    PRINTF(0)("NOT FOUND OIF: %s\n", fileName.c_str());
    2222//     std::string modelFileName = this->Resource::locateFile(modelName);
    2323//     //std::string skinFileName = this->Resource::locateFile(skinName);
     
    3131{
    3232  SubString loadValues(loadString, ',');
    33   std::string modelName;
    34   std::string skinName;
    35   float scale = 1.0f;
     33  std::string fileName;
    3634  if (loadValues.size() > 0)
    37     modelName = loadValues[0];
    38   if (loadValues.size() > 1)
    39     skinName = loadValues[1];
    40   if (loadValues.size() > 2)
    41     scale = MultiType(loadValues[2]).getFloat();
     35    fileName = loadValues[0];
    4236
    43   return ResourceOIF(modelName);
     37  return ResourceOIF(fileName);
    4438}
    4539
    46 std::string ResourceOIF::loadString(const std::string& modelName)
    47 {
    48   return modelName;
    49 }
    5040
    5141
  • branches/mount_points/src/lib/graphics/importer/oif/resource_oif.h

    r10051 r10052  
    1515{
    1616public:
    17   ResourceOIF(const std::string& modelName,
    18               const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
     17  ResourceOIF(const std::string& fileName, const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
    1918  static ResourceOIF createFromString(const std::string& loadString, const Resources::KeepLevel& keepLevel = Resources::KeepLevel());
    20   static std::string loadString(const std::string& modelName);
     19
    2120
    2221private:
  • branches/mount_points/src/world_entities/world_entity.cc

    r10013 r10052  
    2424#include "md2/md2Model.h"
    2525#include "md3/md3_model.h"
     26#include "oif/object_information_file.h"
    2627
    2728#include "aabb_tree_node.h"
     
    191192    {
    192193      PRINTF(4)("fetching OBJ file: %s\n", fileName.c_str());
     194      // creating the model and loading it
    193195      StaticModel* model = new StaticModel();
    194196      *model = ResourceOBJ(fileName, this->scaling);
     
    201203      else
    202204        delete model;
     205
     206      // now get the object information file for this model, if any
     207      std::string oifName = fileName.substr(0, fileName.length() - 3) + ".oif";
     208      this->loadObjectInformationFile( oifName);
    203209    }
    204210    /// LOADING AN MD2-model
     
    246252
    247253  this->models[modelNumber] = model;
     254}
     255
     256
     257
     258/**
     259 * loads the object information file for this model
     260 * @param fileName the name of the file
     261 */
     262void WorldEntity::loadObjectInformationFile(const std::string& fileName)
     263{
     264  PRINTF(0)("loading the oif File: %s", fileName.c_str());
    248265}
    249266
  • branches/mount_points/src/world_entities/world_entity.h

    r10013 r10052  
    3232class AABBTreeNode;
    3333class Model;
     34class ObjectInformationFile;
    3435
    3536
     
    4950  void setModel(Model* model, unsigned int modelNumber = 0);
    5051  Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; };
     52
     53  void loadObjectInformationFile(const std::string& fileName);
    5154
    5255  inline void loadMD2Texture(const std::string& fileName) { this->md2TextureFileName = fileName; }
     
    185188
    186189  std::vector<Model*>     models;             //!< The model that should be loaded for this entity.
     190  ObjectInformationFile*  oiFile;             //!< Reference to the object information file discribing the model of this WE
    187191  std::string             md2TextureFileName; //!< the file name of the md2 model texture, only if this
    188192  std::string             modelLODName;       //!< the name of the model lod file
Note: See TracChangeset for help on using the changeset viewer.