src/GLShared.h

Tue, 11 Mar 2014 16:11:22 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Tue, 11 Mar 2014 16:11:22 +0200
changeset 703
ce2a76cebdbb
parent 698
16e6d7d87982
permissions
-rw-r--r--

- renamed some enumerators, added license header to glcompiler.cc

674
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2013, 2014 Santeri Piippo
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #ifndef LDFORGE_GLSHARED_H
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #define LDFORGE_GLSHARED_H
681
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
21 #include <QString>
674
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22
681
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
23 class LDObject;
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
24
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
25 struct LDPolygon
674
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 {
681
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
27 char num;
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
28 Vertex vertices[4];
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
29 int id;
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
30 int color;
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
31 QString origin;
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
32
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
33 inline int numVertices() const
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
34 {
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
35 return (num == 5) ? 4 : num;
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
36 }
674
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 };
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38
681
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
39 enum EVBOSurface
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
40 {
703
ce2a76cebdbb - renamed some enumerators, added license header to glcompiler.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 698
diff changeset
41 VBOSF_Lines,
ce2a76cebdbb - renamed some enumerators, added license header to glcompiler.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 698
diff changeset
42 VBOSF_Triangles,
ce2a76cebdbb - renamed some enumerators, added license header to glcompiler.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 698
diff changeset
43 VBOSF_Quads,
ce2a76cebdbb - renamed some enumerators, added license header to glcompiler.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 698
diff changeset
44 VBOSF_CondLines,
ce2a76cebdbb - renamed some enumerators, added license header to glcompiler.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 698
diff changeset
45 VBOSF_NumSurfaces
681
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
46 };
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
47
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
48 enum EVBOComplement
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
49 {
703
ce2a76cebdbb - renamed some enumerators, added license header to glcompiler.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 698
diff changeset
50 VBOCM_Surfaces,
ce2a76cebdbb - renamed some enumerators, added license header to glcompiler.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 698
diff changeset
51 VBOCM_NormalColors,
ce2a76cebdbb - renamed some enumerators, added license header to glcompiler.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 698
diff changeset
52 VBOCM_PickColors,
ce2a76cebdbb - renamed some enumerators, added license header to glcompiler.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 698
diff changeset
53 VBOCM_BFCFrontColors,
ce2a76cebdbb - renamed some enumerators, added license header to glcompiler.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 698
diff changeset
54 VBOCM_BFCBackColors,
ce2a76cebdbb - renamed some enumerators, added license header to glcompiler.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 698
diff changeset
55 VBOCM_NumComplements
681
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
56 };
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
57
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
58 // KDevelop doesn't seem to understand some VBO stuff
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
59 #ifdef IN_IDE_PARSER
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
60 using GLenum = unsigned int;
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
61 using GLuint = unsigned int;
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
62 void glBindBuffer (GLenum, GLuint);
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
63 void glGenBuffers (GLuint, GLuint*);
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
64 void glDeleteBuffers (GLuint, GLuint*);
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
65 void glBufferData (GLuint, GLuint, void*, GLuint);
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
66 #endif
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
67
703
ce2a76cebdbb - renamed some enumerators, added license header to glcompiler.cc
Santeri Piippo <crimsondusk64@gmail.com>
parents: 698
diff changeset
68 static const int g_numVBOs = VBOSF_NumSurfaces * VBOCM_NumComplements;
681
c1cc036c6e1f - work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents: 676
diff changeset
69
674
3d8ab0f89102 - refactoring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
70 #endif // LDFORGE_GLSHARED_H

mercurial