Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6009 in orxonox.OLD for trunk/src/lib/graphics


Ignore:
Timestamp:
Dec 10, 2005, 4:07:04 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: abstract model implementation in .cc

@patrick: do you aprove?

Location:
trunk/src/lib/graphics/importer
Files:
2 edited
1 copied
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/Makefile.am

    r5861 r6009  
    44noinst_LIBRARIES = libORXimporter.a
    55
    6 libORXimporter_a_SOURCES = model.cc \
     6libORXimporter_a_SOURCES = abstract_model.cc \
     7                           model.cc \
    78                           objModel.cc \
    89                           primitive_model.cc \
  • trunk/src/lib/graphics/importer/abstract_model.cc

    r6006 r6009  
    1010
    1111   ### File Specific:
    12    main-programmer: ...
     12   main-programmer: Patrick Boenzli
    1313   co-programmer: ...
    1414*/
    1515
    16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
     16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_MODEL
    1717
    18 #include "proto_class.h"
     18#include "abstract_model.h"
    1919
    2020using namespace std;
     
    2525 * @todo this constructor is not jet implemented - do it
    2626*/
    27 ProtoClass::ProtoClass ()
     27AbstractModel::AbstractModel()
    2828{
    29    this->setClassID(CL_PROTO_ID, "ProtoClass");
     29//   this->setClassID(CL_PROTO_ID, "ProtoClass");
     30  this->pModelInfo.numVertices = 0;
     31  this->pModelInfo.numTriangles = 0;
     32  this->pModelInfo.numTexCoor = 0;
    3033
    31    /* If you make a new class, what is most probably the case when you write this file
    32       don't forget to:
    33        1. Add the new file new_class.cc to the ./src/Makefile.am
    34        2. Add the class identifier to ./src/class_id.h eg. CL_NEW_CLASS
    35 
    36       Advanced Topics:
    37       - if you want to let your object be managed via the ObjectManager make sure to read
    38         the object_manager.h header comments. You will use this most certanly only if you
    39         make many objects of your class, like a weapon bullet.
    40    */
     34  this->pModelInfo.pVertices = NULL;
     35  this->pModelInfo.pTriangles = NULL;
     36  this->pModelInfo.pNormals = NULL;
     37  this->pModelInfo.pTexCoor = NULL;
    4138}
    4239
     
    4542 * standard deconstructor
    4643*/
    47 ProtoClass::~ProtoClass ()
     44AbstractModel::~AbstractModel()
    4845{
    4946  // delete what has to be deleted here
  • trunk/src/lib/graphics/importer/abstract_model.h

    r6008 r6009  
    128128
    129129  public:
    130     AbstractModel() { }
    131     virtual ~AbstractModel() { }
     130    AbstractModel();
     131    virtual ~AbstractModel();
    132132
    133133    inline const modelInfo* getModelInfo() const { return &this->pModelInfo; }
     
    153153    inline unsigned int getFaceCount() const { return this->pModelInfo.numTriangles; };
    154154
     155
    155156  protected:
    156157    modelInfo      pModelInfo;      //!< Reference to the modelInfo
  • trunk/src/lib/graphics/importer/vertex_array_model.cc

    r6008 r6009  
    2727using namespace std;
    2828
    29 /**
    30  *  cleans up a ModelGroup
    31 
    32    actually does the same as the delete Operator, but does not delete the predecessing group
    33 */
    34 void ModelGroup::cleanup()
    35 {
    36   PRINTF(5)("Cleaning up group\n");
    37   if (this->firstFace)
    38     delete this->firstFace;
    39   this->firstFace = NULL;
    40   if (this->next)
    41     this->next->cleanup();
    42 }
    43 
    44 
    4529/////////////
    4630/// MODEL ///
     
    6044  this->finalized = false;
    6145  // setting the start group;
    62   this->currentGroup = this->firstGroup = new ModelGroup;
    63   this->groupCount = 0;
    64   this->vertexCount = 0;
    65   this->normalCount = 0;
    66   this->texCoordCount = 0;
    67   this->faceCount = 0;
    68   this->triangleCount = 0;
    69   this->triangles = NULL;
    70   this->pModelInfo = NULL;
    7146
    7247  this->scaleFactor = 1;
  • trunk/src/lib/graphics/importer/vertex_array_model.h

    r6008 r6009  
    11/*!
    2   \file model.h
    3   \brief Contains the Model Class that handles 3D-Models
     2  \file vertex_list_model.h
     3  \brief Contains the VertexListModel Class that handles 3D-Models rendered out of VertexArrays
    44*/
    55
     
    99#include "abstract_model.h"
    1010
    11 #include "material.h"
    1211#include "glincl.h"
     12
    1313#include "array.h"
    1414#include <list>
     
    2424{
    2525 public:
    26   Model(const char* modelName = NULL, MODEL_TYPE type = MODEL_DISPLAY_LIST);
     26  Model();
    2727  virtual ~Model();
    2828
    2929  void draw() const;
    3030
    31   /** @returns a Pointer to the Vertex-Array, if it was deleted it returns NULL */
    32   inline const GLfloat* getVertexArray() const { return this->vertices->getArray(); };
    33   /** @returns the VertexCount of this Model */
    34   inline unsigned int getVertexCount() const { return this->vertexCount; };
    35 
    36   /** @returns a Pointer to the Normals-Array, if it was deleted it returns NULL */
    37   inline const GLfloat* getNormalsArray() const { return this->normals->getArray(); };
    38   /** @returns the NormalsCount of this Model */
    39   inline unsigned int getNormalsCount() const { return this->normalCount; };
    40 
    41   /** @returns a Pointer to the TexCoord-Array, if it was deleted it returns NULL */
    42   inline const GLfloat* getTexCoordArray() const { return this->vTexture->getArray(); };
    43   /** @returns the TexCoord-Count of this Model */
    44   inline unsigned int getTexCoordCount() const { return this->texCoordCount; };
    45 
    46   /** @returns the Count of Faces of this Model */
    47   inline unsigned int getFaceCount() const { return this->faceCount; };
    48 
    49 
    5031  Material* addMaterial(Material* material);
    5132  Material* addMaterial(const char* materialName);
    52 
    5333
    5434  bool addVertex(float x, float y, float z);
Note: See TracChangeset for help on using the changeset viewer.