Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/graphics/importer/vertex_list_model.h @ 6008

Last change on this file since 6008 was 6008, checked in by bensch, 18 years ago

orxonox/trunk: some more functionality in the abstractModel class

File size: 2.7 KB
Line 
1/*!
2  \file model.h
3  \brief Contains the Model Class that handles 3D-Models
4*/
5
6#ifndef _MODEL_H
7#define _MODEL_H
8
9#include "abstract_model.h"
10
11#include "material.h"
12#include "glincl.h"
13#include "array.h"
14#include <list>
15
16// FORWARD DECLARATION //
17template<class T> class tArray;
18
19/////////////
20/// MODEL ///
21/////////////
22//! Class that handles 3D-Models. it can also read them in and display them.
23class Model : public AbstractModel
24{
25 public:
26  Model(const char* modelName = NULL, MODEL_TYPE type = MODEL_DISPLAY_LIST);
27  virtual ~Model();
28
29  void draw() const;
30
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
50  Material* addMaterial(Material* material);
51  Material* addMaterial(const char* materialName);
52
53
54  bool addVertex(float x, float y, float z);
55
56  bool addVertexNormal(float x, float y, float z);
57
58  bool addVertexTexture(float u, float v);
59
60  bool addFace(int faceElemCount, VERTEX_FORMAT type, ...);
61
62  bool addGroup(const char* groupString);
63
64  bool setMaterial(Material* mtl);
65
66  void finalize();
67
68
69 private:
70  bool buildTriangleList();
71
72  bool addGLElement(ModelFaceElement* elem);
73
74  bool importToVertexArray();
75
76  bool deleteArrays();
77  bool cleanup();
78
79 private:
80  bool                       finalized;       //!< Sets the Object to be finalized.
81
82  tArray<GLfloat>            vertices;        //!< The Array that handles the Vertices.
83  tArray<GLfloat>            normals;         //!< The Array that handles the Normals.
84  tArray<GLfloat>            textures;        //!< The Array that handles the VertexTextureCoordinates.
85
86  tArray<GLfloat>            indices;         //!< The Array that tells us what Vertex is connected to which other one.
87
88  std::list<ModelMaterial*>  materialList;    //!< A list for all the Materials in this Model
89};
90
91#endif
Note: See TracBrowser for help on using the repository browser.