Only instantiate m_actorDebugRender when used

This commit is contained in:
Henrique Gemignani Passos Lima 2021-06-29 01:38:51 +03:00
parent 1b4e0dc754
commit d8e5f03886
2 changed files with 6 additions and 3 deletions

View File

@ -202,8 +202,11 @@ void CActor::DrawTouchBounds() {
if (m_debugHovered || m_debugSelected) {
auto aabox = GetTouchBounds();
if (aabox) {
m_actorDebugRender.setAABB(*aabox);
m_actorDebugRender.draw(m_debugAddColor);
if (!m_actorDebugRender) {
m_actorDebugRender = CAABoxShader();
}
m_actorDebugRender->setAABB(*aabox);
m_actorDebugRender->draw(m_debugAddColor);
}
}
}

View File

@ -86,7 +86,7 @@ protected:
void RenderInternal(const CStateManager& mgr) const;
bool IsModelOpaque(const CStateManager& mgr) const;
CAABoxShader m_actorDebugRender;
std::optional<CAABoxShader> m_actorDebugRender;
public:
enum class EFluidState { EnteredFluid, InFluid, LeftFluid };