44 |
44 |
45 class gl::Compiler : public QObject, protected QOpenGLFunctions |
45 class gl::Compiler : public QObject, protected QOpenGLFunctions |
46 { |
46 { |
47 Q_OBJECT |
47 Q_OBJECT |
48 public: |
48 public: |
49 Compiler(const ColorTable& colorTable, QObject* parent); |
49 Compiler(const ldraw::ColorTable& colorTable, QObject* parent); |
50 ~Compiler(); |
50 ~Compiler(); |
51 void build(Model* model, DocumentManager* context); |
51 void build(Model* model, DocumentManager* context); |
52 void buildPolygon(Polygon polygon, std::vector<Vertex>* vboData); |
52 void buildPolygon(Polygon polygon, std::vector<Vertex>* vboData); |
53 std::size_t vertexCount(gl::ArrayClass arrayClass) const; |
53 std::size_t vertexCount(gl::ArrayClass arrayClass) const; |
54 QColor getColorForPolygon(const gl::Polygon& polygon); |
54 QColor getColorForPolygon(const gl::Polygon& polygon); |
81 } |
81 } |
82 private: |
82 private: |
83 std::size_t storedVertexCounts[gl::NUM_ARRAY_CLASSES] = {0_z}; |
83 std::size_t storedVertexCounts[gl::NUM_ARRAY_CLASSES] = {0_z}; |
84 bool initialized = false; |
84 bool initialized = false; |
85 BoundingBox boundingBox; |
85 BoundingBox boundingBox; |
86 const ColorTable& colorTable; |
86 const ldraw::ColorTable& colorTable; |
87 struct |
87 struct |
88 { |
88 { |
89 QOpenGLShaderProgram* program = nullptr; |
89 QOpenGLShaderProgram* program = nullptr; |
90 QOpenGLBuffer buffer{QOpenGLBuffer::VertexBuffer}; |
90 QOpenGLBuffer buffer{QOpenGLBuffer::VertexBuffer}; |
91 QOpenGLVertexArrayObject vertexArray; |
91 QOpenGLVertexArrayObject vertexArray; |