Files
qglengine/core/glcubemap.h
2022-12-14 14:14:44 +03:00

61 lines
1.6 KiB
C++

/*
QGL CubeTexture
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 <http://www.gnu.org/licenses/>.
*/
#ifndef GLCUBEMAP_H
#define GLCUBEMAP_H
#include "chunkstream.h"
#include "glshaders_types.h"
QVector<QVector3D> loadFileHDR(const QString & path, QSize * size = 0);
class CubeTexture {
public:
CubeTexture(QOpenGLExtraFunctions * f_, int _size, const GLenum & _format = GL_RGB16F);
bool init();
void destroy();
void bind(int channel = 0);
void release();
void resize(int _size) {
size = _size;
changed_ = true;
}
void loadHDR(const QVector<QVector3D> & data, QSize sz);
void setFileHDR(const QString & path);
QString fileHDR() const { return hdr_path; }
GLenum format() const { return format_; }
void setFormat(GLenum f) {
format_ = f;
changed_ = true;
}
GLuint id() const { return id_; }
bool isInit() const { return id_ != 0; }
void load();
private:
QOpenGLExtraFunctions * f;
bool changed_;
int size;
GLenum format_;
GLuint id_;
QString hdr_path;
};
#endif // GLCUBEMAP_H