32 { |
32 { |
33 QVector<GLfloat> data[NumVbos]; |
33 QVector<GLfloat> data[NumVbos]; |
34 bool isChanged; |
34 bool isChanged; |
35 }; |
35 }; |
36 |
36 |
37 GLCompiler (GLRenderer* renderer); |
37 GLCompiler(GLRenderer* renderer); |
38 ~GLCompiler(); |
38 ~GLCompiler(); |
39 void compileDocument (LDDocument* doc); |
39 void compileDocument(LDDocument* doc); |
40 void dropObjectInfo (LDObject* obj); |
40 void dropObjectInfo(LDObject* obj); |
41 QColor getColorForPolygon (LDPolygon& poly, LDObject* topobj, ComplementVboType complement) const; |
41 QColor getColorForPolygon(LDPolygon& poly, LDObject* topobj, ComplementVboType complement) const; |
42 QColor indexColorForID (int id) const; |
42 QColor indexColorForID(int id) const; |
43 void initialize(); |
43 void initialize(); |
44 void needMerge(); |
44 void needMerge(); |
45 void prepareVBO (int vbonum); |
45 void prepareVBO(int vbonum); |
46 void setRenderer (GLRenderer* compiler); |
46 void setRenderer(GLRenderer* compiler); |
47 void stageForCompilation (LDObject* obj); |
47 void stageForCompilation(LDObject* obj); |
48 void unstage (LDObject* obj); |
48 void unstage(LDObject* obj); |
49 GLuint vbo (int vbonum) const; |
49 GLuint vbo(int vbonum) const; |
50 int vboSize (int vbonum) const; |
50 int vboSize(int vbonum) const; |
51 |
51 |
52 static int vboNumber (SurfaceVboType surface, ComplementVboType complement); |
52 static int vboNumber(SurfaceVboType surface, ComplementVboType complement); |
53 |
53 |
54 private: |
54 private: |
55 void compileStaged(); |
55 void compileStaged(); |
56 void compileObject (LDObject* obj); |
56 void compileObject(LDObject* obj); |
57 void compilePolygon (LDPolygon& poly, LDObject* topobj, ObjectVBOInfo* objinfo); |
57 void compilePolygon(LDPolygon& poly, LDObject* topobj, ObjectVBOInfo* objinfo); |
58 |
58 |
59 QMap<LDObject*, ObjectVBOInfo> m_objectInfo; |
59 QMap<LDObject*, ObjectVBOInfo> m_objectInfo; |
60 QSet<LDObject*> m_staged; // Objects that need to be compiled |
60 QSet<LDObject*> m_staged; // Objects that need to be compiled |
61 GLuint m_vbo[NumVbos]; |
61 GLuint m_vbo[NumVbos]; |
62 bool m_vboChanged[NumVbos]; |
62 bool m_vboChanged[NumVbos]; |
63 int m_vboSizes[NumVbos]; |
63 int m_vboSizes[NumVbos]; |
64 GLRenderer* m_renderer; |
64 GLRenderer* m_renderer; |
65 }; |
65 }; |
66 |
66 |
67 #define CHECK_GL_ERROR() { CheckGLErrorImpl (__FILE__, __LINE__); } |
67 #define CHECK_GL_ERROR() { CheckGLErrorImpl(__FILE__, __LINE__); } |
68 void CheckGLErrorImpl (const char* file, int line); |
68 void CheckGLErrorImpl(const char* file, int line); |