Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 10, 2005, 2:32:13 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: model is now able to return the values of its vertices

File:
1 edited

Legend:

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

    r4529 r4577  
    77#define _MODEL_H
    88
     9#include "base_object.h"
    910#include "material.h"
    1011#include "glincl.h"
     12#include "array.h"
     13
    1114
    1215// FORWARD DEFINITION //
     
    1922   MODEL_DISPLAY_LIST means, that a DisplayList will be built out of the model. This model will be STATIC, meaning it cannot be changed after initialisation.
    2023   MODEL_VERTEX_ARRAY means, that a VertexArray will be built out of the model. This moel will be DYNAMIX, meaning that one can change the properties from outside of the model.
     24 * \todo implement this stuff
    2125*/
    2226typedef enum MODEL_TYPE {MODEL_DISPLAY_LIST,
    23                         MODEL_VERTEX_ARRAY};
     27                        MODEL_VERTEX_ARRAY};
    2428
    2529
     
    3034
    3135//! an enumerator for VERTEX_FORMAT
    32 typedef enum VERTEX_FORMAT {VERTEX_ONLY = VERTEX,
    33                             VERTEX_NORMAL = NORMAL,
    34                             VERTEX_TEXCOORD = TEXCOORD,
    35                             VERTEX_TEXCOORD_NORMAL = NORMAL | TEXCOORD};
     36typedef enum VERTEX_FORMAT { VERTEX_ONLY = VERTEX,
     37                             VERTEX_NORMAL = NORMAL,
     38                             VERTEX_TEXCOORD = TEXCOORD,
     39                             VERTEX_TEXCOORD_NORMAL = NORMAL | TEXCOORD };
    3640
    3741////////////////////
     
    4549  ~ModelFaceElement();
    4650
    47   int                vertexNumber;         //!< The number of the Vertex out of the Array* vertices, this vertex points to.
    48   int                normalNumber;         //!< The number of the Normal out of the Array* normals, this vertex points to.
    49   int                texCoordNumber;       //!< The number of the textureCoordinate out of the Array* vTexture, this vertex points to.
     51  int                 vertexNumber;         //!< The number of the Vertex out of the Array* vertices, this vertex points to.
     52  int                 normalNumber;         //!< The number of the Normal out of the Array* normals, this vertex points to.
     53  int                 texCoordNumber;       //!< The number of the textureCoordinate out of the Array* vTexture, this vertex points to.
    5054
    51   ModelFaceElement*  next;                 //!< Point to the next FaceElement in this List.
     55  ModelFaceElement*   next;                 //!< Point to the next FaceElement in this List.
    5256};
    5357
     
    5862  ModelFace();
    5963  ~ModelFace();
    60  
    61   int                 vertexCount;     //!< The Count of vertices this Face has.
     64
     65  unsigned int        vertexCount;     //!< The Count of vertices this Face has.
    6266  ModelFaceElement*   firstElem;       //!< Points to the first Vertex (FaceElement) of this Face.
    6367  Material*           material;        //!< The Material to use.
    64  
     68
    6569  ModelFace*          next;            //!< Pointer to the next Face.
    66 }; 
     70};
    6771
    6872//! Group to handle multiple Models per obj-file.
     
    8286  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...
    8387  int          faceCount;      //!< The Number of Faces this Group holds.
    84  
     88
    8589  ModelGroup*  next;           //!< Pointer to the next Group.
    8690};
     
    9195
    9296//! Class that handles 3D-Models. it can also read them in and display them.
    93 class Model
     97class Model : public BaseObject
    9498{
    9599 public:
     
    97101  virtual ~Model(void);
    98102
    99   void setName(const char* name);
    100   /** \returns the Name of the Model */
    101   inline const char* getName() {return this->name;}
    102  
    103103  void draw(void) const;
    104104  void draw(int groupNumber) const;
     
    106106
    107107  /** \returns Count of the Models (Groups) in this File */
    108   inline int getGroupCount(void) const {return this->groupCount;}
     108  inline int getGroupCount(void) const { return this->groupCount; };
     109
     110  /** \returns a Pointer to the Vertex-Array, if it was deleted it returns NULL */
     111  inline const GLfloat* getVertexArray(void) const { return this->vertices->getArray(); };
     112  /** \returns the VertexCount of this Model */
     113  inline unsigned int getVertexArrayCount(void) const { return this->vertexCount; };
     114
     115  /** \returns a Pointer to the Normals-Array, if it was deleted it returns NULL */
     116  inline const GLfloat* getNormalsArray(void) const { return this->normals->getArray(); };
     117  /** \returns the NormalsCount of this Model */
     118  inline unsigned int getNormalsArrayCount(void) const { return this->normalCount; };
     119
     120  /** \returns a Pointer to the TexCoord-Array, if it was deleted it returns NULL */
     121  inline const GLfloat* getTexCoordArray(void) const { return this->vTexture->getArray(); };
     122  /** \returns the TexCoord-Count of this Model */
     123  inline unsigned int getTexCoordArrayCount(void) const { return this->texCoordCount; };
     124
    109125
    110126  Material* addMaterial(Material* material);
     
    152168
    153169 private:
    154   char*            name;            //!< This is the name of the Model.
    155170  MODEL_TYPE       type;            //!< A type for the Model
    156171  bool             finalized;       //!< Sets the Object to be finalized.
    157172
    158   int              vertexCount;     //!< A modelwide Counter for vertices.
    159   int              normalCount;     //!< A modelwide Counter for the normals.
    160   int              texCoordCount;   //!< A modelwide Counter for the texCoord.
     173  unsigned int     vertexCount;     //!< A modelwide Counter for vertices.
     174  unsigned int     normalCount;     //!< A modelwide Counter for the normals.
     175  unsigned int     texCoordCount;   //!< A modelwide Counter for the texCoord.
    161176  Array*           vertices;        //!< The Array that handles the Vertices.
    162177  Array*           normals;         //!< The Array that handles the Normals.
Note: See TracChangeset for help on using the changeset viewer.