mirror of https://github.com/AxioDL/metaforce.git
Text rendering & CWorldTransManager fixes
This commit is contained in:
parent
ef71c009c6
commit
26fd0e2b9f
|
@ -144,109 +144,6 @@ static std::string CPUFeatureString(const zeus::CPUInfo& cpuInf) {
|
|||
#endif
|
||||
return features;
|
||||
}
|
||||
#if 0
|
||||
struct WindowCallback : boo::IWindowCallback {
|
||||
friend struct Application;
|
||||
|
||||
private:
|
||||
bool m_fullscreenToggleRequested = false;
|
||||
boo::SWindowRect m_lastRect;
|
||||
bool m_rectDirty = false;
|
||||
bool m_windowInvalid = false;
|
||||
// ImGuiWindowCallback m_imguiCallback;
|
||||
|
||||
void resized(const boo::SWindowRect& rect, bool sync) override {
|
||||
m_lastRect = rect;
|
||||
m_rectDirty = true;
|
||||
// m_imguiCallback.resized(rect, sync);
|
||||
}
|
||||
|
||||
void mouseDown(const boo::SWindowCoord& coord, EMouseButton button, boo::EModifierKey mods) override {
|
||||
// if (!ImGuiWindowCallback::m_mouseCaptured && g_mainMP1) {
|
||||
// if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
||||
// as->mouseDown(coord, button, mods);
|
||||
// }
|
||||
// }
|
||||
// m_imguiCallback.mouseDown(coord, button, mods);
|
||||
}
|
||||
|
||||
void mouseUp(const boo::SWindowCoord& coord, EMouseButton button, boo::EModifierKey mods) override {
|
||||
if (g_mainMP1) {
|
||||
if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
||||
as->mouseUp(coord, button, mods);
|
||||
}
|
||||
}
|
||||
// m_imguiCallback.mouseUp(coord, button, mods);
|
||||
}
|
||||
|
||||
void mouseMove(const boo::SWindowCoord& coord) override {
|
||||
// if (!ImGuiWindowCallback::m_mouseCaptured && g_mainMP1) {
|
||||
// if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
||||
// as->mouseMove(coord);
|
||||
// }
|
||||
// }
|
||||
// m_imguiCallback.mouseMove(coord);
|
||||
}
|
||||
|
||||
// void mouseEnter(const boo::SWindowCoord& coord) override { m_imguiCallback.mouseEnter(coord); }
|
||||
|
||||
// void mouseLeave(const boo::SWindowCoord& coord) override { m_imguiCallback.mouseLeave(coord); }
|
||||
|
||||
void scroll(const boo::SWindowCoord& coord, const boo::SScrollDelta& scroll) override {
|
||||
// if (!ImGuiWindowCallback::m_mouseCaptured && g_mainMP1) {
|
||||
// if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
||||
// as->scroll(coord, scroll);
|
||||
// }
|
||||
// }
|
||||
// m_imguiCallback.scroll(coord, scroll);
|
||||
}
|
||||
|
||||
void charKeyDown(unsigned long charCode, boo::EModifierKey mods, bool isRepeat) override {
|
||||
// if (!ImGuiWindowCallback::m_keyboardCaptured && g_mainMP1) {
|
||||
// if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
||||
// as->charKeyDown(charCode, mods, isRepeat);
|
||||
// }
|
||||
// }
|
||||
// m_imguiCallback.charKeyDown(charCode, mods, isRepeat);
|
||||
}
|
||||
|
||||
void charKeyUp(unsigned long charCode, boo::EModifierKey mods) override {
|
||||
if (g_mainMP1) {
|
||||
if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
||||
as->charKeyUp(charCode, mods);
|
||||
}
|
||||
}
|
||||
// m_imguiCallback.charKeyUp(charCode, mods);
|
||||
}
|
||||
|
||||
void specialKeyDown(aurora::SpecialKey key, boo::EModifierKey mods, bool isRepeat) override {
|
||||
// if (!ImGuiWindowCallback::m_keyboardCaptured && g_mainMP1) {
|
||||
// if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
||||
// as->specialKeyDown(key, mods, isRepeat);
|
||||
// }
|
||||
// }
|
||||
// if (True(mods & boo::EModifierKey::Alt)) {
|
||||
// if (key == aurora::SpecialKey::Enter) {
|
||||
// m_fullscreenToggleRequested = true;
|
||||
// } else if (key == aurora::SpecialKey::F4) {
|
||||
// m_windowInvalid = true;
|
||||
// }
|
||||
// }
|
||||
// m_imguiCallback.specialKeyDown(key, mods, isRepeat);
|
||||
}
|
||||
|
||||
void specialKeyUp(aurora::SpecialKey key, boo::EModifierKey mods) override {
|
||||
// if (g_mainMP1) {
|
||||
// if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
||||
// as->specialKeyUp(key, mods);
|
||||
// }
|
||||
// }
|
||||
// m_imguiCallback.specialKeyUp(key, mods);
|
||||
}
|
||||
|
||||
void destroyed() override { m_windowInvalid = true; }
|
||||
};
|
||||
#endif
|
||||
|
||||
struct Application : aurora::AppDelegate {
|
||||
private:
|
||||
|
|
|
@ -244,7 +244,7 @@ void CMemoryCardSys::CCardFileInfo::WriteBannerData(COutputStream& out) const {
|
|||
out.Put(texels, 3072);
|
||||
}
|
||||
if (format == ETexelFormat::C8) {
|
||||
out.Put(tex->GetPalette()->GetPaletteData(), 512);
|
||||
out.Put(reinterpret_cast<const u8*>(tex->GetPalette()->GetPaletteData()), 512);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ void CMemoryCardSys::CCardFileInfo::WriteIconData(COutputStream& out) const {
|
|||
out.Put(texels, 1024);
|
||||
}
|
||||
if (format == ETexelFormat::C8) {
|
||||
palette = icon.x8_tex->GetPalette()->GetPaletteData();
|
||||
palette = reinterpret_cast<const u8*>(icon.x8_tex->GetPalette()->GetPaletteData());
|
||||
}
|
||||
}
|
||||
if (palette != nullptr) {
|
||||
|
|
|
@ -615,7 +615,7 @@ void CStateManager::DrawE3DeathEffect() {
|
|||
const float blurAmt = zeus::clamp(0.f, (player.x9f4_deathTime - 1.f) / (6.f - 1.f), 1.f);
|
||||
if (blurAmt > 0.f) {
|
||||
CCameraBlurPass blur;
|
||||
blur.SetBlur(EBlurType::HiBlur, 7.f * blurAmt, 0.f);
|
||||
blur.SetBlur(EBlurType::HiBlur, 7.f * blurAmt, 0.f, false);
|
||||
blur.Draw();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -252,17 +252,18 @@ void CCameraBlurPass::Draw(bool clearDepth) {
|
|||
if (x10_curType == EBlurType::NoBlur)
|
||||
return;
|
||||
|
||||
if (x10_curType == EBlurType::Xray) {
|
||||
if (!m_xrayShader)
|
||||
m_xrayShader.emplace(x0_paletteTex);
|
||||
m_xrayShader->draw(x1c_curValue);
|
||||
} else {
|
||||
if (!m_shader)
|
||||
m_shader.emplace();
|
||||
m_shader->draw(x1c_curValue, clearDepth);
|
||||
if (clearDepth)
|
||||
CGraphics::SetDepthRange(DEPTH_NEAR, DEPTH_FAR);
|
||||
}
|
||||
// TODO
|
||||
// if (x10_curType == EBlurType::Xray) {
|
||||
// if (!m_xrayShader)
|
||||
// m_xrayShader.emplace(x0_paletteTex);
|
||||
// m_xrayShader->draw(x1c_curValue);
|
||||
// } else {
|
||||
// if (!m_shader)
|
||||
// m_shader.emplace();
|
||||
// m_shader->draw(x1c_curValue, clearDepth);
|
||||
// if (clearDepth)
|
||||
// CGraphics::SetDepthRange(DEPTH_NEAR, DEPTH_FAR);
|
||||
// }
|
||||
}
|
||||
|
||||
void CCameraBlurPass::Update(float dt) {
|
||||
|
@ -277,7 +278,8 @@ void CCameraBlurPass::Update(float dt) {
|
|||
}
|
||||
}
|
||||
|
||||
void CCameraBlurPass::SetBlur(EBlurType type, float amount, float duration) {
|
||||
void CCameraBlurPass::SetBlur(EBlurType type, float amount, float duration, bool usePersistentFb) {
|
||||
// TODO impl usePersistentFb
|
||||
if (duration == 0.f) {
|
||||
x24_totalTime = 0.f;
|
||||
x28_remainingTime = 0.f;
|
||||
|
@ -292,9 +294,9 @@ void CCameraBlurPass::SetBlur(EBlurType type, float amount, float duration) {
|
|||
|
||||
x14_endType = type;
|
||||
x10_curType = type;
|
||||
// x2c_usePersistent = b1;
|
||||
x2c_usePersistent = usePersistentFb;
|
||||
} else {
|
||||
// x2c_usePersistent = b1;
|
||||
x2c_usePersistent = usePersistentFb;
|
||||
x24_totalTime = duration;
|
||||
x28_remainingTime = duration;
|
||||
x18_endValue = x1c_curValue;
|
||||
|
@ -311,6 +313,6 @@ void CCameraBlurPass::SetBlur(EBlurType type, float amount, float duration) {
|
|||
}
|
||||
}
|
||||
|
||||
void CCameraBlurPass::DisableBlur(float duration) { SetBlur(EBlurType::NoBlur, 0.f, duration); }
|
||||
void CCameraBlurPass::DisableBlur(float duration) { SetBlur(EBlurType::NoBlur, 0.f, duration, x2c_usePersistent); }
|
||||
|
||||
} // namespace metaforce
|
||||
|
|
|
@ -80,17 +80,14 @@ class CCameraBlurPass {
|
|||
float x20_startValue = 0.f;
|
||||
float x24_totalTime = 0.f;
|
||||
float x28_remainingTime = 0.f;
|
||||
// bool x2c_usePersistent = false;
|
||||
// bool x2d_noPersistentCopy = false;
|
||||
// u32 x30_persistentBuf = 0;
|
||||
|
||||
std::optional<CCameraBlurFilter> m_shader;
|
||||
std::optional<CXRayBlurFilter> m_xrayShader;
|
||||
bool x2c_usePersistent = false;
|
||||
bool x2d_noPersistentCopy = false;
|
||||
u32 x30_persistentBuf = 0;
|
||||
|
||||
public:
|
||||
void Draw(bool clearDepth = false);
|
||||
void Update(float dt);
|
||||
void SetBlur(EBlurType type, float amount, float duration);
|
||||
void SetBlur(EBlurType type, float amount, float duration, bool usePersistentFb);
|
||||
void DisableBlur(float duration);
|
||||
EBlurType GetCurrType() const { return x10_curType; }
|
||||
};
|
||||
|
|
|
@ -245,10 +245,10 @@ void CCubeRenderer::GenerateSphereRampTex() {
|
|||
}
|
||||
|
||||
void CCubeRenderer::LoadThermoPalette() {
|
||||
x288_thermoPalette.Lock();
|
||||
auto* out = x288_thermoPalette.Lock();
|
||||
TToken<CTexture> token = xc_store.GetObj("TXTR_ThermoPalette");
|
||||
u8* data = token.GetObj()->GetPalette()->GetPaletteData();
|
||||
memcpy(x288_thermoPalette.GetPaletteData(), data, 32);
|
||||
const auto* data = token.GetObj()->GetPalette()->GetPaletteData();
|
||||
memcpy(out, data, 32);
|
||||
x288_thermoPalette.UnLock();
|
||||
}
|
||||
|
||||
|
|
|
@ -179,12 +179,6 @@ void CGraphics::EndScene() {
|
|||
g_InterruptLastFrameUsedAbove ^= 1;
|
||||
g_LastFrameUsedAbove = g_InterruptLastFrameUsedAbove;
|
||||
|
||||
/* Flush text instance buffers just before GPU command list submission */
|
||||
CTextSupportShader::UpdateBuffers();
|
||||
|
||||
/* Same with line renderer */
|
||||
// CLineRenderer::UpdateBuffers();
|
||||
|
||||
++g_FrameCounter;
|
||||
|
||||
UpdateFPSCounter();
|
||||
|
@ -688,14 +682,7 @@ void CGraphics::Startup() {
|
|||
}
|
||||
|
||||
void CGraphics::InitGraphicsVariables() {
|
||||
g_LightTypes[0] = ELightType::Directional;
|
||||
g_LightTypes[1] = ELightType::Directional;
|
||||
g_LightTypes[2] = ELightType::Directional;
|
||||
g_LightTypes[3] = ELightType::Directional;
|
||||
g_LightTypes[4] = ELightType::Directional;
|
||||
g_LightTypes[5] = ELightType::Directional;
|
||||
g_LightTypes[6] = ELightType::Directional;
|
||||
g_LightTypes[7] = ELightType::Directional;
|
||||
g_LightTypes.fill(ELightType::Directional);
|
||||
g_LightActive = {};
|
||||
SetDepthWriteMode(false, g_depthFunc, false);
|
||||
SetCullMode(ERglCullMode::None);
|
||||
|
@ -728,22 +715,26 @@ void CGraphics::SetDefaultVtxAttrFmt() {
|
|||
// Unneeded, all attributes are expected to be full floats
|
||||
// Left here for reference
|
||||
|
||||
// GXSetVtxAttrFmt(GX::VTXFMT0, GX::VA_POS, GX::POS_XYZ, GX::F32, 0);
|
||||
// GXSetVtxAttrFmt(GX::VTXFMT1, GX::VA_POS, GX::POS_XYZ, GX::F32, 0);
|
||||
// GXSetVtxAttrFmt(GX::VTXFMT2, GX::VA_POS, GX::POS_XYZ, GX::F32, 0);
|
||||
// GXSetVtxAttrFmt(GX::VTXFMT0, GX::VA_NRM, GX::NRM_XYZ, GX::F32, 0);
|
||||
// GXSetVtxAttrFmt(GX::VTXFMT1, GX::VA_NRM, GX::NRM_XYZ, GX::S16, 14);
|
||||
// GXSetVtxAttrFmt(GX::VTXFMT2, GX::VA_NRM, GX::NRM_XYZ, GX::S16, 14);
|
||||
// GXSetVtxAttrFmt(GX::VTXFMT0, GX::VA_CLR0, GX::CLR_RGBA, GX::RGBA8, 0);
|
||||
// GXSetVtxAttrFmt(GX::VTXFMT1, GX::VA_CLR0, GX::CLR_RGBA, GX::RGBA8, 0);
|
||||
// GXSetVtxAttrFmt(GX::VTXFMT2, GX::VA_CLR0, GX::CLR_RGBA, GX::RGBA8, 0);
|
||||
// GXSetVtxAttrFmt(GX::VTXFMT0, GX::VA_TEX0, GX::TEX_ST, GX::F32, 0);
|
||||
// GXSetVtxAttrFmt(GX::VTXFMT1, GX::VA_TEX0, GX::TEX_ST, GX::F32, 0);
|
||||
// GXSetVtxAttrFmt(GX::VTXFMT2, GX::VA_TEX0, GX::TEX_ST, GX::U16, 15);
|
||||
// for (GX::Attr attr = GX::VA_TEX1; attr <= GX::VA_TEX7; attr = GX::Attr(attr + 1)) {
|
||||
// GXSetVtxAttrFmt(GX::VTXFMT0, attr, GX::TEX_ST, GX::F32, 0);
|
||||
// GXSetVtxAttrFmt(GX::VTXFMT1, attr, GX::TEX_ST, GX::F32, 0);
|
||||
// GXSetVtxAttrFmt(GX::VTXFMT2, attr, GX::TEX_ST, GX::F32, 0);
|
||||
// }
|
||||
GXSetVtxAttrFmt(GX::VTXFMT0, GX::VA_POS, GX::POS_XYZ, GX::F32, 0);
|
||||
GXSetVtxAttrFmt(GX::VTXFMT1, GX::VA_POS, GX::POS_XYZ, GX::F32, 0);
|
||||
GXSetVtxAttrFmt(GX::VTXFMT2, GX::VA_POS, GX::POS_XYZ, GX::F32, 0);
|
||||
GXSetVtxAttrFmt(GX::VTXFMT0, GX::VA_NRM, GX::NRM_XYZ, GX::F32, 0);
|
||||
GXSetVtxAttrFmt(GX::VTXFMT1, GX::VA_NRM, GX::NRM_XYZ, GX::S16, 14);
|
||||
GXSetVtxAttrFmt(GX::VTXFMT2, GX::VA_NRM, GX::NRM_XYZ, GX::S16, 14);
|
||||
GXSetVtxAttrFmt(GX::VTXFMT0, GX::VA_CLR0, GX::CLR_RGBA, GX::RGBA8, 0);
|
||||
GXSetVtxAttrFmt(GX::VTXFMT1, GX::VA_CLR0, GX::CLR_RGBA, GX::RGBA8, 0);
|
||||
GXSetVtxAttrFmt(GX::VTXFMT2, GX::VA_CLR0, GX::CLR_RGBA, GX::RGBA8, 0);
|
||||
GXSetVtxAttrFmt(GX::VTXFMT0, GX::VA_TEX0, GX::TEX_ST, GX::F32, 0);
|
||||
GXSetVtxAttrFmt(GX::VTXFMT1, GX::VA_TEX0, GX::TEX_ST, GX::F32, 0);
|
||||
GXSetVtxAttrFmt(GX::VTXFMT2, GX::VA_TEX0, GX::TEX_ST, GX::U16, 15);
|
||||
for (GX::Attr attr = GX::VA_TEX1; attr <= GX::VA_TEX7; attr = GX::Attr(attr + 1)) {
|
||||
GXSetVtxAttrFmt(GX::VTXFMT0, attr, GX::TEX_ST, GX::F32, 0);
|
||||
GXSetVtxAttrFmt(GX::VTXFMT1, attr, GX::TEX_ST, GX::F32, 0);
|
||||
GXSetVtxAttrFmt(GX::VTXFMT2, attr, GX::TEX_ST, GX::F32, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void CGraphics::ResetGfxStates() noexcept {
|
||||
// sRenderState.x0_ = 0;
|
||||
}
|
||||
} // namespace metaforce
|
||||
|
|
|
@ -324,6 +324,7 @@ public:
|
|||
// aurora::gfx::resolve_depth({rect.x4_left, rect.x8_top, rect.xc_width, rect.x10_height}, bindIdx);
|
||||
}
|
||||
|
||||
static void ResetGfxStates() noexcept;
|
||||
static void SetTevStates(EStreamFlags flags) noexcept;
|
||||
static void SetTevOp(ERglTevStage stage, const CTevCombiners::CTevPass& pass);
|
||||
static void StreamBegin(GX::Primitive primitive);
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace metaforce {
|
|||
u32 CGraphicsPalette::sCurrentFrameCount = 0;
|
||||
|
||||
CGraphicsPalette::CGraphicsPalette(EPaletteFormat fmt, int count)
|
||||
: x0_fmt(fmt), x8_entryCount(count), xc_entries(new u8[count * 2]) {
|
||||
: x0_fmt(fmt), x8_entryCount(count), xc_entries(std::make_unique<u16[]>(count)) {
|
||||
GXInitTlutObj(&x10_tlutObj, xc_entries.get(), static_cast<GXTlutFmt>(x0_fmt), x8_entryCount);
|
||||
}
|
||||
|
||||
|
@ -13,8 +13,8 @@ CGraphicsPalette::CGraphicsPalette(CInputStream& in) : x0_fmt(EPaletteFormat(in.
|
|||
u16 w = in.ReadShort();
|
||||
u16 h = in.ReadShort();
|
||||
x8_entryCount = w * h;
|
||||
xc_entries.reset(new u8[x8_entryCount * 2]);
|
||||
in.Get(xc_entries.get(), x8_entryCount * 2);
|
||||
xc_entries = std::make_unique<u16[]>(x8_entryCount);
|
||||
in.Get(reinterpret_cast<u8*>(xc_entries.get()), x8_entryCount * sizeof(u16));
|
||||
GXInitTlutObj(&x10_tlutObj, xc_entries.get(), static_cast<GXTlutFmt>(x0_fmt), x8_entryCount);
|
||||
// DCFlushRange(xc_entries.get(), x8_entryCount * 2);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ class CGraphicsPalette {
|
|||
EPaletteFormat x0_fmt;
|
||||
u32 x4_frameLoaded{};
|
||||
u32 x8_entryCount;
|
||||
std::unique_ptr<u8[]> xc_entries;
|
||||
std::unique_ptr<u16[]> xc_entries;
|
||||
GXTlutObj x10_tlutObj;
|
||||
bool x1c_locked = false;
|
||||
|
||||
|
@ -28,12 +28,14 @@ public:
|
|||
explicit CGraphicsPalette(EPaletteFormat fmt, int count);
|
||||
explicit CGraphicsPalette(CInputStream& in);
|
||||
|
||||
void Lock() { x1c_locked = true; }
|
||||
u16* Lock() {
|
||||
x1c_locked = true;
|
||||
return xc_entries.get();
|
||||
}
|
||||
void UnLock();
|
||||
void Load();
|
||||
|
||||
[[nodiscard]] u8* GetPaletteData() { return xc_entries.get(); }
|
||||
[[nodiscard]] const u8* GetPaletteData() const { return xc_entries.get(); }
|
||||
[[nodiscard]] const u16* GetPaletteData() const { return xc_entries.get(); }
|
||||
|
||||
static void SetCurrentFrameCount(u32 frameCount) { sCurrentFrameCount = frameCount; }
|
||||
};
|
||||
|
|
|
@ -124,7 +124,7 @@ void CGuiFrame::Update(float dt) { xc_headWidget->Update(dt); }
|
|||
void CGuiFrame::Draw(const CGuiWidgetDrawParms& parms) const {
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(FMT_STRING("CGuiFrame::Draw FRME_{}"), x0_id).c_str(), zeus::skMagenta);
|
||||
CGraphics::SetCullMode(ERglCullMode::None);
|
||||
// CGraphics::ResetGfxStates();
|
||||
CGraphics::ResetGfxStates();
|
||||
CGraphics::SetAmbientColor(zeus::skWhite);
|
||||
DisableLights();
|
||||
x14_camera->Draw(parms);
|
||||
|
|
|
@ -78,40 +78,32 @@ void CGuiTextPane::Draw(const CGuiWidgetDrawParms& parms) {
|
|||
geomCol.a() *= parms.x0_alphaMod;
|
||||
xd4_textSupport.SetGeometryColor(geomCol);
|
||||
|
||||
#if 0
|
||||
CGraphics::SetDepthWriteMode(xb6_31_depthTest, ERglEnum::LEqual, xb7_24_depthWrite);
|
||||
|
||||
switch (xac_drawFlags)
|
||||
{
|
||||
switch (xac_drawFlags) {
|
||||
case EGuiModelDrawFlags::Shadeless:
|
||||
case EGuiModelDrawFlags::Opaque:
|
||||
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::One,
|
||||
ERglBlendFactor::Zero, ERglLogicOp::Clear);
|
||||
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::One, ERglBlendFactor::Zero, ERglLogicOp::Clear);
|
||||
xd4_textSupport.Render();
|
||||
break;
|
||||
case EGuiModelDrawFlags::Alpha:
|
||||
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha,
|
||||
ERglBlendFactor::InvSrcAlpha, ERglLogicOp::Clear);
|
||||
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha, ERglBlendFactor::InvSrcAlpha,
|
||||
ERglLogicOp::Clear);
|
||||
xd4_textSupport.Render();
|
||||
break;
|
||||
case EGuiModelDrawFlags::Additive:
|
||||
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha,
|
||||
ERglBlendFactor::One, ERglLogicOp::Clear);
|
||||
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha, ERglBlendFactor::One, ERglLogicOp::Clear);
|
||||
xd4_textSupport.Render();
|
||||
break;
|
||||
case EGuiModelDrawFlags::AlphaAdditiveOverdraw:
|
||||
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha,
|
||||
ERglBlendFactor::InvSrcAlpha, ERglLogicOp::Clear);
|
||||
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha, ERglBlendFactor::InvSrcAlpha,
|
||||
ERglLogicOp::Clear);
|
||||
xd4_textSupport.Render();
|
||||
xd4_textSupport.SetGeometryColor(geomCol * zeus::CColor(geomCol.a(), geomCol.a(), geomCol.a(), 1.f));
|
||||
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::One,
|
||||
ERglBlendFactor::One, ERglLogicOp::Clear);
|
||||
xd4_textSupport.SetGeometryColor(geomCol * zeus::CColor(geomCol.a(), 1.f));
|
||||
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::One, ERglBlendFactor::One, ERglLogicOp::Clear);
|
||||
xd4_textSupport.Render();
|
||||
break;
|
||||
}
|
||||
#else
|
||||
xd4_textSupport.Render();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CGuiTextPane::TestCursorHit(const zeus::CMatrix4f& vp, const zeus::CVector2f& point) const {
|
||||
|
|
|
@ -149,8 +149,11 @@ void CGuiTextSupport::Update(float dt) {
|
|||
break;
|
||||
}
|
||||
|
||||
//buf->SetPrimitiveOpacity(i, std::min(std::max(0.f, (x3c_curTime - chStartTime) / x54_chFadeTime), 1.f));
|
||||
auto primitive = buf->GetPrimitive(i);
|
||||
float alpha = std::clamp((x3c_curTime - chStartTime) / x54_chFadeTime, 0.f, 1.f);
|
||||
chStartTime += 1.f / x58_chRate;
|
||||
primitive.x0_color1 = zeus::CColor{alpha, alpha};
|
||||
buf->SetPrimitive(primitive, i);
|
||||
}
|
||||
}
|
||||
x3c_curTime += dt;
|
||||
|
|
|
@ -154,11 +154,11 @@ void CRasterFont::DrawString(const CDrawStringOptions& opts, int x, int y, int&
|
|||
|
||||
if (renderBuf != nullptr) {
|
||||
CGraphicsPalette pal(EPaletteFormat::RGB5A3, 4);
|
||||
pal.Lock();
|
||||
*reinterpret_cast<u16*>(pal.GetPaletteData() + 0) = bswap16(zeus::CColor(0.f, 0.f, 0.f, 0.f).toRGB5A3());
|
||||
*reinterpret_cast<u16*>(pal.GetPaletteData() + 2) = bswap16(opts.x4_colors[0].toRGB5A3());
|
||||
*reinterpret_cast<u16*>(pal.GetPaletteData() + 4) = bswap16(opts.x4_colors[1].toRGB5A3());
|
||||
*reinterpret_cast<u16*>(pal.GetPaletteData() + 6) = bswap16(zeus::CColor(0.f, 0.f, 0.f, 0.f).toRGB5A3());
|
||||
u16* data = pal.Lock();
|
||||
data[0] = bswap16(zeus::CColor(0.f, 0.f, 0.f, 0.f).toRGB5A3());
|
||||
data[1] = bswap16(opts.x4_colors[0].toRGB5A3());
|
||||
data[2] = bswap16(opts.x4_colors[1].toRGB5A3());
|
||||
data[3] = bswap16(zeus::CColor(0.f, 0.f, 0.f, 0.f).toRGB5A3());
|
||||
pal.UnLock();
|
||||
renderBuf->AddPaletteChange(pal);
|
||||
}
|
||||
|
|
|
@ -44,16 +44,16 @@ CTextRenderBuffer::Primitive CTextRenderBuffer::GetPrimitive(s32 idx) const {
|
|||
x44_blobSize - x24_primOffsets[idx]);
|
||||
auto cmd = Command(in.ReadChar());
|
||||
if (cmd == Command::ImageRender) {
|
||||
u16 xPos = in.ReadShort();
|
||||
u16 zPos = in.ReadShort();
|
||||
s16 xPos = in.ReadShort();
|
||||
s16 zPos = in.ReadShort();
|
||||
u8 imageIndex = in.ReadChar();
|
||||
CTextColor color(in.ReadUint32());
|
||||
return {color, Command::ImageRender, xPos, zPos, u'\0', imageIndex};
|
||||
}
|
||||
|
||||
if (cmd == Command::CharacterRender) {
|
||||
u16 xPos = in.ReadShort();
|
||||
u16 zPos = in.ReadShort();
|
||||
s16 xPos = in.ReadShort();
|
||||
s16 zPos = in.ReadShort();
|
||||
char16_t glyph = in.ReadUint16();
|
||||
CTextColor color(in.ReadUint32());
|
||||
|
||||
|
@ -207,8 +207,8 @@ void CTextRenderBuffer::AddPaletteChange(const CGraphicsPalette& palette) {
|
|||
GetNextAvailablePalette();
|
||||
paletteIndex = x254_nextPalette - 1;
|
||||
CGraphicsPalette* destPalette = x50_palettes[x254_nextPalette - 1].get();
|
||||
destPalette->Lock();
|
||||
memcpy(destPalette->GetPaletteData(), palette.GetPaletteData(), 8);
|
||||
u16* data = destPalette->Lock();
|
||||
memcpy(data, palette.GetPaletteData(), 8);
|
||||
destPalette->UnLock();
|
||||
}
|
||||
out.WriteUint8(static_cast<u8>(Command::PaletteChange));
|
||||
|
|
|
@ -28,16 +28,14 @@ class CTextRenderBuffer {
|
|||
|
||||
public:
|
||||
enum class Command { CharacterRender, ImageRender, FontChange, PaletteChange, Invalid = -1 };
|
||||
#if 1
|
||||
struct Primitive {
|
||||
CTextColor x0_color1;
|
||||
Command x4_command;
|
||||
u16 x8_xPos;
|
||||
u16 xa_zPos;
|
||||
s16 x8_xPos;
|
||||
s16 xa_zPos;
|
||||
char16_t xc_glyph;
|
||||
u8 xe_imageIndex;
|
||||
};
|
||||
#endif
|
||||
enum class EMode { AllocTally, BufferFill };
|
||||
|
||||
private:
|
||||
|
|
|
@ -77,7 +77,7 @@ void CPauseScreenBlur::Update(float dt, const CStateManager& stateMgr, bool b) {
|
|||
if (x18_blurAmt == 0.f && b) {
|
||||
x1c_camBlur.DisableBlur(0.f);
|
||||
} else {
|
||||
x1c_camBlur.SetBlur(EBlurType::HiBlur, g_tweakGui->GetPauseBlurFactor() * std::fabs(x18_blurAmt), 0.f);
|
||||
x1c_camBlur.SetBlur(EBlurType::HiBlur, g_tweakGui->GetPauseBlurFactor() * std::fabs(x18_blurAmt), 0.f, true);
|
||||
x50_24_blurring = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -463,7 +463,7 @@ void CPlayerVisor::DrawThermalEffect(const CStateManager&) {
|
|||
void CPlayerVisor::UpdateCurrentVisor(float transFactor) {
|
||||
switch (x1c_curVisor) {
|
||||
case CPlayerState::EPlayerVisor::XRay:
|
||||
x90_xrayBlur.SetBlur(EBlurType::Xray, 36.f * transFactor, 0.f);
|
||||
x90_xrayBlur.SetBlur(EBlurType::Xray, 36.f * transFactor, 0.f, false);
|
||||
break;
|
||||
case CPlayerState::EPlayerVisor::Scan: {
|
||||
zeus::CColor dimColor =
|
||||
|
@ -482,7 +482,7 @@ void CPlayerVisor::FinishTransitionIn() {
|
|||
x90_xrayBlur.DisableBlur(0.f);
|
||||
break;
|
||||
case CPlayerState::EPlayerVisor::XRay:
|
||||
x90_xrayBlur.SetBlur(EBlurType::Xray, 36.f, 0.f);
|
||||
x90_xrayBlur.SetBlur(EBlurType::Xray, 36.f, 0.f, false);
|
||||
if (!x5c_visorLoopSfx)
|
||||
x5c_visorLoopSfx =
|
||||
CSfxManager::SfxStart(SFXui_visor_xray_lp, x24_visorSfxVol, 0.f, false, 0x7f, true, kInvalidAreaId);
|
||||
|
@ -509,7 +509,7 @@ void CPlayerVisor::FinishTransitionIn() {
|
|||
void CPlayerVisor::BeginTransitionIn(const CStateManager&) {
|
||||
switch (x1c_curVisor) {
|
||||
case CPlayerState::EPlayerVisor::XRay:
|
||||
x90_xrayBlur.SetBlur(EBlurType::Xray, 0.f, 0.f);
|
||||
x90_xrayBlur.SetBlur(EBlurType::Xray, 0.f, 0.f, false);
|
||||
xc4_vpScaleX = 0.9f;
|
||||
xc8_vpScaleY = 0.9f;
|
||||
CSfxManager::SfxStart(SFXui_into_visor, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||
|
|
|
@ -1324,13 +1324,13 @@ void CElementGen::RenderParticles() {
|
|||
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD0, GX::TEXMAP0, GX::COLOR0A0);
|
||||
CGX::SetChanCtrl(CGX::EChannelId::Channel0, false, GX::SRC_REG, GX::SRC_VTX, {}, GX::DF_NONE, GX::AF_NONE);
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD0, GX::TG_MTX2x4, GX::TG_TEX0, GX::IDENTITY, false, GX::PTIDENTITY);
|
||||
// GXSetVtxAttrFmt(GX::VTXFMT6, GX::VA_POS, GX::POS_XYZ, GX::F32, 0);
|
||||
// GXSetVtxAttrFmt(GX::VTXFMT6, GX::VA_CLR0, GX::CLR_RGBA, GX::RGBA8, 0);
|
||||
// if (constUVs) {
|
||||
// GXSetVtxAttrFmt(GX::VTXFMT6, GX::VA_TEX0, GX::TEX_ST, GX::RGBA8, 1);
|
||||
// } else {
|
||||
// GXSetVtxAttrFmt(GX::VTXFMT6, GX::VA_TEX0, GX::TEX_ST, GX::F32, 0);
|
||||
// }
|
||||
GXSetVtxAttrFmt(GX::VTXFMT6, GX::VA_POS, GX::POS_XYZ, GX::F32, 0);
|
||||
GXSetVtxAttrFmt(GX::VTXFMT6, GX::VA_CLR0, GX::CLR_RGBA, GX::RGBA8, 0);
|
||||
if (constUVs) {
|
||||
GXSetVtxAttrFmt(GX::VTXFMT6, GX::VA_TEX0, GX::TEX_ST, GX::RGBA8, 1);
|
||||
} else {
|
||||
GXSetVtxAttrFmt(GX::VTXFMT6, GX::VA_TEX0, GX::TEX_ST, GX::F32, 0);
|
||||
}
|
||||
|
||||
int mbspVal = std::max(1, x270_MBSP);
|
||||
if (x26c_30_MBLR) {
|
||||
|
|
|
@ -21,7 +21,7 @@ void CScriptCameraBlurKeyframe::AcceptScriptMsg(EScriptObjectMessage msg, TUniqu
|
|||
switch (msg) {
|
||||
case EScriptObjectMessage::Increment:
|
||||
if (GetActive()) {
|
||||
stateMgr.GetCameraBlurPass(3).SetBlur(x34_type, x38_amount, x40_timeIn);
|
||||
stateMgr.GetCameraBlurPass(3).SetBlur(x34_type, x38_amount, x40_timeIn, false);
|
||||
}
|
||||
break;
|
||||
case EScriptObjectMessage::Decrement:
|
||||
|
|
|
@ -218,7 +218,13 @@ void CWorldTransManager::DrawFirstPass(CActorLights* lights) {
|
|||
zeus::CTransform::RotateZ(zeus::degToRad(zeus::clamp(0.f, x0_curTime / 25.f, 100.f) * 360.f + 180.f - 90.f));
|
||||
CGraphics::SetViewPointMatrix(rotateXf * translateXf);
|
||||
DrawAllModels(lights);
|
||||
m_camblur.draw(x4_modelData->x1c8_blurResult);
|
||||
if (x4_modelData->x1c8_blurResult > 0.f) {
|
||||
const auto backupProjectionState = CGraphics::GetProjectionState();
|
||||
CCameraBlurPass blurPass;
|
||||
blurPass.SetBlur(EBlurType::LoBlur, x4_modelData->x1c8_blurResult, 0.f, false);
|
||||
blurPass.Draw();
|
||||
CGraphics::SetProjectionState(backupProjectionState);
|
||||
}
|
||||
}
|
||||
|
||||
void CWorldTransManager::DrawSecondPass(CActorLights* lights) {
|
||||
|
@ -296,8 +302,7 @@ void CWorldTransManager::DrawEnabled() {
|
|||
// m_dissolve.drawCropped(zeus::CColor{1.f, 1.f, 1.f, 1.f - t}, 1.f);
|
||||
}
|
||||
|
||||
CWideScreenFilter::SetViewportToFull();
|
||||
m_widescreen.draw(zeus::skBlack, 1.f);
|
||||
CCameraFilterPass::DrawFilter(EFilterType::Multiply, EFilterShape::CinemaBars, zeus::skBlack, nullptr, 1.f);
|
||||
|
||||
float ftbT = 0.f;
|
||||
if (x0_curTime < 0.25f)
|
||||
|
@ -307,12 +312,12 @@ void CWorldTransManager::DrawEnabled() {
|
|||
else if (x0_curTime > x4_modelData->x1d8_transCompleteTime - 0.25f)
|
||||
ftbT = 1.f - (x4_modelData->x1d8_transCompleteTime - x0_curTime) / 0.25f;
|
||||
if (ftbT > 0.f)
|
||||
m_fadeToBlack.draw(zeus::CColor{0.f, 0.f, 0.f, ftbT});
|
||||
CCameraFilterPass::DrawFilter(EFilterType::Blend, EFilterShape::Fullscreen, zeus::CColor{0.f, ftbT}, nullptr, 1.f);
|
||||
}
|
||||
|
||||
void CWorldTransManager::DrawDisabled() {
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP("CWorldTransManager::DrawDisabled", zeus::skPurple);
|
||||
m_fadeToBlack.draw(zeus::CColor{0.f, 0.f, 0.f, 0.01f});
|
||||
CCameraFilterPass::DrawFilter(EFilterType::Blend, EFilterShape::Fullscreen, zeus::CColor{0.f, 0.01f}, nullptr, 1.f);
|
||||
}
|
||||
|
||||
void CWorldTransManager::DrawText() {
|
||||
|
@ -321,6 +326,11 @@ void CWorldTransManager::DrawText() {
|
|||
CGraphics::SetOrtho(0.f, width, 448.f, 0.f, -4096.f, 4096.f);
|
||||
CGraphics::SetViewPointMatrix(zeus::CTransform());
|
||||
CGraphics::SetModelMatrix(zeus::CTransform::Translate((width - 640.f) / 2.f, 0.f, 448.f));
|
||||
// g_Renderer->SetViewportOrtho(false, -4096.f, 4096.f);
|
||||
// g_Renderer->SetModelMatrix(zeus::CTransform::Translate(0.f, 0.f, 0.f));
|
||||
CGraphics::SetCullMode(ERglCullMode::None);
|
||||
g_Renderer->SetDepthReadWrite(false, false);
|
||||
g_Renderer->SetBlendMode_AdditiveAlpha();
|
||||
x8_textData->Render();
|
||||
|
||||
float filterAlpha = 0.f;
|
||||
|
@ -332,8 +342,10 @@ void CWorldTransManager::DrawText() {
|
|||
if (filterAlpha > 0.f) {
|
||||
zeus::CColor filterColor = x44_27_fadeWhite ? zeus::skWhite : zeus::skBlack;
|
||||
filterColor.a() = filterAlpha;
|
||||
m_fadeToBlack.draw(filterColor);
|
||||
CCameraFilterPass::DrawFilter(EFilterType::Blend, EFilterShape::Fullscreen, filterColor, nullptr, 1.f);
|
||||
}
|
||||
|
||||
CGraphics::SetIsBeginSceneClearFb(true);
|
||||
}
|
||||
|
||||
void CWorldTransManager::Draw() {
|
||||
|
|
|
@ -76,13 +76,6 @@ private:
|
|||
bool x44_27_fadeWhite : 1 = false;
|
||||
bool x44_28_textDirty : 1 = false;
|
||||
|
||||
CColoredQuadFilter m_fadeToBlack{EFilterType::Blend};
|
||||
// CTexturedQuadFilter m_dissolve{EFilterType::Blend, CGraphics::g_SpareTexture.get()};
|
||||
CWideScreenFilter m_widescreen{EFilterType::Blend};
|
||||
CCameraBlurFilter m_camblur;
|
||||
|
||||
// std::array<boo::ObjToken<boo::ITextureCubeR>, 2> m_reflectionCube;
|
||||
|
||||
static int GetSuitCharIdx();
|
||||
void DrawFirstPass(CActorLights* lights);
|
||||
void DrawSecondPass(CActorLights* lights);
|
||||
|
|
Loading…
Reference in New Issue