mirror of https://github.com/AxioDL/metaforce.git
Migrate to aurora submodule
This commit is contained in:
parent
0789f28aac
commit
1e9d96c906
|
@ -42,18 +42,12 @@
|
|||
path = extern/zeus
|
||||
url = ../zeus.git
|
||||
branch = master
|
||||
[submodule "extern/imgui"]
|
||||
path = extern/imgui
|
||||
url = https://github.com/ocornut/imgui.git
|
||||
[submodule "extern/SDL"]
|
||||
path = extern/SDL
|
||||
url = https://github.com/libsdl-org/SDL.git
|
||||
[submodule "extern/dawn"]
|
||||
path = extern/dawn
|
||||
url = https://github.com/encounter/dawn-cmake.git
|
||||
[submodule "extern/nativefiledialog"]
|
||||
path = extern/nativefiledialog
|
||||
url = https://github.com/mlabbe/nativefiledialog.git
|
||||
[submodule "extern/optick"]
|
||||
path = extern/optick
|
||||
url = https://github.com/AxioDL/optick.git
|
||||
[submodule "extern/aurora"]
|
||||
path = extern/aurora
|
||||
url = https://github.com/encounter/aurora.git
|
||||
|
|
|
@ -365,7 +365,6 @@ if(NOT TARGET atdna)
|
|||
endif()
|
||||
|
||||
add_subdirectory(NESEmulator EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(aurora)
|
||||
add_subdirectory(Runtime)
|
||||
add_subdirectory(gbalink EXCLUDE_FROM_ALL)
|
||||
|
||||
|
|
|
@ -604,9 +604,9 @@ void CNESEmulator::ProcessUserInput(const CFinalInput& input, int) {
|
|||
|
||||
if (GetPasswordEntryState() != EPasswordEntryState::NotPasswordScreen) {
|
||||
// Don't swap A/B
|
||||
inValReads[BUTTON_A] = input.DA() || input.DSpecialKey(aurora::SpecialKey::Enter) ||
|
||||
inValReads[BUTTON_A] = input.DA() || input.DSpecialKey(ESpecialKey::Enter) ||
|
||||
input.DMouseButton(EMouseButton::Primary);
|
||||
inValReads[BUTTON_B] = input.DB() || input.DSpecialKey(aurora::SpecialKey::Esc);
|
||||
inValReads[BUTTON_B] = input.DB() || input.DSpecialKey(ESpecialKey::Esc);
|
||||
} else {
|
||||
// Prime controls (B jumps, A shoots)
|
||||
inValReads[BUTTON_B] = input.DA() || input.DY() || input.DMouseButton(EMouseButton::Primary);
|
||||
|
@ -617,8 +617,8 @@ void CNESEmulator::ProcessUserInput(const CFinalInput& input, int) {
|
|||
inValReads[BUTTON_DOWN] = input.DDPDown() || input.DLADown();
|
||||
inValReads[BUTTON_LEFT] = input.DDPLeft() || input.DLALeft();
|
||||
inValReads[BUTTON_RIGHT] = input.DDPRight() || input.DLARight();
|
||||
inValReads[BUTTON_SELECT] = input.DZ() || input.DSpecialKey(aurora::SpecialKey::Tab);
|
||||
inValReads[BUTTON_START] = input.DStart() || input.DSpecialKey(aurora::SpecialKey::Esc);
|
||||
inValReads[BUTTON_SELECT] = input.DZ() || input.DSpecialKey(ESpecialKey::Tab);
|
||||
inValReads[BUTTON_START] = input.DStart() || input.DSpecialKey(ESpecialKey::Esc);
|
||||
}
|
||||
|
||||
bool CNESEmulator::CheckForGameOver(const u8* vram, u8* passwordOut) {
|
||||
|
|
|
@ -35,7 +35,7 @@ private:
|
|||
zeus::CColor m_color;
|
||||
};
|
||||
|
||||
aurora::gfx::TextureHandle m_texture;
|
||||
GXTexObj m_texture;
|
||||
// boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||
// boo::ObjToken<boo::IGraphicsBufferS> m_vbo;
|
||||
// boo::ObjToken<boo::IShaderDataBinding> m_shadBind;
|
||||
|
|
|
@ -788,10 +788,10 @@ void CAutoMapper::SetShouldRotatingSoundBePlaying(bool shouldBePlaying) {
|
|||
void CAutoMapper::ProcessMapScreenInput(const CFinalInput& input, CStateManager& mgr) {
|
||||
zeus::CMatrix3f camRot = xa8_renderStates[0].x8_camOrientation.toTransform().buildMatrix3f();
|
||||
if (x1bc_state == EAutoMapperState::MapScreen) {
|
||||
if ((input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter)) && x328_ == 0 && HasCurrentMapUniverseWorld())
|
||||
if ((input.PA() || input.PSpecialKey(ESpecialKey::Enter)) && x328_ == 0 && HasCurrentMapUniverseWorld())
|
||||
BeginMapperStateTransition(EAutoMapperState::MapScreenUniverse, mgr);
|
||||
} else if (x1bc_state == EAutoMapperState::MapScreenUniverse &&
|
||||
(input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter))) {
|
||||
(input.PA() || input.PSpecialKey(ESpecialKey::Enter))) {
|
||||
const CMapUniverse::CMapWorldData& mapuWld = x8_mapu->GetMapWorldData(x9c_worldIdx);
|
||||
zeus::CVector3f pointLocal = mapuWld.GetWorldTransform().inverse() * xa8_renderStates[0].x20_areaPoint;
|
||||
if (mapuWld.GetWorldAssetId() != g_GameState->CurrentWorldAssetId()) {
|
||||
|
@ -806,7 +806,7 @@ void CAutoMapper::ProcessMapScreenInput(const CFinalInput& input, CStateManager&
|
|||
}
|
||||
|
||||
x2f4_aButtonPos = 0;
|
||||
if (input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter))
|
||||
if (input.PA() || input.PSpecialKey(ESpecialKey::Enter))
|
||||
x2f4_aButtonPos = 1;
|
||||
|
||||
if (IsInPlayerControlState()) {
|
||||
|
@ -1083,8 +1083,8 @@ void CAutoMapper::ProcessControllerInput(const CFinalInput& input, CStateManager
|
|||
}
|
||||
}
|
||||
|
||||
if (input.PZ() || input.PSpecialKey(aurora::SpecialKey::Tab) || input.PB() ||
|
||||
input.PSpecialKey(aurora::SpecialKey::Esc)) {
|
||||
if (input.PZ() || input.PSpecialKey(ESpecialKey::Tab) || input.PB() ||
|
||||
input.PSpecialKey(ESpecialKey::Esc)) {
|
||||
if (x328_ == 0) {
|
||||
if (CanLeaveMapScreenInternal(mgr)) {
|
||||
LeaveMapScreen(mgr);
|
||||
|
|
|
@ -197,10 +197,10 @@ void CMapArea::CMapAreaSurface::PostConstruct(const u8* buf, std::vector<u32>& i
|
|||
CMemoryInStream r(x18_surfOffset, INT_MAX, CMemoryInStream::EOwnerShip::NotOwned);
|
||||
u32 primCount = r.ReadLong();
|
||||
for (u32 i = 0; i < primCount; ++i) {
|
||||
GX::Primitive prim = GX::Primitive(r.ReadLong());
|
||||
GXPrimitive prim = GXPrimitive(r.ReadLong());
|
||||
u32 count = r.ReadLong();
|
||||
switch (prim) {
|
||||
case GX::Primitive::TRIANGLES: {
|
||||
case GX_TRIANGLES: {
|
||||
for (u32 v = 0; v < count; v += 3) {
|
||||
if (!start) {
|
||||
index.push_back(index.back());
|
||||
|
@ -216,7 +216,7 @@ void CMapArea::CMapAreaSurface::PostConstruct(const u8* buf, std::vector<u32>& i
|
|||
}
|
||||
break;
|
||||
}
|
||||
case GX::Primitive::TRIANGLESTRIP: {
|
||||
case GX_TRIANGLESTRIP: {
|
||||
if (!start) {
|
||||
index.push_back(index.back());
|
||||
index.push_back(r.ReadUint8());
|
||||
|
@ -231,7 +231,7 @@ void CMapArea::CMapAreaSurface::PostConstruct(const u8* buf, std::vector<u32>& i
|
|||
index.push_back(index.back());
|
||||
break;
|
||||
}
|
||||
case GX::Primitive::TRIANGLEFAN: {
|
||||
case GX_TRIANGLEFAN: {
|
||||
u8 firstVert = r.ReadUint8();
|
||||
if (!start) {
|
||||
index.push_back(index.back());
|
||||
|
|
|
@ -27,8 +27,8 @@ public:
|
|||
struct Instance {
|
||||
CMapSurfaceShader m_surfacePrims;
|
||||
std::vector<CLineRenderer> m_linePrims;
|
||||
Instance(aurora::ArrayRef<zeus::CVector3f> vbo,
|
||||
aurora::ArrayRef<u16> ibo)
|
||||
Instance(std::vector<zeus::CVector3f> vbo,
|
||||
std::vector<u16> ibo)
|
||||
: m_surfacePrims(vbo, ibo) {}
|
||||
Instance(Instance&&) = default;
|
||||
Instance& operator=(Instance&&) = default;
|
||||
|
|
|
@ -112,19 +112,19 @@ void CMappableObject::Draw(int curArea, const CMapWorldInfo& mwInfo, float alpha
|
|||
SCOPED_GRAPHICS_DEBUG_GROUP("CMappableObject::Draw", zeus::skCyan);
|
||||
if (IsDoorType(x0_type)) {
|
||||
std::pair<zeus::CColor, zeus::CColor> colors = GetDoorColors(curArea, mwInfo, alpha);
|
||||
if (m_doorSurface) // TODO
|
||||
for (int s = 0; s < 6; ++s) {
|
||||
DoorSurface& ds = *m_doorSurface;
|
||||
ds.m_surface.draw(colors.first, s * 4, 4);
|
||||
CLineRenderer& line = ds.m_outline;
|
||||
const u16* baseIdx = &skDoorIndices[s * 4];
|
||||
line.Reset();
|
||||
line.AddVertex(skDoorVerts[baseIdx[0]], colors.second, 1.f);
|
||||
line.AddVertex(skDoorVerts[baseIdx[1]], colors.second, 1.f);
|
||||
line.AddVertex(skDoorVerts[baseIdx[3]], colors.second, 1.f);
|
||||
line.AddVertex(skDoorVerts[baseIdx[2]], colors.second, 1.f);
|
||||
line.Render();
|
||||
}
|
||||
// TODO
|
||||
// for (int s = 0; s < 6; ++s) {
|
||||
// DoorSurface& ds = *m_doorSurface;
|
||||
// ds.m_surface.draw(colors.first, s * 4, 4);
|
||||
// CLineRenderer& line = ds.m_outline;
|
||||
// const u16* baseIdx = &skDoorIndices[s * 4];
|
||||
// line.Reset();
|
||||
// line.AddVertex(skDoorVerts[baseIdx[0]], colors.second, 1.f);
|
||||
// line.AddVertex(skDoorVerts[baseIdx[1]], colors.second, 1.f);
|
||||
// line.AddVertex(skDoorVerts[baseIdx[3]], colors.second, 1.f);
|
||||
// line.AddVertex(skDoorVerts[baseIdx[2]], colors.second, 1.f);
|
||||
// line.Render();
|
||||
// }
|
||||
} else {
|
||||
CAssetId iconRes;
|
||||
zeus::CColor iconColor = zeus::skWhite;
|
||||
|
@ -184,16 +184,16 @@ void CMappableObject::Draw(int curArea, const CMapWorldInfo& mwInfo, float alpha
|
|||
void CMappableObject::DrawDoorSurface(int curArea, const CMapWorldInfo& mwInfo, float alpha, int surfIdx,
|
||||
bool needsVtxLoad) {
|
||||
std::pair<zeus::CColor, zeus::CColor> colors = GetDoorColors(curArea, mwInfo, alpha);
|
||||
DoorSurface& ds = *m_doorSurface;
|
||||
ds.m_surface.draw(colors.first, surfIdx * 4, 4);
|
||||
CLineRenderer& line = ds.m_outline;
|
||||
const u16* baseIdx = &skDoorIndices[surfIdx * 4];
|
||||
line.Reset();
|
||||
line.AddVertex(skDoorVerts[baseIdx[0]], colors.second, 1.f);
|
||||
line.AddVertex(skDoorVerts[baseIdx[1]], colors.second, 1.f);
|
||||
line.AddVertex(skDoorVerts[baseIdx[3]], colors.second, 1.f);
|
||||
line.AddVertex(skDoorVerts[baseIdx[2]], colors.second, 1.f);
|
||||
line.Render();
|
||||
// DoorSurface& ds = *m_doorSurface;
|
||||
// ds.m_surface.draw(colors.first, surfIdx * 4, 4);
|
||||
// CLineRenderer& line = ds.m_outline;
|
||||
// const u16* baseIdx = &skDoorIndices[surfIdx * 4];
|
||||
// line.Reset();
|
||||
// line.AddVertex(skDoorVerts[baseIdx[0]], colors.second, 1.f);
|
||||
// line.AddVertex(skDoorVerts[baseIdx[1]], colors.second, 1.f);
|
||||
// line.AddVertex(skDoorVerts[baseIdx[3]], colors.second, 1.f);
|
||||
// line.AddVertex(skDoorVerts[baseIdx[2]], colors.second, 1.f);
|
||||
// line.Render();
|
||||
}
|
||||
|
||||
zeus::CVector3f CMappableObject::BuildSurfaceCenterPoint(int surfIdx) const {
|
||||
|
|
|
@ -58,14 +58,14 @@ private:
|
|||
u32 xc_;
|
||||
zeus::CTransform x10_transform;
|
||||
|
||||
struct DoorSurface {
|
||||
CMapSurfaceShader m_surface;
|
||||
CLineRenderer m_outline;
|
||||
explicit DoorSurface()
|
||||
: m_surface(skDoorVerts, skDoorIndices)
|
||||
, m_outline(CLineRenderer::EPrimitiveMode::LineLoop, 5, {}, false, false, true) {}
|
||||
};
|
||||
std::optional<DoorSurface> m_doorSurface;
|
||||
// struct DoorSurface {
|
||||
// CMapSurfaceShader m_surface;
|
||||
// CLineRenderer m_outline;
|
||||
// explicit DoorSurface()
|
||||
// : m_surface(skDoorVerts, skDoorIndices)
|
||||
// , m_outline(CLineRenderer::EPrimitiveMode::LineLoop, 5, {}, false, false, true) {}
|
||||
// };
|
||||
// std::optional<DoorSurface> m_doorSurface;
|
||||
|
||||
zeus::CTransform AdjustTransformForType() const;
|
||||
std::pair<zeus::CColor, zeus::CColor> GetDoorColors(int idx, const CMapWorldInfo& mwInfo, float alpha) const;
|
||||
|
@ -83,7 +83,7 @@ public:
|
|||
bool IsDoorConnectedToVisitedArea(const CStateManager&) const;
|
||||
bool IsVisibleToAutoMapper(bool worldVis, const CMapWorldInfo& mwInfo) const;
|
||||
bool GetIsSeen() const;
|
||||
void CreateDoorSurface() { m_doorSurface.emplace(); }
|
||||
// void CreateDoorSurface() { m_doorSurface.emplace(); }
|
||||
|
||||
static void ReadAutoMapperTweaks(const ITweakAutoMapper&);
|
||||
static bool GetTweakIsMapVisibilityCheat();
|
||||
|
|
|
@ -446,7 +446,7 @@ void CGameOptions::TryRestoreDefaults(const CFinalInput& input, int category, in
|
|||
if (options.second[option].option != EGameOption::RestoreDefaults)
|
||||
return;
|
||||
|
||||
if (!forceRestore && !input.PA() && !input.PSpecialKey(aurora::SpecialKey::Enter))
|
||||
if (!forceRestore && !input.PA() && !input.PSpecialKey(ESpecialKey::Enter))
|
||||
return;
|
||||
|
||||
if (frontend) {
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
//#include <fenv.h>
|
||||
//#pragma STDC FENV_ACCESS ON
|
||||
|
||||
#include <SDL_main.h>
|
||||
#include <aurora/aurora.hpp>
|
||||
#include <aurora/event.h>
|
||||
#include <aurora/main.h>
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
|
@ -147,8 +147,10 @@ static std::string CPUFeatureString(const zeus::CPUInfo& cpuInf) {
|
|||
return features;
|
||||
}
|
||||
|
||||
struct Application : aurora::AppDelegate {
|
||||
struct Application {
|
||||
private:
|
||||
int m_argc;
|
||||
char** m_argv;
|
||||
FileStoreManager& m_fileMgr;
|
||||
CVarManager& m_cvarManager;
|
||||
CVarCommons& m_cvarCommons;
|
||||
|
@ -171,14 +173,20 @@ private:
|
|||
// is built, i.e during initialization
|
||||
|
||||
public:
|
||||
Application(FileStoreManager& fileMgr, CVarManager& cvarMgr, CVarCommons& cvarCmns)
|
||||
: m_fileMgr(fileMgr), m_cvarManager(cvarMgr), m_cvarCommons(cvarCmns), m_imGuiConsole(cvarMgr, cvarCmns) {}
|
||||
Application(int argc, char** argv, FileStoreManager& fileMgr, CVarManager& cvarMgr, CVarCommons& cvarCmns)
|
||||
: m_argc(argc)
|
||||
, m_argv(argv)
|
||||
, m_fileMgr(fileMgr)
|
||||
, m_cvarManager(cvarMgr)
|
||||
, m_cvarCommons(cvarCmns)
|
||||
, m_imGuiConsole(cvarMgr, cvarCmns) {}
|
||||
|
||||
void onAppLaunched() noexcept override {
|
||||
void onAppLaunched() noexcept {
|
||||
initialize();
|
||||
|
||||
auto backend = static_cast<std::string>(aurora::get_backend_string());
|
||||
aurora::set_window_title(fmt::format(FMT_STRING("Metaforce {} [{}]"), METAFORCE_WC_DESCRIBE, backend));
|
||||
// TODO
|
||||
// auto backend = static_cast<std::string>(aurora::get_backend_string());
|
||||
// aurora::set_window_title(fmt::format(FMT_STRING("Metaforce {} [{}]"), METAFORCE_WC_DESCRIBE, backend));
|
||||
|
||||
m_voiceEngine = boo::NewAudioVoiceEngine("metaforce", "Metaforce");
|
||||
m_voiceEngine->setVolume(0.7f);
|
||||
|
@ -187,8 +195,8 @@ public:
|
|||
#if TARGET_OS_IOS || TARGET_OS_TV
|
||||
m_deferredProject = std::string{m_fileMgr.getStoreRoot()} + "game.iso";
|
||||
#else
|
||||
for (const auto& str : aurora::get_args()) {
|
||||
auto arg = static_cast<std::string>(str);
|
||||
for (int i = 1; i < m_argc; ++i) {
|
||||
std::string arg = m_argv[i];
|
||||
if (m_deferredProject.empty() && !arg.starts_with('-') && !arg.starts_with('+'))
|
||||
m_deferredProject = arg;
|
||||
else if (arg == "--no-sound")
|
||||
|
@ -202,17 +210,13 @@ public:
|
|||
void initialize() {
|
||||
zeus::detectCPU();
|
||||
|
||||
for (const auto& str : aurora::get_args()) {
|
||||
auto arg = static_cast<std::string>(str);
|
||||
}
|
||||
|
||||
const zeus::CPUInfo& cpuInf = zeus::cpuFeatures();
|
||||
Log.report(logvisor::Info, FMT_STRING("CPU Name: {}"), cpuInf.cpuBrand);
|
||||
Log.report(logvisor::Info, FMT_STRING("CPU Vendor: {}"), cpuInf.cpuVendor);
|
||||
Log.report(logvisor::Info, FMT_STRING("CPU Features: {}"), CPUFeatureString(cpuInf));
|
||||
}
|
||||
|
||||
bool onAppIdle(float realDt) noexcept override {
|
||||
bool onAppIdle(float realDt) noexcept {
|
||||
#ifdef NDEBUG
|
||||
/* Ping the watchdog to let it know we're still alive */
|
||||
CInfiniteLoopDetector::UpdateWatchDog(std::chrono::system_clock::now());
|
||||
|
@ -258,7 +262,8 @@ public:
|
|||
|
||||
// Check if the user has modified the fullscreen CVar, if so set fullscreen state accordingly
|
||||
if (m_cvarCommons.m_fullscreen->isModified()) {
|
||||
aurora::set_fullscreen(m_cvarCommons.getFullscreen());
|
||||
// TODO
|
||||
// aurora::set_fullscreen(m_cvarCommons.getFullscreen());
|
||||
}
|
||||
|
||||
// Let CVarManager inform all CVar listeners of the CVar's state and clear all mdoified flags if necessary
|
||||
|
@ -266,7 +271,8 @@ public:
|
|||
|
||||
if (!g_mainMP1 && m_projectInitialized) {
|
||||
g_mainMP1.emplace(nullptr, nullptr);
|
||||
auto result = g_mainMP1->Init(m_fileMgr, &m_cvarManager, m_voiceEngine.get(), *m_amuseAllocWrapper);
|
||||
auto result =
|
||||
g_mainMP1->Init(m_argc, m_argv, m_fileMgr, &m_cvarManager, m_voiceEngine.get(), *m_amuseAllocWrapper);
|
||||
if (!result.empty()) {
|
||||
Log.report(logvisor::Error, FMT_STRING("{}"), result);
|
||||
m_imGuiConsole.m_errorString = result;
|
||||
|
@ -311,7 +317,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
void onAppDraw() noexcept override {
|
||||
void onAppDraw() noexcept {
|
||||
OPTICK_EVENT("Draw");
|
||||
if (g_Renderer != nullptr) {
|
||||
g_Renderer->BeginScene();
|
||||
|
@ -322,7 +328,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void onAppPostDraw() noexcept override {
|
||||
void onAppPostDraw() noexcept {
|
||||
OPTICK_EVENT("PostDraw");
|
||||
if (m_voiceEngine) {
|
||||
m_voiceEngine->pumpAndMixVoices();
|
||||
|
@ -331,25 +337,17 @@ public:
|
|||
++logvisor::FrameIndex;
|
||||
}
|
||||
|
||||
void onAppWindowResized(const aurora::WindowSize& size) noexcept override {
|
||||
void onAppWindowResized(const AuroraWindowSize& size) noexcept {
|
||||
CGraphics::SetViewportResolution({static_cast<s32>(size.fb_width), static_cast<s32>(size.fb_height)});
|
||||
}
|
||||
|
||||
void onAppWindowMoved(std::int32_t x, std::int32_t y) noexcept override {
|
||||
// TODO: implement this
|
||||
}
|
||||
void onAppDisplayScaleChanged(float scale) noexcept { ImGuiEngine_Initialize(scale); }
|
||||
|
||||
void onAppDisplayScaleChanged(float scale) noexcept override { ImGuiEngine_Initialize(scale); }
|
||||
void onControllerAdded(uint32_t which) noexcept { m_imGuiConsole.ControllerAdded(which); }
|
||||
|
||||
void onControllerButton(uint32_t idx, aurora::ControllerButton button, bool pressed) noexcept override {}
|
||||
void onControllerRemoved(uint32_t which) noexcept { m_imGuiConsole.ControllerRemoved(which); }
|
||||
|
||||
void onControllerAxis(uint32_t idx, aurora::ControllerAxis axis, int16_t value) noexcept override {}
|
||||
|
||||
void onControllerAdded(uint32_t which) noexcept override { m_imGuiConsole.ControllerAdded(which); }
|
||||
|
||||
void onControllerRemoved(uint32_t which) noexcept override { m_imGuiConsole.ControllerRemoved(which); }
|
||||
|
||||
void onAppExiting() noexcept override {
|
||||
void onAppExiting() noexcept {
|
||||
m_imGuiConsole.Shutdown();
|
||||
if (m_voiceEngine) {
|
||||
m_voiceEngine->unlockPump();
|
||||
|
@ -365,127 +363,9 @@ public:
|
|||
CDvdFile::Shutdown();
|
||||
}
|
||||
|
||||
void onCharKeyDown(uint8_t code, aurora::ModifierKey mods, bool isRepeat) noexcept override {
|
||||
if (g_mainMP1) {
|
||||
if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
||||
as->charKeyDown(code, mods, isRepeat);
|
||||
}
|
||||
}
|
||||
}
|
||||
void onImGuiInit(float scale) noexcept { ImGuiEngine_Initialize(scale); }
|
||||
|
||||
void onCharKeyUp(uint8_t code, aurora::ModifierKey mods) noexcept override {
|
||||
if (g_mainMP1) {
|
||||
if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
||||
as->charKeyUp(code, mods);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void onSpecialKeyDown(aurora::SpecialKey key, aurora::ModifierKey mods, bool isRepeat) noexcept override {
|
||||
if (g_mainMP1) {
|
||||
if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
||||
as->specialKeyDown(key, mods, isRepeat);
|
||||
}
|
||||
}
|
||||
if (True(mods & (aurora::ModifierKey::LeftAlt | aurora::ModifierKey::RightAlt))) {
|
||||
if (key == aurora::SpecialKey::Enter) {
|
||||
m_fullscreenToggleRequested = true;
|
||||
} else if (key == aurora::SpecialKey::F4) {
|
||||
m_quitRequested = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void onSpecialKeyUp(aurora::SpecialKey key, aurora::ModifierKey mods) noexcept override {
|
||||
if (g_mainMP1) {
|
||||
if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
||||
as->specialKeyUp(key, mods);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void onTextInput(const std::string& text) noexcept override {}
|
||||
|
||||
void onModifierKeyDown(aurora::ModifierKey mods, bool isRepeat) noexcept override {}
|
||||
void onModifierKeyUp(aurora::ModifierKey mods) noexcept override {}
|
||||
|
||||
void onMouseMove(int32_t x, int32_t y, int32_t xrel, int32_t yrel, aurora::MouseButton state) noexcept override {
|
||||
if (g_mainMP1) {
|
||||
if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
||||
as->mouseMove(SWindowCoord{.pixel = {x, y}});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void onMouseButtonDown(int32_t x, int32_t y, aurora::MouseButton button, int32_t clicks) noexcept override {
|
||||
if (g_mainMP1) {
|
||||
if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
||||
EMouseButton asBtn;
|
||||
switch (button) {
|
||||
case aurora::MouseButton::None:
|
||||
asBtn = EMouseButton::None;
|
||||
break;
|
||||
case aurora::MouseButton::Primary:
|
||||
asBtn = EMouseButton::Primary;
|
||||
break;
|
||||
case aurora::MouseButton::Middle:
|
||||
asBtn = EMouseButton::Middle;
|
||||
break;
|
||||
case aurora::MouseButton::Secondary:
|
||||
asBtn = EMouseButton::Secondary;
|
||||
break;
|
||||
case aurora::MouseButton::Aux1:
|
||||
asBtn = EMouseButton::Aux1;
|
||||
break;
|
||||
case aurora::MouseButton::Aux2:
|
||||
asBtn = EMouseButton::Aux2;
|
||||
break;
|
||||
}
|
||||
as->mouseDown(SWindowCoord{.pixel = {x, y}}, asBtn, {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void onMouseButtonUp(int32_t x, int32_t y, aurora::MouseButton button) noexcept override {
|
||||
if (g_mainMP1) {
|
||||
if (MP1::CGameArchitectureSupport* as = g_mainMP1->GetArchSupport()) {
|
||||
EMouseButton asBtn;
|
||||
switch (button) {
|
||||
case aurora::MouseButton::None:
|
||||
asBtn = EMouseButton::None;
|
||||
break;
|
||||
case aurora::MouseButton::Primary:
|
||||
asBtn = EMouseButton::Primary;
|
||||
break;
|
||||
case aurora::MouseButton::Middle:
|
||||
asBtn = EMouseButton::Middle;
|
||||
break;
|
||||
case aurora::MouseButton::Secondary:
|
||||
asBtn = EMouseButton::Secondary;
|
||||
break;
|
||||
case aurora::MouseButton::Aux1:
|
||||
asBtn = EMouseButton::Aux1;
|
||||
break;
|
||||
case aurora::MouseButton::Aux2:
|
||||
asBtn = EMouseButton::Aux2;
|
||||
break;
|
||||
}
|
||||
as->mouseUp(SWindowCoord{.pixel = {x, y}}, asBtn, {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void onImGuiInit(float scale) noexcept override { ImGuiEngine_Initialize(scale); }
|
||||
|
||||
void onImGuiAddTextures() noexcept override { ImGuiEngine_AddTextures(); }
|
||||
|
||||
[[nodiscard]] std::string getGraphicsApi() const { return m_cvarCommons.getGraphicsApi(); }
|
||||
|
||||
[[nodiscard]] uint32_t getSamples() const { return m_cvarCommons.getSamples(); }
|
||||
|
||||
[[nodiscard]] uint32_t getAnisotropy() const { return m_cvarCommons.getAnisotropy(); }
|
||||
|
||||
[[nodiscard]] bool getDeepColor() const { return m_cvarCommons.getDeepColor(); }
|
||||
void onImGuiAddTextures() noexcept { ImGuiEngine_AddTextures(); }
|
||||
|
||||
[[nodiscard]] std::chrono::nanoseconds getTargetFrameTime() const {
|
||||
if (m_cvarCommons.getVariableFrameTime()) {
|
||||
|
@ -527,9 +407,31 @@ static bool IsClientLoggingEnabled(int argc, char** argv) {
|
|||
return false;
|
||||
}
|
||||
|
||||
static void SetupLogging() {
|
||||
static void SetupLogging() {}
|
||||
|
||||
static std::unique_ptr<metaforce::Application> g_app;
|
||||
static bool g_paused;
|
||||
|
||||
static void aurora_log_callback(AuroraLogLevel level, const char* message, unsigned int len) {
|
||||
logvisor::Level severity = logvisor::Fatal;
|
||||
switch (level) {
|
||||
case LOG_DEBUG:
|
||||
case LOG_INFO:
|
||||
severity = logvisor::Info;
|
||||
break;
|
||||
case LOG_WARNING:
|
||||
severity = logvisor::Warning;
|
||||
break;
|
||||
case LOG_ERROR:
|
||||
severity = logvisor::Error;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
metaforce::Log.report(severity, FMT_STRING("{}"), message);
|
||||
}
|
||||
|
||||
static void aurora_imgui_init_callback(const AuroraWindowSize* size) { g_app->onImGuiInit(size->scale); }
|
||||
|
||||
#if !WINDOWS_STORE
|
||||
int main(int argc, char** argv) {
|
||||
|
@ -550,6 +452,8 @@ int main(int argc, char** argv) {
|
|||
args.emplace_back(argv[i]);
|
||||
}
|
||||
|
||||
auto icon = metaforce::GetIcon();
|
||||
|
||||
// FIXME: logvisor needs to copy this
|
||||
std::string logFilePath;
|
||||
|
||||
|
@ -583,16 +487,72 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
}
|
||||
|
||||
auto app = std::make_unique<metaforce::Application>(fileMgr, cvarMgr, cvarCmns);
|
||||
auto icon = metaforce::GetIcon();
|
||||
auto data = aurora::Icon{
|
||||
.data = std::move(icon.data),
|
||||
.width = icon.width,
|
||||
.height = icon.height,
|
||||
g_app = std::make_unique<metaforce::Application>(argc, argv, fileMgr, cvarMgr, cvarCmns);
|
||||
std::string configPath{fileMgr.getStoreRoot()};
|
||||
const AuroraConfig config{
|
||||
.appName = "Metaforce",
|
||||
.configPath = configPath.c_str(),
|
||||
// .desiredBackend = TODO
|
||||
.msaa = cvarCmns.getSamples(),
|
||||
.maxTextureAnisotropy = static_cast<uint16_t>(cvarCmns.getAnisotropy()),
|
||||
.startFullscreen = cvarCmns.getFullscreen(),
|
||||
.iconRGBA8 = icon.data.get(),
|
||||
.iconWidth = icon.width,
|
||||
.iconHeight = icon.height,
|
||||
.logCallback = aurora_log_callback,
|
||||
.imGuiInitCallback = aurora_imgui_init_callback,
|
||||
};
|
||||
aurora::app_run(std::move(app), std::move(data), argc, argv, fileMgr.getStoreRoot(),
|
||||
aurora::backend_from_string(cvarCmns.getGraphicsApi()), cvarCmns.getSamples(),
|
||||
cvarCmns.getAnisotropy(), cvarCmns.getFullscreen());
|
||||
const auto info = aurora_initialize(argc, argv, &config);
|
||||
g_app->onImGuiAddTextures();
|
||||
g_app->onAppLaunched();
|
||||
g_app->onAppWindowResized(info.windowSize);
|
||||
while (true) {
|
||||
const auto* event = aurora_update();
|
||||
bool exiting = false;
|
||||
while (event != nullptr && event->type != AURORA_NONE) {
|
||||
switch (event->type) {
|
||||
case AURORA_EXIT:
|
||||
exiting = true;
|
||||
break;
|
||||
case AURORA_WINDOW_RESIZED:
|
||||
g_app->onAppWindowResized(event->windowSize);
|
||||
break;
|
||||
case AURORA_CONTROLLER_ADDED:
|
||||
g_app->onControllerAdded(event->controller);
|
||||
break;
|
||||
case AURORA_CONTROLLER_REMOVED:
|
||||
g_app->onControllerRemoved(event->controller);
|
||||
break;
|
||||
case AURORA_PAUSED:
|
||||
g_paused = true;
|
||||
break;
|
||||
case AURORA_UNPAUSED:
|
||||
g_paused = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (exiting) {
|
||||
break;
|
||||
}
|
||||
++event;
|
||||
}
|
||||
if (exiting) {
|
||||
break;
|
||||
}
|
||||
if (g_paused) {
|
||||
continue;
|
||||
}
|
||||
g_app->onAppIdle(1.f / 60.f /* TODO */);
|
||||
aurora_begin_frame();
|
||||
g_app->onAppDraw();
|
||||
aurora_end_frame();
|
||||
g_app->onAppPostDraw();
|
||||
}
|
||||
g_app->onAppExiting();
|
||||
aurora_shutdown();
|
||||
g_app.reset();
|
||||
|
||||
restart = cvarMgr.restartRequired();
|
||||
} while (restart);
|
||||
return 0;
|
||||
|
|
|
@ -153,11 +153,11 @@ set(DISCORD_RPC_LIBRARY "")
|
|||
if (NOT GEKKO AND NOT NX AND NOT IOS AND NOT TVOS)
|
||||
set(DISCORD_RPC_LIBRARY "discord-rpc")
|
||||
endif()
|
||||
set(RUNTIME_LIBRARIES amuse zeus nod NESEmulator libjpeg-turbo jbus kabufuda logvisor OptickCore imgui aurora
|
||||
set(RUNTIME_LIBRARIES amuse zeus nod NESEmulator libjpeg-turbo jbus kabufuda logvisor OptickCore
|
||||
imgui_support aurora::aurora SDL2::SDL2-static SDL2::SDL2main
|
||||
boo # TODO move audiodev
|
||||
${DISCORD_RPC_LIBRARY}
|
||||
${ZLIB_LIBRARIES}
|
||||
SDL2::SDL2-static SDL2::SDL2main
|
||||
)
|
||||
|
||||
add_runtime_common_library(RuntimeCommon ${RUNTIME_SOURCES_A})
|
||||
|
@ -229,7 +229,7 @@ add_executable(metaforce CMain.cpp ${PLAT_SRCS}
|
|||
ImGuiControllerConfig.hpp ImGuiControllerConfig.cpp
|
||||
ImGuiEntitySupport.hpp ImGuiEntitySupport.cpp)
|
||||
# RUNTIME_LIBRARIES repeated here for link ordering
|
||||
target_link_libraries(metaforce PUBLIC RuntimeCommon RuntimeCommonB ${RUNTIME_LIBRARIES} ${PLAT_LIBS})
|
||||
target_link_libraries(metaforce PUBLIC RuntimeCommon RuntimeCommonB ${RUNTIME_LIBRARIES} ${PLAT_LIBS} aurora::main)
|
||||
if (TARGET nativefiledialog)
|
||||
target_link_libraries(metaforce PRIVATE nativefiledialog)
|
||||
endif()
|
||||
|
|
|
@ -112,7 +112,7 @@ void CCameraFilterPass::DrawFilter(EFilterType type, EFilterShape shape, const z
|
|||
g_Renderer->SetBlendMode_AdditiveAlpha();
|
||||
break;
|
||||
case EFilterType::Subtract:
|
||||
CGX::SetBlendMode(GX::BM_SUBTRACT, GX::BL_ONE, GX::BL_ONE, GX::LO_CLEAR);
|
||||
CGX::SetBlendMode(GX_BM_SUBTRACT, GX_BL_ONE, GX_BL_ONE, GX_LO_CLEAR);
|
||||
break;
|
||||
case EFilterType::Blend:
|
||||
g_Renderer->SetBlendMode_AlphaBlended();
|
||||
|
@ -186,12 +186,12 @@ void CCameraFilterPass::DrawFullScreenTexturedQuadQuarters(const zeus::CColor& c
|
|||
CGraphics::SetTevOp(ERglTevStage::Stage1, CTevCombiners::skPassThru);
|
||||
g_Renderer->SetDepthReadWrite(false, false);
|
||||
if (tex != nullptr) {
|
||||
tex->Load(GX::TEXMAP0, EClampMode::Repeat);
|
||||
tex->Load(GX_TEXMAP0, EClampMode::Repeat);
|
||||
}
|
||||
CGraphics::SetCullMode(ERglCullMode::None);
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
g_Renderer->SetModelMatrix(zeus::CTransform::Scale((i & 1) != 0 ? 1.f : -1.f, 0.f, (i & 2) != 0 ? 1.f : -1.f));
|
||||
CGraphics::StreamBegin(GX::TRIANGLESTRIP);
|
||||
CGraphics::StreamBegin(GX_TRIANGLESTRIP);
|
||||
CGraphics::StreamColor(color);
|
||||
CGraphics::StreamTexcoord(lod, lod);
|
||||
CGraphics::StreamVertex(lt.x(), 0.f, rb.y());
|
||||
|
@ -213,11 +213,11 @@ void CCameraFilterPass::DrawFullScreenTexturedQuad(const zeus::CColor& color, CT
|
|||
const auto [lt, rb] = g_Renderer->SetViewportOrtho(true, -4096.f, 4096.f);
|
||||
g_Renderer->SetDepthReadWrite(false, false);
|
||||
if (tex != nullptr) {
|
||||
tex->Load(GX::TEXMAP0, EClampMode::Repeat);
|
||||
tex->Load(GX_TEXMAP0, EClampMode::Repeat);
|
||||
}
|
||||
CGraphics::SetTevOp(ERglTevStage::Stage0, CTevCombiners::sTevPass805a5ebc);
|
||||
CGraphics::SetTevOp(ERglTevStage::Stage1, CTevCombiners::skPassThru);
|
||||
CGraphics::StreamBegin(GX::TRIANGLESTRIP);
|
||||
CGraphics::StreamBegin(GX_TRIANGLESTRIP);
|
||||
CGraphics::StreamColor(color);
|
||||
CGraphics::StreamTexcoord(u, v);
|
||||
CGraphics::StreamVertex(lt.x() - 1.f, 0.f, 1.f + rb.y());
|
||||
|
@ -253,9 +253,9 @@ void CCameraFilterPass::DrawRandomStatic(const zeus::CColor& color, float alpha,
|
|||
u8* out = m_randomStatic.Lock();
|
||||
memcpy(out, buf + ROUND_UP_32(rand() & 0x7fff), m_randomStatic.GetMemoryAllocated());
|
||||
m_randomStatic.UnLock();
|
||||
m_randomStatic.Load(GX::TEXMAP0, EClampMode::Clamp);
|
||||
m_randomStatic.Load(GX_TEXMAP0, EClampMode::Clamp);
|
||||
|
||||
CGraphics::StreamBegin(GX::TRIANGLESTRIP);
|
||||
CGraphics::StreamBegin(GX_TRIANGLESTRIP);
|
||||
CGraphics::StreamColor(color);
|
||||
CGraphics::StreamTexcoord(0.f, 1.f);
|
||||
CGraphics::StreamVertex(lb.x() - 1.f, 0.01f, rt.y() + 1.f);
|
||||
|
@ -289,11 +289,11 @@ void CCameraFilterPass::DrawWideScreen(const zeus::CColor& color, CTexture* tex,
|
|||
// g_Renderer->SetDepthReadWrite(false, false);
|
||||
// g_Renderer->SetModelMatrix({});
|
||||
// if (tex != nullptr) {
|
||||
// tex->Load(GX::TEXMAP0, EClampMode::Repeat);
|
||||
// tex->Load(GX_TEXMAP0, EClampMode::Repeat);
|
||||
// }
|
||||
// CGraphics::SetTevOp(ERglTevStage::Stage0, CTevCombiners::sTevPass805a5ebc);
|
||||
// CGraphics::SetTevOp(ERglTevStage::Stage1, CTevCombiners::skPassThru);
|
||||
// CGraphics::StreamBegin(GX::TRIANGLESTRIP);
|
||||
// CGraphics::StreamBegin(GX_TRIANGLESTRIP);
|
||||
// float x = rand() % 4000;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace metaforce {
|
||||
template <typename BitType>
|
||||
class Flags {
|
||||
public:
|
||||
using MaskType = std::underlying_type_t<BitType>;
|
||||
|
||||
// constructors
|
||||
constexpr Flags() noexcept : m_mask(0) {}
|
||||
|
||||
constexpr Flags(BitType bit) noexcept : m_mask(static_cast<MaskType>(bit)) {}
|
||||
|
||||
constexpr Flags(Flags<BitType> const& rhs) noexcept : m_mask(rhs.m_mask) {}
|
||||
|
||||
constexpr explicit Flags(MaskType flags) noexcept : m_mask(flags) {}
|
||||
|
||||
[[nodiscard]] constexpr bool IsSet(Flags<BitType> const bit) const noexcept { return bool(*this & bit); }
|
||||
|
||||
// relational operators
|
||||
bool operator==(Flags<BitType> const& rhs) const noexcept { return m_mask == rhs.m_mask; }
|
||||
|
||||
// logical operator
|
||||
constexpr bool operator!() const noexcept { return !m_mask; }
|
||||
|
||||
// bitwise operators
|
||||
constexpr Flags<BitType> operator&(Flags<BitType> const& rhs) const noexcept {
|
||||
return Flags<BitType>(m_mask & rhs.m_mask);
|
||||
}
|
||||
|
||||
constexpr Flags<BitType> operator|(Flags<BitType> const& rhs) const noexcept {
|
||||
return Flags<BitType>(m_mask | rhs.m_mask);
|
||||
}
|
||||
|
||||
constexpr Flags<BitType> operator^(Flags<BitType> const& rhs) const noexcept {
|
||||
return Flags<BitType>(m_mask ^ rhs.m_mask);
|
||||
}
|
||||
|
||||
// assignment operators
|
||||
constexpr Flags<BitType>& operator=(Flags<BitType> const& rhs) noexcept {
|
||||
m_mask = rhs.m_mask;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr Flags<BitType>& operator|=(Flags<BitType> const& rhs) noexcept {
|
||||
m_mask |= rhs.m_mask;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr Flags<BitType>& operator&=(Flags<BitType> const& rhs) noexcept {
|
||||
m_mask &= rhs.m_mask;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr Flags<BitType>& operator^=(Flags<BitType> const& rhs) noexcept {
|
||||
m_mask ^= rhs.m_mask;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// cast operators
|
||||
explicit constexpr operator bool() const noexcept { return m_mask != 0; }
|
||||
|
||||
explicit constexpr operator MaskType() const noexcept { return m_mask; }
|
||||
|
||||
private:
|
||||
MaskType m_mask;
|
||||
};
|
||||
} // namespace metaforce
|
|
@ -55,7 +55,7 @@ void CCubeMaterial::SetCurrent(const CModelFlags& flags, const CCubeSurface& sur
|
|||
materialDataCur += 8;
|
||||
for (u32 i = 0; i < texCount; ++i) {
|
||||
u32 texIdx = SBig(*reinterpret_cast<const u32*>(materialDataCur));
|
||||
model.GetTexture(texIdx)->Load(static_cast<GX::TexMapID>(i), EClampMode::Repeat);
|
||||
model.GetTexture(texIdx)->Load(static_cast<GXTexMapID>(i), EClampMode::Repeat);
|
||||
materialDataCur += 4;
|
||||
}
|
||||
}
|
||||
|
@ -83,14 +83,14 @@ void CCubeMaterial::SetCurrent(const CModelFlags& flags, const CCubeSurface& sur
|
|||
for (u32 i = 0; i < konstCount; ++i) {
|
||||
u32 kColor = SBig(*reinterpret_cast<const u32*>(materialDataCur));
|
||||
materialDataCur += 4;
|
||||
CGX::SetTevKColor(static_cast<GX::TevKColorID>(i), kColor);
|
||||
CGX::SetTevKColor(static_cast<GXTevKColorID>(i), kColor);
|
||||
}
|
||||
}
|
||||
|
||||
u32 blendFactors = SBig(*reinterpret_cast<const u32*>(materialDataCur));
|
||||
materialDataCur += 4;
|
||||
if (g_Renderer->IsInAreaDraw()) {
|
||||
CGX::SetBlendMode(GX::BM_BLEND, GX::BL_ONE, GX::BL_ONE, GX::LO_CLEAR);
|
||||
CGX::SetBlendMode(GX_BM_BLEND, GX_BL_ONE, GX_BL_ONE, GX_LO_CLEAR);
|
||||
} else {
|
||||
SetupBlendMode(blendFactors, flags, matFlags.IsSet(CCubeMaterialFlagBits::fAlphaTest));
|
||||
}
|
||||
|
@ -129,12 +129,12 @@ void CCubeMaterial::SetCurrent(const CModelFlags& flags, const CCubeSurface& sur
|
|||
finalTevCount = firstTev + 1;
|
||||
u32 ccFlags = SBig(*reinterpret_cast<const u32*>(materialDataCur + 8));
|
||||
finalCCFlags = ccFlags;
|
||||
auto outputReg = static_cast<GX::TevRegID>(ccFlags >> 9 & 0x3);
|
||||
if (outputReg == GX::TEVREG0) {
|
||||
auto outputReg = static_cast<GXTevRegID>(ccFlags >> 9 & 0x3);
|
||||
if (outputReg == GX_TEVREG0) {
|
||||
materialDataCur += 20;
|
||||
texMapTexCoordFlags += 1;
|
||||
finalCCFlags = SBig(*reinterpret_cast<const u32*>(materialDataCur + 8));
|
||||
GXSetTevColor(GX::TEVREG0, 0xc0c0c0c0);
|
||||
GXSetTevColor(GX_TEVREG0, GXColor{0xc0, 0xc0, 0xc0, 0xc0});
|
||||
}
|
||||
finalACFlags = SBig(*reinterpret_cast<const u32*>(materialDataCur + 12));
|
||||
HandleTev(firstTev, reinterpret_cast<const u32*>(materialDataCur), texMapTexCoordFlags,
|
||||
|
@ -148,8 +148,8 @@ void CCubeMaterial::SetCurrent(const CModelFlags& flags, const CCubeSurface& sur
|
|||
u32 ccFlags = SBig(*reinterpret_cast<const u32*>(materialDataCur + 8));
|
||||
finalCCFlags = ccFlags;
|
||||
finalACFlags = SBig(*reinterpret_cast<const u32*>(materialDataCur + 12));
|
||||
auto outputReg = static_cast<GX::TevRegID>(ccFlags >> 9 & 0x3);
|
||||
if (outputReg == GX::TEVREG2) {
|
||||
auto outputReg = static_cast<GXTevRegID>(ccFlags >> 9 & 0x3);
|
||||
if (outputReg == GX_TEVREG2) {
|
||||
usesTevReg2 = true;
|
||||
}
|
||||
materialDataCur += 20;
|
||||
|
@ -162,13 +162,13 @@ void CCubeMaterial::SetCurrent(const CModelFlags& flags, const CCubeSurface& sur
|
|||
u32 fullTcgCount = SBig(*tcgs);
|
||||
tcgCount = std::min(fullTcgCount, 2u);
|
||||
for (u32 i = 0; i < tcgCount; ++i) {
|
||||
CGX::SetTexCoordGen(GX::TexCoordID(i), SBig(tcgs[i + 1]));
|
||||
CGX::SetTexCoordGen(GXTexCoordID(i), SBig(tcgs[i + 1]));
|
||||
}
|
||||
tcgs += fullTcgCount + 1;
|
||||
} else {
|
||||
tcgCount = SBig(*tcgs);
|
||||
for (u32 i = 0; i < tcgCount; ++i) {
|
||||
CGX::SetTexCoordGen(GX::TexCoordID(i), SBig(tcgs[i + 1]));
|
||||
CGX::SetTexCoordGen(GXTexCoordID(i), SBig(tcgs[i + 1]));
|
||||
}
|
||||
tcgs += tcgCount + 1;
|
||||
}
|
||||
|
@ -176,10 +176,10 @@ void CCubeMaterial::SetCurrent(const CModelFlags& flags, const CCubeSurface& sur
|
|||
const u32* uvAnim = tcgs;
|
||||
u32 animCount = SBig(uvAnim[1]);
|
||||
uvAnim += 2;
|
||||
u32 texMtx = GX::TEXMTX0;
|
||||
u32 pttTexMtx = GX::PTTEXMTX0;
|
||||
u32 texMtx = GX_TEXMTX0;
|
||||
u32 pttTexMtx = GX_PTTEXMTX0;
|
||||
for (u32 i = 0; i < animCount; ++i) {
|
||||
u32 size = HandleAnimatedUV(uvAnim, static_cast<GX::TexMtx>(texMtx), static_cast<GX::PTTexMtx>(pttTexMtx));
|
||||
u32 size = HandleAnimatedUV(uvAnim, static_cast<GXTexMtx>(texMtx), static_cast<GXPTTexMtx>(pttTexMtx));
|
||||
if (size == 0)
|
||||
break;
|
||||
uvAnim += size;
|
||||
|
@ -228,17 +228,17 @@ void CCubeMaterial::SetCurrentBlack() {
|
|||
const auto flags = GetFlags();
|
||||
const auto vatFlags = GetVatFlags();
|
||||
if (flags.IsSet(CCubeMaterialFlagBits::fDepthSorting) || flags.IsSet(CCubeMaterialFlagBits::fAlphaTest)) {
|
||||
CGX::SetBlendMode(GX::BM_BLEND, GX::BL_ZERO, GX::BL_ONE, GX::LO_CLEAR);
|
||||
CGX::SetBlendMode(GX_BM_BLEND, GX_BL_ZERO, GX_BL_ONE, GX_LO_CLEAR);
|
||||
} else {
|
||||
CGX::SetBlendMode(GX::BM_BLEND, GX::BL_ONE, GX::BL_ZERO, GX::LO_CLEAR);
|
||||
CGX::SetBlendMode(GX_BM_BLEND, GX_BL_ONE, GX_BL_ZERO, GX_LO_CLEAR);
|
||||
}
|
||||
CGX::SetVtxDescv_Compressed(vatFlags);
|
||||
CGX::SetTevColorIn(GX::TEVSTAGE0, GX::CC_ZERO, GX::CC_ZERO, GX::CC_ZERO, GX::CC_ZERO /* ? CC_ONE */);
|
||||
CGX::SetTevAlphaIn(GX::TEVSTAGE0, GX::CA_ZERO, GX::CA_ZERO, GX::CA_ZERO, GX::CA_ZERO /* ? CA_KONST */);
|
||||
CGX::SetTevKAlphaSel(GX::TEVSTAGE0, GX::TEV_KASEL_1);
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD0, GX::TG_MTX2x4, GX::TG_POS, GX::IDENTITY, false, GX::PTIDENTITY);
|
||||
CGX::SetStandardTevColorAlphaOp(GX::TEVSTAGE0);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD_NULL, GX::TEXMAP_NULL, GX::COLOR_NULL);
|
||||
CGX::SetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO /* ? CC_ONE */);
|
||||
CGX::SetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO /* ? CA_KONST */);
|
||||
CGX::SetTevKAlphaSel(GX_TEVSTAGE0, GX_TEV_KASEL_1);
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_POS, GX_IDENTITY, false, GX_PTIDENTITY);
|
||||
CGX::SetStandardTevColorAlphaOp(GX_TEVSTAGE0);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR_NULL);
|
||||
CGX::SetNumTevStages(1);
|
||||
CGX::SetNumChans(0);
|
||||
CGX::SetNumTexGens(1);
|
||||
|
@ -246,35 +246,35 @@ void CCubeMaterial::SetCurrentBlack() {
|
|||
}
|
||||
|
||||
void CCubeMaterial::SetupBlendMode(u32 blendFactors, const CModelFlags& flags, bool alphaTest) {
|
||||
auto newSrcFactor = static_cast<GX::BlendFactor>(blendFactors & 0xffff);
|
||||
auto newDstFactor = static_cast<GX::BlendFactor>(blendFactors >> 16 & 0xffff);
|
||||
auto newSrcFactor = static_cast<GXBlendFactor>(blendFactors & 0xffff);
|
||||
auto newDstFactor = static_cast<GXBlendFactor>(blendFactors >> 16 & 0xffff);
|
||||
if (alphaTest) {
|
||||
// discard fragments with alpha < 0.25
|
||||
CGX::SetAlphaCompare(GX::GEQUAL, 64, GX::AOP_OR, GX::NEVER, 0);
|
||||
newSrcFactor = GX::BL_ONE;
|
||||
newDstFactor = GX::BL_ZERO;
|
||||
CGX::SetAlphaCompare(GX_GEQUAL, 64, GX_AOP_OR, GX_NEVER, 0);
|
||||
newSrcFactor = GX_BL_ONE;
|
||||
newDstFactor = GX_BL_ZERO;
|
||||
} else {
|
||||
CGX::SetAlphaCompare(GX::ALWAYS, 0, GX::AOP_OR, GX::ALWAYS, 0);
|
||||
CGX::SetAlphaCompare(GX_ALWAYS, 0, GX_AOP_OR, GX_ALWAYS, 0);
|
||||
}
|
||||
|
||||
if (flags.x0_blendMode > 4 && newSrcFactor == GX::BL_ONE) {
|
||||
newSrcFactor = GX::BL_SRCALPHA;
|
||||
if (newDstFactor == GX::BL_ZERO) {
|
||||
newDstFactor = flags.x0_blendMode > 6 ? GX::BL_ONE : GX::BL_INVSRCALPHA;
|
||||
if (flags.x0_blendMode > 4 && newSrcFactor == GX_BL_ONE) {
|
||||
newSrcFactor = GX_BL_SRCALPHA;
|
||||
if (newDstFactor == GX_BL_ZERO) {
|
||||
newDstFactor = flags.x0_blendMode > 6 ? GX_BL_ONE : GX_BL_INVSRCALPHA;
|
||||
}
|
||||
}
|
||||
|
||||
CGX::SetBlendMode(GX::BM_BLEND, newSrcFactor, newDstFactor, GX::LO_CLEAR);
|
||||
CGX::SetBlendMode(GX_BM_BLEND, newSrcFactor, newDstFactor, GX_LO_CLEAR);
|
||||
}
|
||||
|
||||
void CCubeMaterial::HandleDepth(CModelFlagsFlags modelFlags, CCubeMaterialFlags matFlags) {
|
||||
GX::Compare func = GX::NEVER;
|
||||
GXCompare func = GX_NEVER;
|
||||
if (!(modelFlags & CModelFlagBits::DepthTest)) {
|
||||
func = GX::ALWAYS;
|
||||
func = GX_ALWAYS;
|
||||
} else if (modelFlags & CModelFlagBits::DepthGreater) {
|
||||
func = modelFlags & CModelFlagBits::DepthNonInclusive ? GX::GREATER : GX::GEQUAL;
|
||||
func = modelFlags & CModelFlagBits::DepthNonInclusive ? GX_GREATER : GX_GEQUAL;
|
||||
} else {
|
||||
func = modelFlags & CModelFlagBits::DepthNonInclusive ? GX::LESS : GX::LEQUAL;
|
||||
func = modelFlags & CModelFlagBits::DepthNonInclusive ? GX_LESS : GX_LEQUAL;
|
||||
}
|
||||
bool depthWrite = modelFlags & CModelFlagBits::DepthUpdate && matFlags & CCubeMaterialFlagBits::fDepthWrite;
|
||||
CGX::SetZMode(true, func, depthWrite);
|
||||
|
@ -309,14 +309,14 @@ void CCubeMaterial::EnsureViewDepStateCached(const CCubeSurface* surface) {
|
|||
u32 CCubeMaterial::HandleColorChannels(u32 chanCount, u32 firstChan) {
|
||||
if (CCubeModel::sRenderModelShadow) {
|
||||
if (chanCount != 0) {
|
||||
CGX::SetChanAmbColor(CGX::EChannelId::Channel1, zeus::skBlack);
|
||||
CGX::SetChanMatColor(CGX::EChannelId::Channel1, zeus::skWhite);
|
||||
CGX::SetChanAmbColor(CGX::EChannelId::Channel1, GX_BLACK);
|
||||
CGX::SetChanMatColor(CGX::EChannelId::Channel1, GX_WHITE);
|
||||
|
||||
auto chan0Lights = CGraphics::g_LightActive & ~CCubeModel::sChannel0DisableLightMask;
|
||||
CGX::SetChanCtrl(CGX::EChannelId::Channel0, firstChan, chan0Lights);
|
||||
CGX::SetChanCtrl(CGX::EChannelId::Channel1, CCubeModel::sChannel1EnableLightMask);
|
||||
if (chan0Lights.any()) {
|
||||
CGX::SetChanMatColor(CGX::EChannelId::Channel0, zeus::skWhite);
|
||||
CGX::SetChanMatColor(CGX::EChannelId::Channel0, GX_WHITE);
|
||||
} else {
|
||||
CGX::SetChanMatColor(CGX::EChannelId::Channel0, CGX::GetChanAmbColor(CGX::EChannelId::Channel0));
|
||||
}
|
||||
|
@ -325,8 +325,8 @@ u32 CCubeMaterial::HandleColorChannels(u32 chanCount, u32 firstChan) {
|
|||
}
|
||||
|
||||
if (chanCount == 2) {
|
||||
CGX::SetChanAmbColor(CGX::EChannelId::Channel1, zeus::skBlack);
|
||||
CGX::SetChanMatColor(CGX::EChannelId::Channel1, zeus::skWhite);
|
||||
CGX::SetChanAmbColor(CGX::EChannelId::Channel1, GX_BLACK);
|
||||
CGX::SetChanMatColor(CGX::EChannelId::Channel1, GX_WHITE);
|
||||
} else {
|
||||
CGX::SetChanCtrl(CGX::EChannelId::Channel1, {});
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ u32 CCubeMaterial::HandleColorChannels(u32 chanCount, u32 firstChan) {
|
|||
} else {
|
||||
CGX::SetChanCtrl(CGX::EChannelId::Channel0, firstChan, CGraphics::g_LightActive);
|
||||
if (CGraphics::g_LightActive.any()) {
|
||||
CGX::SetChanMatColor(CGX::EChannelId::Channel0, zeus::skWhite);
|
||||
CGX::SetChanMatColor(CGX::EChannelId::Channel0, GX_WHITE);
|
||||
} else {
|
||||
CGX::SetChanMatColor(CGX::EChannelId::Channel0, CGX::GetChanAmbColor(CGX::EChannelId::Channel0));
|
||||
}
|
||||
|
@ -352,15 +352,15 @@ void CCubeMaterial::HandleTev(u32 tevCur, const u32* materialDataCur, const u32*
|
|||
const u32 colorOps = SBig(materialDataCur[2]);
|
||||
const u32 alphaOps = SBig(materialDataCur[3]);
|
||||
|
||||
const auto stage = static_cast<GX::TevStageID>(tevCur);
|
||||
const auto stage = static_cast<GXTevStageID>(tevCur);
|
||||
CGX::SetStandardDirectTev_Compressed(stage, colorArgs, alphaArgs, colorOps, alphaOps);
|
||||
|
||||
u32 tmtcFlags = SBig(*texMapTexCoordFlags);
|
||||
u32 matFlags = SBig(materialDataCur[4]);
|
||||
CGX::SetTevOrder(stage, static_cast<GX::TexCoordID>(tmtcFlags & 0xFF),
|
||||
static_cast<GX::TexMapID>(tmtcFlags >> 8 & 0xFF), static_cast<GX::ChannelID>(matFlags & 0xFF));
|
||||
CGX::SetTevKColorSel(stage, static_cast<GX::TevKColorSel>(matFlags >> 0x8 & 0xFF));
|
||||
CGX::SetTevKAlphaSel(stage, static_cast<GX::TevKAlphaSel>(matFlags >> 0x10 & 0xFF));
|
||||
CGX::SetTevOrder(stage, static_cast<GXTexCoordID>(tmtcFlags & 0xFF), static_cast<GXTexMapID>(tmtcFlags >> 8 & 0xFF),
|
||||
static_cast<GXChannelID>(matFlags & 0xFF));
|
||||
CGX::SetTevKColorSel(stage, static_cast<GXTevKColorSel>(matFlags >> 0x8 & 0xFF));
|
||||
CGX::SetTevKAlphaSel(stage, static_cast<GXTevKAlphaSel>(matFlags >> 0x10 & 0xFF));
|
||||
}
|
||||
|
||||
constexpr zeus::CTransform MvPostXf{
|
||||
|
@ -368,21 +368,21 @@ constexpr zeus::CTransform MvPostXf{
|
|||
{0.5f, 0.5f, 1.f},
|
||||
};
|
||||
|
||||
u32 CCubeMaterial::HandleAnimatedUV(const u32* uvAnim, GX::TexMtx texMtx, GX::PTTexMtx pttTexMtx) {
|
||||
u32 CCubeMaterial::HandleAnimatedUV(const u32* uvAnim, GXTexMtx texMtx, GXPTTexMtx pttTexMtx) {
|
||||
u32 type = SBig(*uvAnim);
|
||||
const float* params = reinterpret_cast<const float*>(uvAnim + 1);
|
||||
switch (type) {
|
||||
case 0: {
|
||||
auto xf = CGraphics::g_ViewMatrix.inverse().multiplyIgnoreTranslation(CGraphics::g_GXModelMatrix);
|
||||
xf.origin.zeroOut();
|
||||
GXLoadTexMtxImm(&xf, texMtx, GX::MTX3x4);
|
||||
GXLoadTexMtxImm(&MvPostXf, pttTexMtx, GX::MTX3x4);
|
||||
GXLoadTexMtxImm(&xf, texMtx, GX_MTX3x4);
|
||||
GXLoadTexMtxImm(&MvPostXf, pttTexMtx, GX_MTX3x4);
|
||||
return 1;
|
||||
}
|
||||
case 1: {
|
||||
auto xf = CGraphics::g_ViewMatrix.inverse() * CGraphics::g_GXModelMatrix;
|
||||
GXLoadTexMtxImm(&xf, texMtx, GX::MTX3x4);
|
||||
GXLoadTexMtxImm(&MvPostXf, pttTexMtx, GX::MTX3x4);
|
||||
GXLoadTexMtxImm(&xf, texMtx, GX_MTX3x4);
|
||||
GXLoadTexMtxImm(&MvPostXf, pttTexMtx, GX_MTX3x4);
|
||||
return 1;
|
||||
}
|
||||
case 2: {
|
||||
|
@ -392,7 +392,7 @@ u32 CCubeMaterial::HandleAnimatedUV(const u32* uvAnim, GX::TexMtx texMtx, GX::PT
|
|||
const float f4 = SBig(params[3]);
|
||||
const float seconds = CGraphics::GetSecondsMod900();
|
||||
const auto xf = zeus::CTransform::Translate(seconds * f3 + f1, seconds * f4 + f2, 0.f);
|
||||
GXLoadTexMtxImm(&xf, texMtx, GX::MTX3x4);
|
||||
GXLoadTexMtxImm(&xf, texMtx, GX_MTX3x4);
|
||||
return 5;
|
||||
}
|
||||
case 3: {
|
||||
|
@ -406,7 +406,7 @@ u32 CCubeMaterial::HandleAnimatedUV(const u32* uvAnim, GX::TexMtx texMtx, GX::PT
|
|||
xf.basis[1][1] = acos;
|
||||
xf.origin[0] = (1.f - (acos - asin)) * 0.5f;
|
||||
xf.origin[1] = (1.f - (asin + acos)) * 0.5f;
|
||||
GXLoadTexMtxImm(&xf, texMtx, GX::MTX3x4);
|
||||
GXLoadTexMtxImm(&xf, texMtx, GX_MTX3x4);
|
||||
return 3;
|
||||
}
|
||||
case 4:
|
||||
|
@ -420,7 +420,7 @@ u32 CCubeMaterial::HandleAnimatedUV(const u32* uvAnim, GX::TexMtx texMtx, GX::PT
|
|||
xf.origin.x() = 0.f;
|
||||
xf.origin.y() = std::trunc(SBig(params[1]) * std::fmod(value, 1.f)) * SBig(params[2]);
|
||||
}
|
||||
GXLoadTexMtxImm(&xf, texMtx, GX::MTX3x4);
|
||||
GXLoadTexMtxImm(&xf, texMtx, GX_MTX3x4);
|
||||
return 5;
|
||||
}
|
||||
case 6: {
|
||||
|
@ -437,8 +437,8 @@ u32 CCubeMaterial::HandleAnimatedUV(const u32* uvAnim, GX::TexMtx texMtx, GX::PT
|
|||
1.f,
|
||||
},
|
||||
};
|
||||
GXLoadTexMtxImm(&mtx, texMtx, GX::MTX3x4);
|
||||
GXLoadTexMtxImm(&postMtx, pttTexMtx, GX::MTX3x4);
|
||||
GXLoadTexMtxImm(&mtx, texMtx, GX_MTX3x4);
|
||||
GXLoadTexMtxImm(&postMtx, pttTexMtx, GX_MTX3x4);
|
||||
return 1;
|
||||
}
|
||||
case 7: {
|
||||
|
@ -457,8 +457,8 @@ u32 CCubeMaterial::HandleAnimatedUV(const u32* uvAnim, GX::TexMtx texMtx, GX::PT
|
|||
},
|
||||
zeus::CVector3f{xy, z, 1.f},
|
||||
};
|
||||
GXLoadTexMtxImm(&mtx, texMtx, GX::MTX3x4);
|
||||
GXLoadTexMtxImm(&postMtx, pttTexMtx, GX::MTX3x4);
|
||||
GXLoadTexMtxImm(&mtx, texMtx, GX_MTX3x4);
|
||||
GXLoadTexMtxImm(&postMtx, pttTexMtx, GX_MTX3x4);
|
||||
return 3;
|
||||
}
|
||||
default:
|
||||
|
@ -476,38 +476,38 @@ void CCubeMaterial::HandleTransparency(u32& finalTevCount, u32& finalKColorCount
|
|||
}
|
||||
if (modelFlags.x0_blendMode == 3) {
|
||||
// Stage outputting splatted KAlpha as color to reg0
|
||||
auto stage = static_cast<GX::TevStageID>(finalTevCount);
|
||||
CGX::SetTevColorIn(stage, GX::CC_ZERO, GX::CC_ZERO, GX::CC_ZERO, GX::CC_KONST);
|
||||
CGX::SetTevAlphaIn(stage, GX::CA_ZERO, GX::CA_ZERO, GX::CA_ZERO, GX::CA_APREV);
|
||||
CGX::SetTevColorOp(stage, GX::TEV_ADD, GX::TB_ZERO, GX::CS_SCALE_1, true, GX::TEVREG0);
|
||||
CGX::SetTevKColorSel(stage, static_cast<GX::TevKColorSel>(finalKColorCount + GX::TEV_KCSEL_K0_A));
|
||||
CGX::SetTevAlphaOp(stage, GX::TEV_ADD, GX::TB_ZERO, GX::CS_SCALE_1, true, GX::TEVPREV);
|
||||
CGX::SetTevOrder(stage, GX::TEXCOORD_NULL, GX::TEXMAP_NULL, GX::COLOR_NULL);
|
||||
auto stage = static_cast<GXTevStageID>(finalTevCount);
|
||||
CGX::SetTevColorIn(stage, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_KONST);
|
||||
CGX::SetTevAlphaIn(stage, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_APREV);
|
||||
CGX::SetTevColorOp(stage, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVREG0);
|
||||
CGX::SetTevKColorSel(stage, static_cast<GXTevKColorSel>(finalKColorCount + GX_TEV_KCSEL_K0_A));
|
||||
CGX::SetTevAlphaOp(stage, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
|
||||
CGX::SetTevOrder(stage, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR_NULL);
|
||||
CGX::SetTevDirect(stage);
|
||||
|
||||
// Stage interpolating from splatted KAlpha using KColor
|
||||
stage = static_cast<GX::TevStageID>(stage + 1);
|
||||
CGX::SetTevColorIn(stage, GX::CC_CPREV, GX::CC_C0, GX::CC_KONST, GX::CC_ZERO);
|
||||
CGX::SetTevAlphaIn(stage, GX::CA_ZERO, GX::CA_ZERO, GX::CA_ZERO, GX::CA_APREV);
|
||||
CGX::SetTevKColorSel(stage, static_cast<GX::TevKColorSel>(finalKColorCount + GX::TEV_KCSEL_K0));
|
||||
stage = static_cast<GXTevStageID>(stage + 1);
|
||||
CGX::SetTevColorIn(stage, GX_CC_CPREV, GX_CC_C0, GX_CC_KONST, GX_CC_ZERO);
|
||||
CGX::SetTevAlphaIn(stage, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_APREV);
|
||||
CGX::SetTevKColorSel(stage, static_cast<GXTevKColorSel>(finalKColorCount + GX_TEV_KCSEL_K0));
|
||||
CGX::SetStandardTevColorAlphaOp(stage);
|
||||
CGX::SetTevDirect(stage);
|
||||
CGX::SetTevOrder(stage, GX::TEXCOORD_NULL, GX::TEXMAP_NULL, GX::COLOR_NULL);
|
||||
CGX::SetTevKColor(static_cast<GX::TevKColorID>(finalKColorCount), modelFlags.x4_color);
|
||||
CGX::SetTevOrder(stage, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR_NULL);
|
||||
CGX::SetTevKColor(static_cast<GXTevKColorID>(finalKColorCount), modelFlags.x4_color);
|
||||
|
||||
finalKColorCount += 1;
|
||||
finalTevCount += 2;
|
||||
} else {
|
||||
auto stage = static_cast<GX::TevStageID>(finalTevCount);
|
||||
auto stage = static_cast<GXTevStageID>(finalTevCount);
|
||||
if (modelFlags.x0_blendMode == 8) {
|
||||
CGX::SetTevAlphaIn(stage, GX::CA_ZERO, GX::CA_ZERO, GX::CA_ZERO, GX::CA_KONST); // Set KAlpha
|
||||
CGX::SetTevAlphaIn(stage, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_KONST); // Set KAlpha
|
||||
} else {
|
||||
CGX::SetTevAlphaIn(stage, GX::CA_ZERO, GX::CA_KONST, GX::CA_APREV, GX::CA_ZERO); // Mul KAlpha
|
||||
CGX::SetTevAlphaIn(stage, GX_CA_ZERO, GX_CA_KONST, GX_CA_APREV, GX_CA_ZERO); // Mul KAlpha
|
||||
}
|
||||
if (modelFlags.x0_blendMode == 2) {
|
||||
CGX::SetTevColorIn(stage, GX::CC_ZERO, GX::CC_ONE, GX::CC_CPREV, GX::CC_KONST); // Add KColor
|
||||
CGX::SetTevColorIn(stage, GX_CC_ZERO, GX_CC_ONE, GX_CC_CPREV, GX_CC_KONST); // Add KColor
|
||||
} else {
|
||||
CGX::SetTevColorIn(stage, GX::CC_ZERO, GX::CC_KONST, GX::CC_CPREV, GX::CC_ZERO); // Mul KColor
|
||||
CGX::SetTevColorIn(stage, GX_CC_ZERO, GX_CC_KONST, GX_CC_CPREV, GX_CC_ZERO); // Mul KColor
|
||||
}
|
||||
CGX::SetStandardTevColorAlphaOp(stage);
|
||||
|
||||
|
@ -515,10 +515,10 @@ void CCubeMaterial::HandleTransparency(u32& finalTevCount, u32& finalKColorCount
|
|||
finalACFlags = 0x100;
|
||||
|
||||
CGX::SetTevDirect(stage);
|
||||
CGX::SetTevOrder(stage, GX::TEXCOORD_NULL, GX::TEXMAP_NULL, GX::COLOR_NULL);
|
||||
CGX::SetTevKColor(static_cast<GX::TevKColorID>(finalKColorCount), modelFlags.x4_color);
|
||||
CGX::SetTevKColorSel(stage, static_cast<GX::TevKColorSel>(finalKColorCount + GX::TEV_KCSEL_K0));
|
||||
CGX::SetTevKAlphaSel(stage, static_cast<GX::TevKAlphaSel>(finalKColorCount + GX::TEV_KASEL_K0_A));
|
||||
CGX::SetTevOrder(stage, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR_NULL);
|
||||
CGX::SetTevKColor(static_cast<GXTevKColorID>(finalKColorCount), modelFlags.x4_color);
|
||||
CGX::SetTevKColorSel(stage, static_cast<GXTevKColorSel>(finalKColorCount + GX_TEV_KCSEL_K0));
|
||||
CGX::SetTevKAlphaSel(stage, static_cast<GXTevKAlphaSel>(finalKColorCount + GX_TEV_KASEL_K0_A));
|
||||
|
||||
finalTevCount += 1;
|
||||
finalKColorCount += 1;
|
||||
|
@ -528,22 +528,22 @@ void CCubeMaterial::HandleTransparency(u32& finalTevCount, u32& finalKColorCount
|
|||
u32 CCubeMaterial::HandleReflection(bool usesTevReg2, u32 indTexSlot, u32 r5, u32 finalTevCount, u32 texCount,
|
||||
u32 tcgCount, u32 finalKColorCount, u32& finalCCFlags, u32& finalACFlags) {
|
||||
u32 out = 0;
|
||||
GX::TevColorArg colorArg = GX::CC_KONST;
|
||||
GXTevColorArg colorArg = GX_CC_KONST;
|
||||
if (usesTevReg2) {
|
||||
colorArg = GX::CC_C2;
|
||||
const auto stage = static_cast<GX::TevStageID>(finalTevCount);
|
||||
CGX::SetTevColorIn(stage, GX::CC_ZERO, GX::CC_C2, GX::CC_KONST, GX::CC_ZERO);
|
||||
CGX::SetTevAlphaIn(stage, GX::CA_ZERO, GX::CA_ZERO, GX::CA_ZERO, GX::CA_A2);
|
||||
CGX::SetTevColorOp(stage, GX::TEV_ADD, GX::TB_ZERO, GX::CS_SCALE_1, true, GX::TEVREG2);
|
||||
CGX::SetTevAlphaOp(stage, GX::TEV_ADD, GX::TB_ZERO, GX::CS_SCALE_1, true, GX::TEVREG2);
|
||||
CGX::SetTevOrder(stage, GX::TEXCOORD_NULL, GX::TEXMAP_NULL, GX::COLOR_ZERO);
|
||||
colorArg = GX_CC_C2;
|
||||
const auto stage = static_cast<GXTevStageID>(finalTevCount);
|
||||
CGX::SetTevColorIn(stage, GX_CC_ZERO, GX_CC_C2, GX_CC_KONST, GX_CC_ZERO);
|
||||
CGX::SetTevAlphaIn(stage, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_A2);
|
||||
CGX::SetTevColorOp(stage, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVREG2);
|
||||
CGX::SetTevAlphaOp(stage, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVREG2);
|
||||
CGX::SetTevOrder(stage, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR_ZERO);
|
||||
out = 1;
|
||||
}
|
||||
CGX::SetTevKColor(static_cast<GX::TevKColorID>(finalKColorCount), zeus::CColor{sReflectionAlpha, sReflectionAlpha});
|
||||
CGX::SetTevKColorSel(static_cast<GX::TevStageID>(finalTevCount),
|
||||
static_cast<GX::TevKColorSel>(GX::TEV_KCSEL_K0 + finalKColorCount));
|
||||
CGX::SetTevKColor(static_cast<GXTevKColorID>(finalKColorCount), zeus::CColor{sReflectionAlpha, sReflectionAlpha});
|
||||
CGX::SetTevKColorSel(static_cast<GXTevStageID>(finalTevCount),
|
||||
static_cast<GXTevKColorSel>(GX_TEV_KCSEL_K0 + finalKColorCount));
|
||||
|
||||
const auto stage = static_cast<GX::TevStageID>(finalTevCount + out);
|
||||
const auto stage = static_cast<GXTevStageID>(finalTevCount + out);
|
||||
// tex = g_Renderer->GetRealReflection
|
||||
// tex.Load(texCount, 0)
|
||||
|
||||
|
@ -558,10 +558,10 @@ u32 CCubeMaterial::HandleReflection(bool usesTevReg2, u32 indTexSlot, u32 r5, u3
|
|||
}
|
||||
|
||||
void CCubeMaterial::DoPassthru(u32 finalTevCount) {
|
||||
const auto stage = static_cast<GX::TevStageID>(finalTevCount);
|
||||
CGX::SetTevColorIn(stage, GX::CC_ZERO, GX::CC_ZERO, GX::CC_ZERO, GX::CC_CPREV);
|
||||
CGX::SetTevAlphaIn(stage, GX::CA_ZERO, GX::CA_ZERO, GX::CA_ZERO, GX::CA_APREV);
|
||||
CGX::SetTevOrder(stage, GX::TEXCOORD_NULL, GX::TEXMAP_NULL, GX::COLOR_NULL);
|
||||
const auto stage = static_cast<GXTevStageID>(finalTevCount);
|
||||
CGX::SetTevColorIn(stage, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_CPREV);
|
||||
CGX::SetTevAlphaIn(stage, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_APREV);
|
||||
CGX::SetTevOrder(stage, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR_NULL);
|
||||
CGX::SetTevDirect(stage);
|
||||
CGX::SetStandardTevColorAlphaOp(stage);
|
||||
}
|
||||
|
@ -571,14 +571,14 @@ void CCubeMaterial::DoModelShadow(u32 texCount, u32 tcgCount) {
|
|||
// TODO
|
||||
}
|
||||
|
||||
static GX::TevStageID sCurrentTevStage = GX::NULL_STAGE;
|
||||
static GXTevStageID sCurrentTevStage = GX_MAX_TEVSTAGE;
|
||||
void CCubeMaterial::EnsureTevsDirect() {
|
||||
if (sCurrentTevStage == GX::NULL_STAGE) {
|
||||
if (sCurrentTevStage == GX_MAX_TEVSTAGE) {
|
||||
return;
|
||||
}
|
||||
|
||||
CGX::SetNumIndStages(0);
|
||||
CGX::SetTevDirect(sCurrentTevStage);
|
||||
sCurrentTevStage = GX::NULL_STAGE;
|
||||
sCurrentTevStage = GX_MAX_TEVSTAGE;
|
||||
}
|
||||
} // namespace metaforce
|
||||
|
|
|
@ -64,7 +64,7 @@ private:
|
|||
static void HandleDepth(CModelFlagsFlags modelFlags, CCubeMaterialFlags matFlags);
|
||||
static u32 HandleColorChannels(u32 chanCount, u32 firstChan);
|
||||
static void HandleTev(u32 tevCur, const u32* materialDataCur, const u32* texMapTexCoordFlags, bool shadowMapsEnabled);
|
||||
static u32 HandleAnimatedUV(const u32* uvAnim, GX::TexMtx texMtx, GX::PTTexMtx pttTexMtx);
|
||||
static u32 HandleAnimatedUV(const u32* uvAnim, GXTexMtx texMtx, GXPTTexMtx pttTexMtx);
|
||||
static void HandleTransparency(u32& finalTevCount, u32& finalKColorCount, const CModelFlags& modelFlags,
|
||||
u32 blendFactors, u32& finalCCFlags, u32& finalACFlags);
|
||||
static u32 HandleReflection(bool usesTevReg2, u32 indTexSlot, u32 r5, u32 finalTevCount, u32 texCount, u32 tcgCount,
|
||||
|
|
|
@ -177,12 +177,12 @@ void CCubeModel::DrawNormal(TConstVectorRef positions, TConstVectorRef normals,
|
|||
CGX::SetNumIndStages(0);
|
||||
CGX::SetNumTevStages(1);
|
||||
CGX::SetNumTexGens(1); // TODO should this be 0?
|
||||
CGX::SetZMode(true, GX::LEQUAL, true);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD_NULL, GX::TEXMAP_NULL, GX::COLOR_NULL);
|
||||
CGX::SetTevColorIn(GX::TEVSTAGE0, GX::CC_ZERO, GX::CC_ZERO, GX::CC_ZERO, GX::CC_ZERO);
|
||||
CGX::SetTevAlphaIn(GX::TEVSTAGE0, GX::CA_ZERO, GX::CA_ZERO, GX::CA_ZERO, GX::CA_ZERO);
|
||||
CGX::SetStandardTevColorAlphaOp(GX::TEVSTAGE0);
|
||||
CGX::SetBlendMode(GX::BM_BLEND, GX::BL_ZERO, GX::BL_ONE, GX::LO_CLEAR);
|
||||
CGX::SetZMode(true, GX_LEQUAL, true);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR_NULL);
|
||||
CGX::SetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO);
|
||||
CGX::SetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
|
||||
CGX::SetStandardTevColorAlphaOp(GX_TEVSTAGE0);
|
||||
CGX::SetBlendMode(GX_BM_BLEND, GX_BL_ZERO, GX_BL_ONE, GX_LO_CLEAR);
|
||||
DrawFlat(positions, normals, surfaces);
|
||||
}
|
||||
|
||||
|
@ -259,8 +259,8 @@ void CCubeModel::EnableShadowMaps(const CTexture& shadowTex, const zeus::CTransf
|
|||
void CCubeModel::DisableShadowMaps() { sRenderModelShadow = false; }
|
||||
|
||||
void CCubeModel::SetArraysCurrent() {
|
||||
CGX::SetArray(GX::VA_POS, x0_modelInstance.GetVertexPointer(), true);
|
||||
CGX::SetArray(GX::VA_NRM, x0_modelInstance.GetNormalPointer(), true);
|
||||
CGX::SetArray(GX_VA_POS, x0_modelInstance.GetVertexPointer(), true);
|
||||
CGX::SetArray(GX_VA_NRM, x0_modelInstance.GetNormalPointer(), true);
|
||||
SetStaticArraysCurrent();
|
||||
}
|
||||
|
||||
|
@ -280,8 +280,8 @@ void CCubeModel::SetRenderModelBlack(bool v) {
|
|||
}
|
||||
|
||||
void CCubeModel::SetSkinningArraysCurrent(TConstVectorRef positions, TConstVectorRef normals) {
|
||||
CGX::SetArray(GX::VA_POS, positions, false);
|
||||
CGX::SetArray(GX::VA_NRM, normals, false);
|
||||
CGX::SetArray(GX_VA_POS, positions, false);
|
||||
CGX::SetArray(GX_VA_NRM, normals, false);
|
||||
// colors unused
|
||||
SetStaticArraysCurrent();
|
||||
}
|
||||
|
@ -294,22 +294,29 @@ void CCubeModel::SetStaticArraysCurrent() {
|
|||
sUsingPackedLightmaps = false;
|
||||
}
|
||||
if (sUsingPackedLightmaps) {
|
||||
CGX::SetArray(GX::VA_TEX0, packedTexCoords, true);
|
||||
CGX::SetArray(GX_VA_TEX0, packedTexCoords, true);
|
||||
} else {
|
||||
CGX::SetArray(GX::VA_TEX0, texCoords, true);
|
||||
CGX::SetArray(GX_VA_TEX0, texCoords, true);
|
||||
}
|
||||
for (int i = GX_VA_TEX1; i <= GX_VA_TEX7; ++i) {
|
||||
CGX::SetArray(static_cast<GXAttr>(i), texCoords, true);
|
||||
}
|
||||
// TexCoord1 is currently used for all remaining
|
||||
CGX::SetArray(GX::VA_TEX1, texCoords, true);
|
||||
CCubeMaterial::KillCachedViewDepState();
|
||||
}
|
||||
|
||||
void CCubeModel::SetUsingPackedLightmaps(bool v) {
|
||||
sUsingPackedLightmaps = v;
|
||||
if (v) {
|
||||
CGX::SetArray(GX::VA_TEX0, x0_modelInstance.GetPackedTCPointer(), true);
|
||||
CGX::SetArray(GX_VA_TEX0, x0_modelInstance.GetPackedTCPointer(), true);
|
||||
} else {
|
||||
CGX::SetArray(GX::VA_TEX0, x0_modelInstance.GetTCPointer(), true);
|
||||
CGX::SetArray(GX_VA_TEX0, x0_modelInstance.GetTCPointer(), true);
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
aurora::Vec2<float> cinput_stream_helper(CInputStream& in) {
|
||||
float x = in.ReadFloat();
|
||||
float y = in.ReadFloat();
|
||||
return {x, y};
|
||||
}
|
||||
} // namespace metaforce
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <aurora/math.hpp>
|
||||
|
||||
#include "CStopwatch.hpp"
|
||||
#include "CToken.hpp"
|
||||
|
@ -138,4 +139,7 @@ private:
|
|||
static GX::LightMask sChannel0DisableLightMask;
|
||||
static GX::LightMask sChannel1EnableLightMask;
|
||||
};
|
||||
|
||||
template <>
|
||||
aurora::Vec2<float> cinput_stream_helper(CInputStream& in);
|
||||
} // namespace metaforce
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include "Runtime/Particle/CElementGen.hpp"
|
||||
#include "Runtime/CDvdFile.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace metaforce {
|
||||
static logvisor::Module Log("CCubeRenderer");
|
||||
|
||||
|
@ -792,22 +794,22 @@ void CCubeRenderer::SetDebugOption(IRenderer::EDebugOption option, s32 value) {
|
|||
|
||||
void CCubeRenderer::BeginPrimitive(IRenderer::EPrimitiveType type, s32 nverts) {
|
||||
constexpr std::array vtxDescList{
|
||||
GX::VtxDescList{GX::VA_POS, GX::DIRECT},
|
||||
GX::VtxDescList{GX::VA_NRM, GX::DIRECT},
|
||||
GX::VtxDescList{GX::VA_CLR0, GX::DIRECT},
|
||||
GX::VtxDescList{},
|
||||
GXVtxDescList{GX_VA_POS, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_NRM, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_CLR0, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_NULL, GX_NONE},
|
||||
};
|
||||
CGX::SetChanCtrl(CGX::EChannelId::Channel0, false, GX::SRC_REG, GX::SRC_VTX, {}, GX::DF_NONE, GX::AF_NONE);
|
||||
CGX::SetChanCtrl(CGX::EChannelId::Channel0, false, GX_SRC_REG, GX_SRC_VTX, {}, GX_DF_NONE, GX_AF_NONE);
|
||||
CGX::SetNumChans(1);
|
||||
CGX::SetNumTexGens(0);
|
||||
CGX::SetNumTevStages(1);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD_NULL, GX::TEXMAP_NULL, GX::COLOR0A0);
|
||||
CGX::SetTevColorIn(GX::TEVSTAGE0, GX::CC_ZERO, GX::CC_ZERO, GX::CC_ZERO, GX::CC_RASC);
|
||||
CGX::SetTevAlphaIn(GX::TEVSTAGE0, GX::CA_ZERO, GX::CA_ZERO, GX::CA_ZERO, GX::CA_RASA);
|
||||
CGX::SetStandardTevColorAlphaOp(GX::TEVSTAGE0);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
CGX::SetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_RASC);
|
||||
CGX::SetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_RASA);
|
||||
CGX::SetStandardTevColorAlphaOp(GX_TEVSTAGE0);
|
||||
x18_primVertCount = nverts;
|
||||
CGX::SetVtxDescv(vtxDescList.data());
|
||||
CGX::Begin(GX::Primitive(type), GX::VTXFMT0, nverts);
|
||||
CGX::Begin(GXPrimitive(type), GX_VTXFMT0, nverts);
|
||||
}
|
||||
|
||||
void CCubeRenderer::BeginLines(s32 nverts) { BeginPrimitive(EPrimitiveType::Lines, nverts); }
|
||||
|
@ -864,22 +866,22 @@ void CCubeRenderer::DrawThermalModel(CModel& model, const zeus::CColor& multCol,
|
|||
|
||||
void CCubeRenderer::DrawModelDisintegrate(CModel& model, CTexture& tex, const zeus::CColor& color,
|
||||
TConstVectorRef positions, TConstVectorRef normals, float t) {
|
||||
tex.Load(GX::TEXMAP0, EClampMode::Clamp);
|
||||
tex.Load(GX_TEXMAP0, EClampMode::Clamp);
|
||||
CGX::SetNumIndStages(0);
|
||||
CGX::SetNumTevStages(2);
|
||||
CGX::SetNumTexGens(2);
|
||||
CGX::SetNumChans(0);
|
||||
CGX::SetBlendMode(GX::BM_BLEND, GX::BL_SRCALPHA, GX::BL_INVSRCALPHA, GX::LO_CLEAR);
|
||||
CGX::SetStandardTevColorAlphaOp(GX::TEVSTAGE0);
|
||||
CGX::SetStandardTevColorAlphaOp(GX::TEVSTAGE1);
|
||||
CGX::SetTevColorIn(GX::TEVSTAGE0, GX::CC_ZERO, GX::CC_ZERO, GX::CC_ZERO, GX::CC_TEXC);
|
||||
CGX::SetTevAlphaIn(GX::TEVSTAGE0, GX::CA_ZERO, GX::CA_ZERO, GX::CA_ZERO, GX::CA_TEXA);
|
||||
CGX::SetTevColorIn(GX::TEVSTAGE1, GX::CC_ZERO, GX::CC_TEXC, GX::CC_CPREV, GX::CC_KONST);
|
||||
CGX::SetTevAlphaIn(GX::TEVSTAGE1, GX::CA_ZERO, GX::CA_TEXA, GX::CA_APREV, GX::CA_ZERO);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD0, GX::TEXMAP0, GX::COLOR_NULL);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE1, GX::TEXCOORD1, GX::TEXMAP0, GX::COLOR_NULL);
|
||||
CGX::SetTevKColorSel(GX::TEVSTAGE1, GX::TEV_KCSEL_K0);
|
||||
CGX::SetTevKColor(GX::KCOLOR0, color);
|
||||
CGX::SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR);
|
||||
CGX::SetStandardTevColorAlphaOp(GX_TEVSTAGE0);
|
||||
CGX::SetStandardTevColorAlphaOp(GX_TEVSTAGE1);
|
||||
CGX::SetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_TEXC);
|
||||
CGX::SetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_TEXA);
|
||||
CGX::SetTevColorIn(GX_TEVSTAGE1, GX_CC_ZERO, GX_CC_TEXC, GX_CC_CPREV, GX_CC_KONST);
|
||||
CGX::SetTevAlphaIn(GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_TEXA, GX_CA_APREV, GX_CA_ZERO);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD1, GX_TEXMAP0, GX_COLOR_NULL);
|
||||
CGX::SetTevKColorSel(GX_TEVSTAGE1, GX_TEV_KCSEL_K0);
|
||||
CGX::SetTevKColor(GX_KCOLOR0, color);
|
||||
const auto bounds = model.GetInstance().GetBounds();
|
||||
const auto rotation = zeus::CTransform::RotateX(zeus::degToRad(-45.f));
|
||||
const auto transformedBounds = bounds.getTransformedAABox(rotation);
|
||||
|
@ -901,43 +903,43 @@ void CCubeRenderer::DrawModelDisintegrate(CModel& model, CTexture& tex, const ze
|
|||
},
|
||||
zeus::CVector3f{t, ptTex1.origin.y(), 1.f},
|
||||
};
|
||||
GXLoadTexMtxImm(&xf, GX::TEXMTX0, GX::MTX3x4);
|
||||
GXLoadTexMtxImm(&ptTex0, GX::PTTEXMTX0, GX::MTX3x4);
|
||||
GXLoadTexMtxImm(&ptTex1, GX::PTTEXMTX1, GX::MTX3x4);
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD0, GX::TG_MTX3x4, GX::TG_POS, GX::TEXMTX0, false, GX::PTTEXMTX0);
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD1, GX::TG_MTX3x4, GX::TG_POS, GX::TEXMTX0, false, GX::PTTEXMTX1);
|
||||
CGX::SetAlphaCompare(GX::GREATER, 0, GX::AOP_AND, GX::ALWAYS, 0);
|
||||
CGX::SetZMode(true, GX::LEQUAL, true);
|
||||
GXLoadTexMtxImm(&xf, GX_TEXMTX0, GX_MTX3x4);
|
||||
GXLoadTexMtxImm(&ptTex0, GX_PTTEXMTX0, GX_MTX3x4);
|
||||
GXLoadTexMtxImm(&ptTex1, GX_PTTEXMTX1, GX_MTX3x4);
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX3x4, GX_TG_POS, GX_TEXMTX0, false, GX_PTTEXMTX0);
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD1, GX_TG_MTX3x4, GX_TG_POS, GX_TEXMTX0, false, GX_PTTEXMTX1);
|
||||
CGX::SetAlphaCompare(GX_GREATER, 0, GX_AOP_AND, GX_ALWAYS, 0);
|
||||
CGX::SetZMode(true, GX_LEQUAL, true);
|
||||
model.UpdateLastFrame();
|
||||
model.GetInstance().DrawFlat(positions, normals, ESurfaceSelection::All);
|
||||
CGX::SetAlphaCompare(GX::ALWAYS, 0, GX::AOP_AND, GX::ALWAYS, 0);
|
||||
CGX::SetAlphaCompare(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0);
|
||||
}
|
||||
|
||||
void CCubeRenderer::DrawModelFlat(CModel& model, const CModelFlags& flags, bool unsortedOnly, TConstVectorRef positions,
|
||||
TConstVectorRef normals) {
|
||||
if (flags.x0_blendMode >= 7) {
|
||||
CGX::SetBlendMode(GX::BM_BLEND, GX::BL_SRCALPHA, GX::BL_ONE, GX::LO_CLEAR);
|
||||
CGX::SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_ONE, GX_LO_CLEAR);
|
||||
} else if (flags.x0_blendMode >= 5) {
|
||||
CGX::SetBlendMode(GX::BM_BLEND, GX::BL_SRCALPHA, GX::BL_INVSRCALPHA, GX::LO_CLEAR);
|
||||
CGX::SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR);
|
||||
} else {
|
||||
CGX::SetBlendMode(GX::BM_BLEND, GX::BL_ONE, GX::BL_ZERO, GX::LO_CLEAR);
|
||||
CGX::SetBlendMode(GX_BM_BLEND, GX_BL_ONE, GX_BL_ZERO, GX_LO_CLEAR);
|
||||
}
|
||||
CGX::SetZMode(true, flags.x2_flags & CModelFlagBits::DepthTest ? GX::LEQUAL : GX::ALWAYS,
|
||||
CGX::SetZMode(true, flags.x2_flags & CModelFlagBits::DepthTest ? GX_LEQUAL : GX_ALWAYS,
|
||||
flags.x2_flags.IsSet(CModelFlagBits::DepthUpdate));
|
||||
CGX::SetNumTevStages(1);
|
||||
CGX::SetNumTexGens(1);
|
||||
CGX::SetNumChans(0);
|
||||
CGX::SetNumIndStages(0);
|
||||
CGX::SetAlphaCompare(GX::ALWAYS, 0, GX::AOP_AND, GX::ALWAYS, 0);
|
||||
CGX::SetTevColorIn(GX::TEVSTAGE0, GX::CC_ZERO, GX::CC_ZERO, GX::CC_ZERO, GX::CC_KONST);
|
||||
CGX::SetTevAlphaIn(GX::TEVSTAGE0, GX::CA_ZERO, GX::CA_ZERO, GX::CA_ZERO, GX::CA_KONST);
|
||||
CGX::SetTevKColor(GX::KCOLOR0, flags.x4_color);
|
||||
CGX::SetTevKColorSel(GX::TEVSTAGE0, GX::TEV_KCSEL_K0);
|
||||
CGX::SetTevKAlphaSel(GX::TEVSTAGE0, GX::TEV_KASEL_K0_A);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD_NULL, GX::TEXMAP_NULL, GX::COLOR_NULL);
|
||||
CGX::SetStandardTevColorAlphaOp(GX::TEVSTAGE0);
|
||||
CGX::SetTevDirect(GX::TEVSTAGE0);
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD0, GX::TG_MTX2x4, GX::TG_POS, GX::IDENTITY, false, GX::PTIDENTITY);
|
||||
CGX::SetAlphaCompare(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0);
|
||||
CGX::SetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_KONST);
|
||||
CGX::SetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_KONST);
|
||||
CGX::SetTevKColor(GX_KCOLOR0, flags.x4_color);
|
||||
CGX::SetTevKColorSel(GX_TEVSTAGE0, GX_TEV_KCSEL_K0);
|
||||
CGX::SetTevKAlphaSel(GX_TEVSTAGE0, GX_TEV_KASEL_K0_A);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR_NULL);
|
||||
CGX::SetStandardTevColorAlphaOp(GX_TEVSTAGE0);
|
||||
CGX::SetTevDirect(GX_TEVSTAGE0);
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_POS, GX_IDENTITY, false, GX_PTIDENTITY);
|
||||
model.UpdateLastFrame();
|
||||
model.GetInstance().DrawFlat(positions, normals, unsortedOnly ? ESurfaceSelection::Unsorted : ESurfaceSelection::All);
|
||||
}
|
||||
|
@ -979,28 +981,29 @@ void CCubeRenderer::DoThermalBlendCold() {
|
|||
const auto width = CGraphics::GetViewportWidth();
|
||||
const auto top = CGraphics::GetViewportTop();
|
||||
const auto left = CGraphics::GetViewportLeft();
|
||||
CGX::SetZMode(true, GX::LEQUAL, false);
|
||||
CGX::SetZMode(true, GX_LEQUAL, false);
|
||||
// GXSetTexCopySrc(left, top, width, height);
|
||||
// GXSetTexCopyDst(width, height, GX::TF_I4, false);
|
||||
// GXSetTexCopyDst(width, height, GX_TF_I4, false);
|
||||
// GXCopyTex(sSpareTextureData, true);
|
||||
CGraphics::ResolveSpareTexture(
|
||||
aurora::gfx::ClipRect{
|
||||
.x = static_cast<int32_t>(left),
|
||||
.y = static_cast<int32_t>(top),
|
||||
.width = static_cast<int32_t>(width),
|
||||
.height = static_cast<int32_t>(height),
|
||||
},
|
||||
0, GX::TF_I4);
|
||||
// CGraphics::LoadDolphinSpareTexture(width, height, GX::TF_I4, nullptr, GX::TEXMAP7);
|
||||
CGraphics::LoadDolphinSpareTexture(0, GX::TF_I4, GX::TEXMAP7);
|
||||
// TODO TODO TODO
|
||||
// CGraphics::ResolveSpareTexture(
|
||||
// aurora::gfx::ClipRect{
|
||||
// .x = static_cast<int32_t>(left),
|
||||
// .y = static_cast<int32_t>(top),
|
||||
// .width = static_cast<int32_t>(width),
|
||||
// .height = static_cast<int32_t>(height),
|
||||
// },
|
||||
// 0, GX_TF_I4);
|
||||
// CGraphics::LoadDolphinSpareTexture(width, height, GX_TF_I4, nullptr, GX_TEXMAP7);
|
||||
CGraphics::LoadDolphinSpareTexture(0, GX_TF_I4, GX_TEXMAP7);
|
||||
|
||||
// Upload random static texture (game reads from .text)
|
||||
const u8* buf = CDvdFile::GetDolBuf() + 0x4f60;
|
||||
u8* out = m_thermalRandomStatic.Lock();
|
||||
memcpy(out, buf + ROUND_UP_32(x2a8_thermalRand.Next()), m_thermalRandomStatic.GetMemoryAllocated());
|
||||
m_thermalRandomStatic.UnLock();
|
||||
m_thermalRandomStatic.Load(GX::TEXMAP0, EClampMode::Clamp);
|
||||
m_thermalRandomStatic.Load(GX::TEXMAP1, EClampMode::Clamp);
|
||||
m_thermalRandomStatic.Load(GX_TEXMAP0, EClampMode::Clamp);
|
||||
m_thermalRandomStatic.Load(GX_TEXMAP1, EClampMode::Clamp);
|
||||
|
||||
// Configure indirect texturing
|
||||
const float level = std::clamp(x2f0_thermalVisorLevel * 0.5f, 0.f, 0.5f);
|
||||
|
@ -1009,10 +1012,10 @@ void CCubeRenderer::DoThermalBlendCold() {
|
|||
aurora::Vec2{0.f, 0.f},
|
||||
aurora::Vec2{0.f, level},
|
||||
};
|
||||
GXSetIndTexMtx(GX::ITM_0, &mtx, -2);
|
||||
CGX::SetTevIndirect(GX::TEVSTAGE0, GX::INDTEXSTAGE0, GX::ITF_8, GX::ITB_STU, GX::ITM_0, GX::ITW_OFF, GX::ITW_OFF,
|
||||
false, false, GX::ITBA_OFF);
|
||||
GXSetIndTexOrder(GX::INDTEXSTAGE0, GX::TEXCOORD0, GX::TEXMAP0);
|
||||
GXSetIndTexMtx(GX_ITM_0, &mtx, -2);
|
||||
CGX::SetTevIndirect(GX_TEVSTAGE0, GX_INDTEXSTAGE0, GX_ITF_8, GX_ITB_STU, GX_ITM_0, GX_ITW_OFF, GX_ITW_OFF, false,
|
||||
false, GX_ITBA_OFF);
|
||||
GXSetIndTexOrder(GX_INDTEXSTAGE0, GX_TEXCOORD0, GX_TEXMAP0);
|
||||
|
||||
// Configure register colors
|
||||
const auto color0 = zeus::CColor::lerp(x2f4_thermColor, zeus::skWhite, x2f8_thermColdScale);
|
||||
|
@ -1028,40 +1031,40 @@ void CCubeRenderer::DoThermalBlendCold() {
|
|||
cFac = (x2f8_thermColdScale - 0.25f) * 4.f / 3.f;
|
||||
}
|
||||
const zeus::CColor color2{cFac, cFac};
|
||||
GXSetTevColor(GX::TEVREG0, color0);
|
||||
GXSetTevColor(GX::TEVREG1, color1);
|
||||
GXSetTevColor(GX::TEVREG2, color2);
|
||||
GXSetTevColor(GX_TEVREG0, to_gx_color(color0));
|
||||
GXSetTevColor(GX_TEVREG1, to_gx_color(color1));
|
||||
GXSetTevColor(GX_TEVREG2, to_gx_color(color2));
|
||||
|
||||
// Configure TEV stage 0
|
||||
GXSetTevSwapMode(GX::TEVSTAGE0, GX::TEV_SWAP0, GX::TEV_SWAP1);
|
||||
CGX::SetTevColorIn(GX::TEVSTAGE0, GX::CC_ZERO, GX::CC_TEXC, GX::CC_C0, GX::CC_C2);
|
||||
CGX::SetTevAlphaIn(GX::TEVSTAGE0, GX::CA_ZERO, GX::CA_TEXA, GX::CA_A1, GX::CA_A2);
|
||||
CGX::SetStandardTevColorAlphaOp(GX::TEVSTAGE0);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD0, GX::TEXMAP7, GX::COLOR_NULL);
|
||||
GXSetTevSwapMode(GX_TEVSTAGE0, GX_TEV_SWAP0, GX_TEV_SWAP1);
|
||||
CGX::SetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_TEXC, GX_CC_C0, GX_CC_C2);
|
||||
CGX::SetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_TEXA, GX_CA_A1, GX_CA_A2);
|
||||
CGX::SetStandardTevColorAlphaOp(GX_TEVSTAGE0);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP7, GX_COLOR_NULL);
|
||||
|
||||
// Configure TEV stage 1
|
||||
GXSetTevSwapMode(GX::TEVSTAGE1, GX::TEV_SWAP0, GX::TEV_SWAP1);
|
||||
CGX::SetTevColorIn(GX::TEVSTAGE1, GX::CC_ZERO, GX::CC_TEXC, GX::CC_C1, GX::CC_CPREV);
|
||||
CGX::SetTevColorOp(GX::TEVSTAGE1, GX::TEV_SUB, GX::TB_ZERO, GX::CS_SCALE_1, true, GX::TEVPREV);
|
||||
CGX::SetTevAlphaIn(GX::TEVSTAGE1, GX::CA_ZERO, GX::CA_A1, GX::CA_TEXA, GX::CA_APREV);
|
||||
CGX::SetTevAlphaOp(GX::TEVSTAGE1, GX::TEV_ADD, GX::TB_ZERO, GX::CS_SCALE_4, true, GX::TEVPREV);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE1, GX::TEXCOORD0, GX::TEXMAP1, GX::COLOR_NULL);
|
||||
GXSetTevSwapMode(GX_TEVSTAGE1, GX_TEV_SWAP0, GX_TEV_SWAP1);
|
||||
CGX::SetTevColorIn(GX_TEVSTAGE1, GX_CC_ZERO, GX_CC_TEXC, GX_CC_C1, GX_CC_CPREV);
|
||||
CGX::SetTevColorOp(GX_TEVSTAGE1, GX_TEV_SUB, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
|
||||
CGX::SetTevAlphaIn(GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_A1, GX_CA_TEXA, GX_CA_APREV);
|
||||
CGX::SetTevAlphaOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_4, true, GX_TEVPREV);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD0, GX_TEXMAP1, GX_COLOR_NULL);
|
||||
|
||||
// Configure everything else
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD0, GX::TG_MTX3x4, GX::TG_TEX0, GX::IDENTITY, false, GX::PTIDENTITY);
|
||||
CGX::SetAlphaCompare(GX::ALWAYS, 0, GX::AOP_AND, GX::ALWAYS, 0);
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX3x4, GX_TG_TEX0, GX_IDENTITY, false, GX_PTIDENTITY);
|
||||
CGX::SetAlphaCompare(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0);
|
||||
CGX::SetNumTevStages(2);
|
||||
CGX::SetNumTexGens(1);
|
||||
CGX::SetNumChans(0);
|
||||
CGX::SetNumIndStages(1);
|
||||
CGX::SetZMode(false, GX::ALWAYS, false);
|
||||
CGX::SetZMode(false, GX_ALWAYS, false);
|
||||
constexpr std::array vtxDescList{
|
||||
GX::VtxDescList{GX::VA_POS, GX::DIRECT},
|
||||
GX::VtxDescList{GX::VA_TEX0, GX::DIRECT},
|
||||
GX::VtxDescList{},
|
||||
GXVtxDescList{GX_VA_POS, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_TEX0, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_NULL, GX_NONE},
|
||||
};
|
||||
CGX::SetVtxDescv(vtxDescList.data());
|
||||
CGX::SetBlendMode(GX::BM_NONE, GX::BL_ONE, GX::BL_ZERO, GX::LO_CLEAR);
|
||||
CGX::SetBlendMode(GX_BM_NONE, GX_BL_ONE, GX_BL_ZERO, GX_LO_CLEAR);
|
||||
|
||||
// Backup & set viewport/projection
|
||||
const auto backupViewMatrix = CGraphics::g_ViewMatrix;
|
||||
|
@ -1072,7 +1075,7 @@ void CCubeRenderer::DoThermalBlendCold() {
|
|||
GXPixModeSync();
|
||||
|
||||
// Draw
|
||||
CGX::Begin(GX::TRIANGLEFAN, GX::VTXFMT0, 4);
|
||||
CGX::Begin(GX_TRIANGLEFAN, GX_VTXFMT0, 4);
|
||||
GXPosition3f32(0.f, 0.5f, 0.f);
|
||||
GXTexCoord2f32(0.f, 0.f);
|
||||
GXPosition3f32(0.f, 0.5f, static_cast<float>(height));
|
||||
|
@ -1084,10 +1087,10 @@ void CCubeRenderer::DoThermalBlendCold() {
|
|||
CGX::End();
|
||||
|
||||
// Cleanup
|
||||
GXSetTevSwapMode(GX::TEVSTAGE0, GX::TEV_SWAP0, GX::TEV_SWAP0);
|
||||
GXSetTevSwapMode(GX::TEVSTAGE1, GX::TEV_SWAP0, GX::TEV_SWAP0);
|
||||
GXSetTevSwapMode(GX_TEVSTAGE0, GX_TEV_SWAP0, GX_TEV_SWAP0);
|
||||
GXSetTevSwapMode(GX_TEVSTAGE1, GX_TEV_SWAP0, GX_TEV_SWAP0);
|
||||
CGX::SetNumIndStages(0);
|
||||
CGX::SetTevDirect(GX::TEVSTAGE0);
|
||||
CGX::SetTevDirect(GX_TEVSTAGE0);
|
||||
GXSetDstAlpha(false, 255);
|
||||
CGraphics::SetProjectionState(backupProjectionState);
|
||||
CGraphics::SetViewPointMatrix(backupViewMatrix);
|
||||
|
@ -1104,31 +1107,31 @@ void CCubeRenderer::DoThermalBlendHot() {
|
|||
const auto width = CGraphics::GetViewportWidth();
|
||||
const auto top = CGraphics::GetViewportTop();
|
||||
const auto left = CGraphics::GetViewportLeft();
|
||||
CGX::SetZMode(true, GX::LEQUAL, true);
|
||||
CGX::SetZMode(true, GX_LEQUAL, true);
|
||||
// GXSetTexCopySrc(left, top, width, height);
|
||||
// GXSetTexCopyDst(width, height, GX::TF_I4, false);
|
||||
// GXSetTexCopyDst(width, height, GX_TF_I4, false);
|
||||
// GXCopyTex(sSpareTextureData, false);
|
||||
CGraphics::ResolveSpareTexture(CGraphics::g_Viewport, 0, GX::TF_I4);
|
||||
CGraphics::ResolveSpareTexture(CGraphics::g_Viewport, 0, GX_TF_I4);
|
||||
x288_thermoPalette.Load();
|
||||
// CGraphics::LoadDolphinSpareTexture(width, height, GX::TF_C4, GX::TLUT0, nullptr, GX::TEXMAP7);
|
||||
CGraphics::LoadDolphinSpareTexture(0, GX_TF_C4, GX_TLUT0, GX::TEXMAP7);
|
||||
CGX::SetTevColorIn(GX::TEVSTAGE0, GX::CC_ZERO, GX::CC_TEXA, GX::CC_TEXC, GX::CC_ZERO);
|
||||
CGX::SetTevAlphaIn(GX::TEVSTAGE0, GX::CA_ZERO, GX::CA_ZERO, GX::CA_ZERO, GX::CA_TEXA);
|
||||
CGX::SetStandardTevColorAlphaOp(GX::TEVSTAGE0);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD0, GX::TEXMAP7, GX::COLOR_NULL);
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD0, GX::TG_MTX3x4, GX::TG_TEX0, GX::IDENTITY, false, GX::PTIDENTITY);
|
||||
CGX::SetAlphaCompare(GX::ALWAYS, 0, GX::AOP_AND, GX::ALWAYS, 0);
|
||||
// CGraphics::LoadDolphinSpareTexture(width, height, GX_TF_C4, GX::TLUT0, nullptr, GX_TEXMAP7);
|
||||
CGraphics::LoadDolphinSpareTexture(0, GX_TF_C4, GX_TLUT0, GX_TEXMAP7);
|
||||
CGX::SetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_TEXA, GX_CC_TEXC, GX_CC_ZERO);
|
||||
CGX::SetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_TEXA);
|
||||
CGX::SetStandardTevColorAlphaOp(GX_TEVSTAGE0);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP7, GX_COLOR_NULL);
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX3x4, GX_TG_TEX0, GX_IDENTITY, false, GX_PTIDENTITY);
|
||||
CGX::SetAlphaCompare(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0);
|
||||
CGX::SetNumTevStages(1);
|
||||
CGX::SetNumTexGens(1);
|
||||
CGX::SetNumChans(0);
|
||||
CGX::SetZMode(false, GX::LEQUAL, false);
|
||||
CGX::SetZMode(false, GX_LEQUAL, false);
|
||||
constexpr std::array vtxDescList{
|
||||
GX::VtxDescList{GX::VA_POS, GX::DIRECT},
|
||||
GX::VtxDescList{GX::VA_TEX0, GX::DIRECT},
|
||||
GX::VtxDescList{},
|
||||
GXVtxDescList{GX_VA_POS, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_TEX0, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_NULL, GX_NONE},
|
||||
};
|
||||
CGX::SetVtxDescv(vtxDescList.data());
|
||||
CGX::SetBlendMode(GX::BM_BLEND, GX::BL_DSTALPHA, GX::BL_INVDSTALPHA, GX::LO_CLEAR);
|
||||
CGX::SetBlendMode(GX_BM_BLEND, GX_BL_DSTALPHA, GX_BL_INVDSTALPHA, GX_LO_CLEAR);
|
||||
|
||||
// Backup & set viewport/projection
|
||||
const auto backupViewMatrix = CGraphics::g_ViewMatrix;
|
||||
|
@ -1139,7 +1142,7 @@ void CCubeRenderer::DoThermalBlendHot() {
|
|||
GXPixModeSync();
|
||||
|
||||
// Draw
|
||||
CGX::Begin(GX::TRIANGLEFAN, GX::VTXFMT0, 4);
|
||||
CGX::Begin(GX_TRIANGLEFAN, GX_VTXFMT0, 4);
|
||||
GXPosition3f32(0.f, 0.5f, 0.f);
|
||||
GXTexCoord2f32(0.f, 0.f);
|
||||
GXPosition3f32(0.f, 0.5f, static_cast<float>(height));
|
||||
|
@ -1152,7 +1155,7 @@ void CCubeRenderer::DoThermalBlendHot() {
|
|||
|
||||
// Cleanup
|
||||
CGX::SetNumIndStages(0);
|
||||
CGX::SetTevDirect(GX::TEVSTAGE0);
|
||||
CGX::SetTevDirect(GX_TEVSTAGE0);
|
||||
GXSetAlphaUpdate(true);
|
||||
CGraphics::SetProjectionState(backupProjectionState);
|
||||
CGraphics::SetViewPointMatrix(backupViewMatrix);
|
||||
|
@ -1165,7 +1168,7 @@ u32 CCubeRenderer::GetStaticWorldDataSize() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void CCubeRenderer::SetGXRegister1Color(const zeus::CColor& color) { GXSetTevColor(GX::TevRegID::TEVREG1, color); }
|
||||
void CCubeRenderer::SetGXRegister1Color(const zeus::CColor& color) { GXSetTevColor(GX_TEVREG1, to_gx_color(color)); }
|
||||
|
||||
void CCubeRenderer::SetWorldLightFadeLevel(float level) { x2fc_tevReg1Color = zeus::CColor(level, level, level, 1.f); }
|
||||
|
||||
|
@ -1348,7 +1351,7 @@ void CCubeRenderer::DrawOverlappingWorldModelShadows(s32 alphaVal, const std::ve
|
|||
}
|
||||
|
||||
auto& model = *(*item.x10_models)[wordModel + j];
|
||||
CGX::SetTevKColor(GX::KCOLOR0, zeus::CColor{0.f, static_cast<float>(alphaVal) / 255.f});
|
||||
CGX::SetTevKColor(GX_KCOLOR0, zeus::CColor{0.f, static_cast<float>(alphaVal) / 255.f});
|
||||
model.SetArraysCurrent();
|
||||
for (const auto* surf = model.GetFirstUnsortedSurface(); surf != nullptr; surf = surf->GetNextSurface()) {
|
||||
if (surf->GetBounds().intersects(aabb)) {
|
||||
|
@ -1373,8 +1376,7 @@ void CCubeRenderer::SetupCGraphicsState() {
|
|||
CGraphics::SetAmbientColor({0.4f});
|
||||
CGX::SetChanMatColor(CGX::EChannelId::Channel0, zeus::skWhite);
|
||||
CGraphics::SetDepthWriteMode(true, ERglEnum::LEqual, true);
|
||||
CGX::SetChanCtrl(CGX::EChannelId::Channel1, false, GX::SRC_REG, GX::SRC_REG, GX::LIGHT_NULL, GX::DF_NONE,
|
||||
GX::AF_NONE);
|
||||
CGX::SetChanCtrl(CGX::EChannelId::Channel1, false, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE);
|
||||
CCubeMaterial::EnsureTevsDirect();
|
||||
}
|
||||
|
||||
|
@ -1384,7 +1386,7 @@ void CCubeRenderer::SetupRendererStates(bool depthWrite) {
|
|||
CGraphics::SetAmbientColor(zeus::skClear);
|
||||
CGraphics::SetDepthWriteMode(true, ERglEnum::LEqual, depthWrite);
|
||||
CCubeMaterial::ResetCachedMaterials();
|
||||
GXSetTevColor(GX::TEVREG1, x2fc_tevReg1Color);
|
||||
GXSetTevColor(GX_TEVREG1, to_gx_color(x2fc_tevReg1Color));
|
||||
}
|
||||
|
||||
constexpr zeus::CTransform MvPostXf{
|
||||
|
@ -1395,26 +1397,26 @@ constexpr zeus::CTransform MvPostXf{
|
|||
void CCubeRenderer::DoThermalModelDraw(CCubeModel& model, const zeus::CColor& multCol, const zeus::CColor& addCol,
|
||||
TConstVectorRef positions, TConstVectorRef normals, const CModelFlags& flags) {
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP("CCubeRenderer::DoThermalModelDraw", zeus::skBlue);
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD0, GX::TG_MTX3x4, GX::TG_NRM, GX::TEXMTX0, true, GX::PTTEXMTX0);
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX3x4, GX_TG_NRM, GX_TEXMTX0, true, GX_PTTEXMTX0);
|
||||
CGX::SetNumTexGens(1);
|
||||
CGX::SetNumChans(0);
|
||||
x220_sphereRamp.Load(GX::TEXMAP0, EClampMode::Clamp);
|
||||
x220_sphereRamp.Load(GX_TEXMAP0, EClampMode::Clamp);
|
||||
zeus::CTransform xf = CGraphics::g_ViewMatrix.inverse().multiplyIgnoreTranslation(CGraphics::g_GXModelMatrix);
|
||||
xf.origin.zeroOut();
|
||||
GXLoadTexMtxImm(&xf, GX::TEXMTX0, GX::MTX3x4);
|
||||
GXLoadTexMtxImm(&MvPostXf, GX::PTTEXMTX0, GX::MTX3x4);
|
||||
CGX::SetStandardTevColorAlphaOp(GX::TEVSTAGE0);
|
||||
CGX::SetTevColorIn(GX::TEVSTAGE0, GX::CC_ZERO, GX::CC_C0, GX::CC_TEXC, GX::CC_KONST);
|
||||
CGX::SetTevAlphaIn(GX::TEVSTAGE0, GX::CA_ZERO, GX::CA_TEXA, GX::CA_A0, GX::CA_KONST);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD0, GX::TEXMAP0, GX::COLOR_NULL);
|
||||
GXLoadTexMtxImm(&xf, GX_TEXMTX0, GX_MTX3x4);
|
||||
GXLoadTexMtxImm(&MvPostXf, GX_PTTEXMTX0, GX_MTX3x4);
|
||||
CGX::SetStandardTevColorAlphaOp(GX_TEVSTAGE0);
|
||||
CGX::SetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_C0, GX_CC_TEXC, GX_CC_KONST);
|
||||
CGX::SetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_TEXA, GX_CA_A0, GX_CA_KONST);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
||||
CGX::SetNumTevStages(1);
|
||||
CGX::SetTevKColor(GX::KCOLOR0, addCol);
|
||||
CGX::SetTevKColorSel(GX::TEVSTAGE0, GX::TEV_KCSEL_K0);
|
||||
CGX::SetTevKAlphaSel(GX::TEVSTAGE0, GX::TEV_KASEL_K0_A);
|
||||
GXSetTevColor(GX::TEVREG0, multCol);
|
||||
CGX::SetAlphaCompare(GX::ALWAYS, 0, GX::AOP_OR, GX::ALWAYS, 0);
|
||||
CGX::SetBlendMode(GX::BM_BLEND, GX::BL_ONE, GX::BL_ONE, GX::LO_CLEAR);
|
||||
CGX::SetZMode(flags.x2_flags.IsSet(CModelFlagBits::DepthTest), GX::LEQUAL,
|
||||
CGX::SetTevKColor(GX_KCOLOR0, addCol);
|
||||
CGX::SetTevKColorSel(GX_TEVSTAGE0, GX_TEV_KCSEL_K0);
|
||||
CGX::SetTevKAlphaSel(GX_TEVSTAGE0, GX_TEV_KASEL_K0_A);
|
||||
GXSetTevColor(GX_TEVREG0, to_gx_color(multCol));
|
||||
CGX::SetAlphaCompare(GX_ALWAYS, 0, GX_AOP_OR, GX_ALWAYS, 0);
|
||||
CGX::SetBlendMode(GX_BM_BLEND, GX_BL_ONE, GX_BL_ONE, GX_LO_CLEAR);
|
||||
CGX::SetZMode(flags.x2_flags.IsSet(CModelFlagBits::DepthTest), GX_LEQUAL,
|
||||
flags.x2_flags.IsSet(CModelFlagBits::DepthUpdate));
|
||||
model.DrawFlat(positions, normals,
|
||||
flags.x2_flags.IsSet(CModelFlagBits::ThermalUnsortedOnly) ? ESurfaceSelection::Unsorted
|
||||
|
@ -1458,16 +1460,16 @@ void CCubeRenderer::ReallyDrawSpaceWarp(const zeus::CVector3f& pt, float strengt
|
|||
}
|
||||
const auto v2sub = v2left - v2right;
|
||||
if (v2sub.x > 0 && v2sub.y > 0) {
|
||||
GX::FogType fogType;
|
||||
GXFogType fogType;
|
||||
float fogStartZ;
|
||||
float fogEndZ;
|
||||
float fogNearZ;
|
||||
float fogFarZ;
|
||||
GXColor fogColor;
|
||||
CGX::GetFog(&fogType, &fogStartZ, &fogEndZ, &fogNearZ, &fogFarZ, &fogColor);
|
||||
CGX::SetFog(GX::FOG_NONE, fogStartZ, fogEndZ, fogNearZ, fogFarZ, fogColor);
|
||||
CGX::SetFog(GX_FOG_NONE, fogStartZ, fogEndZ, fogNearZ, fogFarZ, fogColor);
|
||||
// GXSetTexCopySrc(v2right.x, v2right.y, v2sub.x, v2sub.y);
|
||||
// GXSetTexCopyDst(v2sub.x, v2sub.y, GX::TF_RGBA8, false);
|
||||
// GXSetTexCopyDst(v2sub.x, v2sub.y, GX_TF_RGBA8, false);
|
||||
// GXCopyTex(sSpareTextureData, false);
|
||||
// GXPixModeSync();
|
||||
CGraphics::ResolveSpareTexture(
|
||||
|
@ -1477,14 +1479,14 @@ void CCubeRenderer::ReallyDrawSpaceWarp(const zeus::CVector3f& pt, float strengt
|
|||
.x8_width = static_cast<u32>(v2sub.x),
|
||||
.xc_height = static_cast<u32>(v2sub.y),
|
||||
},
|
||||
1, GX::TF_RGBA8);
|
||||
CGraphics::LoadDolphinSpareTexture(1, GX::TF_RGBA8, GX::TEXMAP7);
|
||||
x150_reflectionTex.Load(GX::TEXMAP1, EClampMode::Clamp);
|
||||
CGX::SetTevColorIn(GX::TEVSTAGE0, GX::CC_ZERO, GX::CC_ZERO, GX::CC_ZERO, GX::CC_TEXC);
|
||||
CGX::SetTevColorOp(GX::TEVSTAGE0, GX::TEV_ADD, GX::TB_ZERO, GX::CS_SCALE_1, true, GX::TEVPREV);
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD0, GX::TG_MTX3x4, GX::TG_TEX0, GX::IDENTITY, false, GX::PTIDENTITY);
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD1, GX::TG_MTX3x4, GX::TG_TEX1, GX::IDENTITY, false, GX::PTIDENTITY);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD0, GX::TEXMAP7, GX::COLOR_NULL);
|
||||
1, GX_TF_RGBA8);
|
||||
CGraphics::LoadDolphinSpareTexture(1, GX_TF_RGBA8, GX_TEXMAP7);
|
||||
x150_reflectionTex.Load(GX_TEXMAP1, EClampMode::Clamp);
|
||||
CGX::SetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_TEXC);
|
||||
CGX::SetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX3x4, GX_TG_TEX0, GX_IDENTITY, false, GX_PTIDENTITY);
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD1, GX_TG_MTX3x4, GX_TG_TEX1, GX_IDENTITY, false, GX_PTIDENTITY);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP7, GX_COLOR_NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,27 +4,27 @@
|
|||
|
||||
namespace metaforce::CGX {
|
||||
SGXState sGXState{};
|
||||
std::array<GX::VtxDescList, 12> sVtxDescList{};
|
||||
std::array<GXVtxDescList, 12> sVtxDescList{};
|
||||
|
||||
void ResetGXStates() noexcept {
|
||||
sGXState.x48_descList = 0;
|
||||
GXClearVtxDesc();
|
||||
sGXState.x0_arrayPtrs.fill(nullptr);
|
||||
for (GX::TexMapID id = GX::TEXMAP0; id < GX::MAX_TEXMAP; id = static_cast<GX::TexMapID>(id + 1)) {
|
||||
for (GXTexMapID id = GX_TEXMAP0; id < GX_MAX_TEXMAP; id = static_cast<GXTexMapID>(id + 1)) {
|
||||
CTexture::InvalidateTexMap(id);
|
||||
}
|
||||
for (GX::TevKColorID id = GX::KCOLOR0; const auto& item : sGXState.x58_kColors) {
|
||||
for (GXTevKColorID id = GX_KCOLOR0; const auto& item : sGXState.x58_kColors) {
|
||||
GXSetTevKColor(id, item);
|
||||
id = static_cast<GX::TevKColorID>(id + 1);
|
||||
id = static_cast<GXTevKColorID>(id + 1);
|
||||
}
|
||||
GXSetTevSwapModeTable(GX::TEV_SWAP1, GX::CH_RED, GX::CH_GREEN, GX::CH_BLUE, GX::CH_RED);
|
||||
GXSetTevSwapModeTable(GX::TEV_SWAP2, GX::CH_RED, GX::CH_GREEN, GX::CH_BLUE, GX::CH_GREEN);
|
||||
GXSetTevSwapModeTable(GX::TEV_SWAP3, GX::CH_RED, GX::CH_GREEN, GX::CH_BLUE, GX::CH_BLUE);
|
||||
SetAlphaCompare(GX::ALWAYS, 0, GX::AOP_AND, GX::ALWAYS, 0);
|
||||
// GXSetCurrentMtx(0);
|
||||
GXSetTevSwapModeTable(GX_TEV_SWAP1, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_RED);
|
||||
GXSetTevSwapModeTable(GX_TEV_SWAP2, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_GREEN);
|
||||
GXSetTevSwapModeTable(GX_TEV_SWAP3, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_BLUE);
|
||||
SetAlphaCompare(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0);
|
||||
GXSetCurrentMtx(GX_PNMTX0);
|
||||
SetNumIndStages(0);
|
||||
// TODO GXSetIndTexCoordScale
|
||||
for (GX::TevStageID id = GX::TEVSTAGE0; id < GX::MAX_TEVSTAGE; id = static_cast<GX::TevStageID>(id + 1)) {
|
||||
for (GXTevStageID id = GX_TEVSTAGE0; id < GX_MAX_TEVSTAGE; id = static_cast<GXTevStageID>(id + 1)) {
|
||||
SetTevDirect(id);
|
||||
}
|
||||
// GXSetTexCoordCylWrap
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
namespace metaforce::CGX {
|
||||
enum class EChannelId {
|
||||
Channel0, // GX::COLOR0
|
||||
Channel1, // GX::COLOR1
|
||||
Channel0, // GX_COLOR0
|
||||
Channel1, // GX_COLOR1
|
||||
};
|
||||
|
||||
struct STevState {
|
||||
|
@ -18,8 +18,8 @@ struct STevState {
|
|||
u32 xc_alphaOps = 0;
|
||||
u32 x10_indFlags = 0;
|
||||
u32 x14_tevOrderFlags = 0;
|
||||
GX::TevKColorSel x18_kColorSel = GX::TEV_KCSEL_1;
|
||||
GX::TevKAlphaSel x19_kAlphaSel = GX::TEV_KASEL_1;
|
||||
GXTevKColorSel x18_kColorSel = GX_TEV_KCSEL_1;
|
||||
GXTevKAlphaSel x19_kAlphaSel = GX_TEV_KASEL_1;
|
||||
};
|
||||
struct STexState {
|
||||
u32 x0_coordGen = 0;
|
||||
|
@ -38,12 +38,12 @@ struct SGXState {
|
|||
u8 x50_numTevStages = 0;
|
||||
u8 x51_numIndStages = 0;
|
||||
u8 x52_zmode = 0;
|
||||
GX::FogType x53_fogType = GX::FOG_NONE;
|
||||
GXFogType x53_fogType = GX_FOG_NONE;
|
||||
u16 x54_lineWidthAndOffset = 0;
|
||||
u16 x56_blendMode = 0;
|
||||
std::array<GXColor, GX::MAX_KCOLOR> x58_kColors;
|
||||
std::array<STevState, GX::MAX_TEVSTAGE> x68_tevStates;
|
||||
std::array<STexState, GX::MAX_TEXCOORD> x228_texStates;
|
||||
std::array<GXColor, GX_MAX_KCOLOR> x58_kColors;
|
||||
std::array<STevState, GX_MAX_TEVSTAGE> x68_tevStates;
|
||||
std::array<STexState, GX_MAX_TEXCOORD> x228_texStates;
|
||||
u32 x248_alphaCompare = 0;
|
||||
float x24c_fogStartZ = 0.f;
|
||||
float x250_fogEndZ = 0.f;
|
||||
|
@ -52,14 +52,14 @@ struct SGXState {
|
|||
GXColor x25c_fogColor;
|
||||
};
|
||||
extern SGXState sGXState;
|
||||
extern std::array<GX::VtxDescList, 12> sVtxDescList;
|
||||
extern std::array<GXVtxDescList, 12> sVtxDescList;
|
||||
|
||||
static inline void update_fog(u32 value) noexcept {
|
||||
if (sGXState.x53_fogType == GX::FOG_NONE || (sGXState.x56_blendMode & 0xE0) == (value & 0xE0)) {
|
||||
if (sGXState.x53_fogType == GX_FOG_NONE || (sGXState.x56_blendMode & 0xE0) == (value & 0xE0)) {
|
||||
return;
|
||||
}
|
||||
if ((value & 0xE0) == 0x20) {
|
||||
GXSetFogColor(zeus::skClear);
|
||||
GXSetFogColor(GX_CLEAR);
|
||||
return;
|
||||
}
|
||||
GXSetFogColor(sGXState.x25c_fogColor);
|
||||
|
@ -72,23 +72,21 @@ static inline void FlushState() noexcept {
|
|||
sGXState.x4d_prevNumChans = numChans;
|
||||
}
|
||||
if ((sGXState.x4c_dirtyChans & 2) != 0) {
|
||||
// TODO actually COLOR0
|
||||
auto flags = sGXState.x34_chanCtrls[0];
|
||||
GXSetChanCtrl(GX::COLOR0A0, GXBool(flags & 1), GX::ColorSrc(flags >> 1 & 1), GX::ColorSrc(flags >> 2 & 1),
|
||||
flags >> 3 & 0xFF, GX::DiffuseFn(flags >> 11 & 3), GX::AttnFn(flags >> 13 & 3));
|
||||
GXSetChanCtrl(GX_COLOR0, GXBool(flags & 1), GXColorSrc(flags >> 1 & 1), GXColorSrc(flags >> 2 & 1),
|
||||
flags >> 3 & 0xFF, GXDiffuseFn(flags >> 11 & 3), GXAttnFn(flags >> 13 & 3));
|
||||
sGXState.x30_prevChanCtrls[0] = flags;
|
||||
}
|
||||
if ((sGXState.x4c_dirtyChans & 4) != 0) {
|
||||
// TODO actually COLOR1
|
||||
auto flags = sGXState.x34_chanCtrls[1];
|
||||
GXSetChanCtrl(GX::COLOR1A1, GXBool(flags & 1), GX::ColorSrc(flags >> 1 & 1), GX::ColorSrc(flags >> 2 & 1),
|
||||
flags >> 3 & 0xFF, GX::DiffuseFn(flags >> 11 & 3), GX::AttnFn(flags >> 13 & 3));
|
||||
GXSetChanCtrl(GX_COLOR1, GXBool(flags & 1), GXColorSrc(flags >> 1 & 1), GXColorSrc(flags >> 2 & 1),
|
||||
flags >> 3 & 0xFF, GXDiffuseFn(flags >> 11 & 3), GXAttnFn(flags >> 13 & 3));
|
||||
sGXState.x30_prevChanCtrls[1] = flags;
|
||||
}
|
||||
sGXState.x4c_dirtyChans = 0;
|
||||
}
|
||||
|
||||
static inline void Begin(GX::Primitive primitive, GX::VtxFmt fmt, u16 nverts) noexcept {
|
||||
static inline void Begin(GXPrimitive primitive, GXVtxFmt fmt, u16 nverts) noexcept {
|
||||
if (sGXState.x4c_dirtyChans != 0) {
|
||||
FlushState();
|
||||
}
|
||||
|
@ -111,24 +109,23 @@ static inline const GXColor& GetChanAmbColor(EChannelId id) noexcept {
|
|||
|
||||
void ResetGXStates() noexcept;
|
||||
|
||||
static inline void SetAlphaCompare(GX::Compare comp0, u8 ref0, GX::AlphaOp op, GX::Compare comp1, u8 ref1) noexcept {
|
||||
static inline void SetAlphaCompare(GXCompare comp0, u8 ref0, GXAlphaOp op, GXCompare comp1, u8 ref1) noexcept {
|
||||
u32 flags = ref1 << 17 | (comp1 & 7) << 14 | (op & 7) << 11 | ref0 << 3 | (comp0 & 7);
|
||||
if (flags != sGXState.x248_alphaCompare) {
|
||||
sGXState.x248_alphaCompare = flags;
|
||||
GXSetAlphaCompare(comp0, ref0, op, comp1, ref1);
|
||||
// GXSetZCompLoc(comp0 == GX::ALWAYS);
|
||||
GXSetZCompLoc(comp0 == GX_ALWAYS);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static inline void SetArray(GX::Attr attr, const std::vector<T>* data, bool isStatic) noexcept {
|
||||
if (data != nullptr && sGXState.x0_arrayPtrs[attr - GX::VA_POS] != data) {
|
||||
GXSetArray(attr, data, isStatic ? 1 : 0);
|
||||
static inline void SetArray(GXAttr attr, const std::vector<T>* data, bool isStatic) noexcept {
|
||||
if (data != nullptr && sGXState.x0_arrayPtrs[attr - GX_VA_POS] != data) {
|
||||
GXSetArray(attr, data->data(), data->size() * sizeof(T), sizeof(T));
|
||||
}
|
||||
}
|
||||
|
||||
static inline void SetBlendMode(GX::BlendMode mode, GX::BlendFactor srcFac, GX::BlendFactor dstFac,
|
||||
GX::LogicOp op) noexcept {
|
||||
static inline void SetBlendMode(GXBlendMode mode, GXBlendFactor srcFac, GXBlendFactor dstFac, GXLogicOp op) noexcept {
|
||||
const u16 flags = (op & 0xF) << 8 | (dstFac & 7) << 5 | (srcFac & 7) << 2 | (mode & 3);
|
||||
if (flags != sGXState.x56_blendMode) {
|
||||
update_fog(flags);
|
||||
|
@ -137,16 +134,19 @@ static inline void SetBlendMode(GX::BlendMode mode, GX::BlendFactor srcFac, GX::
|
|||
}
|
||||
}
|
||||
|
||||
static inline void SetChanAmbColor(EChannelId id, const GXColor& color) noexcept {
|
||||
static inline void SetChanAmbColor(EChannelId id, GXColor color) noexcept {
|
||||
const auto idx = std::underlying_type_t<EChannelId>(id);
|
||||
if (color != sGXState.x38_chanAmbColors[idx]) {
|
||||
sGXState.x38_chanAmbColors[idx] = color;
|
||||
GXSetChanAmbColor(GX::ChannelID(idx + GX::COLOR0A0), color);
|
||||
GXSetChanAmbColor(GXChannelID(idx + GX_COLOR0A0), color);
|
||||
}
|
||||
}
|
||||
static inline void SetChanAmbColor(EChannelId id, const zeus::CColor& color) noexcept {
|
||||
SetChanAmbColor(id, to_gx_color(color));
|
||||
}
|
||||
|
||||
static inline void SetChanCtrl(EChannelId id, GXBool enable, GX::ColorSrc ambSrc, GX::ColorSrc matSrc,
|
||||
GX::LightMask lights, GX::DiffuseFn diffFn, GX::AttnFn attnFn) noexcept {
|
||||
static inline void SetChanCtrl(EChannelId id, GXBool enable, GXColorSrc ambSrc, GXColorSrc matSrc, GX::LightMask lights,
|
||||
GXDiffuseFn diffFn, GXAttnFn attnFn) noexcept {
|
||||
const auto idx = std::underlying_type_t<EChannelId>(id);
|
||||
if (lights.none()) {
|
||||
enable = false;
|
||||
|
@ -167,19 +167,22 @@ static inline void SetChanCtrl(EChannelId id, u32 flags, GX::LightMask lights) n
|
|||
// Helper function for common logic
|
||||
static inline void SetChanCtrl(EChannelId id, GX::LightMask lights) noexcept {
|
||||
const bool hasLights = lights.any();
|
||||
SetChanCtrl(id, hasLights, GX::SRC_REG, GX::SRC_REG, lights, hasLights ? GX::DF_CLAMP : GX::DF_NONE,
|
||||
hasLights ? GX::AF_SPOT : GX::AF_NONE);
|
||||
SetChanCtrl(id, hasLights, GX_SRC_REG, GX_SRC_REG, lights, hasLights ? GX_DF_CLAMP : GX_DF_NONE,
|
||||
hasLights ? GX_AF_SPOT : GX_AF_NONE);
|
||||
}
|
||||
|
||||
static inline void SetChanMatColor(EChannelId id, const GXColor& color) noexcept {
|
||||
static inline void SetChanMatColor(EChannelId id, GXColor color) noexcept {
|
||||
const auto idx = std::underlying_type_t<EChannelId>(id);
|
||||
if (color != sGXState.x40_chanMatColors[idx]) {
|
||||
sGXState.x40_chanMatColors[idx] = color;
|
||||
GXSetChanMatColor(GX::ChannelID(idx + GX::COLOR0A0), color);
|
||||
GXSetChanMatColor(GXChannelID(idx + GX_COLOR0A0), color);
|
||||
}
|
||||
}
|
||||
static inline void SetChanMatColor(EChannelId id, const zeus::CColor& color) noexcept {
|
||||
SetChanMatColor(id, to_gx_color(color));
|
||||
}
|
||||
|
||||
static inline void SetFog(GX::FogType type, float startZ, float endZ, float nearZ, float farZ,
|
||||
static inline void SetFog(GXFogType type, float startZ, float endZ, float nearZ, float farZ,
|
||||
const GXColor& color) noexcept {
|
||||
sGXState.x25c_fogColor = color;
|
||||
sGXState.x53_fogType = type;
|
||||
|
@ -189,14 +192,14 @@ static inline void SetFog(GX::FogType type, float startZ, float endZ, float near
|
|||
sGXState.x258_fogFarZ = farZ;
|
||||
auto fogColor = color;
|
||||
if ((sGXState.x56_blendMode & 0xE0) == 0x20) {
|
||||
fogColor = zeus::skClear;
|
||||
fogColor = GX_CLEAR;
|
||||
}
|
||||
GXSetFog(type, startZ, endZ, nearZ, farZ, fogColor);
|
||||
}
|
||||
|
||||
void SetIndTexMtxSTPointFive(GX::IndTexMtxID id, s8 scaleExp) noexcept;
|
||||
void SetIndTexMtxSTPointFive(GXIndTexMtxID id, s8 scaleExp) noexcept;
|
||||
|
||||
void SetLineWidth(u8 width, GX::TexOffset offset) noexcept;
|
||||
void SetLineWidth(u8 width, GXTexOffset offset) noexcept;
|
||||
|
||||
static inline void SetNumChans(u8 num) noexcept {
|
||||
sGXState.x4c_dirtyChans = 7; // TODO
|
||||
|
@ -227,18 +230,18 @@ static inline void SetNumTexGens(u8 num) noexcept {
|
|||
}
|
||||
}
|
||||
|
||||
static inline void SetStandardTevColorAlphaOp(GX::TevStageID stageId) noexcept {
|
||||
static inline void SetStandardTevColorAlphaOp(GXTevStageID stageId) noexcept {
|
||||
auto& state = sGXState.x68_tevStates[stageId];
|
||||
if (state.x8_colorOps != 0x100 || state.xc_alphaOps != 0x100) {
|
||||
state.x8_colorOps = 0x100;
|
||||
state.xc_alphaOps = 0x100;
|
||||
GXSetTevColorOp(stageId, GX::TEV_ADD, GX::TB_ZERO, GX::CS_SCALE_1, true, GX::TEVPREV);
|
||||
GXSetTevAlphaOp(stageId, GX::TEV_ADD, GX::TB_ZERO, GX::CS_SCALE_1, true, GX::TEVPREV);
|
||||
GXSetTevColorOp(stageId, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
|
||||
GXSetTevAlphaOp(stageId, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void SetTevAlphaIn(GX::TevStageID stageId, GX::TevAlphaArg a, GX::TevAlphaArg b, GX::TevAlphaArg c,
|
||||
GX::TevAlphaArg d) noexcept {
|
||||
static inline void SetTevAlphaIn(GXTevStageID stageId, GXTevAlphaArg a, GXTevAlphaArg b, GXTevAlphaArg c,
|
||||
GXTevAlphaArg d) noexcept {
|
||||
u32 flags = (d & 31) << 15 | (c & 31) << 10 | (b & 31) << 5 | (a & 31);
|
||||
auto& state = sGXState.x68_tevStates[stageId].x4_alphaInArgs;
|
||||
if (flags != state) {
|
||||
|
@ -247,8 +250,8 @@ static inline void SetTevAlphaIn(GX::TevStageID stageId, GX::TevAlphaArg a, GX::
|
|||
}
|
||||
}
|
||||
|
||||
static inline void SetTevAlphaOp(GX::TevStageID stageId, GX::TevOp op, GX::TevBias bias, GX::TevScale scale,
|
||||
GXBool clamp, GX::TevRegID outReg) noexcept {
|
||||
static inline void SetTevAlphaOp(GXTevStageID stageId, GXTevOp op, GXTevBias bias, GXTevScale scale, GXBool clamp,
|
||||
GXTevRegID outReg) noexcept {
|
||||
u32 flags = (outReg & 3) << 9 | (u8(clamp) & 1) << 8 | (scale & 3) << 6 | (bias & 3) << 4 | (op & 15);
|
||||
auto& state = sGXState.x68_tevStates[stageId].xc_alphaOps;
|
||||
if (flags != state) {
|
||||
|
@ -257,17 +260,17 @@ static inline void SetTevAlphaOp(GX::TevStageID stageId, GX::TevOp op, GX::TevBi
|
|||
}
|
||||
}
|
||||
|
||||
static inline void SetTevAlphaOp_Compressed(GX::TevStageID stageId, u32 ops) noexcept {
|
||||
static inline void SetTevAlphaOp_Compressed(GXTevStageID stageId, u32 ops) noexcept {
|
||||
auto& state = sGXState.x68_tevStates[stageId].xc_alphaOps;
|
||||
if (ops != state) {
|
||||
state = ops;
|
||||
GXSetTevAlphaOp(stageId, GX::TevOp(ops & 31), GX::TevBias(ops >> 4 & 3), GX::TevScale(ops >> 6 & 3),
|
||||
GXBool(ops >> 8 & 1), GX::TevRegID(ops >> 9 & 3));
|
||||
GXSetTevAlphaOp(stageId, GXTevOp(ops & 31), GXTevBias(ops >> 4 & 3), GXTevScale(ops >> 6 & 3), GXBool(ops >> 8 & 1),
|
||||
GXTevRegID(ops >> 9 & 3));
|
||||
}
|
||||
}
|
||||
|
||||
static inline void SetTevColorIn(GX::TevStageID stageId, GX::TevColorArg a, GX::TevColorArg b, GX::TevColorArg c,
|
||||
GX::TevColorArg d) noexcept {
|
||||
static inline void SetTevColorIn(GXTevStageID stageId, GXTevColorArg a, GXTevColorArg b, GXTevColorArg c,
|
||||
GXTevColorArg d) noexcept {
|
||||
u32 flags = (d & 31) << 15 | (c & 31) << 10 | (b & 31) << 5 | (a & 31);
|
||||
auto& state = sGXState.x68_tevStates[stageId].x0_colorInArgs;
|
||||
if (flags != state) {
|
||||
|
@ -276,8 +279,8 @@ static inline void SetTevColorIn(GX::TevStageID stageId, GX::TevColorArg a, GX::
|
|||
}
|
||||
}
|
||||
|
||||
static inline void SetTevColorOp(GX::TevStageID stageId, GX::TevOp op, GX::TevBias bias, GX::TevScale scale,
|
||||
GXBool clamp, GX::TevRegID outReg) noexcept {
|
||||
static inline void SetTevColorOp(GXTevStageID stageId, GXTevOp op, GXTevBias bias, GXTevScale scale, GXBool clamp,
|
||||
GXTevRegID outReg) noexcept {
|
||||
u32 flags = (outReg & 3) << 9 | (u8(clamp) & 1) << 8 | (scale & 3) << 6 | (bias & 3) << 4 | (op & 15);
|
||||
auto& state = sGXState.x68_tevStates[stageId].x8_colorOps;
|
||||
if (flags != state) {
|
||||
|
@ -286,16 +289,16 @@ static inline void SetTevColorOp(GX::TevStageID stageId, GX::TevOp op, GX::TevBi
|
|||
}
|
||||
}
|
||||
|
||||
static inline void SetTevColorOp_Compressed(GX::TevStageID stageId, u32 ops) noexcept {
|
||||
static inline void SetTevColorOp_Compressed(GXTevStageID stageId, u32 ops) noexcept {
|
||||
auto& state = sGXState.x68_tevStates[stageId].x8_colorOps;
|
||||
if (ops != state) {
|
||||
state = ops;
|
||||
GXSetTevColorOp(stageId, GX::TevOp(ops & 31), GX::TevBias(ops >> 4 & 3), GX::TevScale(ops >> 6 & 3),
|
||||
GXBool(ops >> 8 & 1), GX::TevRegID(ops >> 9 & 3));
|
||||
GXSetTevColorOp(stageId, GXTevOp(ops & 31), GXTevBias(ops >> 4 & 3), GXTevScale(ops >> 6 & 3), GXBool(ops >> 8 & 1),
|
||||
GXTevRegID(ops >> 9 & 3));
|
||||
}
|
||||
}
|
||||
|
||||
static inline void SetTevDirect(GX::TevStageID stageId) noexcept {
|
||||
static inline void SetTevDirect(GXTevStageID stageId) noexcept {
|
||||
auto& state = sGXState.x68_tevStates[stageId].x10_indFlags;
|
||||
if (state != 0) {
|
||||
state = 0;
|
||||
|
@ -303,19 +306,19 @@ static inline void SetTevDirect(GX::TevStageID stageId) noexcept {
|
|||
}
|
||||
}
|
||||
|
||||
static inline void SetStandardDirectTev_Compressed(GX::TevStageID stageId, u32 colorArgs, u32 alphaArgs, u32 colorOps,
|
||||
static inline void SetStandardDirectTev_Compressed(GXTevStageID stageId, u32 colorArgs, u32 alphaArgs, u32 colorOps,
|
||||
u32 alphaOps) noexcept {
|
||||
auto& state = sGXState.x68_tevStates[stageId];
|
||||
SetTevDirect(stageId);
|
||||
if (state.x0_colorInArgs != colorArgs) {
|
||||
state.x0_colorInArgs = colorArgs;
|
||||
GXSetTevColorIn(stageId, GX::TevColorArg(colorArgs & 31), GX::TevColorArg(colorArgs >> 5 & 31),
|
||||
GX::TevColorArg(colorArgs >> 10 & 31), GX::TevColorArg(colorArgs >> 15 & 31));
|
||||
GXSetTevColorIn(stageId, GXTevColorArg(colorArgs & 31), GXTevColorArg(colorArgs >> 5 & 31),
|
||||
GXTevColorArg(colorArgs >> 10 & 31), GXTevColorArg(colorArgs >> 15 & 31));
|
||||
}
|
||||
if (state.x4_alphaInArgs != alphaArgs) {
|
||||
state.x4_alphaInArgs = alphaArgs;
|
||||
GXSetTevAlphaIn(stageId, GX::TevAlphaArg(alphaArgs & 31), GX::TevAlphaArg(alphaArgs >> 5 & 31),
|
||||
GX::TevAlphaArg(alphaArgs >> 10 & 31), GX::TevAlphaArg(alphaArgs >> 15 & 31));
|
||||
GXSetTevAlphaIn(stageId, GXTevAlphaArg(alphaArgs & 31), GXTevAlphaArg(alphaArgs >> 5 & 31),
|
||||
GXTevAlphaArg(alphaArgs >> 10 & 31), GXTevAlphaArg(alphaArgs >> 15 & 31));
|
||||
}
|
||||
if (colorOps != alphaOps || (colorOps & 0x1FF) != 0x100) {
|
||||
SetTevColorOp_Compressed(stageId, colorOps);
|
||||
|
@ -323,27 +326,26 @@ static inline void SetStandardDirectTev_Compressed(GX::TevStageID stageId, u32 c
|
|||
} else if (colorOps != state.x8_colorOps || colorOps != state.xc_alphaOps) {
|
||||
state.x8_colorOps = colorOps;
|
||||
state.xc_alphaOps = colorOps;
|
||||
const auto outReg = GX::TevRegID(colorOps >> 9 & 3);
|
||||
GXSetTevColorOp(stageId, GX::TEV_ADD, GX::TB_ZERO, GX::CS_SCALE_1, true, outReg);
|
||||
GXSetTevAlphaOp(stageId, GX::TEV_ADD, GX::TB_ZERO, GX::CS_SCALE_1, true, outReg);
|
||||
const auto outReg = GXTevRegID(colorOps >> 9 & 3);
|
||||
GXSetTevColorOp(stageId, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, outReg);
|
||||
GXSetTevAlphaOp(stageId, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, outReg);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void SetTevIndirect(GX::TevStageID stageId, GX::IndTexStageID indStage, GX::IndTexFormat fmt,
|
||||
GX::IndTexBiasSel biasSel, GX::IndTexMtxID mtxSel, GX::IndTexWrap wrapS,
|
||||
GX::IndTexWrap wrapT, GXBool addPrev, GXBool indLod,
|
||||
GX::IndTexAlphaSel alphaSel) noexcept {
|
||||
static inline void SetTevIndirect(GXTevStageID stageId, GXIndTexStageID indStage, GXIndTexFormat fmt,
|
||||
GXIndTexBiasSel biasSel, GXIndTexMtxID mtxSel, GXIndTexWrap wrapS, GXIndTexWrap wrapT,
|
||||
GXBool addPrev, GXBool indLod, GXIndTexAlphaSel alphaSel) noexcept {
|
||||
// TODO
|
||||
GXSetTevIndirect(stageId, indStage, fmt, biasSel, mtxSel, wrapS, wrapT, addPrev, indLod, alphaSel);
|
||||
}
|
||||
|
||||
static inline void SetTevIndWarp(GX::TevStageID stageId, GX::IndTexStageID indStage, GXBool signedOffset,
|
||||
GXBool replaceMode, GX::IndTexMtxID mtxSel) noexcept {
|
||||
static inline void SetTevIndWarp(GXTevStageID stageId, GXIndTexStageID indStage, GXBool signedOffset,
|
||||
GXBool replaceMode, GXIndTexMtxID mtxSel) noexcept {
|
||||
// TODO
|
||||
GXSetTevIndWarp(stageId, indStage, signedOffset, replaceMode, mtxSel);
|
||||
}
|
||||
|
||||
static inline void SetTevKAlphaSel(GX::TevStageID stageId, GX::TevKAlphaSel sel) noexcept {
|
||||
static inline void SetTevKAlphaSel(GXTevStageID stageId, GXTevKAlphaSel sel) noexcept {
|
||||
auto& state = sGXState.x68_tevStates[stageId].x19_kAlphaSel;
|
||||
if (sel != state) {
|
||||
state = sel;
|
||||
|
@ -351,15 +353,18 @@ static inline void SetTevKAlphaSel(GX::TevStageID stageId, GX::TevKAlphaSel sel)
|
|||
}
|
||||
}
|
||||
|
||||
static inline void SetTevKColor(GX::TevKColorID id, const GXColor& color) noexcept {
|
||||
static inline void SetTevKColor(GXTevKColorID id, const GXColor& color) noexcept {
|
||||
auto& state = sGXState.x58_kColors[id];
|
||||
if (color != state) {
|
||||
state = color;
|
||||
GXSetTevKColor(id, color);
|
||||
}
|
||||
}
|
||||
static inline void SetTevKColor(GXTevKColorID id, const zeus::CColor& color) noexcept {
|
||||
SetTevKColor(id, to_gx_color(color));
|
||||
}
|
||||
|
||||
static inline void SetTevKColorSel(GX::TevStageID stageId, GX::TevKColorSel sel) noexcept {
|
||||
static inline void SetTevKColorSel(GXTevStageID stageId, GXTevKColorSel sel) noexcept {
|
||||
auto& state = sGXState.x68_tevStates[stageId].x18_kColorSel;
|
||||
if (sel != state) {
|
||||
state = sel;
|
||||
|
@ -367,8 +372,8 @@ static inline void SetTevKColorSel(GX::TevStageID stageId, GX::TevKColorSel sel)
|
|||
}
|
||||
}
|
||||
|
||||
static inline void SetTevOrder(GX::TevStageID stageId, GX::TexCoordID texCoord, GX::TexMapID texMap,
|
||||
GX::ChannelID color) noexcept {
|
||||
static inline void SetTevOrder(GXTevStageID stageId, GXTexCoordID texCoord, GXTexMapID texMap,
|
||||
GXChannelID color) noexcept {
|
||||
u32 flags = (color & 0xFF) << 16 | (texMap & 0xFF) << 8 | (texCoord & 0xFF);
|
||||
auto& state = sGXState.x68_tevStates[stageId].x14_tevOrderFlags;
|
||||
if (flags != state) {
|
||||
|
@ -377,9 +382,9 @@ static inline void SetTevOrder(GX::TevStageID stageId, GX::TexCoordID texCoord,
|
|||
}
|
||||
}
|
||||
|
||||
static inline void SetTexCoordGen(GX::TexCoordID dstCoord, GX::TexGenType fn, GX::TexGenSrc src, GX::TexMtx mtx,
|
||||
GXBool normalize, GX::PTTexMtx postMtx) noexcept {
|
||||
u32 flags = ((postMtx - GX::PTTEXMTX0) & 63) << 15 | (u8(normalize) & 1) << 14 | ((mtx - GX::TEXMTX0) & 31) << 9 |
|
||||
static inline void SetTexCoordGen(GXTexCoordID dstCoord, GXTexGenType fn, GXTexGenSrc src, GXTexMtx mtx,
|
||||
GXBool normalize, GXPTTexMtx postMtx) noexcept {
|
||||
u32 flags = ((postMtx - GX_PTTEXMTX0) & 63) << 15 | (u8(normalize) & 1) << 14 | ((mtx - GX_TEXMTX0) & 31) << 9 |
|
||||
(src & 31) << 4 | (fn & 15);
|
||||
auto& state = sGXState.x228_texStates[dstCoord].x0_coordGen;
|
||||
if (flags != state) {
|
||||
|
@ -388,13 +393,13 @@ static inline void SetTexCoordGen(GX::TexCoordID dstCoord, GX::TexGenType fn, GX
|
|||
}
|
||||
}
|
||||
|
||||
static inline void SetTexCoordGen(GX::TexCoordID dstCoord, u32 flags) noexcept {
|
||||
static inline void SetTexCoordGen(GXTexCoordID dstCoord, u32 flags) noexcept {
|
||||
auto& state = sGXState.x228_texStates[dstCoord].x0_coordGen;
|
||||
if (flags != state) {
|
||||
state = flags;
|
||||
GXSetTexCoordGen2(dstCoord, GX::TexGenType(flags & 15), GX::TexGenSrc(flags >> 4 & 31),
|
||||
GX::TexMtx((flags >> 9 & 31) + GX::TEXMTX0), GXBool(flags >> 14 & 1),
|
||||
GX::PTTexMtx((flags >> 15 & 63) + GX::PTTEXMTX0));
|
||||
GXSetTexCoordGen2(dstCoord, GXTexGenType(flags & 15), GXTexGenSrc(flags >> 4 & 31),
|
||||
GXTexMtx((flags >> 9 & 31) + GX_TEXMTX0), GXBool(flags >> 14 & 1),
|
||||
GXPTTexMtx((flags >> 15 & 63) + GX_PTTEXMTX0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -406,28 +411,28 @@ static inline void SetVtxDescv_Compressed(u32 descList) noexcept {
|
|||
u32 attrIdx = 0;
|
||||
do {
|
||||
sVtxDescList[attrIdx] = {
|
||||
GX::Attr(GX::VA_POS + attrIdx),
|
||||
GX::AttrType(descList >> shift & 3),
|
||||
GXAttr(GX_VA_POS + attrIdx),
|
||||
GXAttrType(descList >> shift & 3),
|
||||
};
|
||||
shift += 2;
|
||||
++attrIdx;
|
||||
--remain;
|
||||
} while (remain != 0);
|
||||
sVtxDescList[attrIdx] = {};
|
||||
sVtxDescList[attrIdx] = {GX_VA_NULL, GX_NONE};
|
||||
GXSetVtxDescv(sVtxDescList.data());
|
||||
sGXState.x48_descList = descList;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void SetVtxDescv(const GX::VtxDescList* descList) noexcept {
|
||||
static inline void SetVtxDescv(const GXVtxDescList* descList) noexcept {
|
||||
u32 flags = 0;
|
||||
for (; descList->attr != GX::VA_NULL; ++descList) {
|
||||
flags |= (descList->type & 3) << (descList->attr - GX::VA_POS) * 2;
|
||||
for (; descList->attr != GX_VA_NULL; ++descList) {
|
||||
flags |= (descList->type & 3) << (descList->attr - GX_VA_POS) * 2;
|
||||
}
|
||||
SetVtxDescv_Compressed(flags);
|
||||
}
|
||||
|
||||
static inline void SetZMode(GXBool compareEnable, GX::Compare func, GXBool updateEnable) noexcept {
|
||||
static inline void SetZMode(GXBool compareEnable, GXCompare func, GXBool updateEnable) noexcept {
|
||||
u32 flags = (func & 0xFF) << 2 | (u8(updateEnable) << 1) | (u8(compareEnable) & 1);
|
||||
auto& state = sGXState.x52_zmode;
|
||||
if (flags != state) {
|
||||
|
@ -436,7 +441,7 @@ static inline void SetZMode(GXBool compareEnable, GX::Compare func, GXBool updat
|
|||
}
|
||||
}
|
||||
|
||||
static inline void GetFog(GX::FogType* fogType, float* fogStartZ, float* fogEndZ, float* fogNearZ, float* fogFarZ,
|
||||
static inline void GetFog(GXFogType* fogType, float* fogStartZ, float* fogEndZ, float* fogNearZ, float* fogFarZ,
|
||||
GXColor* fogColor) {
|
||||
if (fogType != nullptr) {
|
||||
*fogType = sGXState.x53_fogType;
|
||||
|
|
|
@ -18,7 +18,7 @@ u32 CGraphics::g_FlippingState;
|
|||
bool CGraphics::g_LastFrameUsedAbove = false;
|
||||
bool CGraphics::g_InterruptLastFrameUsedAbove = false;
|
||||
GX::LightMask CGraphics::g_LightActive{};
|
||||
std::array<GX::LightObj, GX::MaxLights> CGraphics::g_LightObjs;
|
||||
std::array<GXLightObj, GX::MaxLights> CGraphics::g_LightObjs;
|
||||
std::array<ELightType, GX::MaxLights> CGraphics::g_LightTypes;
|
||||
zeus::CTransform CGraphics::g_GXModelView;
|
||||
zeus::CTransform CGraphics::g_GXModelViewInvXpose;
|
||||
|
@ -59,8 +59,8 @@ const std::array<zeus::CMatrix3f, 6> CGraphics::skCubeBasisMats{{
|
|||
}};
|
||||
|
||||
// Stream API
|
||||
static EStreamFlags sStreamFlags;
|
||||
static GX::Primitive sStreamPrimitive;
|
||||
static u32 sStreamFlags;
|
||||
static GXPrimitive sStreamPrimitive;
|
||||
static u32 sVerticesCount;
|
||||
static zeus::CColor sQueuedColor;
|
||||
// Originally writes directly to GX FIFO
|
||||
|
@ -80,7 +80,7 @@ void CGraphics::DisableAllLights() {
|
|||
}
|
||||
|
||||
void CGraphics::LoadLight(ERglLight light, const CLight& info) {
|
||||
const auto lightId = static_cast<GX::LightID>(1 << light);
|
||||
const auto lightId = static_cast<GXLightID>(1 << light);
|
||||
|
||||
auto& obj = g_LightObjs[light];
|
||||
zeus::CVector3f pos = info.GetPosition();
|
||||
|
@ -97,7 +97,7 @@ void CGraphics::LoadLight(ERglLight light, const CLight& info) {
|
|||
GXInitLightDir(&obj, dir.x(), dir.y(), dir.z());
|
||||
GXInitLightAttn(&obj, 1.f, 0.f, 0.f, info.GetAttenuationConstant(), info.GetAttenuationLinear(),
|
||||
info.GetAttenuationQuadratic());
|
||||
GXInitLightSpot(&obj, info.GetSpotCutoff(), GX::SP_COS2);
|
||||
GXInitLightSpot(&obj, info.GetSpotCutoff(), GX_SP_COS2);
|
||||
} else if (type == ELightType::Custom) {
|
||||
pos = g_CameraMatrix * pos;
|
||||
GXInitLightPos(&obj, pos.x(), pos.y(), pos.z());
|
||||
|
@ -114,8 +114,8 @@ void CGraphics::LoadLight(ERglLight light, const CLight& info) {
|
|||
}
|
||||
|
||||
g_LightTypes[light] = type;
|
||||
GX::Color col(info.GetColor().r(), info.GetColor().g(), info.GetColor().b());
|
||||
GXInitLightColor(&obj, col);
|
||||
zeus::CColor col(info.GetColor().r(), info.GetColor().g(), info.GetColor().b());
|
||||
GXInitLightColor(&obj, to_gx_color(col));
|
||||
GXLoadLightObjImm(&obj, lightId);
|
||||
}
|
||||
|
||||
|
@ -130,9 +130,9 @@ void CGraphics::EnableLight(ERglLight light) {
|
|||
void CGraphics::SetLightState(GX::LightMask lightState) {
|
||||
g_LightActive = lightState;
|
||||
const bool hasLights = lightState.any();
|
||||
CGX::SetChanCtrl(CGX::EChannelId::Channel0, hasLights, GX::SRC_REG,
|
||||
sStreamFlags & EStreamFlagBits::fHasColor ? GX::SRC_VTX : GX::SRC_REG, lightState,
|
||||
hasLights ? GX::DF_CLAMP : GX::DF_NONE, hasLights ? GX::AF_SPOT : GX::AF_NONE);
|
||||
CGX::SetChanCtrl(CGX::EChannelId::Channel0, hasLights, GX_SRC_REG,
|
||||
sStreamFlags & 2 /* fHasColor */ ? GX_SRC_VTX : GX_SRC_REG, lightState,
|
||||
hasLights ? GX_DF_CLAMP : GX_DF_NONE, hasLights ? GX_AF_SPOT : GX_AF_NONE);
|
||||
}
|
||||
|
||||
void CGraphics::SetAmbientColor(const zeus::CColor& col) {
|
||||
|
@ -141,21 +141,21 @@ void CGraphics::SetAmbientColor(const zeus::CColor& col) {
|
|||
}
|
||||
|
||||
void CGraphics::SetFog(ERglFogMode mode, float startz, float endz, const zeus::CColor& color) {
|
||||
CGX::SetFog(GX::FogType(mode), startz, endz, g_Proj.x14_near, g_Proj.x18_far, color);
|
||||
CGX::SetFog(GXFogType(mode), startz, endz, g_Proj.x14_near, g_Proj.x18_far, to_gx_color(color));
|
||||
}
|
||||
|
||||
void CGraphics::SetDepthWriteMode(bool compare_enable, ERglEnum comp, bool update_enable) {
|
||||
g_depthFunc = comp;
|
||||
CGX::SetZMode(compare_enable, GX::Compare(comp), update_enable);
|
||||
CGX::SetZMode(compare_enable, GXCompare(comp), update_enable);
|
||||
}
|
||||
|
||||
void CGraphics::SetBlendMode(ERglBlendMode mode, ERglBlendFactor src, ERglBlendFactor dst, ERglLogicOp op) {
|
||||
CGX::SetBlendMode(GX::BlendMode(mode), GX::BlendFactor(src), GX::BlendFactor(dst), GX::LogicOp(op));
|
||||
CGX::SetBlendMode(GXBlendMode(mode), GXBlendFactor(src), GXBlendFactor(dst), GXLogicOp(op));
|
||||
}
|
||||
|
||||
void CGraphics::SetCullMode(ERglCullMode mode) {
|
||||
g_cullMode = mode;
|
||||
GXSetCullMode(GX::CullMode(mode));
|
||||
GXSetCullMode(GXCullMode(mode));
|
||||
}
|
||||
|
||||
void CGraphics::BeginScene() {
|
||||
|
@ -163,7 +163,7 @@ void CGraphics::BeginScene() {
|
|||
}
|
||||
|
||||
void CGraphics::EndScene() {
|
||||
CGX::SetZMode(true, GX::LEQUAL, true);
|
||||
CGX::SetZMode(true, GX_LEQUAL, true);
|
||||
|
||||
/* Spinwait until g_NumBreakpointsWaiting is 0 */
|
||||
/* ++g_NumBreakpointsWaiting; */
|
||||
|
@ -190,10 +190,10 @@ void CGraphics::Render2D(CTexture& tex, u32 x, u32 y, u32 w, u32 h, const zeus::
|
|||
const auto oldLights = g_LightActive;
|
||||
SetOrtho(-g_Viewport.x10_halfWidth, g_Viewport.x10_halfWidth, g_Viewport.x14_halfHeight, -g_Viewport.x14_halfHeight,
|
||||
-1.f, -10.f);
|
||||
GXLoadPosMtxImm({}, GX::PNMTX0);
|
||||
GXLoadPosMtxImm({}, GX_PNMTX0);
|
||||
DisableAllLights();
|
||||
SetCullMode(ERglCullMode::None);
|
||||
tex.Load(GX::TEXMAP0, EClampMode::Repeat);
|
||||
tex.Load(GX_TEXMAP0, EClampMode::Repeat);
|
||||
|
||||
// float hPad, vPad;
|
||||
// if (CGraphics::GetViewportAspect() >= 1.78f) {
|
||||
|
@ -213,7 +213,7 @@ void CGraphics::Render2D(CTexture& tex, u32 x, u32 y, u32 w, u32 h, const zeus::
|
|||
float y1 = scaledY - g_Viewport.x14_halfHeight;
|
||||
float x2 = x1 + scaledW;
|
||||
float y2 = y1 + scaledH;
|
||||
StreamBegin(GX::TRIANGLESTRIP);
|
||||
StreamBegin(GX_TRIANGLESTRIP);
|
||||
StreamColor(col);
|
||||
StreamTexcoord(0.f, 0.f);
|
||||
StreamVertex(x1, y1, 1.f);
|
||||
|
@ -240,8 +240,8 @@ void CGraphics::DoRender2D(const CTexture& tex, s32 x, s32 y, s32 w1, s32 w2, s3
|
|||
void CGraphics::EndRender2D(bool v) {}
|
||||
|
||||
void CGraphics::SetAlphaCompare(ERglAlphaFunc comp0, u8 ref0, ERglAlphaOp op, ERglAlphaFunc comp1, u8 ref1) {
|
||||
CGX::SetAlphaCompare(static_cast<GX::Compare>(comp0), ref0, static_cast<GX::AlphaOp>(op),
|
||||
static_cast<GX::Compare>(comp1), ref1);
|
||||
CGX::SetAlphaCompare(static_cast<GXCompare>(comp0), ref0, static_cast<GXAlphaOp>(op), static_cast<GXCompare>(comp1),
|
||||
ref1);
|
||||
}
|
||||
|
||||
void CGraphics::SetViewPointMatrix(const zeus::CTransform& xf) {
|
||||
|
@ -259,12 +259,12 @@ void CGraphics::SetViewMatrix() {
|
|||
else
|
||||
g_GXModelView = g_CameraMatrix * g_GXModelMatrix;
|
||||
/* Load position matrix */
|
||||
GXLoadPosMtxImm(g_GXModelView, GX::PNMTX0);
|
||||
GXLoadPosMtxImm(&g_GXModelView, GX_PNMTX0);
|
||||
/* Inverse-transpose */
|
||||
g_GXModelViewInvXpose = g_GXModelView.inverse();
|
||||
g_GXModelViewInvXpose.basis.transpose();
|
||||
/* Load normal matrix */
|
||||
GXLoadNrmMtxImm(g_GXModelViewInvXpose, GX::PNMTX0);
|
||||
GXLoadNrmMtxImm(&g_GXModelViewInvXpose, GX_PNMTX0);
|
||||
}
|
||||
|
||||
void CGraphics::SetModelMatrix(const zeus::CTransform& xf) {
|
||||
|
@ -316,7 +316,7 @@ zeus::CMatrix4f CGraphics::GetPerspectiveProjectionMatrix() {
|
|||
return {
|
||||
2.f * g_Proj.x14_near / rml, 0.f, rpl / rml, 0.f, 0.f,
|
||||
2.f * g_Proj.x14_near / tmb, tpb / tmb, 0.f,
|
||||
0.f, 0.f, -fpn / fmn, -2.f * g_Proj.x18_far * g_Proj.x14_near / fmn,
|
||||
0.f, 0.f, -g_Proj.x14_near / fmn, -(g_Proj.x18_far * g_Proj.x14_near) / fmn,
|
||||
0.f, 0.f, -1.f, 0.f,
|
||||
};
|
||||
// clang-format on
|
||||
|
@ -330,7 +330,7 @@ zeus::CMatrix4f CGraphics::GetPerspectiveProjectionMatrix() {
|
|||
return {
|
||||
2.f / rml, 0.f, 0.f, -rpl / rml,
|
||||
0.f, 2.f / tmb, 0.f, -tpb / tmb,
|
||||
0.f, 0.f, -1.f / fmn, -g_Proj.x14_near / fmn,
|
||||
0.f, 0.f, -1.f / fmn, -g_Proj.x18_far / fmn,
|
||||
0.f, 0.f, 0.f, 1.f
|
||||
};
|
||||
// clang-format on
|
||||
|
@ -375,10 +375,10 @@ void CGraphics::FlushProjection() {
|
|||
const auto mtx = GetPerspectiveProjectionMatrix();
|
||||
if (g_Proj.x0_persp) {
|
||||
// Convert and load persp
|
||||
GXSetProjection(mtx, GX::PERSPECTIVE);
|
||||
GXSetProjection(&mtx, GX_PERSPECTIVE);
|
||||
} else {
|
||||
// Convert and load ortho
|
||||
GXSetProjection(mtx, GX::ORTHOGRAPHIC);
|
||||
GXSetProjection(&mtx, GX_ORTHOGRAPHIC);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -521,14 +521,14 @@ void CGraphics::SetUseVideoFilter(bool filter) {
|
|||
|
||||
void CGraphics::SetClearColor(const zeus::CColor& color) {
|
||||
g_ClearColor = color;
|
||||
GXSetCopyClear(color, g_ClearDepthValue);
|
||||
GXSetCopyClear(to_gx_color(color), g_ClearDepthValue);
|
||||
}
|
||||
|
||||
void CGraphics::SetCopyClear(const zeus::CColor& color, float depth) {
|
||||
g_ClearColor = color;
|
||||
g_ClearDepthValue = depth; // 1.6777215E7 * depth; Metroid Prime needed this to convert float [0,1] depth into 24 bit
|
||||
// range, we no longer have this requirement
|
||||
GXSetCopyClear(g_ClearColor, g_ClearDepthValue);
|
||||
GXSetCopyClear(to_gx_color(g_ClearColor), g_ClearDepthValue);
|
||||
}
|
||||
|
||||
void CGraphics::SetIsBeginSceneClearFb(bool clear) { g_IsBeginSceneClearFb = clear; }
|
||||
|
@ -537,19 +537,19 @@ void CGraphics::SetTevOp(ERglTevStage stage, const CTevCombiners::CTevPass& pass
|
|||
CTevCombiners::SetupPass(stage, pass);
|
||||
}
|
||||
|
||||
void CGraphics::StreamBegin(GX::Primitive primitive) {
|
||||
void CGraphics::StreamBegin(GXPrimitive primitive) {
|
||||
// Originally ResetVertexDataStream(true);
|
||||
sQueuedVertices.clear();
|
||||
sQueuedVertices.emplace_back(sQueuedColor);
|
||||
sVerticesCount = 0;
|
||||
// End
|
||||
sStreamFlags = EStreamFlagBits::fHasColor;
|
||||
sStreamFlags = 2;
|
||||
sStreamPrimitive = primitive;
|
||||
}
|
||||
|
||||
void CGraphics::StreamNormal(const zeus::CVector3f& nrm) {
|
||||
sQueuedVertices.back().normal = nrm;
|
||||
sStreamFlags |= EStreamFlagBits::fHasNormal;
|
||||
sStreamFlags |= 1;
|
||||
}
|
||||
|
||||
void CGraphics::StreamColor(const zeus::CColor& color) {
|
||||
|
@ -558,12 +558,12 @@ void CGraphics::StreamColor(const zeus::CColor& color) {
|
|||
} else {
|
||||
sQueuedColor = color;
|
||||
}
|
||||
sStreamFlags |= EStreamFlagBits::fHasColor;
|
||||
sStreamFlags |= 2;
|
||||
}
|
||||
|
||||
void CGraphics::StreamTexcoord(const zeus::CVector2f& uv) {
|
||||
sQueuedVertices.back().texCoord = uv;
|
||||
sStreamFlags |= EStreamFlagBits::fHasTexture;
|
||||
sStreamFlags |= 4;
|
||||
}
|
||||
|
||||
void CGraphics::StreamVertex(const zeus::CVector3f& pos) {
|
||||
|
@ -589,35 +589,36 @@ void CGraphics::UpdateVertexDataStream() {
|
|||
}
|
||||
|
||||
void CGraphics::FlushStream() {
|
||||
std::array<GX::VtxDescList, 5> vtxDescList{};
|
||||
std::array<GXVtxDescList, 5> vtxDescList{};
|
||||
size_t idx = 0;
|
||||
vtxDescList[idx++] = {GX::VA_POS, GX::DIRECT};
|
||||
if (sStreamFlags & EStreamFlagBits::fHasNormal) {
|
||||
vtxDescList[idx++] = {GX::VA_NRM, GX::DIRECT};
|
||||
vtxDescList[idx++] = {GX_VA_POS, GX_DIRECT};
|
||||
if (sStreamFlags & 1) {
|
||||
vtxDescList[idx++] = {GX_VA_NRM, GX_DIRECT};
|
||||
}
|
||||
if (sStreamFlags & EStreamFlagBits::fHasColor) {
|
||||
vtxDescList[idx++] = {GX::VA_CLR0, GX::DIRECT};
|
||||
if (sStreamFlags & 2) {
|
||||
vtxDescList[idx++] = {GX_VA_CLR0, GX_DIRECT};
|
||||
}
|
||||
if (sStreamFlags & EStreamFlagBits::fHasTexture) {
|
||||
vtxDescList[idx++] = {GX::VA_TEX0, GX::DIRECT};
|
||||
if (sStreamFlags & 4) {
|
||||
vtxDescList[idx++] = {GX_VA_TEX0, GX_DIRECT};
|
||||
}
|
||||
vtxDescList[idx] = {GX_VA_NULL, GX_NONE};
|
||||
CGX::SetVtxDescv(vtxDescList.data());
|
||||
SetTevStates(sStreamFlags);
|
||||
FullRender();
|
||||
}
|
||||
|
||||
void CGraphics::FullRender() {
|
||||
CGX::Begin(sStreamPrimitive, GX::VTXFMT0, sVerticesCount);
|
||||
CGX::Begin(sStreamPrimitive, GX_VTXFMT0, sVerticesCount);
|
||||
for (size_t i = 0; i < sVerticesCount; ++i) {
|
||||
const auto& item = sQueuedVertices[i];
|
||||
GXPosition3f32(item.vertex);
|
||||
if (sStreamFlags & EStreamFlagBits::fHasNormal) {
|
||||
if (sStreamFlags & 1) {
|
||||
GXNormal3f32(item.normal);
|
||||
}
|
||||
if (sStreamFlags & EStreamFlagBits::fHasColor) {
|
||||
if (sStreamFlags & 2) {
|
||||
GXColor4f32(item.color);
|
||||
}
|
||||
if (sStreamFlags & EStreamFlagBits::fHasTexture) {
|
||||
if (sStreamFlags & 4) {
|
||||
GXTexCoord2f32(item.texCoord);
|
||||
}
|
||||
}
|
||||
|
@ -638,7 +639,7 @@ void CGraphics::ResetVertexDataStream(bool end) {
|
|||
}
|
||||
}
|
||||
|
||||
void CGraphics::DrawPrimitive(GX::Primitive primitive, const zeus::CVector3f* pos, const zeus::CVector3f& normal,
|
||||
void CGraphics::DrawPrimitive(GXPrimitive primitive, const zeus::CVector3f* pos, const zeus::CVector3f& normal,
|
||||
const zeus::CColor& col, s32 numVerts) {
|
||||
StreamBegin(primitive);
|
||||
StreamColor(col);
|
||||
|
@ -649,25 +650,25 @@ void CGraphics::DrawPrimitive(GX::Primitive primitive, const zeus::CVector3f* po
|
|||
StreamEnd();
|
||||
}
|
||||
|
||||
void CGraphics::SetTevStates(EStreamFlags flags) noexcept {
|
||||
if (flags & EStreamFlagBits::fHasTexture) {
|
||||
void CGraphics::SetTevStates(u32 flags) noexcept {
|
||||
if (flags & 4 /* fHasTexture */) {
|
||||
CGX::SetNumTexGens(1); // sTextureUsed & 3?
|
||||
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD0, GX::TEXMAP0, GX::COLOR0A0);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE1, GX::TEXCOORD1, GX::TEXMAP1, GX::COLOR0A0);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD1, GX_TEXMAP1, GX_COLOR0A0);
|
||||
} else {
|
||||
CGX::SetNumTexGens(0);
|
||||
CGX::SetNumTevStages(1);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD_NULL, GX::TEXMAP_NULL, GX::COLOR0A0);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE1, GX::TEXCOORD_NULL, GX::TEXMAP_NULL, GX::COLOR0A0);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
}
|
||||
CGX::SetNumChans(1);
|
||||
CGX::SetNumIndStages(0);
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD0, GX::TG_MTX2x4, GX::TG_TEX0, GX::IDENTITY, false, GX::PTIDENTITY);
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD1, GX::TG_MTX2x4, GX::TG_TEX1, GX::IDENTITY, false, GX::PTIDENTITY);
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, false, GX_PTIDENTITY);
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD1, GX_TG_MTX2x4, GX_TG_TEX1, GX_IDENTITY, false, GX_PTIDENTITY);
|
||||
const bool hasLights = g_LightActive.any();
|
||||
CGX::SetChanCtrl(CGX::EChannelId::Channel0, hasLights, GX::SRC_REG,
|
||||
flags & EStreamFlagBits::fHasColor ? GX::SRC_VTX : GX::SRC_REG, g_LightActive,
|
||||
hasLights ? GX::DF_CLAMP : GX::DF_NONE, hasLights ? GX::AF_SPOT : GX::AF_NONE);
|
||||
CGX::SetChanCtrl(CGX::EChannelId::Channel0, hasLights, GX_SRC_REG,
|
||||
flags & 2 /* fHasColor */ ? GX_SRC_VTX : GX_SRC_REG, g_LightActive,
|
||||
hasLights ? GX_DF_CLAMP : GX_DF_NONE, hasLights ? GX_AF_SPOT : GX_AF_NONE);
|
||||
CGX::FlushState(); // normally would be handled in FullRender TODO
|
||||
}
|
||||
|
||||
|
@ -715,22 +716,22 @@ 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 (GXAttr attr = GX_VA_TEX1; attr <= GX_VA_TEX7; attr = GXAttr(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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include <zeus/CVector2f.hpp>
|
||||
#include <zeus/CVector2i.hpp>
|
||||
|
||||
#include <aurora/gfx.hpp>
|
||||
#include <optick.h>
|
||||
|
||||
using frame_clock = std::chrono::high_resolution_clock;
|
||||
|
@ -25,108 +24,108 @@ class CTexture;
|
|||
extern CVar* g_disableLighting;
|
||||
class CTimeProvider;
|
||||
|
||||
enum class ERglCullMode : std::underlying_type_t<GX::CullMode> {
|
||||
None = GX::CULL_NONE,
|
||||
Front = GX::CULL_FRONT,
|
||||
Back = GX::CULL_BACK,
|
||||
All = GX::CULL_ALL,
|
||||
enum class ERglCullMode : std::underlying_type_t<GXCullMode> {
|
||||
None = GX_CULL_NONE,
|
||||
Front = GX_CULL_FRONT,
|
||||
Back = GX_CULL_BACK,
|
||||
All = GX_CULL_ALL,
|
||||
};
|
||||
|
||||
enum class ERglBlendMode : std::underlying_type_t<GX::BlendMode> {
|
||||
None = GX::BM_NONE,
|
||||
Blend = GX::BM_BLEND,
|
||||
Logic = GX::BM_LOGIC,
|
||||
Subtract = GX::BM_SUBTRACT,
|
||||
Max = GX::MAX_BLENDMODE,
|
||||
enum class ERglBlendMode : std::underlying_type_t<GXBlendMode> {
|
||||
None = GX_BM_NONE,
|
||||
Blend = GX_BM_BLEND,
|
||||
Logic = GX_BM_LOGIC,
|
||||
Subtract = GX_BM_SUBTRACT,
|
||||
Max = GX_MAX_BLENDMODE,
|
||||
};
|
||||
|
||||
enum class ERglBlendFactor : std::underlying_type_t<GX::BlendFactor> {
|
||||
Zero = GX::BL_ZERO,
|
||||
One = GX::BL_ONE,
|
||||
SrcColor = GX::BL_SRCCLR,
|
||||
InvSrcColor = GX::BL_INVSRCCLR,
|
||||
SrcAlpha = GX::BL_SRCALPHA,
|
||||
InvSrcAlpha = GX::BL_INVSRCALPHA,
|
||||
DstAlpha = GX::BL_DSTALPHA,
|
||||
InvDstAlpha = GX::BL_INVDSTALPHA,
|
||||
DstColor = GX::BL_DSTCLR,
|
||||
InvDstColor = GX::BL_INVDSTCLR,
|
||||
enum class ERglBlendFactor : std::underlying_type_t<GXBlendFactor> {
|
||||
Zero = GX_BL_ZERO,
|
||||
One = GX_BL_ONE,
|
||||
SrcColor = GX_BL_SRCCLR,
|
||||
InvSrcColor = GX_BL_INVSRCCLR,
|
||||
SrcAlpha = GX_BL_SRCALPHA,
|
||||
InvSrcAlpha = GX_BL_INVSRCALPHA,
|
||||
DstAlpha = GX_BL_DSTALPHA,
|
||||
InvDstAlpha = GX_BL_INVDSTALPHA,
|
||||
DstColor = GX_BL_DSTCLR,
|
||||
InvDstColor = GX_BL_INVDSTCLR,
|
||||
};
|
||||
|
||||
enum class ERglLogicOp : std::underlying_type_t<GX::LogicOp> {
|
||||
Clear = GX::LO_CLEAR,
|
||||
And = GX::LO_AND,
|
||||
RevAnd = GX::LO_REVAND,
|
||||
Copy = GX::LO_COPY,
|
||||
InvAnd = GX::LO_INVAND,
|
||||
NoOp = GX::LO_NOOP,
|
||||
Xor = GX::LO_XOR,
|
||||
Or = GX::LO_OR,
|
||||
Nor = GX::LO_NOR,
|
||||
Equiv = GX::LO_EQUIV,
|
||||
Inv = GX::LO_INV,
|
||||
RevOr = GX::LO_REVOR,
|
||||
InvCopy = GX::LO_INVCOPY,
|
||||
InvOr = GX::LO_INVOR,
|
||||
NAnd = GX::LO_NAND,
|
||||
Set = GX::LO_SET,
|
||||
enum class ERglLogicOp : std::underlying_type_t<GXLogicOp> {
|
||||
Clear = GX_LO_CLEAR,
|
||||
And = GX_LO_AND,
|
||||
RevAnd = GX_LO_REVAND,
|
||||
Copy = GX_LO_COPY,
|
||||
InvAnd = GX_LO_INVAND,
|
||||
NoOp = GX_LO_NOOP,
|
||||
Xor = GX_LO_XOR,
|
||||
Or = GX_LO_OR,
|
||||
Nor = GX_LO_NOR,
|
||||
Equiv = GX_LO_EQUIV,
|
||||
Inv = GX_LO_INV,
|
||||
RevOr = GX_LO_REVOR,
|
||||
InvCopy = GX_LO_INVCOPY,
|
||||
InvOr = GX_LO_INVOR,
|
||||
NAnd = GX_LO_NAND,
|
||||
Set = GX_LO_SET,
|
||||
};
|
||||
|
||||
enum class ERglAlphaFunc : std::underlying_type_t<GX::Compare> {
|
||||
Never = GX::NEVER,
|
||||
Less = GX::LESS,
|
||||
Equal = GX::EQUAL,
|
||||
LEqual = GX::LEQUAL,
|
||||
Greater = GX::GREATER,
|
||||
NEqual = GX::NEQUAL,
|
||||
GEqual = GX::GEQUAL,
|
||||
Always = GX::ALWAYS,
|
||||
enum class ERglAlphaFunc : std::underlying_type_t<GXCompare> {
|
||||
Never = GX_NEVER,
|
||||
Less = GX_LESS,
|
||||
Equal = GX_EQUAL,
|
||||
LEqual = GX_LEQUAL,
|
||||
Greater = GX_GREATER,
|
||||
NEqual = GX_NEQUAL,
|
||||
GEqual = GX_GEQUAL,
|
||||
Always = GX_ALWAYS,
|
||||
};
|
||||
|
||||
enum class ERglAlphaOp : std::underlying_type_t<GX::AlphaOp> {
|
||||
And = GX::AOP_AND,
|
||||
Or = GX::AOP_OR,
|
||||
Xor = GX::AOP_XOR,
|
||||
XNor = GX::AOP_XNOR,
|
||||
Max = GX::MAX_ALPHAOP,
|
||||
enum class ERglAlphaOp : std::underlying_type_t<GXAlphaOp> {
|
||||
And = GX_AOP_AND,
|
||||
Or = GX_AOP_OR,
|
||||
Xor = GX_AOP_XOR,
|
||||
XNor = GX_AOP_XNOR,
|
||||
Max = GX_MAX_ALPHAOP,
|
||||
};
|
||||
|
||||
enum class ERglEnum : std::underlying_type_t<GX::Compare> {
|
||||
Never = GX::NEVER,
|
||||
Less = GX::LESS,
|
||||
Equal = GX::EQUAL,
|
||||
LEqual = GX::LEQUAL,
|
||||
Greater = GX::GREATER,
|
||||
NEqual = GX::NEQUAL,
|
||||
GEqual = GX::GEQUAL,
|
||||
Always = GX::ALWAYS,
|
||||
enum class ERglEnum : std::underlying_type_t<GXCompare> {
|
||||
Never = GX_NEVER,
|
||||
Less = GX_LESS,
|
||||
Equal = GX_EQUAL,
|
||||
LEqual = GX_LEQUAL,
|
||||
Greater = GX_GREATER,
|
||||
NEqual = GX_NEQUAL,
|
||||
GEqual = GX_GEQUAL,
|
||||
Always = GX_ALWAYS,
|
||||
};
|
||||
|
||||
using ERglLight = u8;
|
||||
|
||||
enum class ERglTexOffset : std::underlying_type_t<GX::TexOffset> {
|
||||
Zero = GX::TO_ZERO,
|
||||
Sixteenth = GX::TO_SIXTEENTH,
|
||||
Eighth = GX::TO_EIGHTH,
|
||||
Fourth = GX::TO_FOURTH,
|
||||
Half = GX::TO_HALF,
|
||||
One = GX::TO_ONE,
|
||||
enum class ERglTexOffset : std::underlying_type_t<GXTexOffset> {
|
||||
Zero = GX_TO_ZERO,
|
||||
Sixteenth = GX_TO_SIXTEENTH,
|
||||
Eighth = GX_TO_EIGHTH,
|
||||
Fourth = GX_TO_FOURTH,
|
||||
Half = GX_TO_HALF,
|
||||
One = GX_TO_ONE,
|
||||
};
|
||||
|
||||
enum class ERglFogMode : std::underlying_type_t<GX::FogType> {
|
||||
None = GX::FOG_NONE,
|
||||
enum class ERglFogMode : std::underlying_type_t<GXFogType> {
|
||||
None = GX_FOG_NONE,
|
||||
|
||||
PerspLin = GX::FOG_PERSP_LIN,
|
||||
PerspExp = GX::FOG_PERSP_EXP,
|
||||
PerspExp2 = GX::FOG_ORTHO_EXP2,
|
||||
PerspRevExp = GX::FOG_PERSP_REVEXP,
|
||||
PerspRevExp2 = GX::FOG_PERSP_REVEXP2,
|
||||
PerspLin = GX_FOG_PERSP_LIN,
|
||||
PerspExp = GX_FOG_PERSP_EXP,
|
||||
PerspExp2 = GX_FOG_ORTHO_EXP2,
|
||||
PerspRevExp = GX_FOG_PERSP_REVEXP,
|
||||
PerspRevExp2 = GX_FOG_PERSP_REVEXP2,
|
||||
|
||||
OrthoLin = GX::FOG_ORTHO_LIN,
|
||||
OrthoExp = GX::FOG_ORTHO_EXP,
|
||||
OrthoExp2 = GX::FOG_ORTHO_EXP2,
|
||||
OrthoRevExp = GX::FOG_ORTHO_REVEXP,
|
||||
OrthoRevExp2 = GX::FOG_ORTHO_REVEXP2,
|
||||
OrthoLin = GX_FOG_ORTHO_LIN,
|
||||
OrthoExp = GX_FOG_ORTHO_EXP,
|
||||
OrthoExp2 = GX_FOG_ORTHO_EXP2,
|
||||
OrthoRevExp = GX_FOG_ORTHO_REVEXP,
|
||||
OrthoRevExp2 = GX_FOG_ORTHO_REVEXP2,
|
||||
};
|
||||
|
||||
struct SViewport {
|
||||
|
@ -165,13 +164,13 @@ struct SClipScreenRect {
|
|||
, x20_uvYMin(uvYMin)
|
||||
, x24_uvYMax(uvYMax) {}
|
||||
|
||||
SClipScreenRect(const aurora::gfx::ClipRect& rect) {
|
||||
x4_left = rect.x;
|
||||
x8_top = rect.y;
|
||||
xc_width = rect.width;
|
||||
x10_height = rect.height;
|
||||
x14_dstWidth = rect.width;
|
||||
}
|
||||
// SClipScreenRect(const aurora::gfx::ClipRect& rect) {
|
||||
// x4_left = rect.x;
|
||||
// x8_top = rect.y;
|
||||
// xc_width = rect.width;
|
||||
// x10_height = rect.height;
|
||||
// x14_dstWidth = rect.width;
|
||||
// }
|
||||
|
||||
SClipScreenRect(const SViewport& vp) {
|
||||
x4_left = vp.x0_left;
|
||||
|
@ -214,7 +213,7 @@ public:
|
|||
static bool g_LastFrameUsedAbove;
|
||||
static bool g_InterruptLastFrameUsedAbove;
|
||||
static GX::LightMask g_LightActive;
|
||||
static std::array<GX::LightObj, GX::MaxLights> g_LightObjs;
|
||||
static std::array<GXLightObj, GX::MaxLights> g_LightObjs;
|
||||
static std::array<ELightType, GX::MaxLights> g_LightTypes;
|
||||
static zeus::CTransform g_GXModelView;
|
||||
static zeus::CTransform g_GXModelViewInvXpose;
|
||||
|
@ -309,31 +308,33 @@ public:
|
|||
|
||||
static const std::array<zeus::CMatrix3f, 6> skCubeBasisMats;
|
||||
|
||||
static void ResolveSpareTexture(const SClipScreenRect& rect, int bindIdx, GX::TextureFormat format,
|
||||
bool clearDepth = false) {
|
||||
aurora::gfx::resolve_color({rect.x4_left, rect.x8_top, rect.xc_width, rect.x10_height}, bindIdx, format,
|
||||
clearDepth);
|
||||
static void ResolveSpareTexture(const SClipScreenRect& rect, int bindIdx, GXTexFmt format, bool clearDepth = false) {
|
||||
// TODO
|
||||
// aurora::gfx::resolve_color({rect.x4_left, rect.x8_top, rect.xc_width, rect.x10_height}, bindIdx, format,
|
||||
// clearDepth);
|
||||
}
|
||||
static void LoadDolphinSpareTexture(int bindIdx, GX::TextureFormat format, GX::TexMapID id) {
|
||||
GXTexObj obj;
|
||||
GXInitTexObjResolved(&obj, bindIdx, format, GX_CLAMP, GX_CLAMP, GX_TLUT0);
|
||||
GXInitTexObjLOD(&obj, GX_NEAR, GX_NEAR, 0.f, 0.f, 0.f, false, false, GX_ANISO_1);
|
||||
GXLoadTexObj(&obj, id);
|
||||
static void LoadDolphinSpareTexture(int bindIdx, GXTexFmt format, GXTexMapID id) {
|
||||
// TODO
|
||||
// GXTexObj obj;
|
||||
// GXInitTexObjResolved(&obj, bindIdx, format, GX_CLAMP, GX_CLAMP, GX_TLUT0);
|
||||
// GXInitTexObjLOD(&obj, GX_NEAR, GX_NEAR, 0.f, 0.f, 0.f, false, false, GX_ANISO_1);
|
||||
// GXLoadTexObj(&obj, id);
|
||||
}
|
||||
static void LoadDolphinSpareTexture(int bindIdx, GXCITexFmt format, GXTlut tlut, GX::TexMapID id) {
|
||||
GXTexObj obj;
|
||||
GXInitTexObjResolved(&obj, bindIdx, static_cast<GX::TextureFormat>(format), GX_CLAMP, GX_CLAMP, tlut);
|
||||
GXInitTexObjLOD(&obj, GX_NEAR, GX_NEAR, 0.f, 0.f, 0.f, false, false, GX_ANISO_1);
|
||||
GXLoadTexObj(&obj, id);
|
||||
static void LoadDolphinSpareTexture(int bindIdx, GXCITexFmt format, GXTlut tlut, GXTexMapID id) {
|
||||
// TODO
|
||||
// GXTexObj obj;
|
||||
// GXInitTexObjResolved(&obj, bindIdx, static_cast<GXTexFmt>(format), GX_CLAMP, GX_CLAMP, tlut);
|
||||
// GXInitTexObjLOD(&obj, GX_NEAR, GX_NEAR, 0.f, 0.f, 0.f, false, false, GX_ANISO_1);
|
||||
// GXLoadTexObj(&obj, id);
|
||||
}
|
||||
static void ResolveSpareDepth(const SClipScreenRect& rect, int bindIdx = 0) {
|
||||
// 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 SetTevStates(u32 flags) noexcept;
|
||||
static void SetTevOp(ERglTevStage stage, const CTevCombiners::CTevPass& pass);
|
||||
static void StreamBegin(GX::Primitive primitive);
|
||||
static void StreamBegin(GXPrimitive primitive);
|
||||
static void StreamNormal(const zeus::CVector3f& nrm);
|
||||
static void StreamColor(const zeus::CColor& color);
|
||||
static inline void StreamColor(float r, float g, float b, float a) { StreamColor({r, g, b, a}); }
|
||||
|
@ -347,7 +348,7 @@ public:
|
|||
static void ResetVertexDataStream(bool end);
|
||||
static void FlushStream();
|
||||
static void FullRender();
|
||||
static void DrawPrimitive(GX::Primitive primitive, const zeus::CVector3f* pos, const zeus::CVector3f& normal,
|
||||
static void DrawPrimitive(GXPrimitive primitive, const zeus::CVector3f* pos, const zeus::CVector3f& normal,
|
||||
const zeus::CColor& col, s32 numVerts);
|
||||
static void SetLineWidth(float width, ERglTexOffset offs);
|
||||
};
|
||||
|
@ -386,9 +387,13 @@ public:
|
|||
};
|
||||
|
||||
#ifdef AURORA_GFX_DEBUG_GROUPS
|
||||
struct ScopedDebugGroup {
|
||||
inline ScopedDebugGroup(const char* label) noexcept { push_debug_group(label); }
|
||||
inline ~ScopedDebugGroup() noexcept { pop_debug_group(); }
|
||||
};
|
||||
#define SCOPED_GRAPHICS_DEBUG_GROUP(name, ...) \
|
||||
OPTICK_EVENT_DYNAMIC(name); \
|
||||
aurora::gfx::ScopedDebugGroup _GfxDbg_{name}
|
||||
ScopedDebugGroup _GfxDbg_ { name }
|
||||
#else
|
||||
#define SCOPED_GRAPHICS_DEBUG_GROUP(name, ...) OPTICK_EVENT_DYNAMIC(name)
|
||||
#endif
|
||||
|
|
|
@ -20,7 +20,7 @@ void CLineRenderer::Shutdown() {
|
|||
//hecl::VertexBufferPool<CLineRenderer::SDrawVertNoTex> CLineRenderer::s_vertPoolNoTex = {};
|
||||
//hecl::UniformBufferPool<CLineRenderer::SDrawUniform> CLineRenderer::s_uniformPool = {};
|
||||
|
||||
CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, const aurora::gfx::TextureHandle& texture,
|
||||
CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, u32 texture,
|
||||
bool additive, bool zTest, bool zGEqual)
|
||||
: m_mode(mode), m_maxVerts(maxVerts) {
|
||||
OPTICK_EVENT();
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
// hecl::UniformBufferPool<SDrawUniform>::Token m_uniformBuf;
|
||||
// std::array<boo::ObjToken<boo::IShaderDataBinding>, 2> m_shaderBind;
|
||||
|
||||
CLineRenderer(EPrimitiveMode mode, u32 maxVerts, const aurora::gfx::TextureHandle& texture, bool additive,
|
||||
CLineRenderer(EPrimitiveMode mode, u32 maxVerts, u32 texture, bool additive,
|
||||
bool zTest = false, bool zGEqual = false);
|
||||
CLineRenderer(CLineRenderer&&) = default;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ CMetroidModelInstance::CMetroidModelInstance(std::pair<const u8*, u32> modelHead
|
|||
u32 numTexCoords = texCoords.second / 8;
|
||||
CMemoryInStream stream{texCoords.first, texCoords.second};
|
||||
for (u32 i = 0; i < numTexCoords; ++i) {
|
||||
x6c_texCoords.emplace_back(stream.Get<zeus::CVector2f>());
|
||||
x6c_texCoords.emplace_back(stream.Get<aurora::Vec2<float>>());
|
||||
}
|
||||
}
|
||||
{
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <zeus/CAABox.hpp>
|
||||
#include <zeus/CTransform.hpp>
|
||||
#include <aurora/math.hpp>
|
||||
|
||||
namespace metaforce {
|
||||
class CCubeSurface;
|
||||
|
@ -45,5 +46,4 @@ public:
|
|||
[[nodiscard]] const std::vector<aurora::Vec2<float>>* GetTCPointer() const { return &x6c_texCoords; }
|
||||
[[nodiscard]] const std::vector<aurora::Vec2<float>>* GetPackedTCPointer() const { return &x70_packedTexCoords; }
|
||||
};
|
||||
|
||||
} // namespace metaforce
|
||||
|
|
|
@ -91,7 +91,7 @@ CModel::CModel(std::unique_ptr<u8[]> in, u32 dataLen, IObjectStore* store)
|
|||
u32 numFloatUVs = CBasics::SwapBytes(*secSizeCur) / 8;
|
||||
auto floatUVs = StreamFromPartData(dataCur, secSizeCur);
|
||||
for (u32 i = 0; i < numFloatUVs; ++i) {
|
||||
m_floatUVs.emplace_back(floatUVs.Get<zeus::CVector2f>());
|
||||
m_floatUVs.emplace_back(floatUVs.Get<aurora::Vec2<float>>());
|
||||
}
|
||||
|
||||
if ((flags & 4) != 0) {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "Graphics/CCubeSurface.hpp"
|
||||
#include "Graphics/CTexture.hpp"
|
||||
#include "IObjectStore.hpp"
|
||||
#include "Flags.hpp"
|
||||
|
||||
namespace metaforce {
|
||||
class CCubeMaterial;
|
||||
|
|
|
@ -16,18 +16,21 @@ static void MyTHPYuv2RgbTextureSetup(void* dataY, void* dataU, void* dataV, u16
|
|||
GXTexObj texV;
|
||||
GXTexObj texU;
|
||||
GXTexObj texY;
|
||||
GXInitTexObj(&texY, dataY, width, height, GX::TF_I8, GX_CLAMP, GX_CLAMP, false);
|
||||
GXInitTexObj(&texY, dataY, width, height, GX_TF_R8_PC, GX_CLAMP, GX_CLAMP, false);
|
||||
GXInitTexObjLOD(&texY, GX_NEAR, GX_NEAR, 0.0, 0.0, 0.0, false, false, GX_ANISO_1);
|
||||
GXLoadTexObj(&texY, GX::TEXMAP0);
|
||||
GXInitTexObj(&texU, dataU, width / 2, height / 2, GX::TF_I8, GX_CLAMP, GX_CLAMP, false);
|
||||
GXLoadTexObj(&texY, GX_TEXMAP0);
|
||||
GXInitTexObj(&texU, dataU, width / 2, height / 2, GX_TF_R8_PC, GX_CLAMP, GX_CLAMP, false);
|
||||
GXInitTexObjLOD(&texU, GX_NEAR, GX_NEAR, 0.0, 0.0, 0.0, false, false, GX_ANISO_1);
|
||||
GXLoadTexObj(&texU, GX::TEXMAP1);
|
||||
GXInitTexObj(&texV, dataV, width / 2, height / 2, GX::TF_I8, GX_CLAMP, GX_CLAMP, false);
|
||||
GXLoadTexObj(&texU, GX_TEXMAP1);
|
||||
GXInitTexObj(&texV, dataV, width / 2, height / 2, GX_TF_R8_PC, GX_CLAMP, GX_CLAMP, false);
|
||||
GXInitTexObjLOD(&texV, GX_NEAR, GX_NEAR, 0.0, 0.0, 0.0, false, false, GX_ANISO_1);
|
||||
GXLoadTexObj(&texV, GX::TEXMAP2);
|
||||
CTexture::InvalidateTexMap(GX::TEXMAP0);
|
||||
CTexture::InvalidateTexMap(GX::TEXMAP1);
|
||||
CTexture::InvalidateTexMap(GX::TEXMAP2);
|
||||
GXLoadTexObj(&texV, GX_TEXMAP2);
|
||||
CTexture::InvalidateTexMap(GX_TEXMAP0);
|
||||
CTexture::InvalidateTexMap(GX_TEXMAP1);
|
||||
CTexture::InvalidateTexMap(GX_TEXMAP2);
|
||||
GXDestroyTexObj(&texV);
|
||||
GXDestroyTexObj(&texU);
|
||||
GXDestroyTexObj(&texY);
|
||||
}
|
||||
|
||||
const std::array<u8, 32> InterlaceTex{
|
||||
|
@ -35,85 +38,86 @@ const std::array<u8, 32> InterlaceTex{
|
|||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
static void MyTHPGXYuv2RgbSetup(bool interlaced2ndFrame, bool fieldFlip) {
|
||||
CGX::SetZMode(true, GX::ALWAYS, false);
|
||||
CGX::SetBlendMode(GX::BM_NONE, GX::BL_ONE, GX::BL_ZERO, GX::LO_CLEAR);
|
||||
CGX::SetZMode(true, GX_ALWAYS, false);
|
||||
CGX::SetBlendMode(GX_BM_NONE, GX_BL_ONE, GX_BL_ZERO, GX_LO_CLEAR);
|
||||
CGX::SetNumChans(0);
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD0, GX::TG_MTX2x4, GX::TG_TEX0, GX::IDENTITY, false, GX::PTIDENTITY);
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD1, GX::TG_MTX2x4, GX::TG_TEX0, GX::IDENTITY, false, GX::PTIDENTITY);
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, false, GX_PTIDENTITY);
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD1, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, false, GX_PTIDENTITY);
|
||||
if (!fieldFlip) {
|
||||
CGX::SetNumTexGens(3);
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD2, GX::TG_MTX2x4, GX::TG_POS, GX::TEXMTX0, false, GX::PTIDENTITY);
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD2, GX_TG_MTX2x4, GX_TG_POS, GX_TEXMTX0, false, GX_PTIDENTITY);
|
||||
aurora::Mat4x2<float> mtx;
|
||||
mtx.m0.x = 0.125f;
|
||||
mtx.m2.y = 0.25f;
|
||||
if (interlaced2ndFrame) {
|
||||
mtx.m3.y = 0.25f;
|
||||
}
|
||||
GXLoadTexMtxImm(&mtx, GX::TEXMTX0, GX::MTX2x4);
|
||||
GXLoadTexMtxImm(&mtx, GX_TEXMTX0, GX_MTX2x4);
|
||||
GXTexObj texObj;
|
||||
GXInitTexObj(&texObj, InterlaceTex.data(), 8, 4, GX::TF_I8, GX_REPEAT, GX_REPEAT, false);
|
||||
GXInitTexObj(&texObj, InterlaceTex.data(), 8, 4, GX_TF_I8, GX_REPEAT, GX_REPEAT, false);
|
||||
GXInitTexObjLOD(&texObj, GX_NEAR, GX_NEAR, 0.f, 0.f, 0.f, false, false, GX_ANISO_1);
|
||||
GXLoadTexObj(&texObj, GX::TEXMAP3);
|
||||
CTexture::InvalidateTexMap(GX::TEXMAP3);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE4, GX::TEXCOORD2, GX::TEXMAP3, GX::COLOR_NULL);
|
||||
CGX::SetStandardTevColorAlphaOp(GX::TEVSTAGE4);
|
||||
CGX::SetTevColorIn(GX::TEVSTAGE4, GX::CC_ZERO, GX::CC_ZERO, GX::CC_ZERO, GX::CC_CPREV);
|
||||
CGX::SetTevAlphaIn(GX::TEVSTAGE4, GX::CA_ZERO, GX::CA_ZERO, GX::CA_ZERO, GX::CA_TEXA);
|
||||
CGX::SetAlphaCompare(GX::LESS, 128, GX::AOP_AND, GX::ALWAYS, 0);
|
||||
GXLoadTexObj(&texObj, GX_TEXMAP3);
|
||||
GXDestroyTexObj(&texObj);
|
||||
CTexture::InvalidateTexMap(GX_TEXMAP3);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE4, GX_TEXCOORD2, GX_TEXMAP3, GX_COLOR_NULL);
|
||||
CGX::SetStandardTevColorAlphaOp(GX_TEVSTAGE4);
|
||||
CGX::SetTevColorIn(GX_TEVSTAGE4, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_CPREV);
|
||||
CGX::SetTevAlphaIn(GX_TEVSTAGE4, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_TEXA);
|
||||
CGX::SetAlphaCompare(GX_LESS, 128, GX_AOP_AND, GX_ALWAYS, 0);
|
||||
CGX::SetNumTevStages(5);
|
||||
} else {
|
||||
CGX::SetNumTexGens(2);
|
||||
CGX::SetNumTevStages(4);
|
||||
}
|
||||
constexpr std::array vtxDescList{
|
||||
GX::VtxDescList{GX::VA_POS, GX::DIRECT},
|
||||
GX::VtxDescList{GX::VA_TEX0, GX::DIRECT},
|
||||
GX::VtxDescList{},
|
||||
GXVtxDescList{GX_VA_POS, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_TEX0, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_NULL, GX_NONE},
|
||||
};
|
||||
CGX::SetVtxDescv(vtxDescList.data());
|
||||
GXSetColorUpdate(true);
|
||||
GXSetAlphaUpdate(false);
|
||||
GXInvalidateTexAll();
|
||||
GXSetVtxAttrFmt(GX::VTXFMT7, GX::VA_POS, GX::CLR_RGBA, GX::F32, 0);
|
||||
GXSetVtxAttrFmt(GX::VTXFMT7, GX::VA_TEX0, GX::CLR_RGBA, GX::RGBX8, 0);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD1, GX::TEXMAP1, GX::COLOR_NULL);
|
||||
CGX::SetTevColorIn(GX::TEVSTAGE0, GX::CC_ZERO, GX::CC_TEXC, GX::CC_KONST, GX::CC_C0);
|
||||
CGX::SetTevColorOp(GX::TEVSTAGE0, GX::TEV_ADD, GX::TB_ZERO, GX::CS_SCALE_1, false, GX::TEVPREV);
|
||||
CGX::SetTevAlphaIn(GX::TEVSTAGE0, GX::CA_ZERO, GX::CA_TEXA, GX::CA_KONST, GX::CA_A0);
|
||||
CGX::SetTevAlphaOp(GX::TEVSTAGE0, GX::TEV_SUB, GX::TB_ZERO, GX::CS_SCALE_1, false, GX::TEVPREV);
|
||||
CGX::SetTevKColorSel(GX::TEVSTAGE0, GX::TEV_KCSEL_K0);
|
||||
CGX::SetTevKAlphaSel(GX::TEVSTAGE0, GX::TEV_KASEL_K0_A);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE1, GX::TEXCOORD1, GX::TEXMAP2, GX::COLOR_NULL);
|
||||
CGX::SetTevColorIn(GX::TEVSTAGE1, GX::CC_ZERO, GX::CC_TEXC, GX::CC_KONST, GX::CC_CPREV);
|
||||
CGX::SetTevColorOp(GX::TEVSTAGE1, GX::TEV_ADD, GX::TB_ZERO, GX::CS_SCALE_2, false, GX::TEVPREV);
|
||||
CGX::SetTevAlphaIn(GX::TEVSTAGE1, GX::CA_ZERO, GX::CA_TEXA, GX::CA_KONST, GX::CA_APREV);
|
||||
CGX::SetTevAlphaOp(GX::TEVSTAGE1, GX::TEV_SUB, GX::TB_ZERO, GX::CS_SCALE_1, false, GX::TEVPREV);
|
||||
CGX::SetTevKColorSel(GX::TEVSTAGE1, GX::TEV_KCSEL_K1);
|
||||
CGX::SetTevKAlphaSel(GX::TEVSTAGE1, GX::TEV_KASEL_K1_A);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE2, GX::TEXCOORD0, GX::TEXMAP0, GX::COLOR_NULL);
|
||||
CGX::SetTevColorIn(GX::TEVSTAGE2, GX::CC_ZERO, GX::CC_TEXC, GX::CC_ONE, GX::CC_CPREV);
|
||||
CGX::SetTevColorOp(GX::TEVSTAGE2, GX::TEV_ADD, GX::TB_ZERO, GX::CS_SCALE_1, true, GX::TEVPREV);
|
||||
CGX::SetTevAlphaIn(GX::TEVSTAGE2, GX::CA_TEXA, GX::CA_ZERO, GX::CA_ZERO, GX::CA_APREV);
|
||||
CGX::SetTevAlphaOp(GX::TEVSTAGE2, GX::TEV_ADD, GX::TB_ZERO, GX::CS_SCALE_1, true, GX::TEVPREV);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE3, GX::TEXCOORD_NULL, GX::TEXMAP_NULL, GX::COLOR_NULL);
|
||||
CGX::SetTevColorIn(GX::TEVSTAGE3, GX::CC_APREV, GX::CC_CPREV, GX::CC_KONST, GX::CC_ZERO);
|
||||
CGX::SetTevColorOp(GX::TEVSTAGE3, GX::TEV_ADD, GX::TB_ZERO, GX::CS_SCALE_1, true, GX::TEVPREV);
|
||||
CGX::SetTevAlphaIn(GX::TEVSTAGE3, GX::CA_ZERO, GX::CA_ZERO, GX::CA_ZERO, GX::CA_ZERO);
|
||||
CGX::SetTevAlphaOp(GX::TEVSTAGE3, GX::TEV_ADD, GX::TB_ZERO, GX::CS_SCALE_1, true, GX::TEVPREV);
|
||||
CGX::SetTevKColorSel(GX::TEVSTAGE3, GX::TEV_KCSEL_K2);
|
||||
GXSetTevColorS10(GX::TEVREG0, 0xffa60000ff8e0087u);
|
||||
CGX::SetTevKColor(GX::KCOLOR0, zeus::Comp32(0x0000e258));
|
||||
CGX::SetTevKColor(GX::KCOLOR1, zeus::Comp32(0xb30000b6));
|
||||
CGX::SetTevKColor(GX::KCOLOR2, zeus::Comp32(0xff00ff80));
|
||||
GXSetVtxAttrFmt(GX_VTXFMT7, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT7, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 0);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD1, GX_TEXMAP1, GX_COLOR_NULL);
|
||||
CGX::SetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_TEXC, GX_CC_KONST, GX_CC_C0);
|
||||
CGX::SetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, false, GX_TEVPREV);
|
||||
CGX::SetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_TEXA, GX_CA_KONST, GX_CA_A0);
|
||||
CGX::SetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_SUB, GX_TB_ZERO, GX_CS_SCALE_1, false, GX_TEVPREV);
|
||||
CGX::SetTevKColorSel(GX_TEVSTAGE0, GX_TEV_KCSEL_K0);
|
||||
CGX::SetTevKAlphaSel(GX_TEVSTAGE0, GX_TEV_KASEL_K0_A);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD1, GX_TEXMAP2, GX_COLOR_NULL);
|
||||
CGX::SetTevColorIn(GX_TEVSTAGE1, GX_CC_ZERO, GX_CC_TEXC, GX_CC_KONST, GX_CC_CPREV);
|
||||
CGX::SetTevColorOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_2, false, GX_TEVPREV);
|
||||
CGX::SetTevAlphaIn(GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_TEXA, GX_CA_KONST, GX_CA_APREV);
|
||||
CGX::SetTevAlphaOp(GX_TEVSTAGE1, GX_TEV_SUB, GX_TB_ZERO, GX_CS_SCALE_1, false, GX_TEVPREV);
|
||||
CGX::SetTevKColorSel(GX_TEVSTAGE1, GX_TEV_KCSEL_K1);
|
||||
CGX::SetTevKAlphaSel(GX_TEVSTAGE1, GX_TEV_KASEL_K1_A);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE2, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
||||
CGX::SetTevColorIn(GX_TEVSTAGE2, GX_CC_ZERO, GX_CC_TEXC, GX_CC_ONE, GX_CC_CPREV);
|
||||
CGX::SetTevColorOp(GX_TEVSTAGE2, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
|
||||
CGX::SetTevAlphaIn(GX_TEVSTAGE2, GX_CA_TEXA, GX_CA_ZERO, GX_CA_ZERO, GX_CA_APREV);
|
||||
CGX::SetTevAlphaOp(GX_TEVSTAGE2, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE3, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR_NULL);
|
||||
CGX::SetTevColorIn(GX_TEVSTAGE3, GX_CC_APREV, GX_CC_CPREV, GX_CC_KONST, GX_CC_ZERO);
|
||||
CGX::SetTevColorOp(GX_TEVSTAGE3, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
|
||||
CGX::SetTevAlphaIn(GX_TEVSTAGE3, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
|
||||
CGX::SetTevAlphaOp(GX_TEVSTAGE3, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
|
||||
CGX::SetTevKColorSel(GX_TEVSTAGE3, GX_TEV_KCSEL_K2);
|
||||
GXSetTevColorS10(GX_TEVREG0, GXColorS10{-90, 0, -114, 135});
|
||||
CGX::SetTevKColor(GX_KCOLOR0, GXColor{0x00, 0x00, 0xe2, 0x58});
|
||||
CGX::SetTevKColor(GX_KCOLOR1, GXColor{0xb3, 0x00, 0x00, 0xb6});
|
||||
CGX::SetTevKColor(GX_KCOLOR2, GXColor{0xff, 0x00, 0xff, 0x80});
|
||||
}
|
||||
static void MyTHPGXRestore() {
|
||||
CGX::SetZMode(true, GX::ALWAYS, false);
|
||||
CGX::SetBlendMode(GX::BM_NONE, GX::BL_ONE, GX::BL_ZERO, GX::LO_SET);
|
||||
CGX::SetZMode(true, GX_ALWAYS, false);
|
||||
CGX::SetBlendMode(GX_BM_NONE, GX_BL_ONE, GX_BL_ZERO, GX_LO_SET);
|
||||
CGX::SetNumTexGens(1);
|
||||
CGX::SetNumChans(0);
|
||||
CGX::SetNumTevStages(1);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD0, GX::TEXMAP0, GX::COLOR_NULL);
|
||||
CGX::SetAlphaCompare(GX::ALWAYS, 0, GX::AOP_AND, GX::ALWAYS, 0);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
||||
CGX::SetAlphaCompare(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0);
|
||||
}
|
||||
|
||||
/* used in the original to look up fixed-point dividends on a
|
||||
|
@ -295,25 +299,28 @@ CMoviePlayer::CMoviePlayer(const char* path, float preLoadSeconds, bool loop, bo
|
|||
x80_textures.reserve(3);
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
CTHPTextureSet& set = x80_textures.emplace_back();
|
||||
if (deinterlace) {
|
||||
/* metaforce addition: this way interlaced THPs don't look horrible */
|
||||
set.Y[0] = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width, x6c_videoInfo.height / 2, 1, GX::TF_I8,
|
||||
fmt::format(FMT_STRING("Movie {} Texture Set {} Y[0]"), path, i));
|
||||
set.Y[1] = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width, x6c_videoInfo.height / 2, 1, GX::TF_I8,
|
||||
fmt::format(FMT_STRING("Movie {} Texture Set {} Y[1]"), path, i));
|
||||
set.U = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2, 1, GX::TF_I8,
|
||||
fmt::format(FMT_STRING("Movie {} Texture Set {} U"), path, i));
|
||||
set.V = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2, 1, GX::TF_I8,
|
||||
fmt::format(FMT_STRING("Movie {} Texture Set {} V"), path, i));
|
||||
} else {
|
||||
/* normal progressive presentation */
|
||||
set.Y[0] = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width, x6c_videoInfo.height, 1, GX::TF_I8,
|
||||
fmt::format(FMT_STRING("Movie {} Texture Set {} Y"), path, i));
|
||||
set.U = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2, 1, GX::TF_I8,
|
||||
fmt::format(FMT_STRING("Movie {} Texture Set {} U"), path, i));
|
||||
set.V = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2, 1, GX::TF_I8,
|
||||
fmt::format(FMT_STRING("Movie {} Texture Set {} V"), path, i));
|
||||
}
|
||||
// if (deinterlace) {
|
||||
// /* metaforce addition: this way interlaced THPs don't look horrible */
|
||||
// set.Y[0] = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width, x6c_videoInfo.height / 2, 1, GX_TF_I8,
|
||||
// fmt::format(FMT_STRING("Movie {} Texture Set {} Y[0]"), path,
|
||||
// i));
|
||||
// set.Y[1] = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width, x6c_videoInfo.height / 2, 1, GX_TF_I8,
|
||||
// fmt::format(FMT_STRING("Movie {} Texture Set {} Y[1]"), path,
|
||||
// i));
|
||||
// set.U = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2, 1, GX_TF_I8,
|
||||
// fmt::format(FMT_STRING("Movie {} Texture Set {} U"), path, i));
|
||||
// set.V = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2, 1, GX_TF_I8,
|
||||
// fmt::format(FMT_STRING("Movie {} Texture Set {} V"), path, i));
|
||||
// } else {
|
||||
// /* normal progressive presentation */
|
||||
// set.Y[0] = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width, x6c_videoInfo.height, 1, GX_TF_I8,
|
||||
// fmt::format(FMT_STRING("Movie {} Texture Set {} Y"), path,
|
||||
// i));
|
||||
// set.U = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2, 1, GX_TF_I8,
|
||||
// fmt::format(FMT_STRING("Movie {} Texture Set {} U"), path, i));
|
||||
// set.V = aurora::gfx::new_dynamic_texture_2d(x6c_videoInfo.width / 2, x6c_videoInfo.height / 2, 1, GX_TF_I8,
|
||||
// fmt::format(FMT_STRING("Movie {} Texture Set {} V"), path, i));
|
||||
// }
|
||||
if (xf4_25_hasAudio)
|
||||
set.audioBuf.reset(new s16[x28_thpHead.maxAudioSamples * 2]);
|
||||
}
|
||||
|
@ -485,22 +492,22 @@ bool CMoviePlayer::DrawVideo() {
|
|||
const s32 vr = vpLeft + vpWidth + centerX;
|
||||
const s32 vb = vpTop + vpHeight + centerY;
|
||||
const s32 vt = vpTop - centerY;
|
||||
aurora::Vec3<float> v1;
|
||||
aurora::Vec3<float> v2;
|
||||
aurora::Vec3<float> v3;
|
||||
aurora::Vec3<float> v4;
|
||||
v1.x = vl;
|
||||
v1.y = 0.0;
|
||||
v1.z = vb;
|
||||
v2.x = vr;
|
||||
v2.y = 0.0;
|
||||
v2.z = vb;
|
||||
v3.x = vl;
|
||||
v3.y = 0.0;
|
||||
v3.z = vt;
|
||||
v4.x = vr;
|
||||
v4.y = 0.0;
|
||||
v4.z = vt;
|
||||
zeus::CVector3f v1;
|
||||
zeus::CVector3f v2;
|
||||
zeus::CVector3f v3;
|
||||
zeus::CVector3f v4;
|
||||
v1.x() = vl;
|
||||
v1.y() = 0.0;
|
||||
v1.z() = vb;
|
||||
v2.x() = vr;
|
||||
v2.y() = 0.0;
|
||||
v2.z() = vb;
|
||||
v3.x() = vl;
|
||||
v3.y() = 0.0;
|
||||
v3.z() = vt;
|
||||
v4.x() = vr;
|
||||
v4.y() = 0.0;
|
||||
v4.z() = vt;
|
||||
|
||||
DrawFrame(v1, v2, v3, v4);
|
||||
return true;
|
||||
|
@ -525,27 +532,27 @@ void CMoviePlayer::DrawFrame(const zeus::CVector3f& v1, const zeus::CVector3f& v
|
|||
vPad = CGraphics::GetViewportAspect() / 1.33f;
|
||||
}
|
||||
|
||||
/* draw appropriate field */
|
||||
CTHPTextureSet& tex = x80_textures[xd0_drawTexSlot];
|
||||
aurora::gfx::queue_movie_player(tex.Y[m_deinterlace ? (xfc_fieldIndex != 0) : 0], tex.U, tex.V, hPad, vPad);
|
||||
// /* draw appropriate field */
|
||||
// CTHPTextureSet& tex = x80_textures[xd0_drawTexSlot];
|
||||
// aurora::gfx::queue_movie_player(tex.Y[m_deinterlace ? (xfc_fieldIndex != 0) : 0], tex.U, tex.V, hPad, vPad);
|
||||
|
||||
// MyTHPGXYuv2RgbSetup(CGraphics::g_LastFrameUsedAbove, xf4_26_fieldFlip);
|
||||
// uintptr_t planeSize = x6c_videoInfo.width * x6c_videoInfo.height;
|
||||
// uintptr_t planeSizeQuarter = planeSize / 4;
|
||||
// MyTHPYuv2RgbTextureSetup(m_yuvBuf.get(), m_yuvBuf.get() + planeSize, m_yuvBuf.get() + planeSize + planeSizeQuarter,
|
||||
// x6c_videoInfo.width, x6c_videoInfo.height);
|
||||
//
|
||||
// CGX::Begin(GX::TRIANGLEFAN, GX::VTXFMT7, 4);
|
||||
// GXPosition3f32(v1);
|
||||
// GXTexCoord2f32(0.f, 0.f);
|
||||
// GXPosition3f32(v3);
|
||||
// GXTexCoord2f32(0.f, 1.f);
|
||||
// GXPosition3f32(v4);
|
||||
// GXTexCoord2f32(1.f, 1.f);
|
||||
// GXPosition3f32(v2);
|
||||
// GXTexCoord2f32(1.f, 0.f);
|
||||
// CGX::End();
|
||||
// MyTHPGXRestore();
|
||||
MyTHPGXYuv2RgbSetup(CGraphics::g_LastFrameUsedAbove, xf4_26_fieldFlip);
|
||||
uintptr_t planeSize = x6c_videoInfo.width * x6c_videoInfo.height;
|
||||
uintptr_t planeSizeQuarter = planeSize / 4;
|
||||
MyTHPYuv2RgbTextureSetup(m_yuvBuf.get(), m_yuvBuf.get() + planeSize, m_yuvBuf.get() + planeSize + planeSizeQuarter,
|
||||
x6c_videoInfo.width, x6c_videoInfo.height);
|
||||
|
||||
CGX::Begin(GX_TRIANGLEFAN, GX_VTXFMT7, 4);
|
||||
GXPosition3f32(v1);
|
||||
GXTexCoord2f32(0.f, 0.f);
|
||||
GXPosition3f32(v3);
|
||||
GXTexCoord2f32(0.f, 1.f);
|
||||
GXPosition3f32(v4);
|
||||
GXTexCoord2f32(1.f, 1.f);
|
||||
GXPosition3f32(v2);
|
||||
GXTexCoord2f32(1.f, 0.f);
|
||||
CGX::End();
|
||||
MyTHPGXRestore();
|
||||
|
||||
/* ensure second field is being displayed by VI to signal advance
|
||||
* (faked in metaforce with continuous xor) */
|
||||
|
@ -659,25 +666,25 @@ void CMoviePlayer::DecodeFromRead(const void* data) {
|
|||
uintptr_t planeSizeHalf = planeSize / 2;
|
||||
uintptr_t planeSizeQuarter = planeSizeHalf / 2;
|
||||
|
||||
if (m_deinterlace) {
|
||||
/* Deinterlace into 2 discrete 60-fps half-res textures */
|
||||
auto buffer = std::make_unique<u8[]>(planeSizeHalf);
|
||||
for (unsigned y = 0; y < x6c_videoInfo.height / 2; ++y) {
|
||||
memcpy(buffer.get() + x6c_videoInfo.width * y, m_yuvBuf.get() + x6c_videoInfo.width * (y * 2),
|
||||
x6c_videoInfo.width);
|
||||
}
|
||||
aurora::gfx::write_texture(*tex.Y[0], {buffer.get(), planeSizeHalf});
|
||||
for (unsigned y = 0; y < x6c_videoInfo.height / 2; ++y) {
|
||||
memcpy(buffer.get() + x6c_videoInfo.width * y, m_yuvBuf.get() + x6c_videoInfo.width * (y * 2 + 1),
|
||||
x6c_videoInfo.width);
|
||||
}
|
||||
aurora::gfx::write_texture(*tex.Y[1], {buffer.get(), planeSizeHalf});
|
||||
} else {
|
||||
/* Direct planar load */
|
||||
aurora::gfx::write_texture(*tex.Y[0], {m_yuvBuf.get(), planeSize});
|
||||
}
|
||||
aurora::gfx::write_texture(*tex.U, {m_yuvBuf.get() + planeSize, planeSizeQuarter});
|
||||
aurora::gfx::write_texture(*tex.V, {m_yuvBuf.get() + planeSize + planeSizeQuarter, planeSizeQuarter});
|
||||
// if (m_deinterlace) {
|
||||
// /* Deinterlace into 2 discrete 60-fps half-res textures */
|
||||
// auto buffer = std::make_unique<u8[]>(planeSizeHalf);
|
||||
// for (unsigned y = 0; y < x6c_videoInfo.height / 2; ++y) {
|
||||
// memcpy(buffer.get() + x6c_videoInfo.width * y, m_yuvBuf.get() + x6c_videoInfo.width * (y * 2),
|
||||
// x6c_videoInfo.width);
|
||||
// }
|
||||
// aurora::gfx::write_texture(*tex.Y[0], {buffer.get(), planeSizeHalf});
|
||||
// for (unsigned y = 0; y < x6c_videoInfo.height / 2; ++y) {
|
||||
// memcpy(buffer.get() + x6c_videoInfo.width * y, m_yuvBuf.get() + x6c_videoInfo.width * (y * 2 + 1),
|
||||
// x6c_videoInfo.width);
|
||||
// }
|
||||
// aurora::gfx::write_texture(*tex.Y[1], {buffer.get(), planeSizeHalf});
|
||||
// } else {
|
||||
// /* Direct planar load */
|
||||
// aurora::gfx::write_texture(*tex.Y[0], {m_yuvBuf.get(), planeSize});
|
||||
// }
|
||||
// aurora::gfx::write_texture(*tex.U, {m_yuvBuf.get() + planeSize, planeSizeQuarter});
|
||||
// aurora::gfx::write_texture(*tex.V, {m_yuvBuf.get() + planeSize + planeSizeQuarter, planeSizeQuarter});
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -69,9 +69,9 @@ private:
|
|||
};
|
||||
|
||||
struct CTHPTextureSet {
|
||||
std::array<aurora::gfx::TextureHandle, 2> Y;
|
||||
aurora::gfx::TextureHandle U;
|
||||
aurora::gfx::TextureHandle V;
|
||||
std::array<GXTexObj, 2> Y;
|
||||
GXTexObj U;
|
||||
GXTexObj V;
|
||||
u32 playedSamples = 0;
|
||||
u32 audioSamples = 0;
|
||||
std::unique_ptr<s16[]> audioBuf;
|
||||
|
|
|
@ -32,7 +32,7 @@ void CSimpleShadow::Render(TLockedToken<CTexture>& tex) {
|
|||
|
||||
CGraphics::DisableAllLights();
|
||||
CGraphics::SetModelMatrix(x0_xf);
|
||||
tex->Load(GX::TEXMAP0, EClampMode::Repeat);
|
||||
tex->Load(GX_TEXMAP0, EClampMode::Repeat);
|
||||
|
||||
CGraphics::SetTevOp(ERglTevStage::Stage0, CTevCombiners::sTevPass805a5ebc);
|
||||
CGraphics::SetTevOp(ERglTevStage::Stage1, CTevCombiners::skPassThru);
|
||||
|
@ -40,7 +40,7 @@ void CSimpleShadow::Render(TLockedToken<CTexture>& tex) {
|
|||
CGraphics::SetDepthWriteMode(true, ERglEnum::LEqual, false);
|
||||
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha, ERglBlendFactor::InvSrcAlpha,
|
||||
ERglLogicOp::Clear);
|
||||
CGraphics::StreamBegin(GX::QUADS);
|
||||
CGraphics::StreamBegin(GX_QUADS);
|
||||
float radius = x34_radius * x30_scale;
|
||||
CGraphics::StreamColor(zeus::CColor{1.f, x3c_heightAlpha * x38_userAlpha});
|
||||
CGraphics::StreamTexcoord(0.f, 0.f);
|
||||
|
|
|
@ -6,15 +6,15 @@ namespace metaforce::CTevCombiners {
|
|||
u32 CTevPass::sNextUniquePass = 0;
|
||||
|
||||
void CTevPass::Execute(ERglTevStage stage) const {
|
||||
const auto stageId = GX::TevStageID(stage);
|
||||
const auto stageId = GXTevStageID(stage);
|
||||
CGX::SetTevColorIn(stageId, x4_colorPass.x0_a, x4_colorPass.x4_b, x4_colorPass.x8_c, x4_colorPass.xc_d);
|
||||
CGX::SetTevAlphaIn(stageId, x14_alphaPass.x0_a, x14_alphaPass.x4_b, x14_alphaPass.x8_c, x14_alphaPass.xc_d);
|
||||
CGX::SetTevColorOp(stageId, x24_colorOp.x4_op, x24_colorOp.x8_bias, x24_colorOp.xc_scale, x24_colorOp.x0_clamp,
|
||||
x24_colorOp.x10_regId);
|
||||
CGX::SetTevAlphaOp(stageId, x38_alphaOp.x4_op, x38_alphaOp.x8_bias, x38_alphaOp.xc_scale, x38_alphaOp.x0_clamp,
|
||||
x38_alphaOp.x10_regId);
|
||||
CGX::SetTevKColorSel(stageId, GX::TevKColorSel::TEV_KCSEL_8_8);
|
||||
CGX::SetTevKAlphaSel(stageId, GX::TevKAlphaSel::TEV_KASEL_8_8);
|
||||
CGX::SetTevKColorSel(stageId, GX_TEV_KCSEL_8_8);
|
||||
CGX::SetTevKAlphaSel(stageId, GX_TEV_KASEL_8_8);
|
||||
}
|
||||
|
||||
constexpr u32 maxTevPasses = 2;
|
||||
|
@ -22,52 +22,52 @@ static u32 sNumEnabledPasses;
|
|||
static std::array<bool, maxTevPasses> sValidPasses;
|
||||
|
||||
const CTevPass skPassThru{
|
||||
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA},
|
||||
{GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_RASC},
|
||||
{GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_RASA},
|
||||
};
|
||||
const CTevPass sTevPass804bfcc0{
|
||||
{GX::TevColorArg::CC_C0, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_ZERO},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA},
|
||||
{GX_CC_C0, GX_CC_TEXC, GX_CC_RASC, GX_CC_ZERO},
|
||||
{GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_RASA},
|
||||
};
|
||||
const CTevPass sTevPass804bfe68{
|
||||
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_CPREV, GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_ZERO},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_APREV, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_ZERO},
|
||||
{GX_CC_ZERO, GX_CC_CPREV, GX_CC_RASC, GX_CC_ZERO},
|
||||
{GX_CA_ZERO, GX_CA_APREV, GX_CA_RASA, GX_CA_ZERO},
|
||||
};
|
||||
const CTevPass sTevPass805a5698{
|
||||
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_C0, GX::TevColorArg::CC_ZERO},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_A0, GX::TevAlphaArg::CA_ZERO},
|
||||
{GX_CC_ZERO, GX_CC_RASC, GX_CC_C0, GX_CC_ZERO},
|
||||
{GX_CA_ZERO, GX_CA_RASA, GX_CA_A0, GX_CA_ZERO},
|
||||
};
|
||||
const CTevPass sTevPass805a5e70{
|
||||
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_C0},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_A0},
|
||||
{GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_C0},
|
||||
{GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_A0},
|
||||
};
|
||||
const CTevPass sTevPass805a5ebc{
|
||||
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_ZERO},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_TEXA, GX::TevAlphaArg::CA_ZERO},
|
||||
{GX_CC_ZERO, GX_CC_RASC, GX_CC_TEXC, GX_CC_ZERO},
|
||||
{GX_CA_ZERO, GX_CA_RASA, GX_CA_TEXA, GX_CA_ZERO},
|
||||
};
|
||||
const CTevPass sTevPass805a5f08{
|
||||
{GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_TEXA, GX::TevColorArg::CC_ZERO},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_RASA},
|
||||
{GX_CC_RASC, GX_CC_TEXC, GX_CC_TEXA, GX_CC_ZERO},
|
||||
{GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_RASA},
|
||||
};
|
||||
const CTevPass sTevPass805a5f54{
|
||||
{GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_ONE, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_ZERO},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_TEXA, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_ZERO},
|
||||
{GX_CC_RASC, GX_CC_ONE, GX_CC_TEXC, GX_CC_ZERO},
|
||||
{GX_CA_ZERO, GX_CA_TEXA, GX_CA_RASA, GX_CA_ZERO},
|
||||
};
|
||||
const CTevPass sTevPass805a5fa0{
|
||||
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_TEXC},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_TEXA},
|
||||
{GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_TEXC},
|
||||
{GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_TEXA},
|
||||
};
|
||||
const CTevPass sTevPass805a5fec{
|
||||
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_RASC},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_TEXA, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_ZERO},
|
||||
{GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_RASC},
|
||||
{GX_CA_ZERO, GX_CA_TEXA, GX_CA_RASA, GX_CA_ZERO},
|
||||
};
|
||||
const CTevPass sTevPass805a6038{
|
||||
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_TEXC, GX::TevColorArg::CC_RASC, GX::TevColorArg::CC_ZERO},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_KONST, GX::TevAlphaArg::CA_RASA, GX::TevAlphaArg::CA_ZERO},
|
||||
{GX_CC_ZERO, GX_CC_TEXC, GX_CC_RASC, GX_CC_ZERO},
|
||||
{GX_CA_ZERO, GX_CA_KONST, GX_CA_RASA, GX_CA_ZERO},
|
||||
};
|
||||
const CTevPass sTevPass805a6084{
|
||||
{GX::TevColorArg::CC_ZERO, GX::TevColorArg::CC_CPREV, GX::TevColorArg::CC_APREV, GX::TevColorArg::CC_ZERO},
|
||||
{GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_ZERO, GX::TevAlphaArg::CA_APREV},
|
||||
{GX_CC_ZERO, GX_CC_CPREV, GX_CC_APREV, GX_CC_ZERO},
|
||||
{GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_APREV},
|
||||
};
|
||||
|
||||
void Init() {
|
||||
|
|
|
@ -4,78 +4,77 @@
|
|||
#include "RetroTypes.hpp"
|
||||
|
||||
namespace metaforce {
|
||||
enum class ERglTevStage : std::underlying_type_t<GX::TevStageID> {
|
||||
Stage0 = GX::TEVSTAGE0,
|
||||
Stage1 = GX::TEVSTAGE1,
|
||||
Stage2 = GX::TEVSTAGE2,
|
||||
Stage3 = GX::TEVSTAGE3,
|
||||
Stage4 = GX::TEVSTAGE4,
|
||||
Stage5 = GX::TEVSTAGE5,
|
||||
Stage6 = GX::TEVSTAGE6,
|
||||
Stage7 = GX::TEVSTAGE7,
|
||||
Stage8 = GX::TEVSTAGE8,
|
||||
Stage9 = GX::TEVSTAGE9,
|
||||
Stage10 = GX::TEVSTAGE10,
|
||||
Stage11 = GX::TEVSTAGE11,
|
||||
Stage12 = GX::TEVSTAGE12,
|
||||
Stage13 = GX::TEVSTAGE13,
|
||||
Stage14 = GX::TEVSTAGE14,
|
||||
Stage15 = GX::TEVSTAGE15,
|
||||
Max = GX::MAX_TEVSTAGE,
|
||||
None = GX::NULL_STAGE,
|
||||
enum class ERglTevStage : std::underlying_type_t<GXTevStageID> {
|
||||
Stage0 = GX_TEVSTAGE0,
|
||||
Stage1 = GX_TEVSTAGE1,
|
||||
Stage2 = GX_TEVSTAGE2,
|
||||
Stage3 = GX_TEVSTAGE3,
|
||||
Stage4 = GX_TEVSTAGE4,
|
||||
Stage5 = GX_TEVSTAGE5,
|
||||
Stage6 = GX_TEVSTAGE6,
|
||||
Stage7 = GX_TEVSTAGE7,
|
||||
Stage8 = GX_TEVSTAGE8,
|
||||
Stage9 = GX_TEVSTAGE9,
|
||||
Stage10 = GX_TEVSTAGE10,
|
||||
Stage11 = GX_TEVSTAGE11,
|
||||
Stage12 = GX_TEVSTAGE12,
|
||||
Stage13 = GX_TEVSTAGE13,
|
||||
Stage14 = GX_TEVSTAGE14,
|
||||
Stage15 = GX_TEVSTAGE15,
|
||||
Max = GX_MAX_TEVSTAGE,
|
||||
};
|
||||
|
||||
namespace CTevCombiners {
|
||||
struct CTevOp {
|
||||
bool x0_clamp = true;
|
||||
GX::TevOp x4_op = GX::TevOp::TEV_ADD;
|
||||
GX::TevBias x8_bias = GX::TevBias::TB_ZERO;
|
||||
GX::TevScale xc_scale = GX::TevScale::CS_SCALE_1;
|
||||
GX::TevRegID x10_regId = GX::TevRegID::TEVPREV;
|
||||
GXTevOp x4_op = GX_TEV_ADD;
|
||||
GXTevBias x8_bias = GX_TB_ZERO;
|
||||
GXTevScale xc_scale = GX_CS_SCALE_1;
|
||||
GXTevRegID x10_regId = GX_TEVPREV;
|
||||
|
||||
constexpr CTevOp() = default;
|
||||
constexpr CTevOp(bool clamp, GX::TevOp op, GX::TevBias bias, GX::TevScale scale, GX::TevRegID regId)
|
||||
constexpr CTevOp(bool clamp, GXTevOp op, GXTevBias bias, GXTevScale scale, GXTevRegID regId)
|
||||
: x0_clamp(clamp), x4_op(op), x8_bias(bias), xc_scale(scale), x10_regId(regId) {}
|
||||
constexpr CTevOp(u32 compressedDesc)
|
||||
: x0_clamp((compressedDesc >> 8 & 1) != 0)
|
||||
, x4_op(static_cast<GX::TevOp>(compressedDesc & 0xF))
|
||||
, x8_bias(static_cast<GX::TevBias>(compressedDesc >> 4 & 3))
|
||||
, xc_scale(static_cast<GX::TevScale>(compressedDesc >> 6 & 3))
|
||||
, x10_regId(static_cast<GX::TevRegID>(compressedDesc >> 9 & 3)) {}
|
||||
, x4_op(static_cast<GXTevOp>(compressedDesc & 0xF))
|
||||
, x8_bias(static_cast<GXTevBias>(compressedDesc >> 4 & 3))
|
||||
, xc_scale(static_cast<GXTevScale>(compressedDesc >> 6 & 3))
|
||||
, x10_regId(static_cast<GXTevRegID>(compressedDesc >> 9 & 3)) {}
|
||||
|
||||
bool operator==(const CTevOp& rhs) const {
|
||||
return x0_clamp == rhs.x0_clamp && x4_op == rhs.x4_op && x8_bias == rhs.x8_bias && xc_scale == rhs.xc_scale;
|
||||
}
|
||||
};
|
||||
struct ColorPass {
|
||||
GX::TevColorArg x0_a;
|
||||
GX::TevColorArg x4_b;
|
||||
GX::TevColorArg x8_c;
|
||||
GX::TevColorArg xc_d;
|
||||
GXTevColorArg x0_a;
|
||||
GXTevColorArg x4_b;
|
||||
GXTevColorArg x8_c;
|
||||
GXTevColorArg xc_d;
|
||||
|
||||
constexpr ColorPass(GX::TevColorArg a, GX::TevColorArg b, GX::TevColorArg c, GX::TevColorArg d)
|
||||
constexpr ColorPass(GXTevColorArg a, GXTevColorArg b, GXTevColorArg c, GXTevColorArg d)
|
||||
: x0_a(a), x4_b(b), x8_c(c), xc_d(d) {}
|
||||
constexpr ColorPass(u32 compressedDesc)
|
||||
: x0_a(static_cast<GX::TevColorArg>(compressedDesc & 0x1F))
|
||||
, x4_b(static_cast<GX::TevColorArg>(compressedDesc >> 5 & 0x1F))
|
||||
, x8_c(static_cast<GX::TevColorArg>(compressedDesc >> 10 & 0x1F))
|
||||
, xc_d(static_cast<GX::TevColorArg>(compressedDesc >> 15 & 0x1F)) {}
|
||||
: x0_a(static_cast<GXTevColorArg>(compressedDesc & 0x1F))
|
||||
, x4_b(static_cast<GXTevColorArg>(compressedDesc >> 5 & 0x1F))
|
||||
, x8_c(static_cast<GXTevColorArg>(compressedDesc >> 10 & 0x1F))
|
||||
, xc_d(static_cast<GXTevColorArg>(compressedDesc >> 15 & 0x1F)) {}
|
||||
|
||||
bool operator==(const ColorPass& rhs) const { return memcmp(this, &rhs, sizeof(*this)) == 0; }
|
||||
};
|
||||
struct AlphaPass {
|
||||
GX::TevAlphaArg x0_a;
|
||||
GX::TevAlphaArg x4_b;
|
||||
GX::TevAlphaArg x8_c;
|
||||
GX::TevAlphaArg xc_d;
|
||||
GXTevAlphaArg x0_a;
|
||||
GXTevAlphaArg x4_b;
|
||||
GXTevAlphaArg x8_c;
|
||||
GXTevAlphaArg xc_d;
|
||||
|
||||
constexpr AlphaPass(GX::TevAlphaArg a, GX::TevAlphaArg b, GX::TevAlphaArg c, GX::TevAlphaArg d)
|
||||
constexpr AlphaPass(GXTevAlphaArg a, GXTevAlphaArg b, GXTevAlphaArg c, GXTevAlphaArg d)
|
||||
: x0_a(a), x4_b(b), x8_c(c), xc_d(d) {}
|
||||
constexpr AlphaPass(u32 compressedDesc)
|
||||
: x0_a(static_cast<GX::TevAlphaArg>(compressedDesc & 0x1F))
|
||||
, x4_b(static_cast<GX::TevAlphaArg>(compressedDesc >> 5 & 0x1F))
|
||||
, x8_c(static_cast<GX::TevAlphaArg>(compressedDesc >> 10 & 0x1F))
|
||||
, xc_d(static_cast<GX::TevAlphaArg>(compressedDesc >> 15 & 0x1F)) {}
|
||||
: x0_a(static_cast<GXTevAlphaArg>(compressedDesc & 0x1F))
|
||||
, x4_b(static_cast<GXTevAlphaArg>(compressedDesc >> 5 & 0x1F))
|
||||
, x8_c(static_cast<GXTevAlphaArg>(compressedDesc >> 10 & 0x1F))
|
||||
, xc_d(static_cast<GXTevAlphaArg>(compressedDesc >> 15 & 0x1F)) {}
|
||||
|
||||
bool operator==(const AlphaPass& rhs) const { return memcmp(this, &rhs, sizeof(*this)) == 0; }
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <magic_enum.hpp>
|
||||
|
||||
namespace metaforce {
|
||||
static std::array<CTexture*, GX::MAX_TEXMAP> sLoadedTextures{};
|
||||
static std::array<CTexture*, GX_MAX_TEXMAP> sLoadedTextures{};
|
||||
|
||||
CTexture::CTexture(ETexelFormat fmt, u16 w, u16 h, s32 mips, std::string_view label)
|
||||
: x0_fmt(fmt)
|
||||
|
@ -21,7 +21,7 @@ CTexture::CTexture(ETexelFormat fmt, u16 w, u16 h, s32 mips, std::string_view la
|
|||
}
|
||||
|
||||
CTexture::CTexture(CInputStream& in, std::string_view label, EAutoMipmap automip, EBlackKey blackKey)
|
||||
: x0_fmt(ETexelFormat(in.ReadLong()))
|
||||
: x0_fmt(static_cast<ETexelFormat>(in.ReadLong()))
|
||||
, x4_w(in.ReadShort())
|
||||
, x6_h(in.ReadShort())
|
||||
, x8_mips(in.ReadLong())
|
||||
|
@ -64,6 +64,8 @@ CTexture::CTexture(CInputStream& in, std::string_view label, EAutoMipmap automip
|
|||
InitTextureObjs();
|
||||
}
|
||||
|
||||
CTexture::~CTexture() { GXDestroyTexObj(&x20_texObj); }
|
||||
|
||||
u8* CTexture::Lock() {
|
||||
xa_24_locked = true;
|
||||
return GetBitMapData(0);
|
||||
|
@ -78,7 +80,7 @@ void CTexture::UnLock() {
|
|||
m_needsTexObjDataLoad = true;
|
||||
}
|
||||
|
||||
void CTexture::Load(GX::TexMapID id, EClampMode clamp) {
|
||||
void CTexture::Load(GXTexMapID id, EClampMode clamp) {
|
||||
if (sLoadedTextures[id] != this || xa_29_canLoadObj) {
|
||||
auto* data = /*x44_aramToken.GetMRAMSafe() */ x44_aramToken_x4_buff.get();
|
||||
CountMemory();
|
||||
|
@ -104,7 +106,7 @@ void CTexture::Load(GX::TexMapID id, EClampMode clamp) {
|
|||
}
|
||||
}
|
||||
|
||||
void CTexture::LoadMipLevel(float lod, GX::TexMapID id, EClampMode clamp) {
|
||||
void CTexture::LoadMipLevel(float lod, GXTexMapID id, EClampMode clamp) {
|
||||
// auto image_ptr = /*x44_aramToken.GetMRAMSafe() */ x44_aramToken_x4_buff.get();
|
||||
// u32 width = x4_w;
|
||||
// u32 height = x6_h;
|
||||
|
@ -154,16 +156,16 @@ u8* CTexture::GetBitMapData(s32 mip) const { return const_cast<u8*>(GetConstBitM
|
|||
void CTexture::InitBitmapBuffers(ETexelFormat fmt, u16 width, u16 height, s32 mips) {
|
||||
switch (fmt) {
|
||||
case ETexelFormat::I4:
|
||||
x18_gxFormat = GX::TF_I4;
|
||||
x18_gxFormat = GX_TF_I4;
|
||||
break;
|
||||
case ETexelFormat::I8:
|
||||
x18_gxFormat = GX::TF_I8;
|
||||
x18_gxFormat = GX_TF_I8;
|
||||
break;
|
||||
case ETexelFormat::IA4:
|
||||
x18_gxFormat = GX::TF_IA4;
|
||||
x18_gxFormat = GX_TF_IA4;
|
||||
break;
|
||||
case ETexelFormat::IA8:
|
||||
x18_gxFormat = GX::TF_IA8;
|
||||
x18_gxFormat = GX_TF_IA8;
|
||||
break;
|
||||
case ETexelFormat::C4:
|
||||
x1c_gxCIFormat = GX_TF_C4;
|
||||
|
@ -175,16 +177,23 @@ void CTexture::InitBitmapBuffers(ETexelFormat fmt, u16 width, u16 height, s32 mi
|
|||
x1c_gxCIFormat = GX_TF_C14X2;
|
||||
break;
|
||||
case ETexelFormat::RGB565:
|
||||
x18_gxFormat = GX::TF_RGB565;
|
||||
x18_gxFormat = GX_TF_RGB565;
|
||||
break;
|
||||
case ETexelFormat::RGB5A3:
|
||||
x18_gxFormat = GX::TF_RGB5A3;
|
||||
x18_gxFormat = GX_TF_RGB5A3;
|
||||
break;
|
||||
case ETexelFormat::RGBA8:
|
||||
x18_gxFormat = GX::TF_RGBA8;
|
||||
x18_gxFormat = GX_TF_RGBA8;
|
||||
break;
|
||||
case ETexelFormat::CMPR:
|
||||
x18_gxFormat = GX::TF_CMPR;
|
||||
x18_gxFormat = GX_TF_CMPR;
|
||||
break;
|
||||
// Metaforce additions
|
||||
case ETexelFormat::R8PC:
|
||||
x18_gxFormat = GX_TF_R8_PC;
|
||||
break;
|
||||
case ETexelFormat::RGBA8PC:
|
||||
x18_gxFormat = GX_TF_RGBA8_PC;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -192,7 +201,7 @@ void CTexture::InitBitmapBuffers(ETexelFormat fmt, u16 width, u16 height, s32 mi
|
|||
|
||||
u32 format = (x0_fmt == ETexelFormat::C4 || x0_fmt == ETexelFormat::C8 || x0_fmt == ETexelFormat::C14X2)
|
||||
? u32(x1c_gxCIFormat)
|
||||
: u32(x18_gxFormat);
|
||||
: x18_gxFormat;
|
||||
xc_memoryAllocated = GXGetTexBufferSize(width, height, format, mips > 1, mips > 1 ? 11 : 0);
|
||||
x44_aramToken_x4_buff = std::make_unique<u8[]>(xc_memoryAllocated);
|
||||
/*x44_aramToken.PostConstruct(buf, xc_memoryAllocated, 1);*/
|
||||
|
@ -268,8 +277,7 @@ bool CTexture::sMangleMips = false;
|
|||
u32 CTexture::sCurrentFrameCount = 0;
|
||||
u32 CTexture::sTotalAllocatedMemory = 0;
|
||||
|
||||
void CTexture::InvalidateTexMap(GX::TexMapID id) {
|
||||
// TODO: can we unbind in GX?
|
||||
void CTexture::InvalidateTexMap(GXTexMapID id) {
|
||||
sLoadedTextures[id] = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,24 @@
|
|||
#include "GX.hpp"
|
||||
|
||||
namespace metaforce {
|
||||
enum class ETexelFormat {
|
||||
Invalid = -1,
|
||||
I4 = 0,
|
||||
I8 = 1,
|
||||
IA4 = 2,
|
||||
IA8 = 3,
|
||||
C4 = 4,
|
||||
C8 = 5,
|
||||
C14X2 = 6,
|
||||
RGB565 = 7,
|
||||
RGB5A3 = 8,
|
||||
RGBA8 = 9,
|
||||
CMPR = 10,
|
||||
// Metaforce addition: non-converting formats
|
||||
RGBA8PC = 11,
|
||||
R8PC = 12,
|
||||
};
|
||||
|
||||
enum class EClampMode : std::underlying_type_t<GXTexWrapMode> {
|
||||
Clamp = GX_CLAMP,
|
||||
Repeat = GX_REPEAT,
|
||||
|
@ -63,7 +81,7 @@ private:
|
|||
u32 xc_memoryAllocated = 0;
|
||||
std::unique_ptr<CGraphicsPalette> x10_graphicsPalette;
|
||||
std::unique_ptr<CDumpedBitmapDataReloader> x14_bitmapReloader;
|
||||
GX::TextureFormat x18_gxFormat = GX::TF_RGB565;
|
||||
u32 x18_gxFormat = GX_TF_RGB565;
|
||||
GXCITexFmt x1c_gxCIFormat = GX_TF_C8;
|
||||
GXTexObj x20_texObj;
|
||||
EClampMode x40_clampMode = EClampMode::Repeat;
|
||||
|
@ -86,6 +104,7 @@ public:
|
|||
CTexture(ETexelFormat fmt, u16 w, u16 h, s32 mips, std::string_view label);
|
||||
CTexture(CInputStream& in, std::string_view label, EAutoMipmap automip = EAutoMipmap::Zero,
|
||||
EBlackKey blackKey = EBlackKey::Zero);
|
||||
~CTexture();
|
||||
|
||||
[[nodiscard]] ETexelFormat GetTextureFormat() const { return x0_fmt; }
|
||||
[[nodiscard]] u16 GetWidth() const { return x4_w; }
|
||||
|
@ -97,8 +116,8 @@ public:
|
|||
[[nodiscard]] bool HasPalette() const { return x10_graphicsPalette != nullptr; }
|
||||
[[nodiscard]] u8* Lock();
|
||||
void UnLock();
|
||||
void Load(GX::TexMapID id, EClampMode clamp);
|
||||
void LoadMipLevel(float lod, GX::TexMapID id, EClampMode clamp); // was an s32 mip parameter, adjusted to use lod
|
||||
void Load(GXTexMapID id, EClampMode clamp);
|
||||
void LoadMipLevel(float lod, GXTexMapID id, EClampMode clamp); // was an s32 mip parameter, adjusted to use lod
|
||||
// void UnloadBitmapData(u32) const;
|
||||
// void TryReloadBitmapData(CResFactory&) const;
|
||||
// void LoadToMRAM() const;
|
||||
|
@ -112,7 +131,7 @@ public:
|
|||
return x0_fmt == ETexelFormat::C4 || x0_fmt == ETexelFormat::C8 || x0_fmt == ETexelFormat::C14X2;
|
||||
}
|
||||
|
||||
static void InvalidateTexMap(GX::TexMapID id);
|
||||
static void InvalidateTexMap(GXTexMapID id);
|
||||
static void SetMangleMips(bool b) { sMangleMips = b; }
|
||||
static void SetCurrentFrameCount(u32 frameCount) { sCurrentFrameCount = frameCount; }
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -33,11 +33,11 @@ public:
|
|||
enum class EDrawableSorting { SortedCallback, UnsortedCallback };
|
||||
enum class EDebugOption { Invalid = -1, PVSMode, PVSState, FogDisabled };
|
||||
enum class EPrimitiveType {
|
||||
Triangles = GX::TRIANGLES,
|
||||
TriangleFan = GX::TRIANGLEFAN,
|
||||
TriangleStrip = GX::TRIANGLESTRIP,
|
||||
Lines = GX::LINES,
|
||||
LineStrip = GX::LINESTRIP,
|
||||
Triangles = GX_TRIANGLES,
|
||||
TriangleFan = GX_TRIANGLEFAN,
|
||||
TriangleStrip = GX_TRIANGLESTRIP,
|
||||
Lines = GX_LINES,
|
||||
LineStrip = GX_LINESTRIP,
|
||||
};
|
||||
|
||||
virtual ~IRenderer() = default;
|
||||
|
|
|
@ -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,9 +35,7 @@ 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() {
|
||||
|
@ -65,7 +63,8 @@ CSpaceWarpFilter::CSpaceWarpFilter() {
|
|||
// 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);
|
||||
// stages.data(), nullptr, nullptr, texs.size(), texs.data(), nullptr,
|
||||
// nullptr);
|
||||
// return true;
|
||||
// } BooTrace);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -112,8 +112,8 @@ void CAuiEnergyBarT01::Draw(const CGuiWidgetDrawParms& drawParms) {
|
|||
if (barOffT != barMaxT) {
|
||||
CGraphics::SetTevOp(ERglTevStage::Stage0, CTevCombiners::sTevPass805a5ebc);
|
||||
CGraphics::SetTevOp(ERglTevStage::Stage1, CTevCombiners::skPassThru);
|
||||
xbc_tex->Load(GX::TEXMAP0, EClampMode::Repeat);
|
||||
CGraphics::StreamBegin(GX::TRIANGLESTRIP);
|
||||
xbc_tex->Load(GX_TEXMAP0, EClampMode::Repeat);
|
||||
CGraphics::StreamBegin(GX_TRIANGLESTRIP);
|
||||
CGraphics::StreamColor(useCol);
|
||||
auto coords = xd8_coordFunc(barOffT);
|
||||
while (barOffT < barMaxT) {
|
||||
|
|
|
@ -80,8 +80,8 @@ void CAuiImagePane::DoDrawImagePane(const zeus::CColor& color, CTexture& tex, in
|
|||
if ((x14c_deResFactor == 0.f && alpha == 1.f) || tex.GetNumberOfMipMaps() == 1) {
|
||||
CGraphics::SetTevOp(ERglTevStage::Stage0, CTevCombiners::sTevPass805a5ebc);
|
||||
CGraphics::SetTevOp(ERglTevStage::Stage1, CTevCombiners::skPassThru);
|
||||
tex.LoadMipLevel(0.f, GX::TEXMAP0, EClampMode::Repeat);
|
||||
CGraphics::StreamBegin(GX::TRIANGLESTRIP);
|
||||
tex.LoadMipLevel(0.f, GX_TEXMAP0, EClampMode::Repeat);
|
||||
CGraphics::StreamBegin(GX_TRIANGLESTRIP);
|
||||
CGraphics::StreamColor(useColor);
|
||||
for (u32 i = 0; i < useUVs->size(); ++i) {
|
||||
CGraphics::StreamTexcoord((*useUVs)[i] + xd0_uvBias0);
|
||||
|
@ -101,41 +101,41 @@ void CAuiImagePane::DoDrawImagePane(const zeus::CColor& color, CTexture& tex, in
|
|||
|
||||
float rgba1 = (fadeFactor - static_cast<float>(mip1));
|
||||
float rgba2 = 1.f - rgba1;
|
||||
tex.LoadMipLevel(mip1, GX::TexMapID::TEXMAP0, EClampMode::Repeat);
|
||||
tex.LoadMipLevel(mip2, GX::TexMapID::TEXMAP1, EClampMode::Repeat);
|
||||
std::array<GX::VtxDescList, 3> list{{
|
||||
{GX::VA_POS, GX::DIRECT},
|
||||
{GX::VA_TEX0, GX::DIRECT},
|
||||
GX::VtxDescList{},
|
||||
tex.LoadMipLevel(mip1, GX_TEXMAP0, EClampMode::Repeat);
|
||||
tex.LoadMipLevel(mip2, GX_TEXMAP1, EClampMode::Repeat);
|
||||
std::array<GXVtxDescList, 3> list{{
|
||||
{GX_VA_POS, GX_DIRECT},
|
||||
{GX_VA_TEX0, GX_DIRECT},
|
||||
{GX_VA_NULL, GX_NONE},
|
||||
}};
|
||||
|
||||
CGX::SetVtxDescv(list.data());
|
||||
CGX::SetNumChans(0);
|
||||
CGX::SetNumTexGens(2);
|
||||
CGX::SetNumTevStages(2);
|
||||
GX::TevStageID stage = GX::TEVSTAGE0;
|
||||
while (stage < GX::TEVSTAGE2) {
|
||||
GX::TevColorArg colorD = stage == GX::TEVSTAGE0 ? GX::CC_ZERO : GX::CC_CPREV;
|
||||
CGX::SetTevColorIn(stage, GX::CC_ZERO, GX::CC_TEXC, GX::CC_KONST, colorD);
|
||||
GX::TevAlphaArg alphaD = stage == GX::TEVSTAGE0 ? GX::CA_ZERO : GX::CA_APREV;
|
||||
CGX::SetTevAlphaIn(stage, GX::CA_ZERO, GX::CA_TEXA, GX::CA_KONST, alphaD);
|
||||
CGX::SetTevColorOp(stage, GX::TEV_ADD, GX::TB_ZERO, GX::CS_SCALE_1, true, GX::TEVPREV);
|
||||
CGX::SetTevAlphaOp(stage, GX::TEV_ADD, GX::TB_ZERO, GX::CS_SCALE_1, true, GX::TEVPREV);
|
||||
stage = static_cast<GX::TevStageID>(stage + GX::TEVSTAGE1);
|
||||
GXTevStageID stage = GX_TEVSTAGE0;
|
||||
while (stage < GX_TEVSTAGE2) {
|
||||
GXTevColorArg colorD = stage == GX_TEVSTAGE0 ? GX_CC_ZERO : GX_CC_CPREV;
|
||||
CGX::SetTevColorIn(stage, GX_CC_ZERO, GX_CC_TEXC, GX_CC_KONST, colorD);
|
||||
GXTevAlphaArg alphaD = stage == GX_TEVSTAGE0 ? GX_CA_ZERO : GX_CA_APREV;
|
||||
CGX::SetTevAlphaIn(stage, GX_CA_ZERO, GX_CA_TEXA, GX_CA_KONST, alphaD);
|
||||
CGX::SetTevColorOp(stage, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
|
||||
CGX::SetTevAlphaOp(stage, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
|
||||
stage = static_cast<GXTevStageID>(stage + GX_TEVSTAGE1);
|
||||
}
|
||||
CGX::SetTevKAlphaSel(GX::TEVSTAGE0, GX::TEV_KASEL_K0_A);
|
||||
CGX::SetTevKColorSel(GX::TEVSTAGE0, GX::TEV_KCSEL_K0);
|
||||
CGX::SetTevKAlphaSel(GX::TEVSTAGE1, GX::TEV_KASEL_K1_A);
|
||||
CGX::SetTevKColorSel(GX::TEVSTAGE1, GX::TEV_KCSEL_K1);
|
||||
CGX::SetTevKAlphaSel(GX_TEVSTAGE0, GX_TEV_KASEL_K0_A);
|
||||
CGX::SetTevKColorSel(GX_TEVSTAGE0, GX_TEV_KCSEL_K0);
|
||||
CGX::SetTevKAlphaSel(GX_TEVSTAGE1, GX_TEV_KASEL_K1_A);
|
||||
CGX::SetTevKColorSel(GX_TEVSTAGE1, GX_TEV_KCSEL_K1);
|
||||
zeus::CColor col1 = useColor * zeus::CColor(rgba2, rgba2, rgba2, rgba2);
|
||||
zeus::CColor col2 = useColor * zeus::CColor(rgba1, rgba1, rgba1, rgba1);
|
||||
CGX::SetTevKColor(GX::KCOLOR0, col1);
|
||||
CGX::SetTevKColor(GX::KCOLOR1, col2);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD0, GX::TEXMAP0, GX::COLOR_NULL);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE1, GX::TEXCOORD1, GX::TEXMAP1, GX::COLOR_NULL);
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD0, GX::TG_MTX2x4, GX::TG_TEX0, GX::IDENTITY, false, GX::PTIDENTITY);
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD1, GX::TG_MTX2x4, GX::TG_TEX0, GX::IDENTITY, false, GX::PTIDENTITY);
|
||||
CGX::Begin(GX::Primitive::TRIANGLESTRIP, GX::VTXFMT0, 4);
|
||||
CGX::SetTevKColor(GX_KCOLOR0, col1);
|
||||
CGX::SetTevKColor(GX_KCOLOR1, col2);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD1, GX_TEXMAP1, GX_COLOR_NULL);
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, false, GX_PTIDENTITY);
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD1, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, false, GX_PTIDENTITY);
|
||||
CGX::Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 4);
|
||||
for (u32 idx = 0; const auto& coord : xe0_coords) {
|
||||
GXPosition3f32(coord);
|
||||
GXTexCoord2f32((*useUVs)[idx] + xd0_uvBias0);
|
||||
|
@ -146,8 +146,8 @@ void CAuiImagePane::DoDrawImagePane(const zeus::CColor& color, CTexture& tex, in
|
|||
} else {
|
||||
CGraphics::SetTevOp(ERglTevStage::Stage0, CTevCombiners::sTevPass805a5fec);
|
||||
CGraphics::SetTevOp(ERglTevStage::Stage1, CTevCombiners::skPassThru);
|
||||
tex.Load(GX::TEXMAP0, EClampMode::Repeat);
|
||||
CGraphics::StreamBegin(GX::TRIANGLESTRIP);
|
||||
tex.Load(GX_TEXMAP0, EClampMode::Repeat);
|
||||
CGraphics::StreamBegin(GX_TRIANGLESTRIP);
|
||||
CGraphics::StreamColor(useColor);
|
||||
for (u32 i = 0; i < useUVs->size(); ++i) {
|
||||
CGraphics::StreamTexcoord((*useUVs)[i]);
|
||||
|
|
|
@ -71,12 +71,12 @@ CCompoundTargetReticle::CCompoundTargetReticle(const CStateManager& mgr)
|
|||
|
||||
CCompoundTargetReticle::SScanReticuleRenderer::SScanReticuleRenderer() {
|
||||
// CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
for (size_t i = 0; i < m_lineRenderers.size(); ++i) {
|
||||
m_lineRenderers[i].emplace(CLineRenderer::EPrimitiveMode::Lines, 8, aurora::gfx::TextureHandle{}, true, true);
|
||||
for (auto& stripRenderer : m_stripRenderers[i]) {
|
||||
stripRenderer.emplace(CLineRenderer::EPrimitiveMode::LineStrip, 4, aurora::gfx::TextureHandle{}, true, true);
|
||||
}
|
||||
}
|
||||
// for (size_t i = 0; i < m_lineRenderers.size(); ++i) {
|
||||
// m_lineRenderers[i].emplace(CLineRenderer::EPrimitiveMode::Lines, 8, {}, true, true);
|
||||
// for (auto& stripRenderer : m_stripRenderers[i]) {
|
||||
// stripRenderer.emplace(CLineRenderer::EPrimitiveMode::LineStrip, 4, {}, true, true);
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// } BooTrace);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ void CGuiPane::Draw(const CGuiWidgetDrawParms& parms) {
|
|||
col.a() = parms.x0_alphaMod * xa8_color2.a();
|
||||
|
||||
CGraphics::SetTevOp(ERglTevStage::Stage0, CTevCombiners::skPassThru);
|
||||
CGraphics::DrawPrimitive(GX::Primitive::TRIANGLESTRIP, xc0_verts.data(), skDefaultNormal, col, xc0_verts.size());
|
||||
CGraphics::DrawPrimitive(GX_TRIANGLESTRIP, xc0_verts.data(), skDefaultNormal, col, xc0_verts.size());
|
||||
}
|
||||
CGuiWidget::Draw(parms);
|
||||
}
|
||||
|
|
|
@ -32,9 +32,9 @@ CGuiTableGroup::CGuiTableGroup(const CGuiWidgetParms& parms, int elementCount, i
|
|||
, xd0_selectWraparound(selectWraparound) {}
|
||||
|
||||
void CGuiTableGroup::ProcessUserInput(const CFinalInput& input) {
|
||||
if (input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter)) {
|
||||
if (input.PA() || input.PSpecialKey(ESpecialKey::Enter)) {
|
||||
DoAdvance();
|
||||
} else if (input.PB() || input.PSpecialKey(aurora::SpecialKey::Esc)) {
|
||||
} else if (input.PB() || input.PSpecialKey(ESpecialKey::Esc)) {
|
||||
DoCancel();
|
||||
} else {
|
||||
bool decrement;
|
||||
|
|
|
@ -29,7 +29,7 @@ CHudRadarInterface::CHudRadarInterface(CGuiFrame& baseHud, CStateManager& stateM
|
|||
void CHudRadarInterface::DoDrawRadarPaint(float radius) {
|
||||
radius *= 4.f;
|
||||
|
||||
CGraphics::StreamBegin(GX::TRIANGLESTRIP);
|
||||
CGraphics::StreamBegin(GX_TRIANGLESTRIP);
|
||||
CGraphics::StreamTexcoord(0.f, 1.f);
|
||||
CGraphics::StreamVertex(-radius, 0.f, radius);
|
||||
CGraphics::StreamTexcoord(0.f, 0.f);
|
||||
|
@ -124,7 +124,7 @@ void CHudRadarInterface::Draw(const CStateManager& mgr, float alpha) {
|
|||
|
||||
g_Renderer->SetModelMatrix(drawParms.x3c_postTranslate);
|
||||
g_Renderer->SetBlendMode_AdditiveAlpha();
|
||||
x0_txtrRadarPaint->Load(GX::TEXMAP0, EClampMode::Repeat);
|
||||
x0_txtrRadarPaint->Load(GX_TEXMAP0, EClampMode::Repeat);
|
||||
CGraphics::SetTevOp(ERglTevStage::Stage0, CTevCombiners::sTevPass805a5ebc);
|
||||
g_Renderer->SetDepthReadWrite(false, false);
|
||||
zeus::CColor playerColor = g_tweakGuiColors->GetRadarPlayerPaintColor();
|
||||
|
|
|
@ -210,26 +210,26 @@ bool CRasterFont::IsFinishedLoading() const {
|
|||
}
|
||||
|
||||
void CRasterFont::SetupRenderState() {
|
||||
static const GX::VtxDescList skDescList[3] = {
|
||||
{GX::VA_POS, GX::DIRECT},
|
||||
{GX::VA_TEX0, GX::DIRECT},
|
||||
{GX::VA_NULL, GX::NONE}
|
||||
constexpr std::array skDescList = {
|
||||
GXVtxDescList{GX_VA_POS, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_TEX0, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_NULL, GX_NONE},
|
||||
};
|
||||
|
||||
x80_texture->Load(GX::TEXMAP0, EClampMode::Clamp);
|
||||
CGX::SetTevKAlphaSel(GX::TEVSTAGE0, GX::TEV_KASEL_K0_A);
|
||||
CGX::SetTevKColorSel(GX::TEVSTAGE0, GX::TEV_KCSEL_K0);
|
||||
CGX::SetTevColorIn(GX::TEVSTAGE0, GX::CC_ZERO, GX::CC_TEXC, GX::CC_KONST, GX::CC_ZERO);
|
||||
CGX::SetTevAlphaIn(GX::TEVSTAGE0, GX::CA_ZERO, GX::CA_TEXA, GX::CA_KONST, GX::CA_ZERO);
|
||||
CGX::SetStandardTevColorAlphaOp(GX::TEVSTAGE0);
|
||||
CGX::SetTevDirect(GX::TEVSTAGE0);
|
||||
CGX::SetVtxDescv(skDescList);
|
||||
x80_texture->Load(GX_TEXMAP0, EClampMode::Clamp);
|
||||
CGX::SetTevKAlphaSel(GX_TEVSTAGE0, GX_TEV_KASEL_K0_A);
|
||||
CGX::SetTevKColorSel(GX_TEVSTAGE0, GX_TEV_KCSEL_K0);
|
||||
CGX::SetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_TEXC, GX_CC_KONST, GX_CC_ZERO);
|
||||
CGX::SetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_TEXA, GX_CA_KONST, GX_CA_ZERO);
|
||||
CGX::SetStandardTevColorAlphaOp(GX_TEVSTAGE0);
|
||||
CGX::SetTevDirect(GX_TEVSTAGE0);
|
||||
CGX::SetVtxDescv(skDescList.data());
|
||||
CGX::SetNumChans(0);
|
||||
CGX::SetNumTexGens(1);
|
||||
CGX::SetNumTevStages(1);
|
||||
CGX::SetNumIndStages(0);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD0, GX::TEXMAP0, GX::COLOR_NULL);
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD0, GX::TG_MTX2x4, GX::TG_TEX0, GX::IDENTITY, false, GX::PTIDENTITY);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, false, GX_PTIDENTITY);
|
||||
}
|
||||
std::unique_ptr<IObj> FRasterFontFactory([[maybe_unused]] const SObjectTag& tag, CInputStream& in,
|
||||
const CVParamTransfer& vparms, [[maybe_unused]] CObjectReference* selfRef) {
|
||||
|
|
|
@ -42,7 +42,7 @@ void CScanDisplay::CDataDot::Draw(const zeus::CColor& col, float radius) {
|
|||
|
||||
const zeus::CTransform xf = zeus::CTransform::Translate(xc_curPos.x(), 0.f, xc_curPos.y());
|
||||
g_Renderer->SetModelMatrix(xf);
|
||||
CGraphics::StreamBegin(GX::TRIANGLESTRIP);
|
||||
CGraphics::StreamBegin(GX_TRIANGLESTRIP);
|
||||
zeus::CColor useColor = col;
|
||||
useColor.a() *= x24_alpha;
|
||||
CGraphics::StreamColor(useColor);
|
||||
|
@ -84,7 +84,7 @@ void CScanDisplay::ProcessInput(const CFinalInput& input) {
|
|||
return;
|
||||
|
||||
if (xc_state == EScanState::DownloadComplete && x1a4_xAlpha == 0.f) {
|
||||
if (input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary)) {
|
||||
if (input.PA() || input.PSpecialKey(ESpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary)) {
|
||||
if (xa8_message->TextSupport().GetCurTime() < xa8_message->TextSupport().GetTotalAnimationTime()) {
|
||||
xa8_message->TextSupport().SetCurTime(xa8_message->TextSupport().GetTotalAnimationTime());
|
||||
} else {
|
||||
|
@ -96,7 +96,7 @@ void CScanDisplay::ProcessInput(const CFinalInput& input) {
|
|||
} else if (xc_state == EScanState::ViewingScan) {
|
||||
int oldCounter = x1ac_pageCounter;
|
||||
int totalPages = xac_scrollMessage->TextSupport().GetTotalPageCount();
|
||||
if ((input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary)) &&
|
||||
if ((input.PA() || input.PSpecialKey(ESpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary)) &&
|
||||
totalPages != -1) {
|
||||
CGuiTextSupport& supp = !x1ac_pageCounter ? xa8_message->TextSupport() : xac_scrollMessage->TextSupport();
|
||||
if (supp.GetCurTime() < supp.GetTotalAnimationTime())
|
||||
|
@ -452,7 +452,7 @@ void CScanDisplay::Draw() {
|
|||
g_Renderer->SetViewportOrtho(true, -4096.f, 4096.f);
|
||||
g_Renderer->SetBlendMode_AdditiveAlpha();
|
||||
CGraphics::SetTevOp(ERglTevStage::Stage0, CTevCombiners::sTevPass805a5ebc);
|
||||
x0_dataDot->Load(GX::TEXMAP0, EClampMode::Repeat);
|
||||
x0_dataDot->Load(GX_TEXMAP0, EClampMode::Repeat);
|
||||
|
||||
const float vpRatio = CGraphics::GetViewportHeight() / 480.f;
|
||||
for (CDataDot& dot : xbc_dataDots) {
|
||||
|
|
|
@ -72,13 +72,13 @@ void CSplashScreen::Draw() {
|
|||
auto& tex = *x28_texture.GetObj();
|
||||
const auto width = tex.GetWidth();
|
||||
const auto height = tex.GetHeight();
|
||||
tex.Load(GX::TEXMAP0, EClampMode::Clamp);
|
||||
tex.Load(GX_TEXMAP0, EClampMode::Clamp);
|
||||
if (x14_which == ESplashScreen::Nintendo || x14_which == ESplashScreen::Retro) {
|
||||
const auto x = static_cast<float>(133 - (width - 376) / 2);
|
||||
const auto y = static_cast<float>(170 - (height - 104) / 2);
|
||||
CGraphics::SetOrtho(-10.f, 650.f, -5.5f, 484.5f, -1.f, 1.f);
|
||||
CGraphics::SetCullMode(ERglCullMode::None);
|
||||
CGraphics::StreamBegin(GX::TRIANGLESTRIP);
|
||||
CGraphics::StreamBegin(GX_TRIANGLESTRIP);
|
||||
CGraphics::StreamColor(color);
|
||||
CGraphics::StreamTexcoord(0.f, 0.f);
|
||||
CGraphics::StreamVertex({x, 0.f, y + static_cast<float>(height)});
|
||||
|
|
|
@ -130,8 +130,8 @@ void CTextRenderBuffer::Render(const zeus::CColor& color, float time) {
|
|||
auto font = x4_fonts[x4c_activeFont];
|
||||
if (font && font->GetGlyph(chr) != nullptr) {
|
||||
const auto* glyph = font->GetGlyph(chr);
|
||||
CGX::SetTevKColor(GX::KCOLOR0, chrColor * color);
|
||||
CGX::Begin(GX::TRIANGLESTRIP, GX::VTXFMT0, 4);
|
||||
CGX::SetTevKColor(GX_KCOLOR0, chrColor * color);
|
||||
CGX::Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 4);
|
||||
{
|
||||
GXPosition3f32(offX, 0.f, offY);
|
||||
GXTexCoord2f32(glyph->GetStartU(), glyph->GetStartV());
|
||||
|
@ -153,30 +153,30 @@ void CTextRenderBuffer::Render(const zeus::CColor& color, float time) {
|
|||
auto imageDef = x14_images[imageIdx];
|
||||
auto tex = imageDef.x4_texs[static_cast<u32>(time * imageDef.x0_fps) % imageDef.x4_texs.size()];
|
||||
if (tex) {
|
||||
tex->Load(GX::TEXMAP0, EClampMode::Clamp);
|
||||
tex->Load(GX_TEXMAP0, EClampMode::Clamp);
|
||||
float width = imageDef.x4_texs.front()->GetWidth() * imageDef.x14_cropFactor.x();
|
||||
float height = imageDef.x4_texs.front()->GetHeight() * imageDef.x14_cropFactor.y();
|
||||
float cropXHalf = imageDef.x14_cropFactor.x() * 0.5f;
|
||||
float cropYHalf = imageDef.x14_cropFactor.y() * 0.5f;
|
||||
|
||||
CGX::SetTevKAlphaSel(GX::TEVSTAGE0, GX::TEV_KASEL_K0_A);
|
||||
CGX::SetTevKColorSel(GX::TEVSTAGE0, GX::TEV_KCSEL_K0);
|
||||
CGX::SetTevColorIn(GX::TEVSTAGE0, GX::CC_ZERO, GX::CC_TEXC, GX::CC_KONST, GX::CC_ZERO);
|
||||
CGX::SetTevAlphaIn(GX::TEVSTAGE0, GX::CA_ZERO, GX::CA_TEXA, GX::CA_KONST, GX::CA_ZERO);
|
||||
CGX::SetStandardTevColorAlphaOp(GX::TEVSTAGE0);
|
||||
CGX::SetTevKAlphaSel(GX_TEVSTAGE0, GX_TEV_KASEL_K0_A);
|
||||
CGX::SetTevKColorSel(GX_TEVSTAGE0, GX_TEV_KCSEL_K0);
|
||||
CGX::SetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_TEXC, GX_CC_KONST, GX_CC_ZERO);
|
||||
CGX::SetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_TEXA, GX_CA_KONST, GX_CA_ZERO);
|
||||
CGX::SetStandardTevColorAlphaOp(GX_TEVSTAGE0);
|
||||
constexpr std::array skVtxDesc{
|
||||
GX::VtxDescList{GX::VA_POS, GX::DIRECT},
|
||||
GX::VtxDescList{GX::VA_TEX0, GX::DIRECT},
|
||||
GX::VtxDescList{},
|
||||
GXVtxDescList{GX_VA_POS, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_TEX0, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_NULL, GX_NONE},
|
||||
};
|
||||
CGX::SetVtxDescv(skVtxDesc.data());
|
||||
CGX::SetNumChans(0);
|
||||
CGX::SetNumTexGens(1);
|
||||
CGX::SetNumTevStages(1);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD0, GX::TEXMAP0, GX::COLOR_NULL);
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD0, GX::TG_MTX2x4, GX::TG_TEX0, GX::IDENTITY, false, GX::PTIDENTITY);
|
||||
CGX::SetTevKColor(GX::KCOLOR0, imageColor * color);
|
||||
CGX::Begin(GX::TRIANGLESTRIP, GX::VTXFMT0, 4);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, false, GX_PTIDENTITY);
|
||||
CGX::SetTevKColor(GX_KCOLOR0, imageColor * color);
|
||||
CGX::Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 4);
|
||||
{
|
||||
GXPosition3f32(offX, 0.f, offY);
|
||||
GXTexCoord2f32(0.5f - cropXHalf, 0.5f + cropYHalf);
|
||||
|
|
|
@ -37,8 +37,8 @@ enum class EGameplayResult { None, Win, Lose, Playing };
|
|||
class IMain {
|
||||
public:
|
||||
virtual ~IMain() = default;
|
||||
virtual std::string Init(const FileStoreManager& storeMgr, CVarManager* cvarMgr, boo::IAudioVoiceEngine* voiceEngine,
|
||||
amuse::IBackendVoiceAllocator& backend) = 0;
|
||||
virtual std::string Init(int argc, char** argv, const FileStoreManager& storeMgr, CVarManager* cvarMgr,
|
||||
boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& backend) = 0;
|
||||
virtual void Draw() = 0;
|
||||
virtual bool Proc(float dt) = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
#include <zeus/CVector2f.hpp>
|
||||
#define IM_VEC2_CLASS_EXTRA \
|
||||
ImVec2(const zeus::CVector2f& v) { \
|
||||
x = v.x(); \
|
||||
y = v.y(); \
|
||||
} \
|
||||
operator zeus::CVector2f() const { return zeus::CVector2f{x, y}; }
|
||||
#include "ImGuiConsole.hpp"
|
||||
|
||||
#include "../version.h"
|
||||
|
@ -26,6 +33,8 @@ namespace aurora::gfx {
|
|||
extern std::atomic_uint32_t queuedPipelines;
|
||||
extern std::atomic_uint32_t createdPipelines;
|
||||
|
||||
extern size_t g_drawCallCount;
|
||||
extern size_t g_mergedDrawCallCount;
|
||||
extern size_t g_lastVertSize;
|
||||
extern size_t g_lastUniformSize;
|
||||
extern size_t g_lastIndexSize;
|
||||
|
@ -139,6 +148,8 @@ static void Warp(const CAssetId worldId, TAreaId aId) {
|
|||
}
|
||||
}
|
||||
|
||||
static inline float GetScale() { return ImGui::GetIO().DisplayFramebufferScale.x; }
|
||||
|
||||
void ImGuiConsole::ShowMenuGame() {
|
||||
if (g_Main != nullptr) {
|
||||
m_paused = g_Main->IsPaused();
|
||||
|
@ -273,7 +284,7 @@ static void RenderEntityColumns(const ImGuiEntityEntry& entry) {
|
|||
}
|
||||
|
||||
void ImGuiConsole::ShowInspectWindow(bool* isOpen) {
|
||||
float initialWindowSize = 400.f * aurora::get_window_size().scale;
|
||||
float initialWindowSize = 400.f * GetScale();
|
||||
ImGui::SetNextWindowSize(ImVec2{initialWindowSize, initialWindowSize * 1.5f}, ImGuiCond_FirstUseEver);
|
||||
|
||||
if (ImGui::Begin("Inspect", isOpen)) {
|
||||
|
@ -393,7 +404,7 @@ bool ImGuiConsole::ShowEntityInfoWindow(TUniqueId uid) {
|
|||
|
||||
void ImGuiConsole::ShowConsoleVariablesWindow() {
|
||||
// For some reason the window shows up tiny without this
|
||||
float initialWindowSize = 350.f * aurora::get_window_size().scale;
|
||||
float initialWindowSize = 350.f * GetScale();
|
||||
ImGui::SetNextWindowSize(ImVec2{initialWindowSize, initialWindowSize}, ImGuiCond_FirstUseEver);
|
||||
if (ImGui::Begin("Console Variables", &m_showConsoleVariablesWindow)) {
|
||||
if (ImGui::Button("Clear")) {
|
||||
|
@ -663,7 +674,7 @@ void ImGuiConsole::ShowAboutWindow(bool preLaunch) {
|
|||
open = &m_showAboutWindow;
|
||||
}
|
||||
if (ImGui::Begin("About", open, flags)) {
|
||||
float iconSize = 128.f * aurora::get_window_size().scale;
|
||||
float iconSize = 128.f * GetScale();
|
||||
ImGui::SameLine(ImGui::GetWindowSize().x / 2 - iconSize + (iconSize / 2));
|
||||
ImGui::Image(ImGuiEngine::metaforceIcon, ImVec2{iconSize, iconSize});
|
||||
ImGui::PushFont(ImGuiEngine::fontLarge);
|
||||
|
@ -794,7 +805,7 @@ static std::string BytesToString(size_t bytes) {
|
|||
|
||||
void ImGuiConsole::ShowDebugOverlay() {
|
||||
if (!m_frameCounter && !m_frameRate && !m_inGameTime && !m_roomTimer && !m_playerInfo && !m_areaInfo &&
|
||||
!m_worldInfo && !m_randomStats && !m_resourceStats && !m_pipelineInfo) {
|
||||
!m_worldInfo && !m_randomStats && !m_resourceStats && !m_pipelineInfo && !m_drawCallInfo && !m_bufferInfo) {
|
||||
return;
|
||||
}
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
@ -959,6 +970,22 @@ void ImGuiConsole::ShowDebugOverlay() {
|
|||
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Queued pipelines: {}\n"), aurora::gfx::queuedPipelines));
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Done pipelines: {}\n"), aurora::gfx::createdPipelines));
|
||||
}
|
||||
if (m_drawCallInfo && m_developer) {
|
||||
if (hasPrevious) {
|
||||
ImGui::Separator();
|
||||
}
|
||||
hasPrevious = true;
|
||||
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Draw call count: {}\n"), aurora::gfx::g_drawCallCount));
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Merged draw calls: {}\n"), aurora::gfx::g_mergedDrawCallCount));
|
||||
}
|
||||
if (m_bufferInfo && m_developer) {
|
||||
if (hasPrevious) {
|
||||
ImGui::Separator();
|
||||
}
|
||||
hasPrevious = true;
|
||||
|
||||
ImGuiStringViewText(
|
||||
fmt::format(FMT_STRING("Vertex size: {}\n"), BytesToString(aurora::gfx::g_lastVertSize)));
|
||||
ImGuiStringViewText(
|
||||
|
@ -993,11 +1020,14 @@ void ImGuiConsole::ShowInputViewer() {
|
|||
return;
|
||||
}
|
||||
|
||||
u32 thisWhich = aurora::get_which_controller_for_player(input.ControllerIdx());
|
||||
u32 thisWhich = input.ControllerIdx();
|
||||
if (m_whichController != thisWhich) {
|
||||
m_controllerName = static_cast<std::string>(aurora::get_controller_name(thisWhich));
|
||||
const char* name = PADGetName(thisWhich);
|
||||
if (name != nullptr) {
|
||||
m_controllerName = name;
|
||||
m_whichController = thisWhich;
|
||||
}
|
||||
}
|
||||
|
||||
// Code -stolen- borrowed from Practice Mod
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
@ -1009,7 +1039,7 @@ void ImGuiConsole::ShowInputViewer() {
|
|||
}
|
||||
ImGui::SetNextWindowBgAlpha(0.65f);
|
||||
if (ImGui::Begin("Input Overlay", nullptr, windowFlags)) {
|
||||
float scale = aurora::get_window_size().scale;
|
||||
float scale = GetScale();
|
||||
if (!m_controllerName.empty()) {
|
||||
TextCenter(m_controllerName);
|
||||
ImGui::Separator();
|
||||
|
@ -1614,7 +1644,7 @@ void ImGuiConsole::ShowItemsWindow() {
|
|||
|
||||
void ImGuiConsole::ShowLayersWindow() {
|
||||
// For some reason the window shows up tiny without this
|
||||
float initialWindowSize = 350.f * aurora::get_window_size().scale;
|
||||
float initialWindowSize = 350.f * GetScale();
|
||||
ImGui::SetNextWindowSize(ImVec2{initialWindowSize, initialWindowSize}, ImGuiCond_FirstUseEver);
|
||||
|
||||
if (ImGui::Begin("Layers", &m_showLayersWindow)) {
|
||||
|
@ -1856,26 +1886,28 @@ void ImGuiConsole::ShowPreLaunchSettingsWindow() {
|
|||
if (ImGui::Begin("Settings", &m_showPreLaunchSettingsWindow, ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||
if (ImGui::BeginTabBar("Settings")) {
|
||||
if (ImGui::BeginTabItem("Graphics")) {
|
||||
static auto AvailableBackends = aurora::get_available_backends();
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Current backend: {}"), aurora::get_backend_string()));
|
||||
auto desiredBackend = static_cast<int>(aurora::Backend::Invalid);
|
||||
if (auto* cvar = m_cvarMgr.findCVar("graphicsApi")) {
|
||||
bool valid = false;
|
||||
const auto name = cvar->toLiteral(&valid);
|
||||
if (valid) {
|
||||
desiredBackend = static_cast<int>(aurora::backend_from_string(name));
|
||||
}
|
||||
}
|
||||
bool modified = false;
|
||||
modified = ImGui::RadioButton("Auto", &desiredBackend, static_cast<int>(aurora::Backend::Invalid));
|
||||
for (const auto& item : AvailableBackends) {
|
||||
modified = ImGui::RadioButton(magic_enum::enum_name(item).data(), &desiredBackend, static_cast<int>(item)) ||
|
||||
modified;
|
||||
}
|
||||
if (modified) {
|
||||
m_cvarCommons.m_graphicsApi->fromLiteral(
|
||||
aurora::backend_to_string(static_cast<aurora::Backend>(desiredBackend)));
|
||||
}
|
||||
// TODO
|
||||
// static auto AvailableBackends = aurora::get_available_backends();
|
||||
// ImGuiStringViewText(fmt::format(FMT_STRING("Current backend: {}"), aurora::get_backend_string()));
|
||||
// auto desiredBackend = static_cast<int>(aurora::Backend::Invalid);
|
||||
// if (auto* cvar = m_cvarMgr.findCVar("graphicsApi")) {
|
||||
// bool valid = false;
|
||||
// const auto name = cvar->toLiteral(&valid);
|
||||
// if (valid) {
|
||||
// desiredBackend = static_cast<int>(aurora::backend_from_string(name));
|
||||
// }
|
||||
// }
|
||||
// bool modified = false;
|
||||
// modified = ImGui::RadioButton("Auto", &desiredBackend, static_cast<int>(aurora::Backend::Invalid));
|
||||
// for (const auto& item : AvailableBackends) {
|
||||
// modified = ImGui::RadioButton(magic_enum::enum_name(item).data(), &desiredBackend,
|
||||
// static_cast<int>(item)) ||
|
||||
// modified;
|
||||
// }
|
||||
// if (modified) {
|
||||
// m_cvarCommons.m_graphicsApi->fromLiteral(
|
||||
// aurora::backend_to_string(static_cast<aurora::Backend>(desiredBackend)));
|
||||
// }
|
||||
ImGuiCVarCheckbox(m_cvarMgr, "fullscreen", "Fullscreen");
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
|
|
@ -116,8 +116,12 @@ private:
|
|||
bool m_drawLighting = m_cvarCommons.m_debugToolDrawLighting->toBoolean();
|
||||
#if TARGET_OS_IOS
|
||||
bool m_pipelineInfo = false;
|
||||
bool m_drawCallInfo = false;
|
||||
bool m_bufferInfo = false;
|
||||
#else
|
||||
bool m_pipelineInfo = true; // TODO cvar
|
||||
bool m_drawCallInfo = true; // TODO cvar
|
||||
bool m_bufferInfo = true; // TODO cvar
|
||||
#endif
|
||||
bool m_developer = m_cvarMgr.findCVar("developer")->toBoolean();
|
||||
bool m_cheats = m_cvarMgr.findCVar("cheats")->toBoolean();
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
#include "Runtime/ImGuiControllerConfig.hpp"
|
||||
|
||||
#include "Runtime/RetroTypes.hpp"
|
||||
#include "Runtime/Streams/CFileOutStream.hpp"
|
||||
#include "Runtime/Streams/ContainerReaders.hpp"
|
||||
#include "Runtime/Streams/ContainerWriters.hpp"
|
||||
|
||||
#include "aurora/pad.hpp"
|
||||
#include "aurora/aurora.hpp"
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
namespace metaforce {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "Runtime/GCNTypes.hpp"
|
||||
#include "Runtime/Streams/CInputStream.hpp"
|
||||
#include "Runtime/Streams/COutputStream.hpp"
|
||||
#include "aurora/pad.hpp"
|
||||
#include <dolphin/pad.h>
|
||||
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "Runtime/Input/CDolphinController.hpp"
|
||||
|
||||
#include <dolphin/si.h>
|
||||
|
||||
namespace metaforce {
|
||||
CDolphinController::CDolphinController() {
|
||||
static bool sIsInitialized = false;
|
||||
|
@ -31,35 +33,35 @@ float CDolphinController::GetAnalogStickMaxValue(EJoyAxis axis) {
|
|||
void CDolphinController::ReadDevices() {
|
||||
std::array<PADStatus, 4> status{};
|
||||
PADRead(status.data());
|
||||
if (status[0].xa_err == PAD::ERR_NONE) {
|
||||
if (status[0].err == PAD_ERR_NONE) {
|
||||
PADClamp(status.data());
|
||||
x4_status = status;
|
||||
} else {
|
||||
x4_status[0].xa_err = status[0].xa_err;
|
||||
x4_status[1].xa_err = status[1].xa_err;
|
||||
x4_status[2].xa_err = status[2].xa_err;
|
||||
x4_status[3].xa_err = status[3].xa_err;
|
||||
x4_status[0].err = status[0].err;
|
||||
x4_status[1].err = status[1].err;
|
||||
x4_status[2].err = status[2].err;
|
||||
x4_status[3].err = status[3].err;
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < 4; ++i) {
|
||||
if (x4_status[i].xa_err != PAD::ERR_NOT_READY) {
|
||||
if (x4_status[i].xa_err == PAD::ERR_NONE) {
|
||||
if (x4_status[i].err != PAD_ERR_NOT_READY) {
|
||||
if (x4_status[i].err == PAD_ERR_NONE) {
|
||||
x34_gamepadStates[i].SetDeviceIsPresent(true);
|
||||
} else if (x4_status[i].xa_err == PAD::ERR_NO_CONTROLLER) {
|
||||
x1c8_invalidControllers |= PAD::CHAN0_BIT >> i;
|
||||
} else if (x4_status[i].err == PAD_ERR_NO_CONTROLLER) {
|
||||
x1c8_invalidControllers |= PAD_CHAN0_BIT >> i;
|
||||
x34_gamepadStates[i].SetDeviceIsPresent(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (x1b4_controllerTypePollTime[i] == 0) {
|
||||
const auto type = SIProbe(i);
|
||||
if ((type & (SI::ERROR_NO_RESPONSE | SI::ERROR_UNKNOWN | SI::ERROR_BUSY)) == 0) {
|
||||
if ((type & (SI_ERROR_NO_RESPONSE | SI_ERROR_UNKNOWN | SI_ERROR_BUSY)) == 0) {
|
||||
x1b4_controllerTypePollTime[i] = 0x3c;
|
||||
if (type == SI::GC_WIRELESS) {
|
||||
if (type == SI_GC_WIRELESS) {
|
||||
x1a4_controllerTypes[i] = skTypeWavebird;
|
||||
} else if (type == SI::GBA) { /* here for completeness, the GameCube adapter does not support GBA */
|
||||
} else if (type == SI_GBA) { /* here for completeness, the GameCube adapter does not support GBA */
|
||||
x1a4_controllerTypes[i] = skTypeGBA;
|
||||
} else if (type == SI::GC_STANDARD) {
|
||||
} else if (type == SI_GC_STANDARD) {
|
||||
x1a4_controllerTypes[i] = skTypeStandard;
|
||||
}
|
||||
} else {
|
||||
|
@ -94,13 +96,13 @@ void CDolphinController::ProcessAxis(u32 controller, EJoyAxis axis) {
|
|||
|
||||
float axisValue = 0.f;
|
||||
if (axis == EJoyAxis::LeftX) {
|
||||
axisValue = x4_status[controller].x2_stickX;
|
||||
axisValue = x4_status[controller].stickX;
|
||||
} else if (axis == EJoyAxis::LeftY) {
|
||||
axisValue = x4_status[controller].x3_stickY;
|
||||
axisValue = x4_status[controller].stickY;
|
||||
} else if (axis == EJoyAxis::RightX) {
|
||||
axisValue = x4_status[controller].x4_substickX;
|
||||
axisValue = x4_status[controller].substickX;
|
||||
} else if (axis == EJoyAxis::RightY) {
|
||||
axisValue = x4_status[controller].x5_substickY;
|
||||
axisValue = x4_status[controller].substickY;
|
||||
}
|
||||
axisValue *= 1.f / maxAxisValue;
|
||||
float absolute = zeus::clamp(kAbsoluteMinimum, axisValue, kAbsoluteMaximum);
|
||||
|
@ -110,8 +112,8 @@ void CDolphinController::ProcessAxis(u32 controller, EJoyAxis axis) {
|
|||
}
|
||||
|
||||
static constexpr std::array<u16, size_t(EButton::MAX)> mButtonMapping{
|
||||
PAD::BUTTON_A, PAD::BUTTON_B, PAD::BUTTON_X, PAD::BUTTON_Y, PAD::BUTTON_START, PAD::TRIGGER_Z,
|
||||
PAD::BUTTON_UP, PAD::BUTTON_RIGHT, PAD::BUTTON_DOWN, PAD::BUTTON_LEFT, PAD::TRIGGER_L, PAD::TRIGGER_R,
|
||||
PAD_BUTTON_A, PAD_BUTTON_B, PAD_BUTTON_X, PAD_BUTTON_Y, PAD_BUTTON_START, PAD_TRIGGER_Z,
|
||||
PAD_BUTTON_UP, PAD_BUTTON_RIGHT, PAD_BUTTON_DOWN, PAD_BUTTON_LEFT, PAD_TRIGGER_L, PAD_TRIGGER_R,
|
||||
};
|
||||
|
||||
void CDolphinController::ProcessButtons(u32 controller) {
|
||||
|
@ -119,17 +121,19 @@ void CDolphinController::ProcessButtons(u32 controller) {
|
|||
ProcessDigitalButton(controller, x34_gamepadStates[controller].GetButton(EButton(i)), mButtonMapping[i]);
|
||||
}
|
||||
|
||||
ProcessAnalogButton(x4_status[controller].x6_triggerL,
|
||||
ProcessAnalogButton(x4_status[controller].triggerL,
|
||||
x34_gamepadStates[controller].GetAnalogButton(EAnalogButton::Left));
|
||||
ProcessAnalogButton(x4_status[controller].x7_triggerR,
|
||||
ProcessAnalogButton(x4_status[controller].triggerR,
|
||||
x34_gamepadStates[controller].GetAnalogButton(EAnalogButton::Right));
|
||||
}
|
||||
|
||||
void CDolphinController::ProcessDigitalButton(u32 controller, CControllerButton& button, u16 mapping) {
|
||||
bool btnPressed = (x4_status[controller].x0_buttons & mapping) != 0;
|
||||
bool btnPressed = (x4_status[controller].button & mapping) != 0;
|
||||
button.SetPressEvent(PADButtonDown(button.GetIsPressed(), btnPressed));
|
||||
button.SetReleaseEvent(PADButtonUp(button.GetIsPressed(), btnPressed));
|
||||
button.SetIsPressed(btnPressed);
|
||||
}
|
||||
|
||||
void CDolphinController::ProcessAnalogButton(float value, CControllerAxis& axis) {
|
||||
float absolute = value * (1 / 150.f);
|
||||
if (value * (1 / 150.f) > kAbsoluteMaximum) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "Runtime/Input/IController.hpp"
|
||||
|
||||
#include "Runtime/RetroTypes.hpp"
|
||||
|
||||
namespace metaforce {
|
||||
|
||||
|
|
|
@ -56,10 +56,10 @@ CFinalInput::CFinalInput(int cIdx, float dt, const CKeyboardMouseControllerData&
|
|||
, x23_enableAnaRightYP(DRAUp() && !prevInput.DRAUp())
|
||||
, x24_anaLeftTriggerP(DLTrigger() && !prevInput.DLTrigger())
|
||||
, x28_anaRightTriggerP(DRTrigger() && !prevInput.DRTrigger())
|
||||
, x2c_b31_DPUp(data.m_specialKeys[size_t(aurora::SpecialKey::Up)])
|
||||
, x2d_b24_DPRight(data.m_specialKeys[size_t(aurora::SpecialKey::Right)])
|
||||
, x2d_b25_DPDown(data.m_specialKeys[size_t(aurora::SpecialKey::Down)])
|
||||
, x2d_b26_DPLeft(data.m_specialKeys[size_t(aurora::SpecialKey::Left)])
|
||||
, x2c_b31_DPUp(data.m_specialKeys[size_t(ESpecialKey::Up)])
|
||||
, x2d_b24_DPRight(data.m_specialKeys[size_t(ESpecialKey::Right)])
|
||||
, x2d_b25_DPDown(data.m_specialKeys[size_t(ESpecialKey::Down)])
|
||||
, x2d_b26_DPLeft(data.m_specialKeys[size_t(ESpecialKey::Left)])
|
||||
, x2d_b28_PA(DA() && !prevInput.DA())
|
||||
, x2d_b29_PB(DB() && !prevInput.DB())
|
||||
, x2d_b30_PX(DX() && !prevInput.DX())
|
||||
|
@ -316,11 +316,11 @@ static void pad_clamptrigger(int16_t& trigger) {
|
|||
}
|
||||
|
||||
void SAuroraControllerState::clamp() {
|
||||
pad_clampstick(m_axes[size_t(aurora::ControllerAxis::LeftX)], m_axes[size_t(aurora::ControllerAxis::LeftY)],
|
||||
pad_clampstick(m_axes[size_t(EControllerAxis::LeftX)], m_axes[size_t(EControllerAxis::LeftY)],
|
||||
pad_clampregion[3], pad_clampregion[4], pad_clampregion[2]);
|
||||
pad_clampstick(m_axes[size_t(aurora::ControllerAxis::RightX)], m_axes[size_t(aurora::ControllerAxis::RightY)],
|
||||
pad_clampstick(m_axes[size_t(EControllerAxis::RightX)], m_axes[size_t(EControllerAxis::RightY)],
|
||||
pad_clampregion[6], pad_clampregion[7], pad_clampregion[5]);
|
||||
pad_clamptrigger(m_axes[size_t(aurora::ControllerAxis::TriggerLeft)]);
|
||||
pad_clamptrigger(m_axes[size_t(aurora::ControllerAxis::TriggerRight)]);
|
||||
pad_clamptrigger(m_axes[size_t(EControllerAxis::TriggerLeft)]);
|
||||
pad_clamptrigger(m_axes[size_t(EControllerAxis::TriggerRight)]);
|
||||
}
|
||||
} // namespace metaforce
|
||||
|
|
|
@ -12,8 +12,8 @@ struct SAuroraControllerState {
|
|||
u32 m_which = -1;
|
||||
bool m_isGamecube = false;
|
||||
bool m_hasRumble = false;
|
||||
std::array<int16_t, size_t(aurora::ControllerAxis::MAX)> m_axes{};
|
||||
std::bitset<size_t(aurora::ControllerButton::MAX)> m_btns{};
|
||||
std::array<int16_t, size_t(EControllerAxis::MAX)> m_axes{};
|
||||
std::bitset<size_t(EControllerButton::MAX)> m_btns{};
|
||||
|
||||
SAuroraControllerState() = default;
|
||||
SAuroraControllerState(uint32_t which, bool isGamecube, bool hasRumble)
|
||||
|
@ -68,7 +68,7 @@ struct CFinalInput {
|
|||
std::optional<CKeyboardMouseControllerData> m_kbm;
|
||||
|
||||
std::array<bool, 256> m_PCharKeys{};
|
||||
std::array<bool, size_t(aurora::SpecialKey::MAX)> m_PSpecialKeys{};
|
||||
std::array<bool, size_t(ESpecialKey::MAX)> m_PSpecialKeys{};
|
||||
std::array<bool, 6> m_PMouseButtons{};
|
||||
|
||||
|
||||
|
@ -162,13 +162,13 @@ struct CFinalInput {
|
|||
void InitializeAnalog(float leftDiv, float rightDiv);
|
||||
|
||||
bool PKey(char k) const { return m_kbm && m_PCharKeys[size_t(k)]; }
|
||||
bool PSpecialKey(aurora::SpecialKey k) const { return m_kbm && m_PSpecialKeys[size_t(k)]; }
|
||||
bool PSpecialKey(ESpecialKey k) const { return m_kbm && m_PSpecialKeys[size_t(k)]; }
|
||||
bool PMouseButton(EMouseButton k) const { return m_kbm && m_PMouseButtons[size_t(k)]; }
|
||||
bool DKey(char k) const { return m_kbm && m_kbm->m_charKeys[size_t(k)]; }
|
||||
bool DSpecialKey(aurora::SpecialKey k) const { return m_kbm && m_kbm->m_specialKeys[size_t(k)]; }
|
||||
bool DSpecialKey(ESpecialKey k) const { return m_kbm && m_kbm->m_specialKeys[size_t(k)]; }
|
||||
bool DMouseButton(EMouseButton k) const { return m_kbm && m_kbm->m_mouseButtons[size_t(k)]; }
|
||||
float AKey(char k) const { return DKey(k) ? 1.f : 0.f; }
|
||||
float ASpecialKey(aurora::SpecialKey k) const { return DSpecialKey(k) ? 1.f : 0.f; }
|
||||
float ASpecialKey(ESpecialKey k) const { return DSpecialKey(k) ? 1.f : 0.f; }
|
||||
float AMouseButton(EMouseButton k) const { return DMouseButton(k) ? 1.f : 0.f; }
|
||||
|
||||
const std::optional<CKeyboardMouseControllerData>& GetKBM() const { return m_kbm; }
|
||||
|
|
|
@ -69,7 +69,7 @@ void CInputGenerator::controllerRemoved(uint32_t which) noexcept {
|
|||
(*it) = SAuroraControllerState();
|
||||
}
|
||||
|
||||
void CInputGenerator::controllerButton(uint32_t which, aurora::ControllerButton button, bool pressed) noexcept {
|
||||
void CInputGenerator::controllerButton(uint32_t which, EControllerButton button, bool pressed) noexcept {
|
||||
s32 player = aurora::get_controller_player_index(which);
|
||||
if (player < 0) {
|
||||
return;
|
||||
|
@ -77,24 +77,24 @@ void CInputGenerator::controllerButton(uint32_t which, aurora::ControllerButton
|
|||
m_state[player].m_btns.set(size_t(button), pressed);
|
||||
}
|
||||
|
||||
void CInputGenerator::controllerAxis(uint32_t which, aurora::ControllerAxis axis, int16_t value) noexcept {
|
||||
void CInputGenerator::controllerAxis(uint32_t which, EControllerAxis axis, int16_t value) noexcept {
|
||||
s32 player = aurora::get_controller_player_index(which);
|
||||
if (player < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (axis) {
|
||||
case aurora::ControllerAxis::LeftY:
|
||||
case aurora::ControllerAxis::RightY:
|
||||
case EControllerAxis::LeftY:
|
||||
case EControllerAxis::RightY:
|
||||
/* Value is inverted compared to what we expect on the Y axis */
|
||||
value = int16_t(-(value + 1));
|
||||
[[fallthrough]];
|
||||
case aurora::ControllerAxis::LeftX:
|
||||
case aurora::ControllerAxis::RightX:
|
||||
case EControllerAxis::LeftX:
|
||||
case EControllerAxis::RightX:
|
||||
value /= int16_t(256);
|
||||
break;
|
||||
case aurora::ControllerAxis::TriggerLeft:
|
||||
case aurora::ControllerAxis::TriggerRight:
|
||||
case EControllerAxis::TriggerLeft:
|
||||
case EControllerAxis::TriggerRight:
|
||||
value /= int16_t(128);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -42,9 +42,9 @@ public:
|
|||
|
||||
void controllerRemoved(uint32_t which) noexcept;
|
||||
|
||||
void controllerButton(uint32_t which, aurora::ControllerButton button, bool pressed) noexcept;
|
||||
void controllerButton(uint32_t which, EControllerButton button, bool pressed) noexcept;
|
||||
|
||||
void controllerAxis(uint32_t which, aurora::ControllerAxis axis, int16_t value) noexcept;
|
||||
void controllerAxis(uint32_t which, EControllerAxis axis, int16_t value) noexcept;
|
||||
|
||||
|
||||
/* Keyboard and mouse events are delivered on the main game
|
||||
|
@ -74,8 +74,8 @@ public:
|
|||
return;
|
||||
m_data.m_charKeys[charCode] = false;
|
||||
}
|
||||
void specialKeyDown(aurora::SpecialKey key, aurora::ModifierKey, bool) { m_data.m_specialKeys[size_t(key)] = true; }
|
||||
void specialKeyUp(aurora::SpecialKey key, aurora::ModifierKey) { m_data.m_specialKeys[size_t(key)] = false; }
|
||||
void specialKeyDown(ESpecialKey key, aurora::ModifierKey, bool) { m_data.m_specialKeys[size_t(key)] = true; }
|
||||
void specialKeyUp(ESpecialKey key, aurora::ModifierKey) { m_data.m_specialKeys[size_t(key)] = false; }
|
||||
void modKeyDown(aurora::ModifierKey mod, bool) { m_data.m_modMask = m_data.m_modMask | mod; }
|
||||
void modKeyUp(aurora::ModifierKey mod) { m_data.m_modMask = m_data.m_modMask & ~mod; }
|
||||
|
||||
|
|
|
@ -2,12 +2,119 @@
|
|||
|
||||
#include <array>
|
||||
|
||||
#include <aurora/aurora.hpp>
|
||||
#include <aurora/aurora.h>
|
||||
#include "GCNTypes.hpp"
|
||||
|
||||
namespace metaforce {
|
||||
|
||||
// TODO: copied from boo; should be rewritten and included from from aurora
|
||||
// TODO: copied from boo; should be rewritten
|
||||
enum class EControllerButton : uint8_t {
|
||||
A,
|
||||
B,
|
||||
X,
|
||||
Y,
|
||||
Back,
|
||||
Guide,
|
||||
Start,
|
||||
LeftStick,
|
||||
RightStick,
|
||||
LeftShoulder,
|
||||
RightShoulder,
|
||||
DPadUp,
|
||||
DPadDown,
|
||||
DPadLeft,
|
||||
DPadRight,
|
||||
Other,
|
||||
MAX,
|
||||
};
|
||||
enum class EControllerAxis : uint8_t {
|
||||
LeftX,
|
||||
LeftY,
|
||||
RightX,
|
||||
RightY,
|
||||
TriggerLeft,
|
||||
TriggerRight,
|
||||
MAX,
|
||||
};
|
||||
enum class EMouseButton { None = 0, Primary = 1, Secondary = 2, Middle = 3, Aux1 = 4, Aux2 = 5 };
|
||||
enum class ESpecialKey : uint8_t {
|
||||
None = 0,
|
||||
F1 = 1,
|
||||
F2 = 2,
|
||||
F3 = 3,
|
||||
F4 = 4,
|
||||
F5 = 5,
|
||||
F6 = 6,
|
||||
F7 = 7,
|
||||
F8 = 8,
|
||||
F9 = 9,
|
||||
F10 = 10,
|
||||
F11 = 11,
|
||||
F12 = 12,
|
||||
F13 = 13,
|
||||
F14 = 14,
|
||||
F15 = 15,
|
||||
F16 = 16,
|
||||
F17 = 17,
|
||||
F18 = 18,
|
||||
F19 = 19,
|
||||
F20 = 20,
|
||||
F21 = 21,
|
||||
F22 = 22,
|
||||
F23 = 23,
|
||||
F24 = 24,
|
||||
Esc = 25,
|
||||
Enter = 26,
|
||||
Backspace = 27,
|
||||
Insert = 28,
|
||||
Delete = 29,
|
||||
Home = 30,
|
||||
End = 31,
|
||||
PgUp = 32,
|
||||
PgDown = 33,
|
||||
Left = 34,
|
||||
Right = 35,
|
||||
Up = 36,
|
||||
Down = 37,
|
||||
Tab = 38,
|
||||
PrintScreen = 39,
|
||||
ScrollLock = 40,
|
||||
Pause = 41,
|
||||
NumLockClear = 42,
|
||||
KpDivide = 43,
|
||||
KpMultiply = 44,
|
||||
KpMinus = 45,
|
||||
KpPlus = 46,
|
||||
KpEnter = 47,
|
||||
KpNum0 = 48,
|
||||
KpNum1 = 49,
|
||||
KpNum2 = 50,
|
||||
KpNum3 = 51,
|
||||
KpNum4 = 52,
|
||||
KpNum5 = 53,
|
||||
KpNum6 = 54,
|
||||
KpNum7 = 55,
|
||||
KpNum8 = 56,
|
||||
KpNum9 = 57,
|
||||
KpPercent = 58,
|
||||
KpPeriod = 59,
|
||||
KpComma = 60,
|
||||
KpEquals = 61,
|
||||
Application = 62,
|
||||
Power = 63,
|
||||
Execute = 64,
|
||||
Help = 65,
|
||||
Menu = 66,
|
||||
Select = 67,
|
||||
Stop = 68,
|
||||
Again = 69,
|
||||
Undo = 70,
|
||||
Cut = 71,
|
||||
Paste = 72,
|
||||
Find = 73,
|
||||
VolumeUp = 74,
|
||||
VolumeDown = 75,
|
||||
MAX,
|
||||
};
|
||||
enum class EModifierKey {
|
||||
None = 0,
|
||||
Ctrl = 1 << 0,
|
||||
|
@ -56,9 +163,9 @@ struct SScrollDelta {
|
|||
|
||||
struct CKeyboardMouseControllerData {
|
||||
std::array<bool, 256> m_charKeys{};
|
||||
std::array<bool, static_cast<size_t>(aurora::SpecialKey::MAX)> m_specialKeys{};
|
||||
std::array<bool, static_cast<size_t>(ESpecialKey::MAX)> m_specialKeys{};
|
||||
std::array<bool, 6> m_mouseButtons{};
|
||||
aurora::ModifierKey m_modMask = aurora::ModifierKey::None;
|
||||
EModifierKey m_modMask = EModifierKey::None;
|
||||
SWindowCoord m_mouseCoord;
|
||||
SScrollDelta m_accumScroll;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
set(INPUT_SOURCES
|
||||
PAD.hpp
|
||||
IController.hpp DolphinIController.cpp
|
||||
CControllerAxis.hpp
|
||||
CControllerButton.hpp
|
||||
|
|
|
@ -187,18 +187,18 @@ constexpr std::array<ControlMapper::EKBMFunctionList, 70> skKBMMapping{
|
|||
ControlMapper::EKBMFunctionList::KeyPress + 'w', // MapCircleDown,
|
||||
ControlMapper::EKBMFunctionList::KeyPress + 'a', // MapCircleLeft,
|
||||
ControlMapper::EKBMFunctionList::KeyPress + 'd', // MapCircleRight,
|
||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + aurora::SpecialKey::Up, // MapMoveForward,
|
||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + aurora::SpecialKey::Down, // MapMoveBack,
|
||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + aurora::SpecialKey::Left, // MapMoveLeft,
|
||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + aurora::SpecialKey::Right, // MapMoveRight,
|
||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + ESpecialKey::Up, // MapMoveForward,
|
||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + ESpecialKey::Down, // MapMoveBack,
|
||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + ESpecialKey::Left, // MapMoveLeft,
|
||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + ESpecialKey::Right, // MapMoveRight,
|
||||
ControlMapper::EKBMFunctionList::KeyPress + 'e', // MapZoomIn,
|
||||
ControlMapper::EKBMFunctionList::KeyPress + 'q', // MapZoomOut,
|
||||
ControlMapper::EKBMFunctionList::KeyPress + 'e', // SpiderBall,
|
||||
ControlMapper::EKBMFunctionList::KeyPress + 'q', // ChaseCamera,
|
||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + aurora::SpecialKey::Right, // XrayVisor = 50,
|
||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + aurora::SpecialKey::Down, // ThermoVisor = 51,
|
||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + aurora::SpecialKey::Left, // InviroVisor = 52,
|
||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + aurora::SpecialKey::Up, // NoVisor = 53,
|
||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + ESpecialKey::Right, // XrayVisor = 50,
|
||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + ESpecialKey::Down, // ThermoVisor = 51,
|
||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + ESpecialKey::Left, // InviroVisor = 52,
|
||||
ControlMapper::EKBMFunctionList::SpecialKeyPress + ESpecialKey::Up, // NoVisor = 53,
|
||||
ControlMapper::EKBMFunctionList::None, // VisorMenu,
|
||||
ControlMapper::EKBMFunctionList::None, // VisorUp,
|
||||
ControlMapper::EKBMFunctionList::None, // VisorDown,
|
||||
|
@ -307,10 +307,10 @@ static float KBToWASDY(const CKeyboardMouseControllerData& data) {
|
|||
|
||||
static float KBToArrowsX(const CKeyboardMouseControllerData& data) {
|
||||
float retval = 0.0;
|
||||
if (data.m_specialKeys[size_t(aurora::SpecialKey::Left)]) {
|
||||
if (data.m_specialKeys[size_t(ESpecialKey::Left)]) {
|
||||
retval -= 1.0;
|
||||
}
|
||||
if (data.m_specialKeys[size_t(aurora::SpecialKey::Right)]) {
|
||||
if (data.m_specialKeys[size_t(ESpecialKey::Right)]) {
|
||||
retval += 1.0;
|
||||
}
|
||||
return retval;
|
||||
|
@ -318,10 +318,10 @@ static float KBToArrowsX(const CKeyboardMouseControllerData& data) {
|
|||
|
||||
static float KBToArrowsY(const CKeyboardMouseControllerData& data) {
|
||||
float retval = 0.0;
|
||||
if (data.m_specialKeys[size_t(aurora::SpecialKey::Down)]) {
|
||||
if (data.m_specialKeys[size_t(ESpecialKey::Down)]) {
|
||||
retval -= 1.0;
|
||||
}
|
||||
if (data.m_specialKeys[size_t(aurora::SpecialKey::Up)]) {
|
||||
if (data.m_specialKeys[size_t(ESpecialKey::Up)]) {
|
||||
retval += 1.0;
|
||||
}
|
||||
return retval;
|
||||
|
|
|
@ -126,7 +126,7 @@ constexpr ControlMapper::EKBMFunctionList operator+(ControlMapper::EKBMFunctionL
|
|||
return ControlMapper::EKBMFunctionList(static_cast<T>(a) + static_cast<T>(b));
|
||||
}
|
||||
|
||||
constexpr ControlMapper::EKBMFunctionList operator+(ControlMapper::EKBMFunctionList a, aurora::SpecialKey b) {
|
||||
constexpr ControlMapper::EKBMFunctionList operator+(ControlMapper::EKBMFunctionList a, ESpecialKey b) {
|
||||
using T = std::underlying_type_t<ControlMapper::EKBMFunctionList>;
|
||||
return ControlMapper::EKBMFunctionList(static_cast<T>(a) + static_cast<T>(b));
|
||||
}
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
#pragma once
|
||||
#include "Runtime/Input/PAD.hpp"
|
||||
|
||||
#include <dolphin/pad.h>
|
||||
|
||||
namespace metaforce {
|
||||
enum class EIOPort {
|
||||
Player1,
|
||||
Player2,
|
||||
Player3,
|
||||
Player4,
|
||||
Player1 = PAD_CHAN0,
|
||||
Player2 = PAD_CHAN1,
|
||||
Player3 = PAD_CHAN2,
|
||||
Player4 = PAD_CHAN3,
|
||||
};
|
||||
|
||||
enum class EMotorState {
|
||||
Stop = 0,
|
||||
Rumble = 1,
|
||||
StopHard = 2,
|
||||
Stop = PAD_MOTOR_STOP,
|
||||
Rumble = PAD_MOTOR_RUMBLE,
|
||||
StopHard = PAD_MOTOR_STOP_HARD,
|
||||
};
|
||||
} // namespace metaforce
|
|
@ -1,6 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "aurora/pad.hpp"
|
||||
|
||||
using PADStatus = PAD::Status;
|
||||
using PADButton = PAD::BUTTON;
|
|
@ -782,10 +782,10 @@ CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::ProcessUserInput(const CFinalInpu
|
|||
case EUIType::LinkFailed:
|
||||
case EUIType::LinkCompleteOrLinking:
|
||||
case EUIType::TurnOffGBA:
|
||||
if (input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary)) {
|
||||
if (input.PA() || input.PSpecialKey(ESpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary)) {
|
||||
PlayAdvanceSfx();
|
||||
SetUIText(NextLinkUI[size_t(x0_uiType)]);
|
||||
} else if (input.PB() || input.PSpecialKey(aurora::SpecialKey::Esc)) {
|
||||
} else if (input.PB() || input.PSpecialKey(ESpecialKey::Esc)) {
|
||||
const EUIType prevUi = PrevLinkUI[size_t(x0_uiType)];
|
||||
if (prevUi == EUIType::Empty) {
|
||||
break;
|
||||
|
@ -981,7 +981,7 @@ CFrontEndUI::SFusionBonusFrame::EAction CFrontEndUI::SFusionBonusFrame::ProcessU
|
|||
}
|
||||
} else if (x24_loadedFrame) {
|
||||
CFinalInput useInput = input;
|
||||
if (input.PZ() || input.PSpecialKey(aurora::SpecialKey::Tab)) {
|
||||
if (input.PZ() || input.PSpecialKey(ESpecialKey::Tab)) {
|
||||
useInput.x2d_b28_PA = true;
|
||||
m_gbaOverride = true;
|
||||
}
|
||||
|
@ -1238,7 +1238,7 @@ void CFrontEndUI::SNesEmulatorFrame::ProcessUserInput(const CFinalInput& input,
|
|||
switch (x0_mode) {
|
||||
case EMode::Emulator:
|
||||
x4_nesEmu->ProcessUserInput(input, 4);
|
||||
if ((input.ControllerIdx() == 0 && input.PL()) || input.PSpecialKey(aurora::SpecialKey::Esc))
|
||||
if ((input.ControllerIdx() == 0 && input.PL()) || input.PSpecialKey(ESpecialKey::Esc))
|
||||
SetMode(EMode::QuitNESMetroid);
|
||||
break;
|
||||
case EMode::SaveProgress:
|
||||
|
@ -1577,7 +1577,7 @@ bool CFrontEndUI::SOptionsFrontEndFrame::ProcessUserInput(const CFinalInput& inp
|
|||
if (sui)
|
||||
sui->ProcessUserInput(input);
|
||||
if (x1c_loadedFrame && x134_24_visible) {
|
||||
if ((input.PB() || input.PSpecialKey(aurora::SpecialKey::Esc)) && x24_tablegroup_leftmenu->GetIsActive()) {
|
||||
if ((input.PB() || input.PSpecialKey(ESpecialKey::Esc)) && x24_tablegroup_leftmenu->GetIsActive()) {
|
||||
x134_25_exitOptions = true;
|
||||
CSfxManager::SfxStart(SFXfnt_back, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||
} else {
|
||||
|
@ -1966,16 +1966,16 @@ void CFrontEndUI::ProcessUserInput(const CFinalInput& input, CArchitectureQueue&
|
|||
|
||||
if (x50_curScreen != x54_nextScreen) {
|
||||
if (x54_nextScreen == EScreen::AttractMovie &&
|
||||
(input.PStart() || input.PA() || input.PSpecialKey(aurora::SpecialKey::Esc) ||
|
||||
input.PSpecialKey(aurora::SpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary))) {
|
||||
(input.PStart() || input.PA() || input.PSpecialKey(ESpecialKey::Esc) ||
|
||||
input.PSpecialKey(ESpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary))) {
|
||||
/* Player wants to return to opening credits from attract movie */
|
||||
SetFadeBlackTimer(std::min(1.f, x58_fadeBlackTimer));
|
||||
PlayAdvanceSfx();
|
||||
return;
|
||||
}
|
||||
|
||||
if (input.PA() || input.PStart() || input.PSpecialKey(aurora::SpecialKey::Esc) ||
|
||||
input.PSpecialKey(aurora::SpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary)) {
|
||||
if (input.PA() || input.PStart() || input.PSpecialKey(ESpecialKey::Esc) ||
|
||||
input.PSpecialKey(ESpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary)) {
|
||||
if (x50_curScreen == EScreen::OpenCredits && x54_nextScreen == EScreen::Title && x58_fadeBlackTimer > 1.f) {
|
||||
/* Player is too impatient to view opening credits */
|
||||
xd0_playerSkipToTitle = true;
|
||||
|
@ -1985,8 +1985,8 @@ void CFrontEndUI::ProcessUserInput(const CFinalInput& input, CArchitectureQueue&
|
|||
}
|
||||
} else {
|
||||
if (x50_curScreen == EScreen::Title) {
|
||||
if (input.PStart() || input.PA() || input.PSpecialKey(aurora::SpecialKey::Esc) ||
|
||||
input.PSpecialKey(aurora::SpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary)) {
|
||||
if (input.PStart() || input.PA() || input.PSpecialKey(ESpecialKey::Esc) ||
|
||||
input.PSpecialKey(ESpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary)) {
|
||||
if (x58_fadeBlackTimer < 30.f - g_tweakGame->GetPressStartDelay()) {
|
||||
/* Proceed to file select UI */
|
||||
CSfxManager::SfxStart(FETransitionBackSFX[x18_rndA][0], 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||
|
|
|
@ -596,7 +596,7 @@ void CInGameGuiManager::Draw(CStateManager& stateMgr) {
|
|||
float xT = 1.f - zeus::clamp(0.f, (stateMgr.GetPlayer().GetDeathTime() - xStart) / 0.5f, 1.f);
|
||||
float colT = 1.f - zeus::clamp(0.f, (stateMgr.GetPlayer().GetDeathTime() - colStart) / 0.5f, 1.f);
|
||||
SClipScreenRect rect(CGraphics::g_Viewport);
|
||||
CGraphics::ResolveSpareTexture(rect, 0, GX::TF_RGB565);
|
||||
CGraphics::ResolveSpareTexture(rect, 0, GX_TF_RGB565);
|
||||
CCameraFilterPass::DrawFilter(EFilterType::Blend, EFilterShape::Fullscreen, zeus::skBlack, nullptr, 1.f);
|
||||
float z = 0.5f * (zT * zT * zT * zT * zT * (CGraphics::GetViewportHeight() - 12.f) + 12.f);
|
||||
float x = 0.5f * (xT * (CGraphics::GetViewportWidth() - 12.f) + 12.f);
|
||||
|
|
|
@ -141,7 +141,7 @@ void CInventoryScreen::ProcessControllerInput(const CFinalInput& input) {
|
|||
if (input.PStart()) {
|
||||
x19c_samusDoll->BeginViewInterpolate(false);
|
||||
x198_26_exitPauseScreen = true;
|
||||
} else if (input.PB() || input.PSpecialKey(aurora::SpecialKey::Esc)) {
|
||||
} else if (input.PB() || input.PSpecialKey(ESpecialKey::Esc)) {
|
||||
x19c_samusDoll->BeginViewInterpolate(false);
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ void CInventoryScreen::ProcessControllerInput(const CFinalInput& input) {
|
|||
if (input.PLAUp() || m_bodyUpClicked)
|
||||
newPage = std::max(oldPage - 1, 0);
|
||||
else if (input.PLADown() || m_bodyDownClicked ||
|
||||
((input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter) || m_bodyClicked) && !lastPage))
|
||||
((input.PA() || input.PSpecialKey(ESpecialKey::Enter) || m_bodyClicked) && !lastPage))
|
||||
newPage = std::min(oldPage + 1, totalCount - 1);
|
||||
x174_textpane_body->TextSupport().SetPage(newPage);
|
||||
if (oldPage != newPage)
|
||||
|
@ -233,8 +233,8 @@ void CInventoryScreen::ProcessControllerInput(const CFinalInput& input) {
|
|||
}
|
||||
if (!x1ac_textLeaveRequested)
|
||||
x1ac_textLeaveRequested =
|
||||
input.PB() || input.PSpecialKey(aurora::SpecialKey::Esc) ||
|
||||
((input.PA() || m_bodyClicked || input.PSpecialKey(aurora::SpecialKey::Enter)) && lastPage);
|
||||
input.PB() || input.PSpecialKey(ESpecialKey::Esc) ||
|
||||
((input.PA() || m_bodyClicked || input.PSpecialKey(ESpecialKey::Enter)) && lastPage);
|
||||
x1ad_textViewing = !x1ac_textLeaveRequested;
|
||||
} else {
|
||||
x198_29_pulseTextArrowBottom = false;
|
||||
|
|
|
@ -338,7 +338,7 @@ void CLogBookScreen::ProcessControllerInput(const CFinalInput& input) {
|
|||
if (input.PLAUp() || m_bodyUpClicked)
|
||||
newPage = std::max(oldPage - 1, 0);
|
||||
else if (input.PLADown() || m_bodyDownClicked ||
|
||||
((input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter) || m_bodyClicked) && !lastPage))
|
||||
((input.PA() || input.PSpecialKey(ESpecialKey::Enter) || m_bodyClicked) && !lastPage))
|
||||
newPage = std::min(oldPage + 1, pageCount - 1);
|
||||
x174_textpane_body->TextSupport().SetPage(newPage);
|
||||
if (oldPage != newPage)
|
||||
|
@ -352,8 +352,8 @@ void CLogBookScreen::ProcessControllerInput(const CFinalInput& input) {
|
|||
|
||||
if (!x260_26_exitTextScroll)
|
||||
x260_26_exitTextScroll =
|
||||
input.PB() || input.PSpecialKey(aurora::SpecialKey::Esc) ||
|
||||
((input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter) || m_bodyClicked) && lastPage);
|
||||
input.PB() || input.PSpecialKey(ESpecialKey::Esc) ||
|
||||
((input.PA() || input.PSpecialKey(ESpecialKey::Enter) || m_bodyClicked) && lastPage);
|
||||
|
||||
if (g_tweakGui->GetLatchArticleText())
|
||||
x260_25_inTextScroll = !x260_26_exitTextScroll;
|
||||
|
|
|
@ -125,7 +125,7 @@ CIOWin::EMessageReturn CMFGame::OnMessage(const CArchitectureMessage& msg, CArch
|
|||
if (input.ControllerIdx() == 0) {
|
||||
const CEntity* cam = x14_stateManager->GetCameraManager()->GetCurrentCamera(*x14_stateManager);
|
||||
TCastToConstPtr<CCinematicCamera> cineCam = cam;
|
||||
if (input.PStart() || input.PSpecialKey(aurora::SpecialKey::Esc)) {
|
||||
if (input.PStart() || input.PSpecialKey(ESpecialKey::Esc)) {
|
||||
if (cineCam && x14_stateManager->GetSkipCinematicSpecialFunction() != kInvalidUniqueId) {
|
||||
CMidiManager::StopAll();
|
||||
x28_skippedCineCam = cineCam->GetUniqueId();
|
||||
|
@ -134,7 +134,7 @@ CIOWin::EMessageReturn CMFGame::OnMessage(const CArchitectureMessage& msg, CArch
|
|||
} else if (!cineCam) {
|
||||
x14_stateManager->DeferStateTransition(EStateManagerTransition::PauseGame);
|
||||
}
|
||||
} else if ((input.PZ() || input.PSpecialKey(aurora::SpecialKey::Tab)) && !cineCam &&
|
||||
} else if ((input.PZ() || input.PSpecialKey(ESpecialKey::Tab)) && !cineCam &&
|
||||
x14_stateManager->CanShowMapScreen()) {
|
||||
x14_stateManager->DeferStateTransition(EStateManagerTransition::MapScreen);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ CMessageScreen::CMessageScreen(CAssetId msg, float delayTime) : x74_delayTime(de
|
|||
|
||||
void CMessageScreen::ProcessControllerInput(const CFinalInput& input) {
|
||||
if (!x18_loadedMsgScreen || x74_delayTime > 0.f ||
|
||||
!(input.PA() || input.PSpecialKey(aurora::SpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary)))
|
||||
!(input.PA() || input.PSpecialKey(ESpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary)))
|
||||
return;
|
||||
|
||||
if (x1c_textpane_message->TextSupport().GetCurTime() < x1c_textpane_message->TextSupport().GetTotalAnimationTime()) {
|
||||
|
|
|
@ -153,7 +153,7 @@ void COptionsScreen::ProcessControllerInput(const CFinalInput& input) {
|
|||
CGameOptions::TryRestoreDefaults(input, x70_tablegroup_leftlog->GetUserSelection(), x1c_rightSel, false,
|
||||
rightClicked);
|
||||
if (x70_tablegroup_leftlog->GetUserSelection() == 4 &&
|
||||
(input.PA() || leftClicked || input.PSpecialKey(aurora::SpecialKey::Enter)))
|
||||
(input.PA() || leftClicked || input.PSpecialKey(ESpecialKey::Enter)))
|
||||
x19c_quitGame = std::make_unique<CQuitGameScreen>(EQuitType::QuitGame);
|
||||
} else {
|
||||
CPauseScreenBase::ResetMouseState();
|
||||
|
|
|
@ -202,7 +202,7 @@ void CPauseScreen::ProcessControllerInput(const CStateManager& mgr, const CFinal
|
|||
|
||||
if (InputEnabled()) {
|
||||
bool invalid = x8_curSubscreen == ESubScreen::ToGame;
|
||||
if (useInput.PStart() || ((useInput.PB() || useInput.PSpecialKey(aurora::SpecialKey::Esc)) && bExits) ||
|
||||
if (useInput.PStart() || ((useInput.PB() || useInput.PSpecialKey(ESpecialKey::Esc)) && bExits) ||
|
||||
(x7c_screens[x78_activeIdx] && x7c_screens[x78_activeIdx]->ShouldExitPauseScreen())) {
|
||||
CSfxManager::SfxStart(SFXui_pause_screen_exit, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||
StartTransition(0.5f, mgr, ESubScreen::ToGame, 2);
|
||||
|
|
|
@ -353,7 +353,7 @@ void CPlayerVisor::DrawScanEffect(const CStateManager& mgr, CTargetingManager* t
|
|||
rect.x8_top = int((CGraphics::GetViewportHeight() - vpH) / 2.f);
|
||||
rect.xc_width = int(vpW);
|
||||
rect.x10_height = int(vpH);
|
||||
CGraphics::ResolveSpareTexture(rect, 0, GX::TF_RGB565);
|
||||
CGraphics::ResolveSpareTexture(rect, 0, GX_TF_RGB565);
|
||||
|
||||
{
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP("x64_scanDim Draw", zeus::skMagenta);
|
||||
|
@ -366,7 +366,7 @@ void CPlayerVisor::DrawScanEffect(const CStateManager& mgr, CTargetingManager* t
|
|||
const zeus::CTransform seventeenScale = zeus::CTransform::Scale(17.f * vpScale, 1.f, 17.f * vpScale);
|
||||
const zeus::CTransform mm = seventeenScale * windowScale;
|
||||
g_Renderer->SetModelMatrix(mm);
|
||||
CGraphics::LoadDolphinSpareTexture(0, GX::TF_RGB565, GX::TEXMAP0);
|
||||
CGraphics::LoadDolphinSpareTexture(0, GX_TF_RGB565, GX_TEXMAP0);
|
||||
|
||||
if (x108_newScanPane) {
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP("x108_newScanPane Draw", zeus::skMagenta);
|
||||
|
|
|
@ -106,7 +106,7 @@ void CQuitGameScreen::ProcessUserInput(const CFinalInput& input) {
|
|||
x10_loadedFrame->ProcessMouseInput(
|
||||
input, CGuiWidgetDrawParms{1.f, zeus::CVector3f{0.f, 0.f, VerticalOffsets[size_t(x0_type)]}});
|
||||
x10_loadedFrame->ProcessUserInput(input);
|
||||
if ((input.PB() || input.PSpecialKey(aurora::SpecialKey::Esc)) && x0_type != EQuitType::ContinueFromLastSave) {
|
||||
if ((input.PB() || input.PSpecialKey(ESpecialKey::Esc)) && x0_type != EQuitType::ContinueFromLastSave) {
|
||||
x18_action = EQuitAction::No;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -332,7 +332,7 @@ void CSamusDoll::Draw(const CStateManager& mgr, float alpha) {
|
|||
|
||||
bool phazonSuit = x44_suit == CPlayerState::EPlayerSuit::Phazon;
|
||||
if (phazonSuit) {
|
||||
GXSetDstAlpha(true, 1.f);
|
||||
GXSetDstAlpha(true, 255);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i <= x118_suitModel1and2.size(); ++i) {
|
||||
|
|
|
@ -222,18 +222,6 @@ CGameArchitectureSupport::~CGameArchitectureSupport() {
|
|||
CStreamAudioManager::Shutdown();
|
||||
}
|
||||
|
||||
void CGameArchitectureSupport::charKeyDown(uint8_t charCode, aurora::ModifierKey mods, bool isRepeat) {
|
||||
// x30_inputGenerator.charKeyDown(charCode, mods, isRepeat);
|
||||
}
|
||||
|
||||
void CGameArchitectureSupport::specialKeyDown(aurora::SpecialKey key, aurora::ModifierKey mods, bool isRepeat) {
|
||||
// x30_inputGenerator.specialKeyDown(key, mods, isRepeat);
|
||||
}
|
||||
|
||||
void CGameArchitectureSupport::specialKeyUp(aurora::SpecialKey key, aurora::ModifierKey mods) {
|
||||
// x30_inputGenerator.specialKeyUp(key, mods);
|
||||
}
|
||||
|
||||
CMain::CMain(IFactory* resFactory, CSimplePool* resStore)
|
||||
: xe4_gameplayResult(EGameplayResult::Playing)
|
||||
, x128_globalObjects(std::make_unique<CGameGlobalObjects>(resFactory, resStore)) {
|
||||
|
@ -518,8 +506,8 @@ void CMain::HandleDiscordErrored(int errorCode, const char* message) {
|
|||
DiscordLog.report(logvisor::Error, FMT_STRING("Discord Error: {}"), message);
|
||||
}
|
||||
|
||||
std::string CMain::Init(const FileStoreManager& storeMgr, CVarManager* cvarMgr, boo::IAudioVoiceEngine* voiceEngine,
|
||||
amuse::IBackendVoiceAllocator& backend) {
|
||||
std::string CMain::Init(int argc, char** argv, const FileStoreManager& storeMgr, CVarManager* cvarMgr,
|
||||
boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& backend) {
|
||||
m_cvarMgr = cvarMgr;
|
||||
|
||||
{
|
||||
|
@ -607,11 +595,11 @@ std::string CMain::Init(const FileStoreManager& storeMgr, CVarManager* cvarMgr,
|
|||
x70_tweaks.RegisterResourceTweaks(m_cvarMgr);
|
||||
AddWorldPaks();
|
||||
|
||||
auto args = aurora::get_args();
|
||||
for (auto it = args.begin(); it != args.end(); ++it) {
|
||||
if (*it == "--warp" && args.end() - it >= 3) {
|
||||
const char* worldIdxStr = (*(it + 1)).c_str();
|
||||
const char* areaIdxStr = (*(it + 2)).c_str();
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
std::string arg = argv[i];
|
||||
if (arg == "--warp" && i < argc - 2) {
|
||||
const char* worldIdxStr = argv[i + 1];
|
||||
const char* areaIdxStr = argv[i + 2];
|
||||
|
||||
char* endptr = nullptr;
|
||||
m_warpWorldIdx = TAreaId(strtoul(worldIdxStr, &endptr, 0));
|
||||
|
@ -636,8 +624,8 @@ std::string CMain::Init(const FileStoreManager& storeMgr, CVarManager* cvarMgr,
|
|||
break;
|
||||
}
|
||||
|
||||
while (args.end() - it >= 4) {
|
||||
const char* layerStr = (*(it + 3)).c_str();
|
||||
while (i < argc - 3) {
|
||||
const char* layerStr = argv[i + 3];
|
||||
if (!(layerStr[0] == '0' && layerStr[1] == 'x') && (layerStr[0] == '0' || layerStr[0] == '1')) {
|
||||
for (const auto* cur = layerStr; *cur != '\0'; ++cur)
|
||||
if (*cur == '1')
|
||||
|
@ -645,7 +633,7 @@ std::string CMain::Init(const FileStoreManager& storeMgr, CVarManager* cvarMgr,
|
|||
} else if (layerStr[0] == '0' && layerStr[1] == 'x') {
|
||||
m_warpMemoryRelays.emplace_back(TAreaId(strtoul(layerStr + 2, nullptr, 16)));
|
||||
}
|
||||
++it;
|
||||
++i;
|
||||
}
|
||||
|
||||
SetFlowState(EClientFlowStates::StateSetter);
|
||||
|
|
|
@ -90,6 +90,7 @@ public:
|
|||
g_SimplePool = xcc_simplePool;
|
||||
g_CharFactoryBuilder = &xec_charFactoryBuilder;
|
||||
g_AiFuncMap = &x110_aiFuncMap;
|
||||
CGraphics::Startup(); // TODO CGraphicsSys
|
||||
x134_gameState = std::make_unique<CGameState>();
|
||||
g_GameState = x134_gameState.get();
|
||||
g_TweakManager = &x150_tweakManager;
|
||||
|
@ -124,46 +125,12 @@ class CGameArchitectureSupport {
|
|||
EAudioLoadStatus x88_audioLoadStatus = EAudioLoadStatus::Uninitialized;
|
||||
std::vector<TToken<CAudioGroupSet>> x8c_pendingAudioGroups;
|
||||
|
||||
aurora::WindowSize m_windowRect;
|
||||
bool m_rectIsDirty = false;
|
||||
|
||||
void destroyed() { x4_archQueue.Push(MakeMsg::CreateRemoveAllIOWins(EArchMsgTarget::IOWinManager)); }
|
||||
|
||||
void resized(const aurora::WindowSize& rect) {
|
||||
m_windowRect = rect;
|
||||
m_rectIsDirty = true;
|
||||
}
|
||||
|
||||
public:
|
||||
CGameArchitectureSupport(CMain& parent, boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& backend);
|
||||
~CGameArchitectureSupport();
|
||||
|
||||
void mouseDown(const SWindowCoord& coord, EMouseButton button, EModifierKey mods) {
|
||||
// x30_inputGenerator.mouseDown(coord, button, mods);
|
||||
}
|
||||
void mouseUp(const SWindowCoord& coord, EMouseButton button, EModifierKey mods) {
|
||||
// x30_inputGenerator.mouseUp(coord, button, mods);
|
||||
}
|
||||
void mouseMove(const SWindowCoord& coord) {
|
||||
// x30_inputGenerator.mouseMove(coord);
|
||||
}
|
||||
void scroll(const SWindowCoord& coord, const SScrollDelta& scroll) {
|
||||
// x30_inputGenerator.scroll(coord, scroll);
|
||||
}
|
||||
void charKeyDown(uint8_t charCode, aurora::ModifierKey mods, bool isRepeat);
|
||||
void charKeyUp(uint8_t charCode, aurora::ModifierKey mods) {
|
||||
// x30_inputGenerator.charKeyUp(charCode, mods);
|
||||
}
|
||||
void specialKeyDown(aurora::SpecialKey key, aurora::ModifierKey mods, bool isRepeat);
|
||||
|
||||
void specialKeyUp(aurora::SpecialKey key, aurora::ModifierKey mods);
|
||||
void modKeyDown(aurora::ModifierKey mod, bool isRepeat) {
|
||||
// x30_inputGenerator.modKeyDown(mod, isRepeat);
|
||||
}
|
||||
void modKeyUp(aurora::ModifierKey mod) {
|
||||
// x30_inputGenerator.modKeyUp(mod);
|
||||
}
|
||||
|
||||
void PreloadAudio();
|
||||
bool LoadAudio();
|
||||
void UnloadAudio();
|
||||
|
@ -171,12 +138,6 @@ public:
|
|||
void Update(float dt);
|
||||
void Draw();
|
||||
|
||||
bool isRectDirty() const { return m_rectIsDirty; }
|
||||
const aurora::WindowSize& getWindowRect() {
|
||||
m_rectIsDirty = false;
|
||||
return m_windowRect;
|
||||
}
|
||||
|
||||
CIOWinManager& GetIOWinManager() { return x58_ioWinManager; }
|
||||
};
|
||||
|
||||
|
@ -252,12 +213,11 @@ public:
|
|||
|
||||
// int RsMain(int argc, char** argv, boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator&
|
||||
// backend);
|
||||
std::string Init(const FileStoreManager& storeMgr, CVarManager* cvarManager, boo::IAudioVoiceEngine* voiceEngine,
|
||||
amuse::IBackendVoiceAllocator& backend) override;
|
||||
std::string Init(int argc, char** argv, const FileStoreManager& storeMgr, CVarManager* cvarManager,
|
||||
boo::IAudioVoiceEngine* voiceEngine, amuse::IBackendVoiceAllocator& backend) override;
|
||||
bool Proc(float dt) override;
|
||||
void Draw() override;
|
||||
void Shutdown() override;
|
||||
// boo::IWindow* GetMainWindow() const override;
|
||||
|
||||
void MemoryCardInitializePump();
|
||||
|
||||
|
|
|
@ -91,11 +91,11 @@ void COmegaPirate::CFlash::Render(CStateManager& mgr) {
|
|||
if (xf0_thermalSpot == nullptr || !xe8_thermalSpotToken) {
|
||||
return;
|
||||
}
|
||||
xf0_thermalSpot->Load(GX::TEXMAP0, EClampMode::Repeat);
|
||||
xf0_thermalSpot->Load(GX_TEXMAP0, EClampMode::Repeat);
|
||||
|
||||
float sizeMul = 35.f;
|
||||
if (visor == CPlayerState::EPlayerVisor::XRay) {
|
||||
CGX::SetBlendMode(GX::BM_SUBTRACT, GX::BL_ONE, GX::BL_ZERO, GX::LO_CLEAR);
|
||||
CGX::SetBlendMode(GX_BM_SUBTRACT, GX_BL_ONE, GX_BL_ZERO, GX_LO_CLEAR);
|
||||
sizeMul = 60.f;
|
||||
} else {
|
||||
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha, ERglBlendFactor::One, ERglLogicOp::Clear);
|
||||
|
@ -111,7 +111,7 @@ void COmegaPirate::CFlash::Render(CStateManager& mgr) {
|
|||
CGraphics::SetTevOp(ERglTevStage::Stage1, CTevCombiners::skPassThru);
|
||||
CGraphics::SetDepthWriteMode(false, ERglEnum::Always, false);
|
||||
CGraphics::StreamColor(zeus::CColor{1.f, std::min(1.f, size)});
|
||||
CGraphics::StreamBegin(GX::TRIANGLEFAN);
|
||||
CGraphics::StreamBegin(GX_TRIANGLEFAN);
|
||||
CGraphics::StreamTexcoord(0.f, 0.f);
|
||||
CGraphics::StreamVertex(rvS + upVec);
|
||||
CGraphics::StreamTexcoord(1.f, 0.f);
|
||||
|
|
|
@ -1386,7 +1386,7 @@ void CThardus::RenderFlare(const CStateManager& mgr, float t) {
|
|||
if (!x91c_flareTexture) {
|
||||
return;
|
||||
}
|
||||
x91c_flareTexture->Load(GX::TEXMAP0, EClampMode::Repeat);
|
||||
x91c_flareTexture->Load(GX_TEXMAP0, EClampMode::Repeat);
|
||||
|
||||
const float scale = 30.f * t;
|
||||
zeus::CVector3f offset = scale * CGraphics::g_ViewMatrix.basis[2];
|
||||
|
@ -1398,7 +1398,7 @@ void CThardus::RenderFlare(const CStateManager& mgr, float t) {
|
|||
CGraphics::SetTevOp(ERglTevStage::Stage1, CTevCombiners::skPassThru);
|
||||
CGraphics::SetDepthWriteMode(false, ERglEnum::Always, false);
|
||||
CGraphics::StreamColor({t, t});
|
||||
CGraphics::StreamBegin(GX::TRIANGLEFAN);
|
||||
CGraphics::StreamBegin(GX_TRIANGLEFAN);
|
||||
CGraphics::StreamTexcoord(0.f, 0.f);
|
||||
CGraphics::StreamVertex(min + offset);
|
||||
CGraphics::StreamTexcoord(1.f, 0.f);
|
||||
|
|
|
@ -913,27 +913,27 @@ void CElementGen::RenderModels() {
|
|||
CParticle& target = x30_particles[0];
|
||||
int partFrame = x74_curFrame - target.x28_startFrame;
|
||||
cachedTex = texr->GetValueTexture(partFrame).GetObj();
|
||||
cachedTex->Load(GX::TEXMAP0, EClampMode::Repeat);
|
||||
cachedTex->Load(GX_TEXMAP0, EClampMode::Repeat);
|
||||
|
||||
CGraphics::SetTevOp(ERglTevStage::Stage0, CTevCombiners::sTevPass805a5ebc);
|
||||
if (moveRedToAlphaBuffer) {
|
||||
CGX::SetTevColorIn(GX::TEVSTAGE1, GX::CC_ZERO, GX::CC_CPREV, GX::CC_APREV, GX::CC_ZERO);
|
||||
CGX::SetTevAlphaIn(GX::TEVSTAGE1, GX::CA_ZERO, GX::CA_TEXA, GX::CA_APREV, GX::CA_ZERO);
|
||||
CGX::SetStandardTevColorAlphaOp(GX::TEVSTAGE1);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE1, GX::TEXCOORD0, GX::TEXMAP0, GX::COLOR_NULL);
|
||||
GXSetTevSwapMode(GX::TEVSTAGE1, GX::TEV_SWAP0, GX::TEV_SWAP1);
|
||||
CGX::SetTevColorIn(GX_TEVSTAGE1, GX_CC_ZERO, GX_CC_CPREV, GX_CC_APREV, GX_CC_ZERO);
|
||||
CGX::SetTevAlphaIn(GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_TEXA, GX_CA_APREV, GX_CA_ZERO);
|
||||
CGX::SetStandardTevColorAlphaOp(GX_TEVSTAGE1);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
||||
GXSetTevSwapMode(GX_TEVSTAGE1, GX_TEV_SWAP0, GX_TEV_SWAP1);
|
||||
CGX::SetNumTevStages(2);
|
||||
constexpr std::array vtxDescList{
|
||||
GX::VtxDescList{GX::VA_POS, GX::DIRECT},
|
||||
GX::VtxDescList{GX::VA_CLR0, GX::DIRECT},
|
||||
GX::VtxDescList{GX::VA_TEX0, GX::DIRECT},
|
||||
GX::VtxDescList{},
|
||||
GXVtxDescList{GX_VA_POS, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_CLR0, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_TEX0, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_NULL, GX_NONE},
|
||||
};
|
||||
CGX::SetVtxDescv(vtxDescList.data());
|
||||
CGX::SetChanCtrl(CGX::EChannelId::Channel0, {});
|
||||
CGX::SetNumChans(1);
|
||||
CGX::SetTexCoordGen(GX::TEXCOORD0, GX::TG_MTX2x4, GX::TG_TEX0, GX::IDENTITY, false, GX::PTIDENTITY);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD0, GX::TEXMAP0, GX::COLOR0A0);
|
||||
CGX::SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY, false, GX_PTIDENTITY);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||
CGX::SetNumTexGens(1);
|
||||
} else {
|
||||
CGraphics::SetTevOp(ERglTevStage::Stage1, CTevCombiners::skPassThru);
|
||||
|
@ -1036,7 +1036,7 @@ void CElementGen::RenderModels() {
|
|||
|
||||
if (desc->x45_24_x31_26_PMUS) {
|
||||
if (moveRedToAlphaBuffer) {
|
||||
CGX::Begin(GX::QUADS, GX::VTXFMT0, 4);
|
||||
CGX::Begin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
GXPosition3f32(0.5f, 0.f, 0.5f);
|
||||
GXColor4f32(col);
|
||||
GXTexCoord2f32(uvs.xMax, uvs.yMax);
|
||||
|
@ -1051,7 +1051,7 @@ void CElementGen::RenderModels() {
|
|||
GXTexCoord2f32(uvs.xMax, uvs.yMin);
|
||||
CGX::End();
|
||||
} else {
|
||||
CGraphics::StreamBegin(GX::QUADS);
|
||||
CGraphics::StreamBegin(GX_QUADS);
|
||||
CGraphics::StreamColor(col);
|
||||
CGraphics::StreamTexcoord(uvs.xMax, uvs.yMax);
|
||||
CGraphics::StreamVertex(0.5f, 0.f, 0.5f);
|
||||
|
@ -1087,7 +1087,7 @@ void CElementGen::RenderModels() {
|
|||
CGraphics::SetCullMode(ERglCullMode::Front);
|
||||
CTevCombiners::ResetStates();
|
||||
if (moveRedToAlphaBuffer) {
|
||||
GXSetTevSwapMode(GX::TEVSTAGE1, GX::TEV_SWAP0, GX::TEV_SWAP0);
|
||||
GXSetTevSwapMode(GX_TEVSTAGE1, GX_TEV_SWAP0, GX_TEV_SWAP0);
|
||||
}
|
||||
CGraphics::SetAlphaCompare(ERglAlphaFunc::Always, 0, ERglAlphaOp::And, ERglAlphaFunc::Always, 0);
|
||||
}
|
||||
|
@ -1132,7 +1132,7 @@ void CElementGen::RenderLines() {
|
|||
CParticle& target = x30_particles[0];
|
||||
int partFrame = x74_curFrame - target.x28_startFrame;
|
||||
cachedTex = texr->GetValueTexture(partFrame).GetObj();
|
||||
cachedTex->Load(GX::TEXMAP0, EClampMode::Repeat);
|
||||
cachedTex->Load(GX_TEXMAP0, EClampMode::Repeat);
|
||||
|
||||
/* Set TEXC * RASC */
|
||||
|
||||
|
@ -1162,7 +1162,7 @@ void CElementGen::RenderLines() {
|
|||
if (!constTexr) {
|
||||
CTexture* tex = texr->GetValueTexture(partFrame).GetObj();
|
||||
if (tex != cachedTex) {
|
||||
tex->Load(GX::TEXMAP0, EClampMode::Repeat);
|
||||
tex->Load(GX_TEXMAP0, EClampMode::Repeat);
|
||||
cachedTex = tex;
|
||||
}
|
||||
}
|
||||
|
@ -1253,7 +1253,7 @@ void CElementGen::RenderParticles() {
|
|||
CParticle& target = x30_particles[0];
|
||||
int partFrame = x74_curFrame - target.x28_startFrame;
|
||||
cachedTex = texr->GetValueTexture(partFrame).GetObj();
|
||||
cachedTex->Load(GX::TEXMAP0, EClampMode::Repeat);
|
||||
cachedTex->Load(GX_TEXMAP0, EClampMode::Repeat);
|
||||
|
||||
CGraphics::SetTevOp(ERglTevStage::Stage0, CTevCombiners::sTevPass805a5ebc);
|
||||
if (hasModuColor) {
|
||||
|
@ -1271,46 +1271,46 @@ void CElementGen::RenderParticles() {
|
|||
}
|
||||
|
||||
constexpr std::array vtxDescList{
|
||||
GX::VtxDescList{GX::VA_POS, GX::DIRECT},
|
||||
GX::VtxDescList{GX::VA_CLR0, GX::DIRECT},
|
||||
GX::VtxDescList{GX::VA_TEX0, GX::DIRECT},
|
||||
GX::VtxDescList{},
|
||||
GXVtxDescList{GX_VA_POS, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_CLR0, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_TEX0, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_NULL, GX_NONE},
|
||||
};
|
||||
CGX::SetVtxDescv(vtxDescList.data());
|
||||
GX::TevStageID nextStage;
|
||||
GXTevStageID nextStage;
|
||||
if (hasModuColor) {
|
||||
CGX::SetNumChans(2);
|
||||
nextStage = GX::TEVSTAGE2;
|
||||
CGX::SetTevOrder(GX::TEVSTAGE1, GX::TEXCOORD_NULL, GX::TEXMAP_NULL, GX::COLOR1A1);
|
||||
nextStage = GX_TEVSTAGE2;
|
||||
CGX::SetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR1A1);
|
||||
CGX::SetChanAmbColor(CGX::EChannelId::Channel1, zeus::skBlack);
|
||||
CGX::SetChanMatColor(CGX::EChannelId::Channel1, x338_moduColor);
|
||||
CGX::SetChanCtrl(CGX::EChannelId::Channel1, {});
|
||||
} else {
|
||||
CGX::SetNumChans(1);
|
||||
nextStage = GX::TEVSTAGE1;
|
||||
nextStage = GX_TEVSTAGE1;
|
||||
}
|
||||
|
||||
bool moveRedToAlphaBuffer = sMoveRedToAlphaBuffer;
|
||||
if (g_subtractBlend) {
|
||||
CGraphics::SetDepthWriteMode(x26c_28_zTest, ERglEnum::LEqual, false);
|
||||
CGX::SetBlendMode(GX::BM_SUBTRACT, GX::BL_ONE, GX::BL_ZERO, GX::LO_CLEAR);
|
||||
CGX::SetBlendMode(GX_BM_SUBTRACT, GX_BL_ONE, GX_BL_ZERO, GX_LO_CLEAR);
|
||||
if (moveRedToAlphaBuffer) {
|
||||
CGX::SetTevColorIn(nextStage, GX::CC_ZERO, GX::CC_CPREV, GX::CC_APREV, GX::CC_ZERO);
|
||||
CGX::SetTevAlphaIn(nextStage, GX::CA_ZERO, GX::CA_TEXA, GX::CA_APREV, GX::CA_ZERO);
|
||||
CGX::SetTevColorIn(nextStage, GX_CC_ZERO, GX_CC_CPREV, GX_CC_APREV, GX_CC_ZERO);
|
||||
CGX::SetTevAlphaIn(nextStage, GX_CA_ZERO, GX_CA_TEXA, GX_CA_APREV, GX_CA_ZERO);
|
||||
CGX::SetStandardTevColorAlphaOp(nextStage);
|
||||
CGX::SetTevOrder(nextStage, GX::TEXCOORD0, GX::TEXMAP0, GX::COLOR_NULL);
|
||||
GXSetTevSwapMode(nextStage, GX::TEV_SWAP0, GX::TEV_SWAP1);
|
||||
nextStage = GX::TevStageID(nextStage + 1);
|
||||
CGX::SetTevOrder(nextStage, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
||||
GXSetTevSwapMode(nextStage, GX_TEV_SWAP0, GX_TEV_SWAP1);
|
||||
nextStage = GXTevStageID(nextStage + 1);
|
||||
}
|
||||
} else if (moveRedToAlphaBuffer) {
|
||||
CGraphics::SetDepthWriteMode(x26c_28_zTest, ERglEnum::LEqual, false);
|
||||
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::One, ERglBlendFactor::One, ERglLogicOp::Clear);
|
||||
CGX::SetTevColorIn(nextStage, GX::CC_ZERO, GX::CC_CPREV, GX::CC_APREV, GX::CC_ZERO);
|
||||
CGX::SetTevAlphaIn(nextStage, GX::CA_ZERO, GX::CA_TEXA, GX::CA_APREV, GX::CA_ZERO);
|
||||
CGX::SetTevColorIn(nextStage, GX_CC_ZERO, GX_CC_CPREV, GX_CC_APREV, GX_CC_ZERO);
|
||||
CGX::SetTevAlphaIn(nextStage, GX_CA_ZERO, GX_CA_TEXA, GX_CA_APREV, GX_CA_ZERO);
|
||||
CGX::SetStandardTevColorAlphaOp(nextStage);
|
||||
CGX::SetTevOrder(nextStage, GX::TEXCOORD0, GX::TEXMAP0, GX::COLOR_NULL);
|
||||
GXSetTevSwapMode(nextStage, GX::TEV_SWAP0, GX::TEV_SWAP1);
|
||||
nextStage = GX::TevStageID(nextStage + 1);
|
||||
CGX::SetTevOrder(nextStage, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
||||
GXSetTevSwapMode(nextStage, GX_TEV_SWAP0, GX_TEV_SWAP1);
|
||||
nextStage = GXTevStageID(nextStage + 1);
|
||||
} else if (x26c_26_AAPH) {
|
||||
CGraphics::SetDepthWriteMode(x26c_28_zTest, ERglEnum::LEqual, false);
|
||||
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha, ERglBlendFactor::One, ERglLogicOp::Clear);
|
||||
|
@ -1321,22 +1321,22 @@ void CElementGen::RenderParticles() {
|
|||
}
|
||||
CGX::SetNumTevStages(nextStage);
|
||||
CGX::SetNumTexGens(1);
|
||||
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);
|
||||
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);
|
||||
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_TEX0, GX_TEX_ST, GX_F32, 0);
|
||||
}
|
||||
|
||||
int mbspVal = std::max(1, x270_MBSP);
|
||||
if (x26c_30_MBLR) {
|
||||
CGX::Begin(GX::QUADS, GX::VTXFMT6, mbspVal * x30_particles.size() * 4);
|
||||
CGX::Begin(GX_QUADS, GX_VTXFMT6, mbspVal * x30_particles.size() * 4);
|
||||
} else {
|
||||
CGX::Begin(GX::QUADS, GX::VTXFMT6, mbspVal * 4);
|
||||
CGX::Begin(GX_QUADS, GX_VTXFMT6, mbspVal * 4);
|
||||
}
|
||||
|
||||
std::vector<CParticleListItem> sortItems;
|
||||
|
@ -1629,7 +1629,7 @@ void CElementGen::RenderParticles() {
|
|||
|
||||
CGX::End();
|
||||
if (moveRedToAlphaBuffer) {
|
||||
GXSetTevSwapMode(GX::TevStageID(nextStage - 1), GX::TEV_SWAP0, GX::TEV_SWAP0);
|
||||
GXSetTevSwapMode(GXTevStageID(nextStage - 1), GX_TEV_SWAP0, GX_TEV_SWAP0);
|
||||
}
|
||||
CGraphics::SetCullMode(ERglCullMode::Front);
|
||||
CGraphics::SetAlphaCompare(ERglAlphaFunc::Always, 0, ERglAlphaOp::And, ERglAlphaFunc::Always, 0);
|
||||
|
@ -1668,7 +1668,7 @@ void CElementGen::RenderParticlesIndirectTexture() {
|
|||
CParticle& firstParticle = x30_particles[0];
|
||||
int partFrame = x74_curFrame - firstParticle.x28_startFrame;
|
||||
CTexture* cachedTex = texr->GetValueTexture(partFrame).GetObj();
|
||||
cachedTex->Load(GX::TEXMAP0, EClampMode::Repeat);
|
||||
cachedTex->Load(GX_TEXMAP0, EClampMode::Repeat);
|
||||
|
||||
SUVElementSet uvs = {0.f, 0.f, 1.f, 1.f};
|
||||
bool constTexr = texr->HasConstantTexture();
|
||||
|
@ -1677,7 +1677,7 @@ void CElementGen::RenderParticlesIndirectTexture() {
|
|||
|
||||
CUVElement* tind = desc->x58_x44_TIND.get();
|
||||
CTexture* cachedIndTex = tind->GetValueTexture(partFrame).GetObj();
|
||||
cachedIndTex->Load(GX::TEXMAP2, EClampMode::Repeat);
|
||||
cachedIndTex->Load(GX_TEXMAP2, EClampMode::Repeat);
|
||||
|
||||
SUVElementSet uvsInd = {0.f, 0.f, 1.f, 1.f};
|
||||
bool constIndTexr = tind->HasConstantTexture();
|
||||
|
@ -1724,7 +1724,7 @@ void CElementGen::RenderParticlesIndirectTexture() {
|
|||
if (!constTexr) {
|
||||
CTexture* tex = texr->GetValueTexture(thisPartFrame).GetObj();
|
||||
if (tex != cachedTex) {
|
||||
tex->Load(GX::TEXMAP0, EClampMode::Repeat);
|
||||
tex->Load(GX_TEXMAP0, EClampMode::Repeat);
|
||||
cachedTex = tex;
|
||||
}
|
||||
}
|
||||
|
@ -1732,7 +1732,7 @@ void CElementGen::RenderParticlesIndirectTexture() {
|
|||
if (!constIndTexr) {
|
||||
CTexture* tex = tind->GetValueTexture(thisPartFrame).GetObj();
|
||||
if (tex != cachedIndTex) {
|
||||
tex->Load(GX::TEXMAP2, EClampMode::Repeat);
|
||||
tex->Load(GX_TEXMAP2, EClampMode::Repeat);
|
||||
cachedIndTex = tex;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,22 +93,22 @@ void CParticleElectric::SetupLineGXMaterial() {
|
|||
|
||||
void CParticleElectric::DrawLineStrip(const std::vector<zeus::CVector3f>& verts, float width,
|
||||
const zeus::CColor& color) {
|
||||
const size_t useIdx = m_nextLineRenderer;
|
||||
if (++m_nextLineRenderer > m_lineRenderers.size()) {
|
||||
m_lineRenderers.resize(m_nextLineRenderer);
|
||||
}
|
||||
if (!m_lineRenderers[useIdx]) {
|
||||
m_lineRenderers[useIdx] = std::make_unique<CLineRenderer>(CLineRenderer::EPrimitiveMode::LineStrip, x150_SSEG,
|
||||
aurora::gfx::TextureHandle{}, true, true);
|
||||
}
|
||||
CLineRenderer& renderer = *m_lineRenderers[useIdx];
|
||||
const zeus::CColor useColor = x1b8_moduColor * color;
|
||||
|
||||
renderer.Reset();
|
||||
for (const zeus::CVector3f& vert : verts) {
|
||||
renderer.AddVertex(vert, useColor, width);
|
||||
}
|
||||
renderer.Render(); // g_Renderer->IsThermalVisorHotPass()
|
||||
// const size_t useIdx = m_nextLineRenderer;
|
||||
// if (++m_nextLineRenderer > m_lineRenderers.size()) {
|
||||
// m_lineRenderers.resize(m_nextLineRenderer);
|
||||
// }
|
||||
// if (!m_lineRenderers[useIdx]) {
|
||||
// m_lineRenderers[useIdx] = std::make_unique<CLineRenderer>(CLineRenderer::EPrimitiveMode::LineStrip, x150_SSEG,
|
||||
// aurora::gfx::TextureHandle{}, true, true);
|
||||
// }
|
||||
// CLineRenderer& renderer = *m_lineRenderers[useIdx];
|
||||
// const zeus::CColor useColor = x1b8_moduColor * color;
|
||||
//
|
||||
// renderer.Reset();
|
||||
// for (const zeus::CVector3f& vert : verts) {
|
||||
// renderer.AddVertex(vert, useColor, width);
|
||||
// }
|
||||
// renderer.Render(); // g_Renderer->IsThermalVisorHotPass()
|
||||
}
|
||||
|
||||
void CParticleElectric::RenderLines() {
|
||||
|
|
|
@ -306,10 +306,10 @@ int CParticleSwoosh::WrapIndex(int i) const {
|
|||
|
||||
void CParticleSwoosh::RenderNSidedSpline() {
|
||||
if (x1c_desc->x44_29_WIRE) {
|
||||
x1bc_prim = GX::LINES;
|
||||
x1bc_prim = GX_LINES;
|
||||
m_lineRenderer->Reset();
|
||||
} else {
|
||||
x1bc_prim = GX::QUADS;
|
||||
x1bc_prim = GX_QUADS;
|
||||
}
|
||||
|
||||
bool cros = x1c_desc->x44_25_CROS;
|
||||
|
@ -444,7 +444,7 @@ void CParticleSwoosh::RenderNSidedSpline() {
|
|||
const auto v2 = GetSplinePoint(x16c_p0[otherK], x17c_p1[otherK], x18c_p2[otherK], x19c_p3[otherK], t1);
|
||||
const auto v3 = GetSplinePoint(x16c_p0[k], x17c_p1[k], x18c_p2[k], x19c_p3[k], t1);
|
||||
|
||||
if (x1bc_prim == GX::LINES) {
|
||||
if (x1bc_prim == GX_LINES) {
|
||||
m_lineRenderer->AddVertex(v0, color, 1.f);
|
||||
m_lineRenderer->AddVertex(v1, color, 1.f);
|
||||
m_lineRenderer->AddVertex(v1, color, 1.f);
|
||||
|
@ -457,7 +457,7 @@ void CParticleSwoosh::RenderNSidedSpline() {
|
|||
m_lineRenderer->AddVertex(v3, color, 1.f);
|
||||
m_lineRenderer->AddVertex(v3, color, 1.f);
|
||||
m_lineRenderer->AddVertex(v0, color, 1.f);
|
||||
} else if (x1bc_prim == GX::QUADS) {
|
||||
} else if (x1bc_prim == GX_QUADS) {
|
||||
m_cachedVerts.push_back({v0, {x1d4_uvs.xMin, x1d4_uvs.yMin}, color});
|
||||
m_cachedVerts.push_back({v1, {x1d4_uvs.xMin, x1d4_uvs.yMax}, color});
|
||||
m_cachedVerts.push_back({v2, {x1d4_uvs.xMax, x1d4_uvs.yMin}, color});
|
||||
|
@ -478,7 +478,7 @@ void CParticleSwoosh::RenderNSidedSpline() {
|
|||
}
|
||||
}
|
||||
|
||||
if (x1bc_prim == GX::LINES) {
|
||||
if (x1bc_prim == GX_LINES) {
|
||||
// m_lineRenderer->Render(g_Renderer->IsThermalVisorHotPass());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ private:
|
|||
int x1b0_SPLN = 0;
|
||||
int x1b4_LENG = 0;
|
||||
int x1b8_SIDE = 0;
|
||||
GX::Primitive x1bc_prim{};
|
||||
GXPrimitive x1bc_prim{};
|
||||
CRandom16 x1c0_rand;
|
||||
float x1c4_ = 0.f;
|
||||
float x1c8_ = 0.f;
|
||||
|
|
|
@ -12,16 +12,16 @@
|
|||
|
||||
namespace metaforce {
|
||||
|
||||
CPlasmaProjectile::RenderObjects::RenderObjects(aurora::gfx::TextureHandle tex, aurora::gfx::TextureHandle glowTex)
|
||||
: m_beamStrip1(8, CColoredStripShader::Mode::Additive, {})
|
||||
, m_beamStrip2(10, CColoredStripShader::Mode::FullAdditive, tex)
|
||||
, m_beamStrip3(18, CColoredStripShader::Mode::FullAdditive, tex)
|
||||
, m_beamStrip4(14, CColoredStripShader::Mode::Additive, glowTex)
|
||||
, m_beamStrip1Sub(8, CColoredStripShader::Mode::Subtractive, {})
|
||||
, m_beamStrip2Sub(10, CColoredStripShader::Mode::Subtractive, tex)
|
||||
, m_beamStrip3Sub(18, CColoredStripShader::Mode::Subtractive, tex)
|
||||
, m_beamStrip4Sub(14, CColoredStripShader::Mode::Subtractive, glowTex)
|
||||
, m_motionBlurStrip(16, CColoredStripShader::Mode::Alpha, {}) {}
|
||||
//CPlasmaProjectile::RenderObjects::RenderObjects(aurora::gfx::TextureHandle tex, aurora::gfx::TextureHandle glowTex)
|
||||
//: m_beamStrip1(8, CColoredStripShader::Mode::Additive, {})
|
||||
//, m_beamStrip2(10, CColoredStripShader::Mode::FullAdditive, tex)
|
||||
//, m_beamStrip3(18, CColoredStripShader::Mode::FullAdditive, tex)
|
||||
//, m_beamStrip4(14, CColoredStripShader::Mode::Additive, glowTex)
|
||||
//, m_beamStrip1Sub(8, CColoredStripShader::Mode::Subtractive, {})
|
||||
//, m_beamStrip2Sub(10, CColoredStripShader::Mode::Subtractive, tex)
|
||||
//, m_beamStrip3Sub(18, CColoredStripShader::Mode::Subtractive, tex)
|
||||
//, m_beamStrip4Sub(14, CColoredStripShader::Mode::Subtractive, glowTex)
|
||||
//, m_motionBlurStrip(16, CColoredStripShader::Mode::Alpha, {}) {}
|
||||
|
||||
CPlasmaProjectile::CPlasmaProjectile(const TToken<CWeaponDescription>& wDesc, std::string_view name, EWeaponType wType,
|
||||
const CBeamInfo& bInfo, const zeus::CTransform& xf, EMaterialTypes matType,
|
||||
|
@ -148,7 +148,7 @@ void CPlasmaProjectile::RenderMotionBlur() {
|
|||
v2.m_pos = GetPointCache()[i];
|
||||
v2.m_color = v1.m_color;
|
||||
}
|
||||
m_renderObjs->m_motionBlurStrip.draw(zeus::skWhite, verts.size(), verts.data());
|
||||
// m_renderObjs->m_motionBlurStrip.draw(zeus::skWhite, verts.size(), verts.data());
|
||||
}
|
||||
|
||||
void CPlasmaProjectile::RenderBeam(s32 subdivs, float width, const zeus::CColor& color, s32 flags,
|
||||
|
@ -401,6 +401,8 @@ void CPlasmaProjectile::AddToRenderer(const zeus::CFrustum& frustum, CStateManag
|
|||
void CPlasmaProjectile::Render(CStateManager& mgr) {
|
||||
if (!GetActive())
|
||||
return;
|
||||
|
||||
// TODO
|
||||
SCOPED_GRAPHICS_DEBUG_GROUP("CPlasmaProjectile::Render", zeus::skOrange);
|
||||
|
||||
zeus::CTransform xf = GetBeamTransform();
|
||||
|
@ -418,23 +420,23 @@ void CPlasmaProjectile::Render(CStateManager& mgr) {
|
|||
|
||||
// Pass1: alpha-controlled additive
|
||||
CGraphics::SetModelMatrix(xf);
|
||||
RenderBeam(3, 0.25f * x4b8_beamWidth, zeus::CColor(1.f, 0.3f), flags | 0x4,
|
||||
(flags & 0x10) ? m_renderObjs->m_beamStrip1Sub : m_renderObjs->m_beamStrip1);
|
||||
// RenderBeam(3, 0.25f * x4b8_beamWidth, zeus::CColor(1.f, 0.3f), flags | 0x4,
|
||||
// (flags & 0x10) ? m_renderObjs->m_beamStrip1Sub : m_renderObjs->m_beamStrip1);
|
||||
|
||||
// Pass2: textured
|
||||
CGraphics::SetModelMatrix(xf * zeus::CTransform::RotateY(zeus::degToRad(x4c8_beamAngle)));
|
||||
RenderBeam(4, 0.5f * x4b8_beamWidth, x490_innerColor, flags | 0x1,
|
||||
(flags & 0x10) ? m_renderObjs->m_beamStrip2Sub : m_renderObjs->m_beamStrip2);
|
||||
// RenderBeam(4, 0.5f * x4b8_beamWidth, x490_innerColor, flags | 0x1,
|
||||
// (flags & 0x10) ? m_renderObjs->m_beamStrip2Sub : m_renderObjs->m_beamStrip2);
|
||||
|
||||
// Pass3: textured | length-controlled UVY
|
||||
CGraphics::SetModelMatrix(xf * zeus::CTransform::RotateY(zeus::degToRad(-x4c8_beamAngle)));
|
||||
RenderBeam(8, x4b8_beamWidth, x494_outerColor, flags | 0x3,
|
||||
(flags & 0x10) ? m_renderObjs->m_beamStrip3Sub : m_renderObjs->m_beamStrip3);
|
||||
// RenderBeam(8, x4b8_beamWidth, x494_outerColor, flags | 0x3,
|
||||
// (flags & 0x10) ? m_renderObjs->m_beamStrip3Sub : m_renderObjs->m_beamStrip3);
|
||||
|
||||
// Pass4: textured | alpha-controlled additive | glow texture
|
||||
CGraphics::SetModelMatrix(xf);
|
||||
RenderBeam(6, 1.25f * x4b8_beamWidth, x494_outerColor, flags | 0xd,
|
||||
(flags & 0x10) ? m_renderObjs->m_beamStrip4Sub : m_renderObjs->m_beamStrip4);
|
||||
// RenderBeam(6, 1.25f * x4b8_beamWidth, x494_outerColor, flags | 0xd,
|
||||
// (flags & 0x10) ? m_renderObjs->m_beamStrip4Sub : m_renderObjs->m_beamStrip4);
|
||||
}
|
||||
|
||||
} // namespace metaforce
|
||||
|
|
|
@ -81,19 +81,19 @@ private:
|
|||
bool x548_28_drawOwnerFirst : 1;
|
||||
bool x548_29_activePlayerPhazon : 1 = false;
|
||||
|
||||
struct RenderObjects {
|
||||
CColoredStripShader m_beamStrip1;
|
||||
CColoredStripShader m_beamStrip2;
|
||||
CColoredStripShader m_beamStrip3;
|
||||
CColoredStripShader m_beamStrip4;
|
||||
CColoredStripShader m_beamStrip1Sub;
|
||||
CColoredStripShader m_beamStrip2Sub;
|
||||
CColoredStripShader m_beamStrip3Sub;
|
||||
CColoredStripShader m_beamStrip4Sub;
|
||||
CColoredStripShader m_motionBlurStrip;
|
||||
RenderObjects(aurora::gfx::TextureHandle tex, aurora::gfx::TextureHandle glowTex);
|
||||
};
|
||||
std::optional<RenderObjects> m_renderObjs;
|
||||
// struct RenderObjects {
|
||||
// CColoredStripShader m_beamStrip1;
|
||||
// CColoredStripShader m_beamStrip2;
|
||||
// CColoredStripShader m_beamStrip3;
|
||||
// CColoredStripShader m_beamStrip4;
|
||||
// CColoredStripShader m_beamStrip1Sub;
|
||||
// CColoredStripShader m_beamStrip2Sub;
|
||||
// CColoredStripShader m_beamStrip3Sub;
|
||||
// CColoredStripShader m_beamStrip4Sub;
|
||||
// CColoredStripShader m_motionBlurStrip;
|
||||
// RenderObjects(CTexture& tex, CTexture& glowTex);
|
||||
// };
|
||||
// std::optional<RenderObjects> m_renderObjs;
|
||||
|
||||
void SetLightsActive(bool active, CStateManager& mgr);
|
||||
void CreatePlasmaLights(u32 sourceId, const CLight& l, CStateManager& mgr);
|
||||
|
|
|
@ -2134,7 +2134,7 @@ zeus::CVector3f CPlayerGun::ConvertToScreenSpace(const zeus::CVector3f& pos, con
|
|||
void CPlayerGun::CopyScreenTex() {
|
||||
// Copy lower right quadrant to gpCopyTexBuf as RGBA8
|
||||
// GXSetTexCopySrc(320, 224, 320, 224);
|
||||
// GXSetTexCopyDst(320, 224, GX::TF_RGBA8, false);
|
||||
// GXSetTexCopyDst(320, 224, GX_TF_RGBA8, false);
|
||||
// GXCopyTex(sSpareTextureData, false);
|
||||
// GXPixModeSync();
|
||||
SViewport viewport = CGraphics::g_Viewport;
|
||||
|
@ -2144,7 +2144,7 @@ void CPlayerGun::CopyScreenTex() {
|
|||
viewport.x4_top = viewport.xc_height;
|
||||
viewport.x10_halfWidth *= 0.5f;
|
||||
viewport.x14_halfHeight *= 0.5f;
|
||||
CGraphics::ResolveSpareTexture(viewport, 2, GX::TF_RGBA8, false);
|
||||
CGraphics::ResolveSpareTexture(viewport, 2, GX_TF_RGBA8, false);
|
||||
}
|
||||
|
||||
void CPlayerGun::DrawScreenTex(float z) {
|
||||
|
@ -2156,19 +2156,19 @@ void CPlayerGun::DrawScreenTex(float z) {
|
|||
g_Renderer->SetViewportOrtho(false, -1.f, 1.f);
|
||||
g_Renderer->SetBlendMode_AlphaBlended();
|
||||
CGraphics::SetDepthWriteMode(true, ERglEnum::GEqual, true);
|
||||
CGraphics::LoadDolphinSpareTexture(2, GX::TF_RGBA8, GX::TEXMAP7);
|
||||
CGraphics::LoadDolphinSpareTexture(2, GX_TF_RGBA8, GX_TEXMAP7);
|
||||
constexpr std::array vtxDescList{
|
||||
GX::VtxDescList{GX::VA_POS, GX::DIRECT},
|
||||
GX::VtxDescList{GX::VA_TEX0, GX::DIRECT},
|
||||
GX::VtxDescList{},
|
||||
GXVtxDescList{GX_VA_POS, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_TEX0, GX_DIRECT},
|
||||
GXVtxDescList{GX_VA_NULL, GX_NONE},
|
||||
};
|
||||
CGX::SetVtxDescv(vtxDescList.data());
|
||||
CGX::SetNumChans(0);
|
||||
CGX::SetNumTexGens(1);
|
||||
CGX::SetNumTevStages(1);
|
||||
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD0, GX::TEXMAP7, GX::COLOR_NULL);
|
||||
CGX::SetChanCtrl(CGX::EChannelId::Channel0, false, GX::SRC_REG, GX::SRC_REG, {}, GX::DF_NONE, GX::AF_NONE);
|
||||
CGX::Begin(GX::TRIANGLESTRIP, GX::VTXFMT0, 4);
|
||||
CGX::SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP7, GX_COLOR_NULL);
|
||||
CGX::SetChanCtrl(CGX::EChannelId::Channel0, false, GX_SRC_REG, GX_SRC_REG, {}, GX_DF_NONE, GX_AF_NONE);
|
||||
CGX::Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 4);
|
||||
GXPosition3f32(CGraphics::g_Viewport.x10_halfWidth, z, 0.f);
|
||||
GXTexCoord2f32(0.f, 1.f);
|
||||
GXPosition3f32(CGraphics::g_Viewport.x8_width, z, 0.f);
|
||||
|
|
|
@ -75,7 +75,7 @@ protected:
|
|||
bool xe7_30_doTargetDistanceTest : 1 = true;
|
||||
bool xe7_31_targetable : 1 = true;
|
||||
|
||||
aurora::gfx::TextureHandle m_reflectionCube;
|
||||
GXTexObj m_reflectionCube;
|
||||
zeus::CColor m_debugAddColor = zeus::skClear;
|
||||
float m_debugAddColorTime = 0.f;
|
||||
|
||||
|
|
|
@ -269,10 +269,10 @@ CFluidPlaneShader::RenderSetupInfo CFluidPlaneCPU::RenderSetup(const CStateManag
|
|||
m_cachedAdditive != (mgr.GetThermalDrawFlag() == EThermalDrawFlag::Hot)) {
|
||||
m_cachedDoubleLightmapBlend = doubleLightmapBlend;
|
||||
m_cachedAdditive = mgr.GetThermalDrawFlag() == EThermalDrawFlag::Hot;
|
||||
m_shader.emplace(x44_fluidType, x10_texPattern1, x20_texPattern2, x30_texColor, xb0_bumpMap, xc0_envMap,
|
||||
xd0_envBumpMap, xe0_lightmap,
|
||||
m_tessellation ? CFluidPlaneManager::RippleMapTex : aurora::gfx::TextureHandle{},
|
||||
m_cachedDoubleLightmapBlend, m_cachedAdditive, m_maxVertCount);
|
||||
// m_shader.emplace(x44_fluidType, x10_texPattern1, x20_texPattern2, x30_texColor, xb0_bumpMap, xc0_envMap,
|
||||
// xd0_envBumpMap, xe0_lightmap,
|
||||
// m_tessellation ? CFluidPlaneManager::RippleMapTex : aurora::gfx::TextureHandle{},
|
||||
// m_cachedDoubleLightmapBlend, m_cachedAdditive, m_maxVertCount);
|
||||
}
|
||||
|
||||
return out;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue