ArchitectureColoredPainting/ArchitectureColoredPainting/Light.h

30 lines
796 B
C++

#pragma once
#include <vector>
#include <QVector3D>
#include <QVector4D>
#include <QMatrix4x4>
#include <QtMath>
#include <QOpenGLFunctions_4_5_Compatibility>
#include "Camera.h"
#include "Model.h"
class Light
{
public:
QVector3D lightDirection = QVector3D(0.2, 4, 1).normalized();
std::vector<float> shadowCascadeLevels;
float blendRatio = 0.3;
std::vector<float> frustumSizes;
Model* model;
Light(Camera* camera);
std::vector<QVector4D> getFrustumCornersWorldSpace(const QMatrix4x4& projview);
std::vector<QVector4D> getFrustumCornersWorldSpace(const QMatrix4x4& proj, const QMatrix4x4& view);
QMatrix4x4 getLightSpaceMatrix(const float nearPlane, const float farPlane);
std::vector<QMatrix4x4> getLightSpaceMatrices();
private:
Camera* camera;
};