Sat, 14 Dec 2019 23:00:01 +0200
fixed build
| 19 | 1 | /* |
| 2 | * LDForge: LDraw parts authoring CAD | |
| 3 | * Copyright (C) 2013 - 2018 Teemu Piippo | |
| 4 | * | |
| 5 | * This program is free software: you can redistribute it and/or modify | |
| 6 | * it under the terms of the GNU General Public License as published by | |
| 7 | * the Free Software Foundation, either version 3 of the License, or | |
| 8 | * (at your option) any later version. | |
| 9 | * | |
| 10 | * This program is distributed in the hope that it will be useful, | |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 13 | * GNU General Public License for more details. | |
| 14 | * | |
| 15 | * You should have received a copy of the GNU General Public License | |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 17 | */ | |
| 18 | ||
| 19 | #pragma once | |
| 20 | #include "main.h" | |
| 21 | #include "gl/partrenderer.h" | |
| 22 | #include "gl/common.h" | |
| 23 | #include "types/boundingbox.h" | |
| 24 | #include <QMap> | |
| 25 | #include <QSet> | |
| 26 | ||
| 27 | namespace gl | |
| 28 | { | |
| 29 | class Compiler; | |
| 30 | class Renderer; | |
| 31 | } | |
| 32 | ||
| 33 | /* | |
| 34 | * Compiles LDObjects into polygons for the GLRenderer to draw. | |
| 35 | */ | |
| 36 | class gl::Compiler : public QObject, protected QOpenGLFunctions | |
| 37 | { | |
| 38 | Q_OBJECT | |
| 39 | public: | |
| 40 | Compiler(Renderer* renderer); | |
| 41 | ~Compiler(); | |
| 42 | void initialize(); | |
| 43 | Point3D modelCenter(); | |
| 44 | void prepareVBO (int vbonum); | |
| 45 | GLuint vbo (int vbonum) const; | |
| 46 | int vboSize (int vbonum) const; | |
| 47 | static int vboNumber (VboClass surface, VboSubclass complement); | |
| 48 | private: | |
| 49 | struct ObjectVboData | |
| 50 | { | |
| 51 | QVector<GLfloat> data[gl::numVbos]; | |
| 52 | }; | |
| 53 | QMap<QPersistentModelIndex, ObjectVboData> m_objectInfo; | |
| 54 | QSet<QPersistentModelIndex> m_staged; // Objects that need to be compiled | |
| 55 | GLuint m_vbo[gl::numVbos]; | |
| 56 | bool m_vboChanged[gl::numVbos] = {true}; | |
| 57 | bool needBoundingBoxRebuild = true; | |
| 58 | int m_vboSizes[gl::numVbos] = {0}; | |
| 59 | }; | |
| 60 | ||
| 61 | #define CHECK_GL_ERROR() { checkGLError(__FILE__, __LINE__); } | |
| 62 | void checkGLError (QString file, int line); |