dust3d/application/sources/model_opengl_program.h

31 lines
1002 B
C
Raw Normal View History

2022-09-19 13:30:03 +00:00
#ifndef DUST3D_APPLICATION_MODEL_OPENGL_PROGRAM_H_
#define DUST3D_APPLICATION_MODEL_OPENGL_PROGRAM_H_
2022-09-23 17:33:55 +00:00
#include <memory>
2022-09-19 13:30:03 +00:00
#include <QOpenGLShaderProgram>
2022-09-20 12:48:22 +00:00
#include <QOpenGLShader>
2022-09-23 17:33:55 +00:00
#include <QOpenGLTexture>
2022-09-19 13:30:03 +00:00
class ModelOpenGLProgram: public QOpenGLShaderProgram
{
public:
void load(bool isCoreProfile=false);
int getUniformLocationByName(const std::string &name);
bool isCoreProfile() const;
2022-09-23 17:33:55 +00:00
void bindEnvironment();
2022-09-19 13:30:03 +00:00
private:
2022-09-20 12:48:22 +00:00
void addShaderFromResource(QOpenGLShader::ShaderType type, const char *resourceName);
2022-09-19 13:30:03 +00:00
bool m_isLoaded = false;
bool m_isCoreProfile = false;
2022-09-20 12:48:22 +00:00
std::map<std::string, int> m_uniformLocationMap;
2022-09-23 17:33:55 +00:00
std::unique_ptr<QOpenGLTexture> m_environmentIrradianceMap;
std::unique_ptr<QOpenGLTexture> m_environmentSpecularMap;
std::unique_ptr<std::vector<std::unique_ptr<QOpenGLTexture>>> m_environmentIrradianceMaps;
std::unique_ptr<std::vector<std::unique_ptr<QOpenGLTexture>>> m_environmentSpecularMaps;
2022-09-19 13:30:03 +00:00
};
#endif