17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 09:49:19 +02:00
Files
maszyna/betterRenderer/renderer/source/csm.h
maj00r 26501b0fd7 hoist standard includes above everything else
Ordering them before the imports in the same file was not enough: a
project header on line 1 can import a module several levels down whose
global module fragment already pulled in the same standard header, and
that include guard does not cross the module boundary. Putting them
first means the guard is set before anything can import.

Skips vendored single-header libraries and anything inside an #if.
2026-09-10 01:02:17 +02:00

32 lines
1.1 KiB
C++

#pragma once
#include <array>
#include <vector>
#include <nvrhi/nvrhi.h>
#include "nvrenderer/resource_registry.h"
struct MaShadowMap : public MaResourceRegistry {
MaShadowMap(class NvRenderer* renderer);
void Init();
std::vector<double> m_shadow_planes;
std::vector<glm::dmat4> m_cascade_matrices;
std::vector<glm::dmat4> m_cascade_matrices_clamped;
double m_far_plane_first;
double m_far_plane_last;
double m_shadow_far_plane;
nvrhi::BufferHandle m_projection_buffer;
nvrhi::BufferHandle m_inverse_projection_buffer;
class NvRendererBackend* m_backend;
void CalcCascades(const glm::dmat4& projection, const glm::dmat4& view,
const glm::dvec3& light);
void UpdateConstants(nvrhi::ICommandList* command_list);
static void GetViewPlaneCornersWorldSpace(
const glm::dmat4& projection, const glm::dmat4& inverse_projection,
const glm::dmat4& inverse_view, const double& d, bool normalize,
glm::dvec3& ll, glm::dvec3& lr, glm::dvec3& ul, glm::dvec3& ur);
struct ShadowProjectionConstants {
std::array<glm::mat4, 8> m_shadow_projection;
std::array<float, 8> m_shadow_planes;
};
};