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

View File

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