/* QGL GLRendererBase Ivan Pelipenko peri4ko@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef GLRENDERERBASE_H #define GLRENDERERBASE_H #include "glcamera.h" #include "glshaders.h" class GLRendererBase: public QObject , protected QOpenGLExtraFunctions { friend class QGLView; Q_OBJECT public: GLRendererBase(QGLView * view_); virtual void prepareScene() {;} virtual void renderScene() = 0; struct RenderingParameters { RenderingParameters(); void prepare(); void setUniform(QOpenGLShaderProgram * prog); QMatrix4x4 view_matrix, view_matrix_i; QMatrix4x4 proj_matrix, proj_matrix_i; QMatrix4x4 viewproj_matrix, viewproj_matrix_i; QMatrix3x3 normal_matrix; }; RenderingParameters rp; protected: virtual void setupLight(const Light & l, int inpass_index, int gl_index); virtual void setupAmbientLight(const QColor & a, bool first_pass); virtual void setupShadersLights(int lights_count) {} virtual void setupTextures(ObjectBase & object, GLRendererBase::RenderingParameters & rp, bool first_object = false); virtual void setupShadersTextures(ObjectBase & object, GLRendererBase::RenderingParameters & rp) {} virtual void reloadShaders() {} virtual void init(int width, int height) {} virtual void resize(int width, int height) {} inline void applyFilteringParameters(); QGLView * view; QImage white_image, violent_image; GLuint white_image_id, violent_image_id; }; #endif // GLRENDERERBASE_H