mirror of https://github.com/AxioDL/metaforce.git
Add debug rendering for CScriptPlatform (CVar: debugTool.drawPlatformCollision)
This commit is contained in:
parent
dc270ced7e
commit
0781307c49
|
@ -75,19 +75,21 @@ void ViewManager::TestGameView::think() {
|
||||||
auto pt = std::div(igt, 3600);
|
auto pt = std::div(igt, 3600);
|
||||||
overlayText +=
|
overlayText +=
|
||||||
fmt::format(FMT_STRING("PlayTime: {:02d}:{:02d}:{:02d}.{:03d}\n"), pt.quot, pt.rem / 60, pt.rem % 60, ms);
|
fmt::format(FMT_STRING("PlayTime: {:02d}:{:02d}:{:02d}.{:03d}\n"), pt.quot, pt.rem / 60, pt.rem % 60, ms);
|
||||||
if (g_StateManager->GetCurrentArea() != nullptr) {
|
}
|
||||||
if (m_currentRoom != g_StateManager->GetCurrentArea()) {
|
|
||||||
m_currentRoom = static_cast<const void*>(g_StateManager->GetCurrentArea());
|
if (g_StateManager->GetCurrentArea() != nullptr && m_cvarCommons.m_debugOverlayShowRoomTimer->toBoolean()) {
|
||||||
m_lastRoomTime = igt - m_currentRoomStart;
|
double igt = g_GameState->GetTotalPlayTime();
|
||||||
m_currentRoomStart = igt;
|
if (m_currentRoom != g_StateManager->GetCurrentArea()) {
|
||||||
}
|
m_currentRoom = static_cast<const void*>(g_StateManager->GetCurrentArea());
|
||||||
double currentRoomTime = igt - m_currentRoomStart;
|
m_lastRoomTime = igt - m_currentRoomStart;
|
||||||
u32 curFrames = std::round(u32(currentRoomTime * 60));
|
m_currentRoomStart = igt;
|
||||||
u32 lastFrames = std::round(u32(m_lastRoomTime * 60));
|
|
||||||
overlayText += fmt::format(FMT_STRING("Room Time:{:8.3f}/{:6d}| Last Room:{:8.3f}/{:6d}\n"),
|
|
||||||
currentRoomTime, curFrames,
|
|
||||||
m_lastRoomTime, lastFrames);
|
|
||||||
}
|
}
|
||||||
|
double currentRoomTime = igt - m_currentRoomStart;
|
||||||
|
u32 curFrames = std::round(u32(currentRoomTime * 60));
|
||||||
|
u32 lastFrames = std::round(u32(m_lastRoomTime * 60));
|
||||||
|
overlayText += fmt::format(FMT_STRING("Room Time:{:8.3f}/{:6d}| Last Room:{:8.3f}/{:6d}\n"),
|
||||||
|
currentRoomTime, curFrames,
|
||||||
|
m_lastRoomTime, lastFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_StateManager->Player() && m_cvarCommons.m_debugOverlayPlayerInfo->toBoolean()) {
|
if (g_StateManager->Player() && m_cvarCommons.m_debugOverlayPlayerInfo->toBoolean()) {
|
||||||
|
|
|
@ -58,6 +58,7 @@ hecl::CVar* debugToolDrawAiPath = nullptr;
|
||||||
hecl::CVar* debugToolDrawLighting = nullptr;
|
hecl::CVar* debugToolDrawLighting = nullptr;
|
||||||
hecl::CVar* debugToolDrawCollisionActors = nullptr;
|
hecl::CVar* debugToolDrawCollisionActors = nullptr;
|
||||||
hecl::CVar* debugToolDrawMazePath = nullptr;
|
hecl::CVar* debugToolDrawMazePath = nullptr;
|
||||||
|
hecl::CVar* debugToolDrawPlatformCollision = nullptr;
|
||||||
hecl::CVar* sm_logScripting = nullptr;
|
hecl::CVar* sm_logScripting = nullptr;
|
||||||
} // namespace
|
} // namespace
|
||||||
logvisor::Module LogModule("urde::CStateManager");
|
logvisor::Module LogModule("urde::CStateManager");
|
||||||
|
@ -547,11 +548,12 @@ void CStateManager::DrawDebugStuff() const {
|
||||||
|
|
||||||
// FIXME: Add proper globals for CVars
|
// FIXME: Add proper globals for CVars
|
||||||
if (debugToolDrawAiPath == nullptr || debugToolDrawCollisionActors == nullptr || debugToolDrawLighting == nullptr ||
|
if (debugToolDrawAiPath == nullptr || debugToolDrawCollisionActors == nullptr || debugToolDrawLighting == nullptr ||
|
||||||
debugToolDrawMazePath == nullptr) {
|
debugToolDrawMazePath == nullptr || debugToolDrawPlatformCollision == nullptr) {
|
||||||
debugToolDrawAiPath = hecl::CVarManager::instance()->findCVar("debugTool.drawAiPath");
|
debugToolDrawAiPath = hecl::CVarManager::instance()->findCVar("debugTool.drawAiPath");
|
||||||
debugToolDrawMazePath = hecl::CVarManager::instance()->findCVar("debugTool.drawMazePath");
|
debugToolDrawMazePath = hecl::CVarManager::instance()->findCVar("debugTool.drawMazePath");
|
||||||
debugToolDrawCollisionActors = hecl::CVarManager::instance()->findCVar("debugTool.drawCollisionActors");
|
debugToolDrawCollisionActors = hecl::CVarManager::instance()->findCVar("debugTool.drawCollisionActors");
|
||||||
debugToolDrawLighting = hecl::CVarManager::instance()->findCVar("debugTool.drawLighting");
|
debugToolDrawLighting = hecl::CVarManager::instance()->findCVar("debugTool.drawLighting");
|
||||||
|
debugToolDrawPlatformCollision = hecl::CVarManager::instance()->findCVar("debugTool.drawPlatformCollision");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -574,6 +576,10 @@ void CStateManager::DrawDebugStuff() const {
|
||||||
if (debugToolDrawCollisionActors->toBoolean()) {
|
if (debugToolDrawCollisionActors->toBoolean()) {
|
||||||
colAct->DebugDraw();
|
colAct->DebugDraw();
|
||||||
}
|
}
|
||||||
|
} else if (const TCastToPtr<CScriptPlatform> plat = ent) {
|
||||||
|
if (debugToolDrawPlatformCollision->toBoolean() && plat->GetActive()) {
|
||||||
|
plat->DebugDraw();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -560,4 +560,12 @@ zeus::CQuaternion CScriptPlatform::Move(float dt, CStateManager& mgr) {
|
||||||
return zeus::CQuaternion();
|
return zeus::CQuaternion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CScriptPlatform::DebugDraw() {
|
||||||
|
if (!m_boxFilter) {
|
||||||
|
m_boxFilter = {CAABoxShader()};
|
||||||
|
}
|
||||||
|
|
||||||
|
m_boxFilter->setAABB(*GetTouchBounds());
|
||||||
|
m_boxFilter->draw({1.f, 0.f, 1.f, .5f});
|
||||||
|
}
|
||||||
} // namespace urde
|
} // namespace urde
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "Runtime/World/CDamageVulnerability.hpp"
|
#include "Runtime/World/CDamageVulnerability.hpp"
|
||||||
#include "Runtime/World/CHealthInfo.hpp"
|
#include "Runtime/World/CHealthInfo.hpp"
|
||||||
#include "Runtime/World/CPhysicsActor.hpp"
|
#include "Runtime/World/CPhysicsActor.hpp"
|
||||||
|
#include "Runtime/Graphics/Shaders/CAABoxShader.hpp"
|
||||||
|
|
||||||
#include <zeus/CQuaternion.hpp>
|
#include <zeus/CQuaternion.hpp>
|
||||||
#include <zeus/CTransform.hpp>
|
#include <zeus/CTransform.hpp>
|
||||||
|
@ -72,6 +73,7 @@ class CScriptPlatform : public CPhysicsActor {
|
||||||
static rstl::reserved_vector<TUniqueId, 1024> BuildNearListFromRiders(CStateManager& mgr,
|
static rstl::reserved_vector<TUniqueId, 1024> BuildNearListFromRiders(CStateManager& mgr,
|
||||||
const std::vector<SRiders>& movedRiders);
|
const std::vector<SRiders>& movedRiders);
|
||||||
|
|
||||||
|
std::optional<CAABoxShader> m_boxFilter;
|
||||||
public:
|
public:
|
||||||
CScriptPlatform(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
CScriptPlatform(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||||
CModelData&& mData, const CActorParameters& actParms, const zeus::CAABox& aabb, float speed,
|
CModelData&& mData, const CActorParameters& actParms, const zeus::CAABox& aabb, float speed,
|
||||||
|
@ -114,5 +116,7 @@ public:
|
||||||
|
|
||||||
virtual void SplashThink(const zeus::CAABox&, const CFluidPlane&, float, CStateManager&) const;
|
virtual void SplashThink(const zeus::CAABox&, const CFluidPlane&, float, CStateManager&) const;
|
||||||
virtual zeus::CQuaternion Move(float, CStateManager&);
|
virtual zeus::CQuaternion Move(float, CStateManager&);
|
||||||
|
|
||||||
|
void DebugDraw();
|
||||||
};
|
};
|
||||||
} // namespace urde
|
} // namespace urde
|
||||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit 892bc4a196aeea96bf9ba836126914d2d44667a2
|
Subproject commit 4b30bc1ffe6499755b2d1c219cee01ef3e18848d
|
Loading…
Reference in New Issue