metaforce/Runtime/Graphics/Shaders/CWorldShadowShader.hpp

49 lines
1.0 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
#include <optional>
#include "Runtime/GCNTypes.hpp"
#include "Runtime/Graphics/Shaders/CTexturedQuadFilter.hpp"
#include "zeus/CColor.hpp"
#include "zeus/CMatrix4f.hpp"
2018-12-08 05:30:43 +00:00
namespace urde {
class CWorldShadowShader {
2020-10-04 03:56:36 +00:00
public:
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;
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{};
public:
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; }
hsh::render_texture2d GetTexture() const { return m_tex.get_color(0); }
};
2018-12-08 05:30:43 +00:00
} // namespace urde