Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 10, 2005, 11:18:19 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: cleanup in the StaticModel class, as my idea changed

File:
1 edited

Legend:

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

    r6022 r6031  
    1616// FORWARD DECLARATION //
    1717template<class T> class tArray;
    18 
    19 
    20 //! an enumerator fot the different Model Types.
    21 /**
    22    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.
    23    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
    25 */
    26 typedef enum MODEL_TYPE {
    27   MODEL_DISPLAY_LIST,
    28   MODEL_VERTEX_ARRAY
    29 };
    30 
    3118
    3219// definition of different modes for setting up Faces
     
    11198{
    11299 public:
    113   StaticModel(const char* modelName = NULL, MODEL_TYPE type = MODEL_DISPLAY_LIST);
     100  StaticModel(const char* modelName = NULL);
    114101  virtual ~StaticModel();
    115102
     
    120107  void rebuild();
    121108
    122   /** @returns Count of the Models (Groups) in this File */
    123   inline int getGroupCount() const { return this->groupCount; };
    124 
    125   /** @returns a Pointer to the Vertex-Array, if it was deleted it returns NULL */
    126   inline const GLfloat* getVertexArray() const { return this->vertices->getArray(); };
    127   /** @returns the VertexCount of this Model */
    128   inline unsigned int getVertexCount() const { return this->vertexCount; };
    129 
    130   /** @returns a Pointer to the Normals-Array, if it was deleted it returns NULL */
    131   inline const GLfloat* getNormalsArray() const { return this->normals->getArray(); };
    132   /** @returns the NormalsCount of this Model */
    133   inline unsigned int getNormalsCount() const { return this->normalCount; };
    134 
    135   /** @returns a Pointer to the TexCoord-Array, if it was deleted it returns NULL */
    136   inline const GLfloat* getTexCoordArray() const { return this->vTexture->getArray(); };
    137   /** @returns the TexCoord-Count of this Model */
    138   inline unsigned int getTexCoordCount() const { return this->texCoordCount; };
    139 
    140   /** @returns the Count of Faces of this Model */
    141   inline unsigned int getFaceCount() const { return this->faceCount; };
    142 
    143 
    144109  Material* addMaterial(Material* material);
    145110  Material* addMaterial(const char* materialName);
    146111
    147112  bool addGroup(const char* groupString);
     113
    148114  bool addVertex(const char* vertexString);
    149115  bool addVertex(float x, float y, float z);
     116
    150117  bool addFace(const char* faceString);
    151118  bool addFace(int faceElemCount, VERTEX_FORMAT type, ...);
     119
    152120  bool addVertexNormal(const char* normalString);
    153121  bool addVertexNormal(float x, float y, float z);
     122
    154123  bool addVertexTexture(const char* vTextureString);
    155124  bool addVertexTexture(float u, float v);
     125
    156126  bool setMaterial(const char* mtlString);
    157127  bool setMaterial(Material* mtl);
     128
    158129  void finalize();
    159130
     
    163134
    164135  Material* findMaterialByName(const char* materialName);
    165 
    166136
    167137 protected:
     
    173143  bool importToDisplayList();
    174144  bool buildTriangleList();
     145
    175146  bool addGLElement(ModelFaceElement* elem);
    176147
    177   bool importToVertexArray();
    178 
    179   bool deleteArrays();
    180148  bool cleanup();
    181149
    182150 private:
    183   MODEL_TYPE                 type;            //!< A type for the Model
    184151  bool                       finalized;       //!< Sets the Object to be finalized.
    185152
    186   unsigned int               vertexCount;     //!< A modelwide Counter for vertices.
    187   unsigned int               normalCount;     //!< A modelwide Counter for the normals.
    188   unsigned int               texCoordCount;   //!< A modelwide Counter for the texCoord.
    189153  unsigned int               faceCount;       //!< A modelwide Counter for the faces
    190   unsigned int               triangleCount;   //!< Number of triangles >= faceCount
    191   tArray<GLfloat>*           vertices;        //!< The Array that handles the Vertices.
    192   tArray<GLfloat>*           normals;         //!< The Array that handles the Normals.
    193   tArray<GLfloat>*           vTexture;        //!< The Array that handles the VertexTextureCoordinates.
    194   sTriangleExt*              triangles;       //!< The Array of triangles in the model.h style
     154
     155  tArray<GLfloat>            vertices;        //!< The Array that handles the Vertices.
     156  tArray<GLfloat>            normals;         //!< The Array that handles the Normals.
     157  tArray<GLfloat>            vTexture;        //!< The Array that handles the VertexTextureCoordinates.
    195158
    196159  ModelGroup*                firstGroup;      //!< The first of all groups.
Note: See TracChangeset for help on using the changeset viewer.