code format

This commit is contained in:
2022-12-14 14:14:44 +03:00
parent 1dfca0aeab
commit cb944b62e4
85 changed files with 4451 additions and 3744 deletions

View File

@@ -1,19 +1,19 @@
/*
QGL Framebuffer
Ivan Pelipenko peri4ko@yandex.ru
QGL Framebuffer
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 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.
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 <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GLFRAMEBUFFER_H
@@ -22,23 +22,27 @@
#include "glbuffer.h"
class Framebuffer
{
class Framebuffer {
friend class FramebufferMipmap;
public:
Framebuffer(QOpenGLExtraFunctions * f_, int colorAttachments = 1, bool withDepth = true, GLenum colorFormat = GL_RGBA8, GLenum _target = GL_TEXTURE_2D);
Framebuffer(QOpenGLExtraFunctions * f_,
int colorAttachments = 1,
bool withDepth = true,
GLenum colorFormat = GL_RGBA8,
GLenum _target = GL_TEXTURE_2D);
Framebuffer(QOpenGLExtraFunctions * f_, QVector<GLenum> colors_, bool withDepth = true, GLenum _target = GL_TEXTURE_2D);
virtual ~Framebuffer();
GLuint id() const {return fbo;}
GLuint colorTexture(int index = 0) const {return colors[index];}
GLuint depthTexture() const {return tex_d;}
GLenum target() const {return target_;}
bool isInit() const {return fbo != 0;}
int width() const {return wid;}
int height() const {return hei;}
QSize size() const {return QSize(wid, hei);}
QRect rect() const {return QRect(0, 0, wid, hei);}
GLuint id() const { return fbo; }
GLuint colorTexture(int index = 0) const { return colors[index]; }
GLuint depthTexture() const { return tex_d; }
GLenum target() const { return target_; }
bool isInit() const { return fbo != 0; }
int width() const { return wid; }
int height() const { return hei; }
QSize size() const { return QSize(wid, hei); }
QRect rect() const { return QRect(0, 0, wid, hei); }
QImage grab() const;
QVector<float> grabF(int index) const;
void queryPoint(int index, QPoint p);
@@ -48,23 +52,29 @@ public:
QVector<uint> getPointsByte() const;
QVector<QVector4D> getPointsFloat() const;
QImage getImage() const;
int queriedPoints() const {return pbo_queried;}
void blit(int index_from, GLuint fb_to, int index_to, QRect from, QRect to, GLbitfield mask = GL_COLOR_BUFFER_BIT, GLenum filter = GL_NEAREST) const;
int queriedPoints() const { return pbo_queried; }
void blit(int index_from,
GLuint fb_to,
int index_to,
QRect from,
QRect to,
GLbitfield mask = GL_COLOR_BUFFER_BIT,
GLenum filter = GL_NEAREST) const;
void resize(int width, int height, bool force = false);
void reinit();
void bind();
void release();
void setReadBuffer(int index) {glReadBuffer(GL_COLOR_ATTACHMENT0 + index);}
void setReadBuffer(int index) { glReadBuffer(GL_COLOR_ATTACHMENT0 + index); }
void setWriteBuffer(int index);
void setWriteBuffers(const int * indeces, int count);
void setWriteBuffers(const QVector<int> & indeces) {setWriteBuffers(indeces.constData(), indeces.size());}
void setWriteBuffers(const QVector<int> & indeces) { setWriteBuffers(indeces.constData(), indeces.size()); }
void setWriteBuffers();
void unsetWriteBuffers();
void enablePixelBuffer();
void setColorTextureFiltering(int index, GLenum filter);
void copyDepthFrom(GLuint tex) {;}
void copyDepthFrom(GLuint tex) { ; }
void bindColorTexture(int index, int channel = 0);
void bindColorTextures();
void bindDepthTexture(int channel);