src/GLCompiler.h

changeset 694
3868f52da6b9
parent 692
94feb28faffe
child 698
16e6d7d87982
equal deleted inserted replaced
693:8432b37034a9 694:3868f52da6b9
26 26
27 // ============================================================================= 27 // =============================================================================
28 // 28 //
29 class GLCompiler 29 class GLCompiler
30 { 30 {
31 PROPERTY (public, LDDocumentPointer, document, setDocument, STOCK_WRITE)
32
33 public: 31 public:
34 struct ObjectVBOInfo 32 struct ObjectVBOInfo
35 { 33 {
36 QVector<GLfloat> data[gNumVBOs]; 34 QVector<GLfloat> data[gNumVBOs];
37 }; 35 };
38 36
39 GLCompiler(); 37 GLCompiler();
40 ~GLCompiler(); 38 ~GLCompiler();
41 void compileDocument(); 39 void compileDocument (LDDocument* doc);
42 void dropObject (LDObject* obj); 40 void dropObject (LDObject* obj);
43 void initialize(); 41 void initialize();
44 QColor getPolygonColor (LDPolygon& poly, LDObject* topobj) const; 42 QColor getPolygonColor (LDPolygon& poly, LDObject* topobj) const;
45 QColor getIndexColor (int id) const; 43 QColor getIndexColor (int id) const;
46 void needMerge(); 44 void needMerge();
59 return mVBOs[vbonum]; 57 return mVBOs[vbonum];
60 } 58 }
61 59
62 inline int getVBOCount (int vbonum) const 60 inline int getVBOCount (int vbonum) const
63 { 61 {
64 return mVBOData[vbonum].size() / 3; 62 return mVBOSizes[vbonum] / 3;
65 } 63 }
66 64
67 private: 65 private:
68 void compileStaged(); 66 void compileStaged();
69 void compileObject (LDObject* obj); 67 void compileObject (LDObject* obj);
70 void compileSubObject (LDObject* obj, LDObject* topobj, GLCompiler::ObjectVBOInfo* objinfo); 68 void compileSubObject (LDObject* obj, LDObject* topobj, GLCompiler::ObjectVBOInfo* objinfo);
71 void writeColor (QVector<float>& array, const QColor& color); 69 void writeColor (QVector<float>& array, const QColor& color);
72 void compilePolygon (LDPolygon& poly, LDObject* topobj, GLCompiler::ObjectVBOInfo* objinfo); 70 void compilePolygon (LDPolygon& poly, LDObject* topobj, GLCompiler::ObjectVBOInfo* objinfo);
73 71
74 QMap<LDObject*, ObjectVBOInfo> mObjectInfo; 72 QMap<LDObject*, ObjectVBOInfo> mObjectInfo;
75 QVector<GLfloat> mVBOData[gNumVBOs]; 73 LDObjectList mStaged; // Objects that need to be compiled
76 GLuint mVBOs[gNumVBOs]; 74 GLuint mVBOs[gNumVBOs];
77 bool mChanged[gNumVBOs]; 75 bool mChanged[gNumVBOs];
78 LDObjectList mStaged; // Objects that need to be compiled 76 int mVBOSizes[gNumVBOs];
79 }; 77 };
80 78
81 #define checkGLError() { checkGLError_private (__FILE__, __LINE__); } 79 #define checkGLError() { checkGLError_private (__FILE__, __LINE__); }
82 void checkGLError_private (const char* file, int line); 80 void checkGLError_private (const char* file, int line);
83 81

mercurial