Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 18, 2005, 11:27:40 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/movie_player: merged the trunk back into the movie_player
merged with command:
svn merge -r 4014:HEAD ../trunk/ movie_player/
no conflicts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/movie_player/src/lib/graphics/importer/model.h

    r3917 r4217  
    3434                    VERTEX_TEXCOORD_NORMAL = NORMAL | TEXCOORD};
    3535
     36////////////////////
     37/// SUB-ELEMENTS ///
     38////////////////////
     39//! This is the placeholder of one Vertex beloning to a Face.
     40class ModelFaceElement
     41{
     42 public:
     43  ModelFaceElement();
     44  ~ModelFaceElement();
     45
     46  int vertexNumber;         //!< The number of the Vertex out of the Array* vertices, this vertex points to.
     47  int normalNumber;         //!< The number of the Normal out of the Array* normals, this vertex points to.
     48  int texCoordNumber;       //!< The number of the textureCoordinate out of the Array* vTexture, this vertex points to.
     49  ModelFaceElement* next;   //!< Point to the next FaceElement in this List.
     50};
     51
     52//! This is the placeholder of a Face belonging to a Group of Faces.
     53class ModelFace
     54{
     55 public:
     56  ModelFace();
     57  ~ModelFace();
     58
     59  int vertexCount;                //!< The Count of vertices this Face has.
     60  ModelFaceElement* firstElem;    //!< Points to the first Vertex (FaceElement) of this Face.
     61 
     62  Material* material;             //!< The Material to use.
     63 
     64  ModelFace* next;                //!< Pointer to the next Face.
     65};
     66
     67//! Group to handle multiple Models per obj-file.
     68class ModelGroup
     69{
     70 public:
     71  ModelGroup();
     72  ~ModelGroup();
     73
     74  void cleanup();
     75
     76  char* name;                 //!< the Name of the Group. this is an identifier, that can be accessed via the draw (char* name) function.
     77 
     78  GLubyte* indices;           //!< The indices of the Groups. Needed for vertex-arrays
     79  GLuint listNumber;          //!< The number of the GL-List this Group gets.
     80  ModelFace* firstFace;       //!< The first Face in this group.
     81  ModelFace* currentFace;     //!< The current Face in this Group (the one we are currently working with.)
     82  int faceMode;               //!< The Mode the Face is in: initially -1, 0 for FaceList opened, 1 for Material,  3 for triangle, 4 for Quad, 5+ for Poly \todo ENUM...
     83  int faceCount;              //!< The Number of Faces this Group holds.
     84 
     85  ModelGroup* next;           //!< Pointer to the next Group.
     86};
     87
     88/////////////
     89/// MODEL ///
     90/////////////
     91
    3692//! Class that handles 3D-Models. it can also read them in and display them.
    3793class Model
    3894{
    3995 private:
    40   /////////////
    41   // structs //
    42   /////////////
    43   //! This is the placeholder of one Vertex beloning to a Face.
    44   struct FaceElement
    45   {
    46     int vertexNumber;    //!< The number of the Vertex out of the Array* vertices, this vertex points to.
    47     int normalNumber;    //!< The number of the Normal out of the Array* normals, this vertex points to.
    48     int texCoordNumber;  //!< The number of the textureCoordinate out of the Array* vTexture, this vertex points to.
    49     FaceElement* next;   //!< Point to the next FaceElement in this List.
    50   };
    5196
    52   //! This is the placeholder of a Face belonging to a Group of Faces.
    53   struct Face
    54   {
    55     int vertexCount;        //!< The Count of vertices this Face has.
    56     FaceElement* firstElem; //!< Points to the first Vertex (FaceElement) of this Face.
     97  char* name;                 //!< This is the name of the Model.
     98  MODEL_TYPE type;            //!< A type for the Model
     99  bool finalized;             //!< Sets the Object to be finalized.
    57100
    58     Material* material;     //!< The Material to use.
     101  int vertexCount;            //!< A modelwide Counter for vertices.
     102  int normalCount;            //!< A modelwide Counter for the normals.
     103  int texCoordCount;          //!< A modelwide Counter for the texCoord.
     104  Array* vertices;            //!< The Array that handles the Vertices.
     105  Array* normals;             //!< The Array that handles the Normals.
     106  Array* vTexture;            //!< The Array that handles the VertexTextureCoordinates.
    59107
    60     Face* next;             //!< Pointer to the next Face.
    61   };
     108  ModelGroup* firstGroup;     //!< The first of all groups.
     109  ModelGroup* currentGroup;   //!< The currentGroup. this is the one we will work with.
     110  int groupCount;             //!< The Count of Groups.
    62111
    63   //! Group to handle multiple Models per obj-file.
    64   struct Group
    65   {
    66     char* name;         //!< the Name of the Group. this is an identifier, that can be accessed via the draw (char* name) function.
    67 
    68     GLubyte* indices;   //!< The indices of the Groups. Needed for vertex-arrays
    69     GLuint listNumber;  //!< The number of the GL-List this Group gets.
    70     Face* firstFace;    //!< The first Face in this group.
    71     Face* currentFace;  //!< The current Face in this Group (the one we are currently working with.)
    72     int faceMode;       //!< The Mode the Face is in: initially -1, 0 for FaceList opened, 1 for Material,  3 for triangle, 4 for Quad, 5+ for Poly \todo ENUM...
    73     int faceCount;      //!< The Number of Faces this Group holds.
    74 
    75     Group* next;        //!< Pointer to the next Group.
    76   };
    77 
    78   char* name;            //!< This is the name of the Model.
    79   MODEL_TYPE type;
    80   bool finalized;        //!< Sets the Object to be finalized.
    81 
    82   Array* vertices;      //!< The Array that handles the Vertices.
    83   int verticesCount;    //!< A global Counter for vertices.
    84   Array* normals;       //!< The Array that handles the Normals.
    85   Array* vTexture;      //!< The Array that handles the VertexTextureCoordinates.
    86 
    87   Group* firstGroup;    //!< The first of all groups.
    88   Group* currentGroup;  //!< The currentGroup. this is the one we will work with.
    89   int groupCount;       //!< The Count of Groups.
    90 
    91   tList<Material>* materialList;
     112  tList<Material>* materialList;//!< A list for all the Materials in this Model
    92113 
    93 
    94   bool initGroup(Group* group);
    95   bool initFace (Face* face);
    96 
    97114  bool buildVertexNormals(void);
    98115
    99116  bool importToDisplayList(void);
    100   bool addGLElement(FaceElement* elem);
     117  bool addGLElement(ModelFaceElement* elem);
    101118
    102119  bool importToVertexArray(void);
     
    104121  bool deleteArrays(void);
    105122  bool cleanup(void);
    106   bool cleanupGroup(Group* group);
    107   bool cleanupFace(Face* face);
    108   bool cleanupFaceElement(FaceElement* faceElem);
    109123
    110124
     
    121135
    122136  void setName(const char* name);
     137  /** \returns the Name of the Model */
    123138  inline const char* getName() {return this->name;}
    124139 
     
    126141  void draw(int groupNumber) const;
    127142  void draw(char* groupName) const;
    128   int getGroupCount() const;
     143
     144  /** \returns Count of the Models (Groups) in this File */
     145  inline int getGroupCount(void) const {return this->groupCount;}
    129146
    130147  Material* addMaterial(Material* material);
     
    143160  bool setMaterial(Material* mtl);
    144161  void finalize(void);
     162
     163  /** \returns The number of Vertices of the Model */
     164  inline int getVertexCount(void) const {return this->vertexCount;}
     165  /** \returns The number of Normals of the Model */
     166  inline int getNormalCount(void) const {return this->normalCount;}
     167  /** \returns The number of Texture Coordinates of the Model*/
     168  inline int getTexCoordCount(void) const {return this->texCoordCount;}
    145169};
    146170
Note: See TracChangeset for help on using the changeset viewer.