Mon, 10 Mar 2014 14:12:28 +0200
- refactor
674 | 1 | /* |
2 | * LDForge: LDraw parts authoring CAD | |
3 | * Copyright (C) 2013, 2014 Santeri Piippo | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | ||
19 | #ifndef LDFORGE_GLSHARED_H | |
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 | 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 | 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 | 37 | }; |
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 | { |
c1cc036c6e1f
- work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents:
676
diff
changeset
|
41 | vboLines, |
c1cc036c6e1f
- work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents:
676
diff
changeset
|
42 | vboTriangles, |
c1cc036c6e1f
- work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents:
676
diff
changeset
|
43 | vboQuads, |
c1cc036c6e1f
- work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents:
676
diff
changeset
|
44 | vboCondLines, |
c1cc036c6e1f
- work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents:
676
diff
changeset
|
45 | vboNumSurfaces |
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 | { |
c1cc036c6e1f
- work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents:
676
diff
changeset
|
50 | vboSurfaces, |
c1cc036c6e1f
- work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents:
676
diff
changeset
|
51 | vboNormalColors, |
c1cc036c6e1f
- work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents:
676
diff
changeset
|
52 | vboPickColors, |
c1cc036c6e1f
- work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents:
676
diff
changeset
|
53 | vboBFCFrontColors, |
c1cc036c6e1f
- work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents:
676
diff
changeset
|
54 | vboBFCBackColors, |
c1cc036c6e1f
- work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents:
676
diff
changeset
|
55 | vboNumComplements |
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 | |
698 | 68 | static const int g_numVBOs = vboNumSurfaces * vboNumComplements; |
681
c1cc036c6e1f
- work on improved rendering performance
Santeri Piippo <crimsondusk64@gmail.com>
parents:
676
diff
changeset
|
69 | |
674 | 70 | #endif // LDFORGE_GLSHARED_H |