Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/graphics/importer/vertex_array_model.h @ 6518

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

orxonox/trunk: changing the height of the Grid should work

File size: 2.4 KB
RevLine 
[2823]1/*!
[6010]2 * @file vertex_array_model.h
3 * @brief Contains the VertexArrayModel Class that handles 3D-Models rendered out of VertexArrays
4 */
[2823]5
[6010]6#ifndef _VERTEX_ARRAY_MODEL_H
7#define _VERTEX_ARRAY_MODEL_H
[2773]8
[6022]9#include "model.h"
[5701]10
[3917]11#include "glincl.h"
[6009]12
[6037]13#include <vector>
[2748]14
[6010]15/* Forward Declaration */
16class Material;
[3427]17
[6010]18
[4022]19/////////////
20/// MODEL ///
21/////////////
22//! Class that handles 3D-Models. it can also read them in and display them.
[6037]23/**
24 * this renders models with help of the OpenGL glVertexArray
25 */
[6022]26class VertexArrayModel : public Model
[4022]27{
[3398]28 public:
[6010]29  VertexArrayModel();
[6308]30  VertexArrayModel(const Model& model);
[6010]31  virtual ~VertexArrayModel();
[3910]32
[4746]33  void draw() const;
[3910]34
[6037]35
36  void newStripe();
37
[6010]38  void addVertex(float x, float y, float z);
39  void addNormal(float x, float y, float z);
40  void addTexCoor(float u, float v);
[6310]41  void addColor(float r, float g, float b);
[4106]42
[6310]43  void addIndice(GLuint indice);
44
[6010]45  void finalize();
[4468]46
[6452]47  unsigned int vertexCount() const { return this->vertices.size(); };
48  unsigned int normalCount() const { return this->normals.size(); };
49  unsigned int texCoordCount() const { return this->texCoords.size(); };
50  unsigned int colorCount() const { return this->colors.size(); };
51  unsigned int indiceCount() const { return this->indices.size(); };
52
[6454]53  Vector& vertex(unsigned int i) { return this->vertices[i]; };
54  Vector& normal(unsigned int i) { return this->normals[i]; };
55  //Vector& texCoord(unsigned int i) { return this->texCoord[i]; };
56  Vector& color(unsigned int i) { return this->colors[i]; };
57  GLuint  index(unsigned int i) { return this->indices[i]; };
[6308]58  //
[6310]59  void planeModel(float sizeX, float sizeY, unsigned int resolutionX, unsigned int resolutionY);
60  void spiralSphere(const float radius, const unsigned int loops, const unsigned int segmentsPerLoop);
[4468]61
[6310]62  void debug() const;
63
[4468]64 private:
[6012]65  void importToVertexArray();
[4468]66
67 private:
[6453]68  std::vector<Vector>        vertices;        //!< The Array that handles the Vertices.
69  std::vector<Vector>        normals;         //!< The Array that handles the Normals.
70  std::vector<float>         texCoords;       //!< The Array that handles the VertexTextureCoordinates.
71  std::vector<Vector>        colors;          //!< The Array that handles Colors.
[4468]72
[6310]73  std::vector<GLuint>        indices;         //!< The Array that tells us what Vertex is connected to which other one.
[6037]74
75  std::vector<GLuint>        stripes;         //!< A lsit of Stripes of this Model.
76
[2748]77};
[2773]78
79#endif
Note: See TracBrowser for help on using the repository browser.