Replaced includes with forward declares.

This commit is contained in:
Leonardo Zide 2020-12-15 18:47:58 -08:00
parent c2d1b5ce7c
commit dac9b599a5
10 changed files with 26 additions and 18 deletions

View file

@ -9,6 +9,7 @@
#include "lc_partselectionwidget.h" #include "lc_partselectionwidget.h"
#include "lc_shortcuts.h" #include "lc_shortcuts.h"
#include "view.h" #include "view.h"
#include "camera.h"
#include "lc_previewwidget.h" #include "lc_previewwidget.h"
lcApplication* gApplication; lcApplication* gApplication;

View file

@ -80,8 +80,10 @@ class lcContext;
class lcMesh; class lcMesh;
struct lcMeshSection; struct lcMeshSection;
struct lcRenderMesh; struct lcRenderMesh;
struct lcObjectSection;
class lcTexture; class lcTexture;
class lcScene; class lcScene;
class lcViewSphere;
enum class lcRenderMeshState : int; enum class lcRenderMeshState : int;
class lcFile; class lcFile;

View file

@ -8,6 +8,7 @@
#include "texfont.h" #include "texfont.h"
#include "lc_model.h" #include "lc_model.h"
#include "lc_scene.h" #include "lc_scene.h"
#include "lc_viewsphere.h"
lcGLWidget* lcGLWidget::mLastFocusedView; lcGLWidget* lcGLWidget::mLastFocusedView;
std::vector<lcGLWidget*> lcGLWidget::mViews; std::vector<lcGLWidget*> lcGLWidget::mViews;

View file

@ -218,6 +218,7 @@ protected:
lcCursor mCursor = lcCursor::Default; lcCursor mCursor = lcCursor::Default;
std::unique_ptr<lcScene> mScene; std::unique_ptr<lcScene> mScene;
std::unique_ptr<lcViewSphere> mViewSphere;
lcModel* mModel = nullptr; lcModel* mModel = nullptr;
lcPiece* mActiveSubmodelInstance = nullptr; lcPiece* mActiveSubmodelInstance = nullptr;

View file

@ -19,6 +19,7 @@
#include "view.h" #include "view.h"
#include "project.h" #include "project.h"
#include "piece.h" #include "piece.h"
#include "camera.h"
#include "group.h" #include "group.h"
#include "pieceinf.h" #include "pieceinf.h"
#include "lc_library.h" #include "lc_library.h"

View file

