2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2017-10-01 04:26:46 +00:00
|
|
|
|
2019-09-28 02:53:03 +00:00
|
|
|
#include <optional>
|
|
|
|
|
2019-09-29 00:30:53 +00:00
|
|
|
#include "Runtime/GCNTypes.hpp"
|
2019-09-28 02:53:03 +00:00
|
|
|
#include "Runtime/Graphics/Shaders/CTexturedQuadFilter.hpp"
|
|
|
|
|
2020-09-28 20:54:40 +00:00
|
|
|
#include "zeus/CColor.hpp"
|
|
|
|
#include "zeus/CMatrix4f.hpp"
|
2017-10-01 04:26:46 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
|
|
|
|
|
|
|
class CWorldShadowShader {
|
2020-10-04 03:56:36 +00:00
|
|
|
public:
|
2020-09-28 20:54:40 +00:00
|
|
|
struct Vert {
|
|
|
|
hsh::float3 m_pos;
|
|
|
|
};
|
2018-12-08 05:30:43 +00:00
|
|
|
struct Uniform {
|
2020-10-04 03:56:36 +00:00
|
|
|
hsh::float4x4 m_matrix;
|
|
|
|
hsh::float4 m_color;
|
2018-12-08 05:30:43 +00:00
|
|
|
};
|
2020-10-04 03:56:36 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
hsh::owner<hsh::render_texture2d> m_tex;
|
|
|
|
std::optional<CTexturedQuadFilter> m_prevQuad;
|
|
|
|
u32 m_w, m_h;
|
|
|
|
|
2020-09-28 20:54:40 +00:00
|
|
|
hsh::dynamic_owner<hsh::vertex_buffer<Vert>> m_vbo;
|
|
|
|
hsh::dynamic_owner<hsh::uniform_buffer<Uniform>> m_uniBuf;
|
|
|
|
hsh::binding m_dataBind;
|
2020-10-04 03:56:36 +00:00
|
|
|
hsh::binding m_zDataBind;
|
|
|
|
Uniform m_uniform{};
|
2017-10-01 04:26:46 +00:00
|
|
|
|
|
|
|
public:
|
2020-03-31 03:52:22 +00:00
|
|
|
explicit CWorldShadowShader(u32 w, u32 h);
|
2018-12-08 05:30:43 +00:00
|
|
|
void bindRenderTarget();
|
|
|
|
void drawBase(float extent);
|
|
|
|
void lightenShadow();
|
|
|
|
void blendPreviousShadow();
|
|
|
|
void resolveTexture();
|
|
|
|
|
|
|
|
u32 GetWidth() const { return m_w; }
|
|
|
|
u32 GetHeight() const { return m_h; }
|
|
|
|
|
2020-09-28 20:54:40 +00:00
|
|
|
hsh::render_texture2d GetTexture() const { return m_tex.get_color(0); }
|
2017-10-01 04:26:46 +00:00
|
|
|
};
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde
|