Tue, 11 Mar 2014 16:11:22 +0200
- renamed some enumerators, added license header to glcompiler.cc
src/GLCompiler.cc | file | annotate | diff | comparison | revisions | |
src/GLRenderer.cc | file | annotate | diff | comparison | revisions | |
src/GLShared.h | file | annotate | diff | comparison | revisions |
--- a/src/GLCompiler.cc Tue Mar 11 15:44:27 2014 +0200 +++ b/src/GLCompiler.cc Tue Mar 11 16:11:22 2014 +0200 @@ -1,3 +1,21 @@ +/* + * LDForge: LDraw parts authoring CAD + * Copyright (C) 2013, 2014 Santeri Piippo + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + #define GL_GLEXT_PROTOTYPES #include <GL/glu.h> #include <GL/glext.h> @@ -276,10 +294,10 @@ switch (poly.num) { - case 3: surface = vboTriangles; numverts = 3; break; - case 4: surface = vboQuads; numverts = 4; break; - case 2: surface = vboLines; numverts = 2; break; - case 5: surface = vboCondLines; numverts = 2; break; + case 3: surface = VBOSF_Triangles; numverts = 3; break; + case 4: surface = VBOSF_Quads; numverts = 4; break; + case 2: surface = VBOSF_Lines; numverts = 2; break; + case 5: surface = VBOSF_CondLines; numverts = 2; break; default: print ("OMGWTFBBQ weird polygon with number %1 (topobj: #%2, %3), origin: %4", @@ -298,7 +316,7 @@ { switch ((EVBOComplement) complement) { - case vboSurfaces: + case VBOCM_Surfaces: { // Write coordinates. Apparently Z must be flipped too? vbodata << poly.vertices[vert].x() @@ -307,25 +325,25 @@ break; } - case vboNormalColors: + case VBOCM_NormalColors: { writeColor (vbodata, normalColor); break; } - case vboPickColors: + case VBOCM_PickColors: { writeColor (vbodata, pickColor); break; } - case vboBFCFrontColors: + case VBOCM_BFCFrontColors: { writeColor (vbodata, g_BFCFrontColor); break; } - case vboBFCBackColors: + case VBOCM_BFCBackColors: { writeColor (vbodata, g_BFCBackColor); break;
--- a/src/GLRenderer.cc Tue Mar 11 15:44:27 2014 +0200 +++ b/src/GLRenderer.cc Tue Mar 11 16:11:22 2014 +0200 @@ -407,10 +407,10 @@ if (isPicking()) { - drawVBOs (vboTriangles, vboPickColors, GL_TRIANGLES); - drawVBOs (vboQuads, vboPickColors, GL_QUADS); - drawVBOs (vboLines, vboPickColors, GL_LINES); - drawVBOs (vboCondLines, vboPickColors, GL_LINES); + drawVBOs (VBOSF_Triangles, VBOCM_PickColors, GL_TRIANGLES); + drawVBOs (VBOSF_Quads, VBOCM_PickColors, GL_QUADS); + drawVBOs (VBOSF_Lines, VBOCM_PickColors, GL_LINES); + drawVBOs (VBOSF_CondLines, VBOCM_PickColors, GL_LINES); } else { @@ -418,21 +418,21 @@ { glEnable (GL_CULL_FACE); glCullFace (GL_BACK); - drawVBOs (vboTriangles, vboBFCFrontColors, GL_TRIANGLES); - drawVBOs (vboQuads, vboBFCFrontColors, GL_QUADS); + drawVBOs (VBOSF_Triangles, VBOCM_BFCFrontColors, GL_TRIANGLES); + drawVBOs (VBOSF_Quads, VBOCM_BFCFrontColors, GL_QUADS); glCullFace (GL_FRONT); - drawVBOs (vboTriangles, vboBFCBackColors, GL_TRIANGLES); - drawVBOs (vboQuads, vboBFCBackColors, GL_QUADS); + drawVBOs (VBOSF_Triangles, VBOCM_BFCBackColors, GL_TRIANGLES); + drawVBOs (VBOSF_Quads, VBOCM_BFCBackColors, GL_QUADS); glDisable (GL_CULL_FACE); } else { - drawVBOs (vboTriangles, vboNormalColors, GL_TRIANGLES); - drawVBOs (vboQuads, vboNormalColors, GL_QUADS); + drawVBOs (VBOSF_Triangles, VBOCM_NormalColors, GL_TRIANGLES); + drawVBOs (VBOSF_Quads, VBOCM_NormalColors, GL_QUADS); } - drawVBOs (vboLines, vboNormalColors, GL_LINES); - drawVBOs (vboCondLines, vboNormalColors, GL_LINES); + drawVBOs (VBOSF_Lines, VBOCM_NormalColors, GL_LINES); + drawVBOs (VBOSF_CondLines, VBOCM_NormalColors, GL_LINES); if (gl_axes) { @@ -459,7 +459,7 @@ // void GLRenderer::drawVBOs (EVBOSurface surface, EVBOComplement colors, GLenum type) { - int surfacenum = m_compiler->vboNumber (surface, vboSurfaces); + int surfacenum = m_compiler->vboNumber (surface, VBOCM_Surfaces); int colornum = m_compiler->vboNumber (surface, colors); m_compiler->prepareVBO (surfacenum);
--- a/src/GLShared.h Tue Mar 11 15:44:27 2014 +0200 +++ b/src/GLShared.h Tue Mar 11 16:11:22 2014 +0200 @@ -38,21 +38,21 @@ enum EVBOSurface { - vboLines, - vboTriangles, - vboQuads, - vboCondLines, - vboNumSurfaces + VBOSF_Lines, + VBOSF_Triangles, + VBOSF_Quads, + VBOSF_CondLines, + VBOSF_NumSurfaces }; enum EVBOComplement { - vboSurfaces, - vboNormalColors, - vboPickColors, - vboBFCFrontColors, - vboBFCBackColors, - vboNumComplements + VBOCM_Surfaces, + VBOCM_NormalColors, + VBOCM_PickColors, + VBOCM_BFCFrontColors, + VBOCM_BFCBackColors, + VBOCM_NumComplements }; // KDevelop doesn't seem to understand some VBO stuff @@ -65,6 +65,6 @@ void glBufferData (GLuint, GLuint, void*, GLuint); #endif -static const int g_numVBOs = vboNumSurfaces * vboNumComplements; +static const int g_numVBOs = VBOSF_NumSurfaces * VBOCM_NumComplements; #endif // LDFORGE_GLSHARED_H \ No newline at end of file