~glmark2-dev/glmark2/libmatrix-util

« back to all changes in this revision

Viewing changes to mesh.h

  • Committer: Alexandros Frantzis
  • Date: 2010-07-07 10:32:18 UTC
  • Revision ID: git-v1:d2683504fc3cc84e7f3aefd917147037706cecf0
Initial release of original OpenGL code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _MESH_H
 
2
#define _MESH_H
 
3
 
 
4
#include "screen.h"
 
5
#include "vector.h"
 
6
 
 
7
#include <stdio.h>
 
8
#include <math.h>
 
9
 
 
10
class Texel
 
11
{
 
12
public:
 
13
    GLfloat u, v;
 
14
    
 
15
    Texel();
 
16
    Texel(GLfloat pU, GLfloat pV);
 
17
};
 
18
 
 
19
class Vertex
 
20
{
 
21
public:
 
22
    Vector3f v;
 
23
    Vector3f n;
 
24
    Texel t;
 
25
};
 
26
 
 
27
// Data for a mesh to be rendered by vertex arrays' or vbos' has 3 verticies per
 
28
// polygon and no polygonal data
 
29
class Mesh
 
30
{
 
31
public:
 
32
    unsigned mVertexQty;         // Quantity of Verticies
 
33
    unsigned mPolygonQty;        // Quantity of polygons, not really needed
 
34
    GLenum mMode;           // Polygon mode, eg GL_QUADS, GL_TRIANGLES etc...
 
35
    Vertex *mVertex;        // Storage for the verticies
 
36
 
 
37
    GLuint mBuildList;      // Build list name
 
38
 
 
39
        GLuint mVBOVertices;    // Vertex VBO name
 
40
        GLuint mVBONormals;     // Texture coordinate VBO name
 
41
        GLuint mVBOTexCoords;   // Texture coordinate VBO name
 
42
    
 
43
    Mesh();                 // Default Constructor, should set pointers to null
 
44
    ~Mesh();
 
45
    
 
46
    void make_cube();
 
47
    void make_torus();
 
48
    void render();
 
49
    void render_array();
 
50
    void build_list();
 
51
    void build_vbo();
 
52
    void render_vbo();
 
53
};
 
54
 
 
55
#endif