38 lines
739 B
C++
38 lines
739 B
C++
#ifndef SHADOWMAP_H
|
|
#define SHADOWMAP_H
|
|
|
|
#include <QMatrix4x4>
|
|
#include <QObject>
|
|
#include <QOpenGLFunctions_4_5_Core>
|
|
#include <QOpenGLShaderProgram>
|
|
|
|
#include "types.h"
|
|
#include "shader.h"
|
|
|
|
|
|
class ShadowMap: public QObject, protected QOpenGLFunctions_4_5_Core
|
|
{
|
|
Q_OBJECT
|
|
|
|
private:
|
|
QMatrix4x4 m_depthProjection;
|
|
QMatrix4x4 m_depthView;
|
|
static QMatrix4x4 m_bias;
|
|
|
|
GLsizei m_size;
|
|
GLuint m_frameBuffer;
|
|
GLuint m_depthTexture;
|
|
public:
|
|
ShadowMap(GLsizei size);
|
|
~ShadowMap();
|
|
void initGl();
|
|
void preRender();
|
|
void setUniforms(Shader* program, RenderPassType renderPass);
|
|
GLuint depthTexture() const;
|
|
|
|
public slots:
|
|
void setLightDirection(QVector3D lightDirection);
|
|
};
|
|
|
|
#endif // SHADOWMAP_H
|