Tue, 11 Mar 2014 14:35:21 +0200
- renamed several GLCompiler members and methods
src/GLCompiler.cc | file | annotate | diff | comparison | revisions | |
src/GLCompiler.h | file | annotate | diff | comparison | revisions | |
src/GLRenderer.cc | file | annotate | diff | comparison | revisions |
--- a/src/GLCompiler.cc Mon Mar 10 14:30:37 2014 +0200 +++ b/src/GLCompiler.cc Tue Mar 11 14:35:21 2014 +0200 @@ -77,14 +77,14 @@ GLCompiler::GLCompiler() { needMerge(); - memset (m_VBOSizes, 0, sizeof m_VBOSizes); + memset (m_vboSizes, 0, sizeof m_vboSizes); } // ============================================================================= // void GLCompiler::initialize() { - glGenBuffers (g_numVBOs, &mVBOs[0]); + glGenBuffers (g_numVBOs, &m_vbo[0]); checkGLError(); } @@ -92,13 +92,13 @@ // GLCompiler::~GLCompiler() { - glDeleteBuffers (g_numVBOs, &mVBOs[0]); + glDeleteBuffers (g_numVBOs, &m_vbo[0]); checkGLError(); } // ============================================================================= // -uint32 GLCompiler::getColorRGB (const QColor& color) +uint32 GLCompiler::colorToRGB (const QColor& color) { return (color.red() & 0xFF) << 0x00 | @@ -109,7 +109,7 @@ // ============================================================================= // -QColor GLCompiler::getIndexColor (int id) const +QColor GLCompiler::indexColorForID (int id) const { // Calculate a color based from this index. This method caters for // 16777216 objects. I don't think that will be exceeded anytime soon. :) @@ -122,7 +122,7 @@ // ============================================================================= // -QColor GLCompiler::getPolygonColor (LDPolygon& poly, LDObject* topobj) const +QColor GLCompiler::polygonColor (LDPolygon& poly, LDObject* topobj) const { QColor qcol; @@ -189,7 +189,7 @@ // void GLCompiler::stageForCompilation (LDObject* obj) { - mStaged << obj; + m_staged << obj; } // ============================================================================= @@ -207,12 +207,12 @@ // void GLCompiler::compileStaged() { - removeDuplicates (mStaged); + removeDuplicates (m_staged); - for (LDObject* obj : mStaged) + for (LDObject* obj : m_staged) compileObject (obj); - mStaged.clear(); + m_staged.clear(); } // ============================================================================= @@ -227,29 +227,29 @@ QVector<GLfloat> vbodata; - for (auto it = mObjectInfo.begin(); it != mObjectInfo.end(); ++it) + for (auto it = m_objectInfo.begin(); it != m_objectInfo.end(); ++it) { if (it.key()->document() == getCurrentDocument()) vbodata += it->data[vbonum]; } - glBindBuffer (GL_ARRAY_BUFFER, mVBOs[vbonum]); + glBindBuffer (GL_ARRAY_BUFFER, m_vbo[vbonum]); glBufferData (GL_ARRAY_BUFFER, vbodata.size() * sizeof(GLfloat), vbodata.constData(), GL_DYNAMIC_DRAW); glBindBuffer (GL_ARRAY_BUFFER, 0); checkGLError(); m_vboChanged[vbonum] = false; - m_VBOSizes[vbonum] = vbodata.size(); + m_vboSizes[vbonum] = vbodata.size(); } // ============================================================================= // void GLCompiler::dropObject (LDObject* obj) { - auto it = mObjectInfo.find (obj); + auto it = m_objectInfo.find (obj); - if (it != mObjectInfo.end()) + if (it != m_objectInfo.end()) { - mObjectInfo.erase (it); + m_objectInfo.erase (it); needMerge(); } } @@ -262,7 +262,7 @@ ObjectVBOInfo info; dropObject (obj); compileSubObject (obj, obj, &info); - mObjectInfo[obj] = info; + m_objectInfo[obj] = info; needMerge(); print ("#%1 compiled.\n", obj->id()); } @@ -289,10 +289,10 @@ for (int complement = 0; complement < vboNumComplements; ++complement) { - const int vbonum = getVBONumber (surface, (EVBOComplement) complement); + const int vbonum = vboNumber (surface, (EVBOComplement) complement); QVector<GLfloat>& vbodata = objinfo->data[vbonum]; - const QColor normalColor = getPolygonColor (poly, topobj); - const QColor pickColor = getIndexColor (topobj->id()); + const QColor normalColor = polygonColor (poly, topobj); + const QColor pickColor = indexColorForID (topobj->id()); for (int vert = 0; vert < numverts; ++vert) {
--- a/src/GLCompiler.h Mon Mar 10 14:30:37 2014 +0200 +++ b/src/GLCompiler.h Tue Mar 11 14:35:21 2014 +0200 @@ -39,27 +39,27 @@ void compileDocument (LDDocument* doc); void dropObject (LDObject* obj); void initialize(); - QColor getPolygonColor (LDPolygon& poly, LDObject* topobj) const; - QColor getIndexColor (int id) const; + QColor polygonColor (LDPolygon& poly, LDObject* topobj) const; + QColor indexColorForID (int id) const; void needMerge(); void prepareVBO (int vbonum); void stageForCompilation (LDObject* obj); - static uint32 getColorRGB (const QColor& color); + static uint32 colorToRGB (const QColor& color); - static inline int getVBONumber (EVBOSurface surface, EVBOComplement complement) + static inline int vboNumber (EVBOSurface surface, EVBOComplement complement) { return (surface * vboNumComplements) + complement; } - inline GLuint getVBO (int vbonum) const + inline GLuint vbo (int vbonum) const { - return mVBOs[vbonum]; + return m_vbo[vbonum]; } - inline int getVBOCount (int vbonum) const + inline int vboCount (int vbonum) const { - return m_VBOSizes[vbonum] / 3; + return m_vboSizes[vbonum] / 3; } private: @@ -69,11 +69,11 @@ void writeColor (QVector<float>& array, const QColor& color); void compilePolygon (LDPolygon& poly, LDObject* topobj, GLCompiler::ObjectVBOInfo* objinfo); - QMap<LDObject*, ObjectVBOInfo> mObjectInfo; - LDObjectList mStaged; // Objects that need to be compiled - GLuint mVBOs[g_numVBOs]; + QMap<LDObject*, ObjectVBOInfo> m_objectInfo; + LDObjectList m_staged; // Objects that need to be compiled + GLuint m_vbo[g_numVBOs]; bool m_vboChanged[g_numVBOs]; - int m_VBOSizes[g_numVBOs]; + int m_vboSizes[g_numVBOs]; }; #define checkGLError() { checkGLError_private (__FILE__, __LINE__); }
--- a/src/GLRenderer.cc Mon Mar 10 14:30:37 2014 +0200 +++ b/src/GLRenderer.cc Tue Mar 11 14:35:21 2014 +0200 @@ -459,14 +459,14 @@ // void GLRenderer::drawVBOs (EVBOSurface surface, EVBOComplement colors, GLenum type) { - int surfacenum = m_compiler->getVBONumber (surface, vboSurfaces); - int colornum = m_compiler->getVBONumber (surface, colors); + int surfacenum = m_compiler->vboNumber (surface, vboSurfaces); + int colornum = m_compiler->vboNumber (surface, colors); m_compiler->prepareVBO (surfacenum); m_compiler->prepareVBO (colornum); - GLuint surfacevbo = m_compiler->getVBO (surfacenum); - GLuint colorvbo = m_compiler->getVBO (colornum); - GLsizei count = m_compiler->getVBOCount (surfacevbo); + GLuint surfacevbo = m_compiler->vbo (surfacenum); + GLuint colorvbo = m_compiler->vbo (colornum); + GLsizei count = m_compiler->vboCount (surfacevbo); if (count > 0) {