mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-16 00:17:13 +00:00
Migrate to aurora submodule
This commit is contained in:
@@ -61,7 +61,7 @@ void CColoredStripShader::Shutdown() {
|
||||
// stages.data(), nullptr, nullptr, texs.size(), texs.data(), nullptr, nullptr);
|
||||
//}
|
||||
|
||||
CColoredStripShader::CColoredStripShader(size_t maxVerts, Mode mode, aurora::gfx::TextureHandle tex) {
|
||||
CColoredStripShader::CColoredStripShader(size_t maxVerts, Mode mode, CTexture& tex) {
|
||||
// CGraphics::CommitResources([this, maxVerts, mode, tex](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
// BuildResources(ctx, maxVerts, mode, tex);
|
||||
// return true;
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
};
|
||||
static void Initialize();
|
||||
static void Shutdown();
|
||||
CColoredStripShader(size_t maxVerts, Mode mode, aurora::gfx::TextureHandle tex);
|
||||
CColoredStripShader(size_t maxVerts, Mode mode, CTexture& tex);
|
||||
void draw(const zeus::CColor& color, size_t numVerts, const Vert* verts);
|
||||
};
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ CFluidPlaneShader::CFluidPlaneShader(EFluidType type, const TLockedToken<CTextur
|
||||
const TLockedToken<CTexture>& patternTex2, const TLockedToken<CTexture>& colorTex,
|
||||
const TLockedToken<CTexture>& bumpMap, const TLockedToken<CTexture>& envMap,
|
||||
const TLockedToken<CTexture>& envBumpMap, const TLockedToken<CTexture>& lightmap,
|
||||
const aurora::gfx::TextureHandle& rippleMap, bool doubleLightmapBlend,
|
||||
CTexture& rippleMap, bool doubleLightmapBlend,
|
||||
bool additive, u32 maxVertCount)
|
||||
: m_patternTex1(patternTex1)
|
||||
, m_patternTex2(patternTex2)
|
||||
@@ -207,10 +207,11 @@ CFluidPlaneShader::CFluidPlaneShader(EFluidType type, const TLockedToken<CTextur
|
||||
, m_envMap(envMap)
|
||||
, m_envBumpMap(envBumpMap)
|
||||
, m_lightmap(lightmap)
|
||||
, m_rippleMap(rippleMap) {
|
||||
//, m_rippleMap(rippleMap)
|
||||
{
|
||||
SFluidPlaneShaderInfo shaderInfo(type, m_patternTex1.HasReference(), m_patternTex2.HasReference(),
|
||||
m_colorTex.HasReference(), m_bumpMap.HasReference(), m_envMap.HasReference(),
|
||||
m_envBumpMap.HasReference(), m_lightmap.HasReference(), m_rippleMap.operator bool(),
|
||||
m_envBumpMap.HasReference(), m_lightmap.HasReference(), false/*m_rippleMap.operator bool()*/,
|
||||
doubleLightmapBlend, additive);
|
||||
// m_pipelines = _cache.GetOrBuildShader(shaderInfo);
|
||||
PrepareBinding(maxVertCount);
|
||||
|
||||
@@ -106,7 +106,7 @@ private:
|
||||
TLockedToken<CTexture> m_envMap;
|
||||
TLockedToken<CTexture> m_envBumpMap;
|
||||
TLockedToken<CTexture> m_lightmap;
|
||||
aurora::gfx::TextureHandle m_rippleMap;
|
||||
// aurora::gfx::TextureHandle m_rippleMap;
|
||||
// boo::ObjToken<boo::IGraphicsBufferD> m_vbo;
|
||||
// boo::ObjToken<boo::IGraphicsBufferD> m_pvbo;
|
||||
// boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
const TLockedToken<CTexture>& patternTex2, const TLockedToken<CTexture>& colorTex,
|
||||
const TLockedToken<CTexture>& bumpMap, const TLockedToken<CTexture>& envMap,
|
||||
const TLockedToken<CTexture>& envBumpMap, const TLockedToken<CTexture>& lightmap,
|
||||
const aurora::gfx::TextureHandle& rippleMap, bool doubleLightmapBlend, bool additive,
|
||||
CTexture& rippleMap, bool doubleLightmapBlend, bool additive,
|
||||
u32 maxVertCount);
|
||||
CFluidPlaneShader(const TLockedToken<CTexture>& patternTex1, const TLockedToken<CTexture>& patternTex2,
|
||||
const TLockedToken<CTexture>& colorTex, u32 maxVertCount);
|
||||
|
||||
@@ -54,7 +54,7 @@ void CLineRendererShaders::Shutdown() {
|
||||
}
|
||||
|
||||
void CLineRendererShaders::BuildShaderDataBinding(CLineRenderer& renderer,
|
||||
const aurora::gfx::TextureHandle& texture, bool additive,
|
||||
CTexture& texture, bool additive,
|
||||
bool zTest, bool zGEqual) {
|
||||
// std::array<boo::ObjToken<boo::IShaderPipeline>, 2>* pipeline = nullptr;
|
||||
//
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
static void Initialize();
|
||||
static void Shutdown();
|
||||
static void BuildShaderDataBinding(CLineRenderer& renderer,
|
||||
const aurora::gfx::TextureHandle& texture, bool additive, bool zTest,
|
||||
CTexture& texture, bool additive, bool zTest,
|
||||
bool zGEqual);
|
||||
};
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ void CMapSurfaceShader::Shutdown() {
|
||||
// s_Pipeline.reset();
|
||||
}
|
||||
|
||||
CMapSurfaceShader::CMapSurfaceShader(aurora::ArrayRef<zeus::CVector3f> vbo,
|
||||
aurora::ArrayRef<uint16_t> ibo)
|
||||
CMapSurfaceShader::CMapSurfaceShader(std::vector<zeus::CVector3f> vbo,
|
||||
std::vector<uint16_t> ibo)
|
||||
//: m_vbo(vbo), m_ibo(ibo)
|
||||
{
|
||||
// m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
||||
|
||||
@@ -22,8 +22,8 @@ class CMapSurfaceShader {
|
||||
public:
|
||||
static void Initialize();
|
||||
static void Shutdown();
|
||||
CMapSurfaceShader(aurora::ArrayRef<zeus::CVector3f> vbo,
|
||||
aurora::ArrayRef<uint16_t> ibo);
|
||||
CMapSurfaceShader(std::vector<zeus::CVector3f> vbo,
|
||||
std::vector<uint16_t> ibo);
|
||||
void draw(const zeus::CColor& color, u32 start, u32 count);
|
||||
};
|
||||
|
||||
|
||||
@@ -35,39 +35,38 @@ void CSpaceWarpFilter::GenerateWarpRampTex() {
|
||||
data[y][x][0] = data[y][x][1] = data[y][x][2];
|
||||
}
|
||||
}
|
||||
m_warpTex = aurora::gfx::new_static_texture_2d(
|
||||
WARP_RAMP_RES + 1, WARP_RAMP_RES + 1, 1, GX::TF_RGBA8,
|
||||
{reinterpret_cast<const uint8_t*>(data.data()), (WARP_RAMP_RES + 1) * (WARP_RAMP_RES + 1) * 4}, "Warp Ramp");
|
||||
m_warpTex.emplace(ETexelFormat::RGBA8PC, WARP_RAMP_RES + 1, WARP_RAMP_RES + 1, 1, "Warp Ramp");
|
||||
}
|
||||
|
||||
CSpaceWarpFilter::CSpaceWarpFilter() {
|
||||
// CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
// GenerateWarpRampTex(ctx);
|
||||
//
|
||||
// struct Vert {
|
||||
// zeus::CVector2f m_pos;
|
||||
// zeus::CVector2f m_uv;
|
||||
// };
|
||||
// const std::array<Vert, 4> verts{{
|
||||
// {{-1.f, -1.f}, {0.f, 0.f}},
|
||||
// {{-1.f, 1.f}, {0.f, 1.f}},
|
||||
// {{1.f, -1.f}, {1.f, 0.f}},
|
||||
// {{1.f, 1.f}, {1.f, 1.f}},
|
||||
// }};
|
||||
//
|
||||
// m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, verts.data(), 32, verts.size());
|
||||
// m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
||||
//
|
||||
// const std::array<boo::ObjToken<boo::IGraphicsBuffer>, 1> bufs{m_uniBuf.get()};
|
||||
// constexpr std::array<boo::PipelineStage, 1> stages{boo::PipelineStage::Vertex};
|
||||
// const std::array<boo::ObjToken<boo::ITexture>, 2> texs{
|
||||
// CGraphics::g_SpareTexture.get(),
|
||||
// m_warpTex.get(),
|
||||
// };
|
||||
// m_dataBind = ctx.newShaderDataBinding(s_Pipeline, m_vbo.get(), nullptr, nullptr, bufs.size(), bufs.data(),
|
||||
// stages.data(), nullptr, nullptr, texs.size(), texs.data(), nullptr, nullptr);
|
||||
// return true;
|
||||
// } BooTrace);
|
||||
// CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
// GenerateWarpRampTex(ctx);
|
||||
//
|
||||
// struct Vert {
|
||||
// zeus::CVector2f m_pos;
|
||||
// zeus::CVector2f m_uv;
|
||||
// };
|
||||
// const std::array<Vert, 4> verts{{
|
||||
// {{-1.f, -1.f}, {0.f, 0.f}},
|
||||
// {{-1.f, 1.f}, {0.f, 1.f}},
|
||||
// {{1.f, -1.f}, {1.f, 0.f}},
|
||||
// {{1.f, 1.f}, {1.f, 1.f}},
|
||||
// }};
|
||||
//
|
||||
// m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, verts.data(), 32, verts.size());
|
||||
// m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
||||
//
|
||||
// const std::array<boo::ObjToken<boo::IGraphicsBuffer>, 1> bufs{m_uniBuf.get()};
|
||||
// constexpr std::array<boo::PipelineStage, 1> stages{boo::PipelineStage::Vertex};
|
||||
// const std::array<boo::ObjToken<boo::ITexture>, 2> texs{
|
||||
// CGraphics::g_SpareTexture.get(),
|
||||
// m_warpTex.get(),
|
||||
// };
|
||||
// m_dataBind = ctx.newShaderDataBinding(s_Pipeline, m_vbo.get(), nullptr, nullptr, bufs.size(), bufs.data(),
|
||||
// stages.data(), nullptr, nullptr, texs.size(), texs.data(), nullptr,
|
||||
// nullptr);
|
||||
// return true;
|
||||
// } BooTrace);
|
||||
}
|
||||
|
||||
void CSpaceWarpFilter::draw(const zeus::CVector3f& pt) {
|
||||
@@ -132,15 +131,15 @@ void CSpaceWarpFilter::draw(const zeus::CVector3f& pt) {
|
||||
m_uniform.m_matrix[1][1] = clipRect.x10_height / vp.y();
|
||||
m_uniform.m_matrix[3][0] = pt.x() + (1.f / vp.x());
|
||||
m_uniform.m_matrix[3][1] = pt.y() + (1.f / vp.y());
|
||||
// if (CGraphics::g_BooPlatform == boo::IGraphicsDataFactory::Platform::OpenGL) {
|
||||
// m_uniform.m_matrix[3][2] = pt.z() * 2.f - 1.f;
|
||||
// } else if (CGraphics::g_BooPlatform == boo::IGraphicsDataFactory::Platform::Vulkan) {
|
||||
// m_uniform.m_matrix[1][1] *= -1.f;
|
||||
// m_uniform.m_matrix[3][1] *= -1.f;
|
||||
// m_uniform.m_matrix[3][2] = pt.z();
|
||||
// } else {
|
||||
// m_uniform.m_matrix[3][2] = pt.z();
|
||||
// }
|
||||
// if (CGraphics::g_BooPlatform == boo::IGraphicsDataFactory::Platform::OpenGL) {
|
||||
// m_uniform.m_matrix[3][2] = pt.z() * 2.f - 1.f;
|
||||
// } else if (CGraphics::g_BooPlatform == boo::IGraphicsDataFactory::Platform::Vulkan) {
|
||||
// m_uniform.m_matrix[1][1] *= -1.f;
|
||||
// m_uniform.m_matrix[3][1] *= -1.f;
|
||||
// m_uniform.m_matrix[3][2] = pt.z();
|
||||
// } else {
|
||||
// m_uniform.m_matrix[3][2] = pt.z();
|
||||
// }
|
||||
|
||||
if (clipRect.x4_left) {
|
||||
clipRect.x4_left -= 1;
|
||||
@@ -158,15 +157,15 @@ void CSpaceWarpFilter::draw(const zeus::CVector3f& pt) {
|
||||
clipRect.x4_left += CGraphics::g_CroppedViewport.x4_left;
|
||||
clipRect.x8_top += CGraphics::g_CroppedViewport.x8_top;
|
||||
clipRect.x8_top = CGraphics::GetViewportHeight() - clipRect.x10_height - clipRect.x8_top;
|
||||
// CGraphics::ResolveSpareTexture(clipRect);
|
||||
// CGraphics::ResolveSpareTexture(clipRect);
|
||||
|
||||
m_uniform.m_strength.x() =
|
||||
m_uniform.m_matrix[0][0] * m_strength * 0.5f * (clipRect.x10_height / float(clipRect.xc_width));
|
||||
m_uniform.m_strength.y() = m_uniform.m_matrix[1][1] * m_strength * 0.5f;
|
||||
// m_uniBuf->load(&m_uniform, sizeof(m_uniform));
|
||||
// m_uniBuf->load(&m_uniform, sizeof(m_uniform));
|
||||
|
||||
// CGraphics::SetShaderDataBinding(m_dataBind);
|
||||
// CGraphics::DrawArray(0, 4);
|
||||
// CGraphics::SetShaderDataBinding(m_dataBind);
|
||||
// CGraphics::DrawArray(0, 4);
|
||||
}
|
||||
|
||||
} // namespace metaforce
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "Runtime/GCNTypes.hpp"
|
||||
#include "Runtime/Graphics/CGraphics.hpp"
|
||||
#include "Runtime/Graphics/CTexture.hpp"
|
||||
|
||||
#include <zeus/CMatrix4f.hpp>
|
||||
#include <zeus/CVector3f.hpp>
|
||||
@@ -17,7 +18,7 @@ class CSpaceWarpFilter {
|
||||
zeus::CVector3f m_strength;
|
||||
};
|
||||
std::array<std::array<std::array<u8, 4>, 8>, 4> m_shiftTexture{};
|
||||
aurora::gfx::TextureHandle m_warpTex;
|
||||
std::optional<CTexture> m_warpTex;
|
||||
// boo::ObjToken<boo::IGraphicsBufferS> m_vbo;
|
||||
// boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||
// boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
||||
|
||||
@@ -15,7 +15,7 @@ class CXRayBlurFilter {
|
||||
std::array<zeus::CMatrix4f, 8> m_uv;
|
||||
};
|
||||
TLockedToken<CTexture> m_paletteTex;
|
||||
aurora::gfx::TextureHandle m_booTex;
|
||||
// aurora::gfx::TextureHandle m_booTex;
|
||||
// boo::ObjToken<boo::IGraphicsBufferS> m_vbo;
|
||||
// boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||
// boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
||||
|
||||
Reference in New Issue
Block a user