CCollisionEditorViewport: Make use of in-class initializers

This commit is contained in:
Lioncash 2020-06-28 02:51:20 -04:00
parent 6bc9c7fdb1
commit 4c6080184f
2 changed files with 11 additions and 12 deletions

View File

@ -1,12 +1,11 @@
#include "CCollisionEditorViewport.h"
/** Constructor */
CCollisionEditorViewport::CCollisionEditorViewport(QWidget* pParent /*= 0*/)
CCollisionEditorViewport::CCollisionEditorViewport(QWidget* pParent)
: CBasicViewport(pParent)
, mGridEnabled(true)
, mpRenderer{std::make_unique<CRenderer>()}
{
mpRenderer = std::make_unique<CRenderer>();
qreal pixelRatio = devicePixelRatioF();
const qreal pixelRatio = devicePixelRatioF();
mpRenderer->SetViewportSize(width() * pixelRatio, height() * pixelRatio);
mpRenderer->SetClearColor(CColor(0.3f, 0.3f, 0.3f));
mpRenderer->ToggleGrid(true);

View File

@ -12,22 +12,22 @@ class CCollisionEditorViewport : public CBasicViewport
Q_OBJECT
std::unique_ptr<CRenderer> mpRenderer;
CCollisionNode* mpCollisionNode;
CCollisionNode* mpCollisionNode = nullptr;
CGridRenderable mGrid;
bool mGridEnabled;
bool mGridEnabled = true;
public:
/** Constructor */
CCollisionEditorViewport(QWidget* pParent = 0);
explicit CCollisionEditorViewport(QWidget* pParent = nullptr);
/** CBasicViewport interface */
virtual void Paint() override;
virtual void OnResize() override;
void Paint() override;
void OnResize() override;
/** Accessors */
inline void SetNode(CCollisionNode* pNode) { mpCollisionNode = pNode; }
inline void SetGridEnabled(bool Enabled) { mGridEnabled = Enabled; }
inline void SetOBBTreeDepth(int Depth)
void SetNode(CCollisionNode* pNode) { mpCollisionNode = pNode; }
void SetGridEnabled(bool Enabled) { mGridEnabled = Enabled; }
void SetOBBTreeDepth(int Depth)
{
mViewInfo.CollisionSettings.DrawBoundingHierarchy = (Depth > 0);
mViewInfo.CollisionSettings.BoundingHierarchyRenderDepth = Depth;