src/gldata.h

changeset 490
fff86085017e
parent 489
0b32138fedcc
child 666
c595cfb4791c
equal deleted inserted replaced
489:0b32138fedcc 490:fff86085017e
46 PickColor, 46 PickColor,
47 }; 47 };
48 48
49 struct CompiledTriangle { 49 struct CompiledTriangle {
50 vertex verts[3]; 50 vertex verts[3];
51 uint8 numVerts; 51 uint8 numVerts; // 2 if a line
52 QRgb rgb; 52 QRgb rgb; // Color of this poly normally
53 QRgb pickrgb; 53 QRgb pickrgb; // Color of this poly while picking
54 bool isCondLine; 54 bool isCondLine; // Is this a conditional line?
55 LDObject* obj; 55 LDObject* obj; // Pointer to the object this poly represents
56 }; 56 };
57 57
58 struct Vertex { 58 struct Vertex {
59 float x, y, z; 59 float x, y, z;
60 uint32 color; 60 uint32 color;
86 86
87 VertexCompiler(); 87 VertexCompiler();
88 ~VertexCompiler(); 88 ~VertexCompiler();
89 void setFile (LDFile* file); 89 void setFile (LDFile* file);
90 void compileFile(); 90 void compileFile();
91 void compileObject (LDObject* obj, LDObject* topobj);
92 void forgetObject (LDObject* obj); 91 void forgetObject (LDObject* obj);
92 void initObject (LDObject* obj);
93 const Array* getMergedBuffer (GL::VAOType type); 93 const Array* getMergedBuffer (GL::VAOType type);
94 QColor getObjectColor (LDObject* obj, ColorType list) const; 94 QColor getObjectColor (LDObject* obj, ColorType list) const;
95 void needMerge();
96 void stageForCompilation (LDObject* obj);
95 97
96 static uint32 getColorRGB (QColor& color); 98 static uint32 getColorRGB (QColor& color);
97 99
98 private: 100 private:
99 void compilePolygon (LDObject* drawobj, LDObject* trueobj); 101 void compilePolygon (LDObject* drawobj, LDObject* trueobj, List<CompiledTriangle>& data);
102 void compileObject (LDObject* obj);
103 void compileSubObject (LDObject* obj, LDObject* topobj, List<CompiledTriangle>& data);
100 Array* postprocess (const CompiledTriangle& i, GL::VAOType type); 104 Array* postprocess (const CompiledTriangle& i, GL::VAOType type);
101 105
102 QMap<LDObject*, List<CompiledTriangle>> m_objArrays; 106 QMap<LDObject*, Array*> m_objArrays;
103 QMap<LDFile*, Array*> m_fileCache; 107 QMap<LDFile*, Array*> m_fileCache;
104 Array m_mainArrays[GL::NumArrays]; 108 Array m_mainArrays[GL::NumArrays];
105 LDFile* m_file; 109 LDFile* m_file;
106 bool m_changed[GL::NumArrays]; 110 bool m_changed[GL::NumArrays];
111 List<LDObject*> m_staged;
107 }; 112 };
108 113
109 extern VertexCompiler g_vertexCompiler; 114 extern VertexCompiler g_vertexCompiler;
110 115
111 #endif // LDFORGE_GLDATA_H 116 #endif // LDFORGE_GLDATA_H

mercurial