code format

This commit is contained in:
2022-12-14 14:14:33 +03:00
parent 09e5342956
commit cdb02fc9be
278 changed files with 15371 additions and 12176 deletions

View File

@@ -19,48 +19,56 @@
#ifndef GLFRAMEBUFFER_H
#define GLFRAMEBUFFER_H
#include <QOpenGLExtraFunctions>
#include "gltypes.h"
#include <QOpenGLExtraFunctions>
class GLFramebuffer : protected QOpenGLExtraFunctions
{
class GLFramebuffer: protected QOpenGLExtraFunctions {
public:
GLFramebuffer(int colorAttachments = 1, bool withDepth = true, GLenum colorFormat = GL_RGBA8, GLenum target = GL_TEXTURE_2D);
virtual ~GLFramebuffer();
GLuint id() const {return fbo;}
GLuint colorTexture(int index = 0) const {return colors[index];}
GLenum colorFormat() const {return color_format;}
GLuint depthTexture() const {return tex_d;}
GLenum target() const {return target_;}
int width() const {return wid;}
int height() const {return hei;}
QSize size() const {return QSize(wid, hei);}
GLuint id() const { return fbo; }
GLuint colorTexture(int index = 0) const { return colors[index]; }
GLenum colorFormat() const { return color_format; }
GLuint depthTexture() const { return tex_d; }
GLenum target() const { return target_; }
int width() const { return wid; }
int height() const { return hei; }
QSize size() const { return QSize(wid, hei); }
QImage grab() const;
void resize(int width, int height, bool force = false);
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(int * indeces, int count);
void setColorFormat(GLenum format) {color_format = format; is_changed = true;}
void setColorFormat(GLenum format) {
color_format = format;
is_changed = true;
}
void copyDepthFrom(GLuint tex) {;}
void copyDepthFrom(GLuint tex) { ; }
void bindColorTextures();
void bindDepthTexture(int channel);
private:
void deleteGLRenderbuffer(GLuint & drbo) {if (drbo != 0) glDeleteRenderbuffers(1, &drbo); drbo = 0;}
void deleteGLFramebuffer(GLuint & fbo) {if (fbo != 0) glDeleteFramebuffers(1, &fbo); fbo = 0;}
void deleteGLRenderbuffer(GLuint & drbo) {
if (drbo != 0) glDeleteRenderbuffers(1, &drbo);
drbo = 0;
}
void deleteGLFramebuffer(GLuint & fbo) {
if (fbo != 0) glDeleteFramebuffers(1, &fbo);
fbo = 0;
}
bool is_depth, is_changed;
QVector<GLuint> colors;
GLenum color_format, target_;
GLuint fbo, drbo, tex_d;
GLint prev_view[4], wid, hei;
};
#endif // GLFRAMEBUFFER_H