@ -6,6 +6,7 @@
#include "lc_model.h" #include "lc_model.h"
#include "camera.h" #include "camera.h"
#include "lc_library.h" #include "lc_library.h"
#include "lc_viewsphere.h"
#include "lc_qglwidget.h" #include "lc_qglwidget.h"
@ -80,8 +81,9 @@ void lcPreviewDockWidget::SetPreviewLock()
} }
lcPreviewWidget::lcPreviewWidget() lcPreviewWidget::lcPreviewWidget()
: lcGLWidget(nullptr), mLoader(new Project(true)), mViewSphere(this) : lcGLWidget(nullptr), mLoader(new Project(true))
{ {
mViewSphere = std::unique_ptr<lcViewSphere>(new lcViewSphere(this));
mLoader->SetActiveModel(0); mLoader->SetActiveModel(0);
mModel = mLoader->GetActiveModel(); mModel = mLoader->GetActiveModel();
@ -286,7 +288,7 @@ void lcPreviewWidget::OnDraw()
DrawAxes(); DrawAxes();
if (Preferences.mDrawPreviewViewSphere) if (Preferences.mDrawPreviewViewSphere)
mViewSphere.Draw(); mViewSphere->Draw();
DrawViewport(); DrawViewport();
} }
@ -301,7 +303,7 @@ void lcPreviewWidget::OnLeftButtonDown()
return; return;
} }
if (mViewSphere.OnLeftButtonDown()) if (mViewSphere->OnLeftButtonDown())
return; return;
lcTrackTool OverrideTool = lcTrackTool::OrbitXY; lcTrackTool OverrideTool = lcTrackTool::OrbitXY;
@ -319,7 +321,8 @@ void lcPreviewWidget::OnLeftButtonUp()
{ {
StopTracking(mTrackButton == lcTrackButton::Left); StopTracking(mTrackButton == lcTrackButton::Left);
if (mViewSphere.OnLeftButtonUp()) { if (mViewSphere->OnLeftButtonUp())
{
ZoomExtents(); ZoomExtents();
return; return;
} }
@ -390,9 +393,9 @@ void lcPreviewWidget::OnMouseMove()
if (mTrackButton == lcTrackButton::None) if (mTrackButton == lcTrackButton::None)
{ {
if (mViewSphere.OnMouseMove()) if (mViewSphere->OnMouseMove())
{ {
lcTrackTool NewTrackTool = mViewSphere.IsDragging() ? lcTrackTool::OrbitXY : lcTrackTool::None; lcTrackTool NewTrackTool = mViewSphere->IsDragging() ? lcTrackTool::OrbitXY : lcTrackTool::None;
if (NewTrackTool != mTrackTool) if (NewTrackTool != mTrackTool)
{ {

View file

@ -2,7 +2,6 @@
#include "lc_glwidget.h" #include "lc_glwidget.h"
#include "lc_scene.h" #include "lc_scene.h"
#include "lc_viewsphere.h"
#include "lc_commands.h" #include "lc_commands.h"
class lcQGLWidget; class lcQGLWidget;
@ -66,7 +65,6 @@ protected:
void OnButtonDown(lcTrackButton TrackButton); void OnButtonDown(lcTrackButton TrackButton);
Project* mLoader; Project* mLoader;
lcViewSphere mViewSphere;
QString mDescription; QString mDescription;
bool mIsModel; bool mIsModel;

View file

@ -2,7 +2,7 @@
#include "lc_viewsphere.h" #include "lc_viewsphere.h"
#include "view.h" #include "view.h"
#include "lc_previewwidget.h" #include "lc_previewwidget.h"
#include "camera.h"
#include "lc_context.h" #include "lc_context.h"
#include "lc_stringcache.h" #include "lc_stringcache.h"
#include "lc_application.h" #include "lc_application.h"

View file

@ -9,13 +9,16 @@
#include "pieceinf.h" #include "pieceinf.h"
#include "lc_synth.h" #include "lc_synth.h"
#include "lc_scene.h" #include "lc_scene.h"
#include "lc_context.h"
#include "lc_viewsphere.h"
lcVertexBuffer View::mRotateMoveVertexBuffer; lcVertexBuffer View::mRotateMoveVertexBuffer;
lcIndexBuffer View::mRotateMoveIndexBuffer; lcIndexBuffer View::mRotateMoveIndexBuffer;
View::View(lcModel* Model) View::View(lcModel* Model)
: lcGLWidget(Model), mViewSphere(this) : lcGLWidget(Model)
{ {
mViewSphere = std::unique_ptr<lcViewSphere>(new lcViewSphere(this));
memset(mGridSettings, 0, sizeof(mGridSettings)); memset(mGridSettings, 0, sizeof(mGridSettings));
mDragState = lcDragState::None; mDragState = lcDragState::None;
@ -731,7 +734,7 @@ void View::OnDraw()
else if (Tool == lcTool::RotateView && mTrackButton == lcTrackButton::None) else if (Tool == lcTool::RotateView && mTrackButton == lcTrackButton::None)
DrawRotateViewOverlay(); DrawRotateViewOverlay();
mViewSphere.Draw(); mViewSphere->Draw();
DrawViewport(); DrawViewport();
} }
@ -2425,7 +2428,7 @@ void View::OnLeftButtonDown()
return; return;
} }
if (mViewSphere.OnLeftButtonDown()) if (mViewSphere->OnLeftButtonDown())
return; return;
lcTrackTool OverrideTool = GetOverrideTrackTool(Qt::LeftButton); lcTrackTool OverrideTool = GetOverrideTrackTool(Qt::LeftButton);
@ -2443,7 +2446,7 @@ void View::OnLeftButtonUp()
{ {
StopTracking(mTrackButton == lcTrackButton::Left); StopTracking(mTrackButton == lcTrackButton::Left);
if (mViewSphere.OnLeftButtonUp()) if (mViewSphere->OnLeftButtonUp())
return; return;
} }
@ -2534,9 +2537,9 @@ void View::OnMouseMove()
if (mTrackButton == lcTrackButton::None) if (mTrackButton == lcTrackButton::None)
{ {
if (mViewSphere.OnMouseMove()) if (mViewSphere->OnMouseMove())
{ {
lcTrackTool NewTrackTool = mViewSphere.IsDragging() ? lcTrackTool::OrbitXY : lcTrackTool::None; lcTrackTool NewTrackTool = mViewSphere->IsDragging() ? lcTrackTool::OrbitXY : lcTrackTool::None;
if (NewTrackTool != mTrackTool) if (NewTrackTool != mTrackTool)
{ {

View file

@ -1,8 +1,7 @@
#pragma once #pragma once
#include "lc_glwidget.h" #include "lc_glwidget.h"
#include "camera.h" #include "lc_context.h"
#include "lc_viewsphere.h"
class View : public lcGLWidget class View : public lcGLWidget
{ {
@ -95,7 +94,6 @@ protected:
PieceInfo* mMouseDownPiece; PieceInfo* mMouseDownPiece;
QImage mRenderImage; QImage mRenderImage;
std::pair<lcFramebuffer, lcFramebuffer> mRenderFramebuffer; std::pair<lcFramebuffer, lcFramebuffer> mRenderFramebuffer;
lcViewSphere mViewSphere;
lcVertexBuffer mGridBuffer; lcVertexBuffer mGridBuffer;
int mGridSettings[7]; int mGridSettings[7];