2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-11 09:07:41 +00:00

Fix an insane number of things with hsh refactoring

This commit is contained in:
2020-10-07 20:03:07 -04:00
parent 3c9816af12
commit 036e769210
41 changed files with 255 additions and 198 deletions

View File

@@ -9,18 +9,16 @@
namespace urde {
using namespace hsh::pipeline;
template <ERglCullMode CullMode, ERglEnum Compare, bool DepthWrite, ERglBlendMode Mode, ERglBlendFactor SrcFac,
ERglBlendFactor DstFac, ERglLogicOp Op, bool AlphaWrite>
struct CAABoxShaderPipeline
: pipeline<topology<hsh::TriangleStrip>, ERglBlendModeAttachment<Mode, SrcFac, DstFac, Op, AlphaWrite>,
ERglCullModeAttachment<CullMode>, ERglDepthCompareAttachment<Compare>, depth_write<DepthWrite>> {
struct CAABoxShaderPipeline : pipeline<topology<hsh::TriangleStrip>,
ERglBlendModeAttachment<ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha,
ERglBlendFactor::InvSrcAlpha, ERglLogicOp::Clear, false>,
ERglCullModeAttachment<ERglCullMode::None>,
ERglDepthCompareAttachment<ERglEnum::LEqual>, depth_write<true>> {
CAABoxShaderPipeline(hsh::vertex_buffer<CAABoxShader::Vert> vbo, hsh::uniform_buffer<CAABoxShader::Uniform> uniBuf) {
this->position = uniBuf->m_xf * hsh::float4(vbo->m_pos, 1.f);
this->color_out[0] = uniBuf->m_color;
}
};
template struct CAABoxShaderPipeline<ERglCullMode::None, ERglEnum::LEqual, true, ERglBlendMode::Blend,
ERglBlendFactor::SrcAlpha, ERglBlendFactor::InvSrcAlpha, ERglLogicOp::Clear, true>;
constexpr size_t VertexCount = 34;
@@ -53,8 +51,7 @@ CAABoxShader::CAABoxShader(const zeus::CAABox& aabb) {
m_vbo = hsh::create_vertex_buffer(verts);
m_uniBuf = hsh::create_dynamic_uniform_buffer<Uniform>();
m_dataBind.hsh_bind(CAABoxShaderPipeline<gx_CullMode, gx_DepthTest, gx_DepthWrite, gx_BlendMode, gx_BlendSrcFac,
gx_BlendDstFac, gx_BlendOp, gx_AlphaWrite>(m_vbo.get(), m_uniBuf.get()));
m_dataBind.hsh_bind(CAABoxShaderPipeline(m_vbo.get(), m_uniBuf.get()));
}
void CAABoxShader::draw(const zeus::CColor& color) {

View File

@@ -14,10 +14,13 @@ template <EFilterType Type>
struct CColoredQuadFilterPipeline : FilterPipeline<Type> {
CColoredQuadFilterPipeline(hsh::vertex_buffer<CColoredQuadFilter::Vert> vbo,
hsh::uniform_buffer<CColoredQuadFilter::Uniform> uniBuf) {
this->position = hsh::float4(vbo->m_pos, 1.f);
this->position = uniBuf->m_matrix * hsh::float4(vbo->m_pos, 1.f);
this->color_out[0] = uniBuf->m_color;
}
};
template struct CColoredQuadFilterPipeline<EFilterType::Add>;
template struct CColoredQuadFilterPipeline<EFilterType::Blend>;
template struct CColoredQuadFilterPipeline<EFilterType::Multiply>;
CColoredQuadFilter::CColoredQuadFilter(EFilterType type) {
constexpr std::array<Vert, 4> verts{{
@@ -36,6 +39,7 @@ CColoredQuadFilter::CColoredQuadFilter(EFilterType type) {
void CColoredQuadFilter::draw(const zeus::CColor& color, const zeus::CRectangle& rect) {
SCOPED_GRAPHICS_DEBUG_GROUP("CColoredQuadFilter::draw", zeus::skMagenta);
m_uniform.m_matrix = zeus::CMatrix4f{};
m_uniform.m_matrix[0][0] = rect.size.x() * 2.f;
m_uniform.m_matrix[1][1] = rect.size.y() * 2.f;
m_uniform.m_matrix[3][0] = rect.position.x() * 2.f - 1.f;

View File

@@ -1,5 +1,7 @@
#pragma once
#include "hsh/hsh.h"
#include "zeus/CColor.hpp"
#include "zeus/CMatrix4f.hpp"

View File

@@ -15,8 +15,8 @@ struct CDecalShaderTexPipeline
std::conditional_t<Additive, std::conditional_t<RedToAlpha, MultiplyAttachment<>, AdditiveAttachment<>>,
BlendAttachment<>>,
depth_compare<hsh::LEqual>, depth_write<false>> {
CDecalShaderTexPipeline(hsh::vertex_buffer<SParticleInstanceTex> vbo, hsh::uniform_buffer<SParticleUniforms> uniBuf,
hsh::texture2d tex) {
CDecalShaderTexPipeline(hsh::vertex_buffer<SParticleInstanceTex> vbo HSH_VAR_INSTANCE,
hsh::uniform_buffer<SParticleUniforms> uniBuf, hsh::texture2d tex) {
this->position = uniBuf->mvp * vbo->pos[this->vertex_id];
this->color_out[0] = vbo->color * uniBuf->moduColor * tex.sample<float>(vbo->uvs[this->vertex_id]);
if constexpr (RedToAlpha) {
@@ -31,7 +31,7 @@ template struct CDecalShaderTexPipeline<false, false>;
template <bool Additive>
struct CDecalShaderNoTexPipeline : pipeline<std::conditional_t<Additive, AdditiveAttachment<>, BlendAttachment<>>,
depth_compare<hsh::LEqual>, depth_write<!Additive>> {
CDecalShaderNoTexPipeline(hsh::vertex_buffer<SParticleInstanceNoTex> vbo,
CDecalShaderNoTexPipeline(hsh::vertex_buffer<SParticleInstanceNoTex> vbo HSH_VAR_INSTANCE,
hsh::uniform_buffer<SParticleUniforms> uniBuf) {
this->position = uniBuf->mvp * vbo->pos[this->vertex_id];
this->color_out[0] = vbo->color * uniBuf->moduColor;

View File

@@ -33,7 +33,7 @@ using BlendModeAttachment = typename BlendModeAttachmentExt<Mode, AlphaWrite>::t
template <BlendMode Mode, bool AlphaWrite, bool ZTest, bool ZWrite, bool RedToAlpha>
struct CElementGenShadersTexPipeline : pipeline<topology<hsh::TriangleStrip>, BlendModeAttachment<Mode, AlphaWrite>,
depth_compare<ZTest ? hsh::LEqual : hsh::Always>, depth_write<ZWrite>> {
CElementGenShadersTexPipeline(hsh::vertex_buffer<SParticleInstanceTex> vbo,
CElementGenShadersTexPipeline(hsh::vertex_buffer<SParticleInstanceTex> vbo HSH_VAR_INSTANCE,
hsh::uniform_buffer<SParticleUniforms> uniBuf, hsh::texture2d tex) {
this->position = uniBuf->mvp * vbo->pos[this->vertex_id];
this->color_out[0] = vbo->color * uniBuf->moduColor * tex.sample<float>(vbo->uvs[this->vertex_id]);
@@ -42,15 +42,14 @@ struct CElementGenShadersTexPipeline : pipeline<topology<hsh::TriangleStrip>, Bl
}
}
};
template struct CElementGenShadersTexPipeline<BlendMode::Regular, true, true, true, false>;
template struct CElementGenShadersTexPipeline<BlendMode::Additive, true, true, true, true>;
template struct CElementGenShadersTexPipeline<BlendMode::Subtract, true, true, true, true>;
template struct CElementGenShadersTexPipeline<BlendMode::Additive, false, true, false, false>;
template struct CElementGenShadersTexPipeline<BlendMode::Regular, false, true, false, false>;
template <BlendMode Mode, bool AlphaWrite, bool ZTest, bool ZWrite, bool ColoredIndirect>
struct CElementGenShadersIndTexPipeline
: pipeline<topology<hsh::TriangleStrip>, BlendModeAttachment<Mode, AlphaWrite>,
depth_compare<ZTest ? hsh::LEqual : hsh::Always>, depth_write<ZWrite>> {
CElementGenShadersIndTexPipeline(hsh::vertex_buffer<SParticleInstanceIndTex> vbo,
CElementGenShadersIndTexPipeline(hsh::vertex_buffer<SParticleInstanceIndTex> vbo HSH_VAR_INSTANCE,
hsh::uniform_buffer<SParticleUniforms> uniBuf, hsh::texture2d texrTex,
hsh::texture2d tindTex, hsh::render_texture2d sceneTex) {
this->position = uniBuf->mvp * vbo->pos[this->vertex_id];
@@ -65,22 +64,19 @@ struct CElementGenShadersIndTexPipeline
}
}
};
template struct CElementGenShadersIndTexPipeline<BlendMode::Regular, true, true, true, true>;
template struct CElementGenShadersIndTexPipeline<BlendMode::Additive, true, true, true, false>;
template struct CElementGenShadersIndTexPipeline<BlendMode::Regular, false, true, false, false>;
template <BlendMode Mode, bool AlphaWrite, bool ZTest, bool ZWrite>
struct CElementGenShadersNoTexPipeline
: pipeline<topology<hsh::TriangleStrip>, BlendModeAttachment<Mode, AlphaWrite>,
depth_compare<ZTest ? hsh::LEqual : hsh::Always>, depth_write<ZWrite>> {
CElementGenShadersNoTexPipeline(hsh::vertex_buffer<SParticleInstanceNoTex> vbo,
CElementGenShadersNoTexPipeline(hsh::vertex_buffer<SParticleInstanceNoTex> vbo HSH_VAR_INSTANCE,
hsh::uniform_buffer<SParticleUniforms> uniBuf) {
this->position = uniBuf->mvp * vbo->pos[this->vertex_id];
this->color_out[0] = vbo->color * uniBuf->moduColor;
}
};
template struct CElementGenShadersNoTexPipeline<BlendMode::Regular, true, true, true>;
template struct CElementGenShadersNoTexPipeline<BlendMode::Additive, true, true, true>;
template struct CElementGenShadersNoTexPipeline<BlendMode::Subtract, true, true, true>;
template struct CElementGenShadersNoTexPipeline<BlendMode::Regular, false, true, false>;
CElementGenShaders::EShaderClass CElementGenShaders::GetShaderClass(CElementGen& gen) {
const auto* desc = gen.x1c_genDesc.GetObj();

View File

@@ -61,19 +61,19 @@ void CEnergyBarShader::draw(const zeus::CColor& color0, const std::vector<Vertex
if (!verts0.empty()) {
m_uniform.m_color = color0;
m_uniBuf[0].load(m_uniform);
m_dataBind[0].draw_indexed(0, verts0.size());
m_dataBind[0].draw(0, verts0.size());
vertIter += verts0.size();
}
if (!verts1.empty()) {
m_uniform.m_color = color1;
m_uniBuf[1].load(m_uniform);
m_dataBind[1].draw_indexed(vertIter, verts1.size());
m_dataBind[1].draw(vertIter, verts1.size());
vertIter += verts1.size();
}
if (!verts2.empty()) {
m_uniform.m_color = color2;
m_uniBuf[2].load(m_uniform);
m_dataBind[2].draw_indexed(vertIter, verts2.size());
m_dataBind[2].draw(vertIter, verts2.size());
}
}

View File

@@ -8,6 +8,8 @@
#include "zeus/CVector2f.hpp"
#include "zeus/CVector3f.hpp"
#include "hsh/hsh.h"
namespace urde {
class CTexture;

View File

@@ -12,7 +12,7 @@ struct CEnvFxShadersPipeline
// FIXME replace MultiplyAttachment with ERglBlendFactor One:One equivalent
: pipeline<topology<hsh::TriangleStrip>, std::conditional_t<Blend, BlendAttachment<false>, MultiplyAttachment<false>>,
depth_compare<hsh::LEqual>, depth_write<false>> {
CEnvFxShadersPipeline(hsh::vertex_buffer<CEnvFxShaders::Instance> vbo,
CEnvFxShadersPipeline(hsh::vertex_buffer<CEnvFxShaders::Instance> vbo HSH_VAR_INSTANCE,
hsh::uniform_buffer<CEnvFxShaders::Uniform> envFxUniBuf,
hsh::uniform_buffer<CGraphics::CFogState> fogUniBuf, hsh::texture2d texFlake,
hsh::texture2d texEnv) {

View File

@@ -35,7 +35,7 @@ template <bool Additive, bool AlphaWrite, hsh::Compare ZComp>
struct CLineRendererNoTexPipeline
: pipeline<std::conditional_t<Additive, AdditiveAttachment<AlphaWrite>, BlendAttachment<AlphaWrite>>,
depth_compare<ZComp>> {
CLineRendererNoTexPipeline(hsh::vertex_buffer<CLineRenderer::SDrawVertTex> vbo,
CLineRendererNoTexPipeline(hsh::vertex_buffer<CLineRenderer::SDrawVertNoTex> vbo,
hsh::uniform_buffer<CLineRenderer::SDrawUniform> uniBuf HSH_VAR_STAGE(fragment)) {
this->position = vbo->pos;
hsh::float4 colorIn = vbo->color * uniBuf->moduColor;
@@ -46,6 +46,7 @@ struct CLineRendererNoTexPipeline
template struct CLineRendererNoTexPipeline<false, false, hsh::Always>;
template struct CLineRendererNoTexPipeline<false, false, hsh::LEqual>;
template struct CLineRendererNoTexPipeline<false, false, hsh::Greater>;
template struct CLineRendererNoTexPipeline<false, false, hsh::GEqual>;
template struct CLineRendererNoTexPipeline<false, true, hsh::Always>;
template struct CLineRendererNoTexPipeline<false, true, hsh::LEqual>;
template struct CLineRendererNoTexPipeline<false, true, hsh::Greater>;

View File

@@ -23,8 +23,7 @@ CMapSurfaceShader::CMapSurfaceShader(hsh::vertex_buffer<Vert> vbo, hsh::index_bu
void CMapSurfaceShader::draw(const zeus::CColor& color, u32 start, u32 count) {
SCOPED_GRAPHICS_DEBUG_GROUP("CMapSurfaceShader::draw", zeus::skMagenta);
Uniform uniform = {CGraphics::GetPerspectiveProjectionMatrix(true) * CGraphics::g_GXModelView.toMatrix4f(), color};
m_uniBuf.load(uniform);
m_uniBuf.load({CGraphics::GetPerspectiveProjectionMatrix(true) * CGraphics::g_GXModelView.toMatrix4f(), color});
m_dataBind.draw_indexed(start, count);
}

View File

@@ -5,6 +5,8 @@
#include "zeus/CColor.hpp"
#include "zeus/CMatrix4f.hpp"
#include "hsh/hsh.h"
namespace urde {
class CMapSurfaceShader {

View File

@@ -9,7 +9,7 @@ namespace urde {
using namespace hsh::pipeline;
struct CRadarPaintShaderPipeline : pipeline<topology<hsh::TriangleStrip>, AdditiveAttachment<>, depth_write<false>> {
CRadarPaintShaderPipeline(hsh::vertex_buffer<CRadarPaintShader::Instance> vbo,
CRadarPaintShaderPipeline(hsh::vertex_buffer<CRadarPaintShader::Instance> vbo HSH_VAR_INSTANCE,
hsh::uniform_buffer<CRadarPaintShader::Uniform> ubo, hsh::texture2d tex) {
this->position = ubo->xf * hsh::float4(vbo->pos[this->vertex_id], 1.f);
this->color_out[0] = vbo->color * tex.sample<float>(vbo->uv[this->vertex_id]);

View File

@@ -2,6 +2,8 @@
#include "Runtime/CToken.hpp"
#include "hsh/hsh.h"
#include "zeus/CColor.hpp"
namespace urde {

View File

@@ -4,6 +4,8 @@
#include "Runtime/GCNTypes.hpp"
#include "hsh/hsh.h"
#include "zeus/CVector3f.hpp"
namespace urde {

View File

@@ -33,7 +33,7 @@ using DrawFlagsAttachment = typename DrawFlagsAttachmentExt<Flags>::type;
template <CGuiWidget::EGuiModelDrawFlags Flags>
struct CTextSupportShaderCharacterPipeline
: pipeline<topology<hsh::TriangleStrip>, DrawFlagsAttachment<Flags>, depth_write<false>, depth_compare<hsh::LEqual>> {
CTextSupportShaderCharacterPipeline(hsh::vertex_buffer<CTextSupportShader::CharacterInstance> vbo,
CTextSupportShaderCharacterPipeline(hsh::vertex_buffer<CTextSupportShader::CharacterInstance> vbo HSH_VAR_INSTANCE,
hsh::uniform_buffer<CTextSupportShader::Uniform> ubo, hsh::texture2d_array tex) {
this->position = ubo->m_mvp * hsh::float4(vbo->m_pos[this->vertex_id], 1.f);
hsh::float4 fontColor = ubo->m_uniformColor * vbo->m_fontColor;
@@ -49,7 +49,7 @@ template struct CTextSupportShaderCharacterPipeline<CGuiWidget::EGuiModelDrawFla
template <CGuiWidget::EGuiModelDrawFlags Flags>
struct CTextSupportShaderImagePipeline
: pipeline<topology<hsh::TriangleStrip>, DrawFlagsAttachment<Flags>, depth_write<false>, depth_compare<hsh::LEqual>> {
CTextSupportShaderImagePipeline(hsh::vertex_buffer<CTextSupportShader::ImageInstance> vbo,
CTextSupportShaderImagePipeline(hsh::vertex_buffer<CTextSupportShader::ImageInstance> vbo HSH_VAR_INSTANCE,
hsh::uniform_buffer<CTextSupportShader::Uniform> ubo, hsh::texture2d tex) {
this->position = ubo->m_mvp * hsh::float4(vbo->m_pos[this->vertex_id], 1.f);
// FIXME hsh bug: sampler appears to be completely ignored

View File

@@ -12,25 +12,51 @@ namespace urde {
template <EFilterType Type, bool TexAlpha>
struct CTexturedQuadFilterPipeline : FilterPipeline<Type> {
CTexturedQuadFilterPipeline(hsh::vertex_buffer<CTexturedQuadFilter::Vert> vbo,
hsh::uniform_buffer<CTexturedQuadFilter::Uniform> uniBuf, hsh::texture2d tex) {
this->position = hsh::float4(vbo->m_pos, 1.f);
hsh::uniform_buffer<CTexturedQuadFilter::Uniform> uniBuf,
hsh::texture2d tex) {
this->position = uniBuf->m_matrix * hsh::float4(vbo->m_pos, 1.f);
if constexpr (TexAlpha) {
this->color_out[0] = uniBuf->m_color * tex.sample_bias<float>(vbo->m_uv, uniBuf->m_lod, {});
this->color_out[0] = uniBuf->m_color * tex.sample_bias<float>(vbo->m_uv, uniBuf->m_lod);
} else {
this->color_out[0] =
uniBuf->m_color * hsh::float4(tex.sample_bias<float>(vbo->m_uv, uniBuf->m_lod, {}).xyz(), 1.f);
uniBuf->m_color * hsh::float4(tex.sample_bias<float>(vbo->m_uv, uniBuf->m_lod).xyz(), 1.f);
}
}
};
template struct CTexturedQuadFilterPipeline<EFilterType::Blend, false>;
template struct CTexturedQuadFilterPipeline<EFilterType::Add, true>;
template struct CTexturedQuadFilterPipeline<EFilterType::Multiply, false>;
template <typename Tex>
CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type, Tex tex, ZTest ztest)
template <EFilterType Type, bool TexAlpha>
struct CTexturedQuadFilterRenderTexPipeline : FilterPipeline<Type> {
CTexturedQuadFilterRenderTexPipeline(hsh::vertex_buffer<CTexturedQuadFilter::Vert> vbo,
hsh::uniform_buffer<CTexturedQuadFilter::Uniform> uniBuf,
hsh::render_texture2d tex) {
this->position = uniBuf->m_matrix * hsh::float4(vbo->m_pos, 1.f);
if constexpr (TexAlpha) {
this->color_out[0] = uniBuf->m_color * tex.sample_bias<float>(vbo->m_uv, uniBuf->m_lod);
} else {
this->color_out[0] =
uniBuf->m_color * hsh::float4(tex.sample_bias<float>(vbo->m_uv, uniBuf->m_lod).xyz(), 1.f);
}
}
};
template struct CTexturedQuadFilterRenderTexPipeline<EFilterType::Blend, false>;
CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type, hsh::texture2d tex, ZTest ztest)
: m_zTest(ztest) {
m_vbo = hsh::create_dynamic_vertex_buffer<Vert>(16);
m_uniBuf = hsh::create_dynamic_uniform_buffer<Uniform>();
m_dataBind.hsh_bind(CTexturedQuadFilterPipeline<type, false>(m_vbo.get(), m_uniBuf.get(), tex));
}
CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type, hsh::render_texture2d tex, ZTest ztest)
: m_zTest(ztest) {
m_vbo = hsh::create_dynamic_vertex_buffer<Vert>(16);
m_uniBuf = hsh::create_dynamic_uniform_buffer<Uniform>();
m_dataBind.hsh_rend_bind(CTexturedQuadFilterRenderTexPipeline<type, false>(m_vbo.get(), m_uniBuf.get(), tex));
}
CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type, TLockedToken<CTexture> tex, ZTest ztest)
: CTexturedQuadFilter(type, (tex ? tex->GetBooTexture() : hsh::texture2d{}), ztest) {
m_tex = tex;
@@ -49,8 +75,10 @@ void CTexturedQuadFilter::draw(const zeus::CColor& color, float uvScale, const z
m_uniform.m_matrix[0][0] = rect.size.x() * 2.f;
m_uniform.m_matrix[1][1] = rect.size.y() * 2.f;
m_uniform.m_matrix[2][2] = 1.f;
m_uniform.m_matrix[3][0] = rect.position.x() * 2.f - 1.f;
m_uniform.m_matrix[3][1] = rect.position.y() * 2.f - 1.f;
m_uniform.m_matrix[3][3] = 1.f;
m_uniform.m_color = color;
m_uniBuf.load(m_uniform);
@@ -140,13 +168,18 @@ void CTexturedQuadFilter::DrawFilter(EFilterShape shape, const zeus::CColor& col
}
}
template <typename Tex>
CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(EFilterType type, Tex tex) {
CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(EFilterType type, hsh::texture2d tex) {
m_vbo = hsh::create_dynamic_vertex_buffer<Vert>(16);
m_uniBuf = hsh::create_dynamic_uniform_buffer<Uniform>();
m_dataBind.hsh_bind_alpha(CTexturedQuadFilterPipeline<type, true>(m_vbo.get(), m_uniBuf.get(), tex));
}
CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(EFilterType type, hsh::render_texture2d tex) {
m_vbo = hsh::create_dynamic_vertex_buffer<Vert>(16);
m_uniBuf = hsh::create_dynamic_uniform_buffer<Uniform>();
m_dataBind.hsh_render_bind_alpha(CTexturedQuadFilterRenderTexPipeline<type, true>(m_vbo.get(), m_uniBuf.get(), tex));
}
CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(EFilterType type, TLockedToken<CTexture> tex)
: CTexturedQuadFilterAlpha(type, (tex ? tex->GetBooTexture() : hsh::texture2d{})) {
m_tex = tex;

View File

@@ -2,6 +2,8 @@
#include "Runtime/CToken.hpp"
#include "hsh/hsh.h"
#include "zeus/CColor.hpp"
#include "zeus/CMatrix4f.hpp"
#include "zeus/CRectangle.hpp"
@@ -32,7 +34,7 @@ protected:
hsh::dynamic_owner<hsh::vertex_buffer<Vert>> m_vbo;
hsh::dynamic_owner<hsh::uniform_buffer<Uniform>> m_uniBuf;
hsh::binding m_dataBind;
Uniform m_uniform;
Uniform m_uniform{};
ZTest m_zTest;
CTexturedQuadFilter() = default;
@@ -40,8 +42,8 @@ protected:
public:
static constexpr zeus::CRectangle DefaultRect{0.f, 0.f, 1.f, 1.f};
explicit CTexturedQuadFilter(EFilterType type, TLockedToken<CTexture> tex, ZTest zTest = ZTest::None);
template <typename Tex>
explicit CTexturedQuadFilter(EFilterType type, Tex tex, ZTest zTest = ZTest::None);
explicit CTexturedQuadFilter(EFilterType type, hsh::texture2d tex, ZTest zTest = ZTest::None);
explicit CTexturedQuadFilter(EFilterType type, hsh::render_texture2d tex, ZTest zTest = ZTest::None);
CTexturedQuadFilter(const CTexturedQuadFilter&) = delete;
CTexturedQuadFilter& operator=(const CTexturedQuadFilter&) = delete;
CTexturedQuadFilter(CTexturedQuadFilter&&) = default;
@@ -56,8 +58,8 @@ public:
class CTexturedQuadFilterAlpha : public CTexturedQuadFilter {
public:
explicit CTexturedQuadFilterAlpha(EFilterType type, TLockedToken<CTexture> tex);
template <typename Tex>
explicit CTexturedQuadFilterAlpha(EFilterType type, Tex tex);
explicit CTexturedQuadFilterAlpha(EFilterType type, hsh::texture2d tex);
explicit CTexturedQuadFilterAlpha(EFilterType type, hsh::render_texture2d tex);
};
} // namespace urde

View File

@@ -2,6 +2,8 @@
#include <array>
#include "hsh/hsh.h"
#include "zeus/CColor.hpp"
#include "zeus/CMatrix4f.hpp"

View File

@@ -5,11 +5,13 @@
#include "Runtime/CToken.hpp"
#include "zeus/CMatrix4f.hpp"
#include "hsh/hsh.h"
namespace urde {
class CTexture;
class CXRayBlurFilter {
friend struct CXRayBlurFilterPipeline;
public:
struct Vert {
hsh::float2 m_pos;
hsh::float2 m_uv;
@@ -17,6 +19,8 @@ class CXRayBlurFilter {
struct Uniform {
std::array<hsh::float4x4, 8> m_uv;
};
private:
TLockedToken<CTexture> m_paletteTex;
hsh::owner<hsh::vertex_buffer<Vert>> m_vbo;
hsh::dynamic_owner<hsh::uniform_buffer<Uniform>> m_uniBuf;