mirror of
https://github.com/leozide/leocad
synced 2025-01-18 22:26:44 +01:00
Merged DrawViewport().
This commit is contained in:
parent
c758ef2910
commit
489f5e6f7e
13 changed files with 90 additions and 105 deletions
|
@ -26,6 +26,7 @@ void lcPreferences::LoadDefaults()
|
||||||
mAxesColor = lcGetProfileInt(LC_PROFILE_AXES_COLOR);
|
mAxesColor = lcGetProfileInt(LC_PROFILE_AXES_COLOR);
|
||||||
mOverlayColor = lcGetProfileInt(LC_PROFILE_OVERLAY_COLOR);
|
mOverlayColor = lcGetProfileInt(LC_PROFILE_OVERLAY_COLOR);
|
||||||
mActiveViewColor = lcGetProfileInt(LC_PROFILE_ACTIVE_VIEW_COLOR);
|
mActiveViewColor = lcGetProfileInt(LC_PROFILE_ACTIVE_VIEW_COLOR);
|
||||||
|
mInactiveViewColor = lcGetProfileInt(LC_PROFILE_INACTIVE_VIEW_COLOR);
|
||||||
mDrawEdgeLines = lcGetProfileInt(LC_PROFILE_DRAW_EDGE_LINES);
|
mDrawEdgeLines = lcGetProfileInt(LC_PROFILE_DRAW_EDGE_LINES);
|
||||||
mLineWidth = lcGetProfileFloat(LC_PROFILE_LINE_WIDTH);
|
mLineWidth = lcGetProfileFloat(LC_PROFILE_LINE_WIDTH);
|
||||||
mAllowLOD = lcGetProfileInt(LC_PROFILE_ALLOW_LOD);
|
mAllowLOD = lcGetProfileInt(LC_PROFILE_ALLOW_LOD);
|
||||||
|
@ -49,7 +50,6 @@ void lcPreferences::LoadDefaults()
|
||||||
mRestoreTabLayout = lcGetProfileInt(LC_PROFILE_RESTORE_TAB_LAYOUT);
|
mRestoreTabLayout = lcGetProfileInt(LC_PROFILE_RESTORE_TAB_LAYOUT);
|
||||||
mColorTheme = static_cast<lcColorTheme>(lcGetProfileInt(LC_PROFILE_COLOR_THEME));
|
mColorTheme = static_cast<lcColorTheme>(lcGetProfileInt(LC_PROFILE_COLOR_THEME));
|
||||||
|
|
||||||
mPreviewActiveColor = lcGetProfileInt(LC_PROFILE_PREVIEW_ACTIVE_COLOR);
|
|
||||||
mPreviewViewSphereEnabled = lcGetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_ENABLED);
|
mPreviewViewSphereEnabled = lcGetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_ENABLED);
|
||||||
mPreviewViewSphereSize = lcGetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_SIZE);
|
mPreviewViewSphereSize = lcGetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_SIZE);
|
||||||
mPreviewViewSphereLocation = static_cast<lcViewSphereLocation>(lcGetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION));
|
mPreviewViewSphereLocation = static_cast<lcViewSphereLocation>(lcGetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION));
|
||||||
|
@ -74,6 +74,7 @@ void lcPreferences::SaveDefaults()
|
||||||
lcSetProfileInt(LC_PROFILE_GRADIENT_COLOR_BOTTOM, mBackgroundGradientColorBottom);
|
lcSetProfileInt(LC_PROFILE_GRADIENT_COLOR_BOTTOM, mBackgroundGradientColorBottom);
|
||||||
lcSetProfileInt(LC_PROFILE_OVERLAY_COLOR, mOverlayColor);
|
lcSetProfileInt(LC_PROFILE_OVERLAY_COLOR, mOverlayColor);
|
||||||
lcSetProfileInt(LC_PROFILE_ACTIVE_VIEW_COLOR, mActiveViewColor);
|
lcSetProfileInt(LC_PROFILE_ACTIVE_VIEW_COLOR, mActiveViewColor);
|
||||||
|
lcSetProfileInt(LC_PROFILE_INACTIVE_VIEW_COLOR, mInactiveViewColor);
|
||||||
lcSetProfileInt(LC_PROFILE_DRAW_EDGE_LINES, mDrawEdgeLines);
|
lcSetProfileInt(LC_PROFILE_DRAW_EDGE_LINES, mDrawEdgeLines);
|
||||||
lcSetProfileFloat(LC_PROFILE_LINE_WIDTH, mLineWidth);
|
lcSetProfileFloat(LC_PROFILE_LINE_WIDTH, mLineWidth);
|
||||||
lcSetProfileInt(LC_PROFILE_ALLOW_LOD, mAllowLOD);
|
lcSetProfileInt(LC_PROFILE_ALLOW_LOD, mAllowLOD);
|
||||||
|
@ -97,7 +98,6 @@ void lcPreferences::SaveDefaults()
|
||||||
lcSetProfileInt(LC_PROFILE_RESTORE_TAB_LAYOUT, mRestoreTabLayout);
|
lcSetProfileInt(LC_PROFILE_RESTORE_TAB_LAYOUT, mRestoreTabLayout);
|
||||||
lcSetProfileInt(LC_PROFILE_COLOR_THEME, static_cast<int>(mColorTheme));
|
lcSetProfileInt(LC_PROFILE_COLOR_THEME, static_cast<int>(mColorTheme));
|
||||||
|
|
||||||
lcSetProfileInt(LC_PROFILE_PREVIEW_ACTIVE_COLOR, mPreviewActiveColor);
|
|
||||||
lcSetProfileInt(LC_PROFILE_PREVIEW_ENABLED, mPreviewViewSphereEnabled);
|
lcSetProfileInt(LC_PROFILE_PREVIEW_ENABLED, mPreviewViewSphereEnabled);
|
||||||
lcSetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_SIZE, mPreviewViewSphereSize);
|
lcSetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_SIZE, mPreviewViewSphereSize);
|
||||||
lcSetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION, static_cast<int>(mPreviewViewSphereLocation));
|
lcSetProfileInt(LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION, static_cast<int>(mPreviewViewSphereLocation));
|
||||||
|
|
|
@ -52,6 +52,7 @@ public:
|
||||||
quint32 mAxesColor;
|
quint32 mAxesColor;
|
||||||
quint32 mOverlayColor;
|
quint32 mOverlayColor;
|
||||||
quint32 mActiveViewColor;
|
quint32 mActiveViewColor;
|
||||||
|
quint32 mInactiveViewColor;
|
||||||
bool mDrawEdgeLines;
|
bool mDrawEdgeLines;
|
||||||
float mLineWidth;
|
float mLineWidth;
|
||||||
bool mAllowLOD;
|
bool mAllowLOD;
|
||||||
|
@ -77,7 +78,6 @@ public:
|
||||||
lcColorTheme mColorTheme;
|
lcColorTheme mColorTheme;
|
||||||
|
|
||||||
int mPreviewEnabled;
|
int mPreviewEnabled;
|
||||||
quint32 mPreviewActiveColor;
|
|
||||||
int mPreviewViewSphereEnabled;
|
int mPreviewViewSphereEnabled;
|
||||||
int mPreviewViewSphereSize;
|
int mPreviewViewSphereSize;
|
||||||
lcViewSphereLocation mPreviewViewSphereLocation;
|
lcViewSphereLocation mPreviewViewSphereLocation;
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include "lc_model.h"
|
#include "lc_model.h"
|
||||||
#include "lc_scene.h"
|
#include "lc_scene.h"
|
||||||
|
|
||||||
|
lcGLWidget* lcGLWidget::mLastFocusView;
|
||||||
|
|
||||||
lcGLWidget::lcGLWidget(lcModel* Model)
|
lcGLWidget::lcGLWidget(lcModel* Model)
|
||||||
: mModel(Model), mScene(new lcScene())
|
: mModel(Model), mScene(new lcScene())
|
||||||
{
|
{
|
||||||
|
@ -17,6 +19,9 @@ lcGLWidget::lcGLWidget(lcModel* Model)
|
||||||
|
|
||||||
lcGLWidget::~lcGLWidget()
|
lcGLWidget::~lcGLWidget()
|
||||||
{
|
{
|
||||||
|
if (mLastFocusView == this)
|
||||||
|
mLastFocusView = nullptr;
|
||||||
|
|
||||||
if (mDeleteContext)
|
if (mDeleteContext)
|
||||||
delete mContext;
|
delete mContext;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +31,12 @@ lcModel* lcGLWidget::GetActiveModel() const
|
||||||
return !mActiveSubmodelInstance ? mModel : mActiveSubmodelInstance->mPieceInfo->GetModel();
|
return !mActiveSubmodelInstance ? mModel : mActiveSubmodelInstance->mPieceInfo->GetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lcGLWidget::SetFocus(bool Focus)
|
||||||
|
{
|
||||||
|
if (Focus)
|
||||||
|
mLastFocusView = this;
|
||||||
|
}
|
||||||
|
|
||||||
void lcGLWidget::SetMousePosition(int MouseX, int MouseY)
|
void lcGLWidget::SetMousePosition(int MouseX, int MouseY)
|
||||||
{
|
{
|
||||||
mMouseX = MouseX;
|
mMouseX = MouseX;
|
||||||
|
@ -388,6 +399,47 @@ void lcGLWidget::DrawBackground() const
|
||||||
Context->SetDepthWrite(true);
|
Context->SetDepthWrite(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lcGLWidget::DrawViewport() const
|
||||||
|
{
|
||||||
|
mContext->SetWorldMatrix(lcMatrix44Identity());
|
||||||
|
mContext->SetViewMatrix(lcMatrix44Translation(lcVector3(0.375, 0.375, 0.0)));
|
||||||
|
mContext->SetProjectionMatrix(lcMatrix44Ortho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f));
|
||||||
|
|
||||||
|
mContext->SetDepthWrite(false);
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
mContext->SetMaterial(lcMaterialType::UnlitColor);
|
||||||
|
|
||||||
|
if (mLastFocusView == this)
|
||||||
|
mContext->SetColor(lcVector4FromColor(lcGetPreferences().mActiveViewColor));
|
||||||
|
else
|
||||||
|
mContext->SetColor(lcVector4FromColor(lcGetPreferences().mInactiveViewColor));
|
||||||
|
|
||||||
|
float Verts[8] = { 0.0f, 0.0f, mWidth - 1.0f, 0.0f, mWidth - 1.0f, mHeight - 1.0f, 0.0f, mHeight - 1.0f };
|
||||||
|
|
||||||
|
mContext->SetVertexBufferPointer(Verts);
|
||||||
|
mContext->SetVertexFormatPosition(2);
|
||||||
|
mContext->DrawPrimitives(GL_LINE_LOOP, 0, 4);
|
||||||
|
|
||||||
|
const char* CameraName = mCamera->GetName();
|
||||||
|
|
||||||
|
if (CameraName[0])
|
||||||
|
{
|
||||||
|
mContext->SetMaterial(lcMaterialType::UnlitTextureModulate);
|
||||||
|
mContext->SetColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
mContext->BindTexture2D(gTexFont.GetTexture());
|
||||||
|
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
|
gTexFont.PrintText(mContext, 3.0f, (float)mHeight - 1.0f - 6.0f, 0.0f, CameraName);
|
||||||
|
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
}
|
||||||
|
|
||||||
|
mContext->SetDepthWrite(true);
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
}
|
||||||
|
|
||||||
void lcGLWidget::DrawAxes() const
|
void lcGLWidget::DrawAxes() const
|
||||||
{
|
{
|
||||||
// glClear(GL_DEPTH_BUFFER_BIT);
|
// glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
|
@ -111,6 +111,7 @@ public:
|
||||||
return mMouseY;
|
return mMouseY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetFocus(bool Focus);
|
||||||
void SetMousePosition(int MouseX, int MouseY);
|
void SetMousePosition(int MouseX, int MouseY);
|
||||||
void SetMouseModifiers(Qt::KeyboardModifiers MouseModifiers);
|
void SetMouseModifiers(Qt::KeyboardModifiers MouseModifiers);
|
||||||
void SetContext(lcContext* Context);
|
void SetContext(lcContext* Context);
|
||||||
|
@ -124,6 +125,7 @@ public:
|
||||||
lcMatrix44 GetProjectionMatrix() const;
|
lcMatrix44 GetProjectionMatrix() const;
|
||||||
|
|
||||||
void DrawBackground() const;
|
void DrawBackground() const;
|
||||||
|
void DrawViewport() const;
|
||||||
void DrawAxes() const;
|
void DrawAxes() const;
|
||||||
|
|
||||||
virtual void OnDraw() { }
|
virtual void OnDraw() { }
|
||||||
|
@ -162,7 +164,7 @@ protected:
|
||||||
int mMouseDownY = 0;
|
int mMouseDownY = 0;
|
||||||
Qt::KeyboardModifiers mMouseModifiers = Qt::NoModifier;
|
Qt::KeyboardModifiers mMouseModifiers = Qt::NoModifier;
|
||||||
|
|
||||||
bool mTrackUpdated;
|
bool mTrackUpdated = false;
|
||||||
lcTrackTool mTrackTool = lcTrackTool::None;
|
lcTrackTool mTrackTool = lcTrackTool::None;
|
||||||
lcTrackButton mTrackButton = lcTrackButton::None;
|
lcTrackButton mTrackButton = lcTrackButton::None;
|
||||||
lcCursor mCursor = lcCursor::Default;
|
lcCursor mCursor = lcCursor::Default;
|
||||||
|
@ -175,4 +177,6 @@ protected:
|
||||||
|
|
||||||
lcCamera* mCamera = nullptr;
|
lcCamera* mCamera = nullptr;
|
||||||
bool mDeleteContext = true;
|
bool mDeleteContext = true;
|
||||||
|
|
||||||
|
static lcGLWidget* mLastFocusView;
|
||||||
};
|
};
|
||||||
|
|
|
@ -239,30 +239,6 @@ void lcPreviewWidget::SetViewpoint(const lcVector3& Position)
|
||||||
Redraw();
|
Redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcPreviewWidget::DrawViewport()
|
|
||||||
{
|
|
||||||
mContext->SetWorldMatrix(lcMatrix44Identity());
|
|
||||||
mContext->SetViewMatrix(lcMatrix44Translation(lcVector3(0.375, 0.375, 0.0)));
|
|
||||||
mContext->SetProjectionMatrix(lcMatrix44Ortho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f));
|
|
||||||
|
|
||||||
mContext->SetDepthWrite(false);
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
|
||||||
|
|
||||||
if (true/*we have an active view*/)
|
|
||||||
{
|
|
||||||
mContext->SetMaterial(lcMaterialType::UnlitColor);
|
|
||||||
mContext->SetColor(lcVector4FromColor(lcGetPreferences().mPreviewActiveColor));
|
|
||||||
float Verts[8] = { 0.0f, 0.0f, mWidth - 1.0f, 0.0f, mWidth - 1.0f, mHeight - 1.0f, 0.0f, mHeight - 1.0f };
|
|
||||||
|
|
||||||
mContext->SetVertexBufferPointer(Verts);
|
|
||||||
mContext->SetVertexFormatPosition(2);
|
|
||||||
mContext->DrawPrimitives(GL_LINE_LOOP, 0, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
mContext->SetDepthWrite(true);
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
void lcPreviewWidget::StopTracking(bool Accept)
|
void lcPreviewWidget::StopTracking(bool Accept)
|
||||||
{
|
{
|
||||||
if (mTrackButton == lcTrackButton::None)
|
if (mTrackButton == lcTrackButton::None)
|
||||||
|
|
|
@ -68,8 +68,6 @@ public:
|
||||||
void OnMouseWheel(float Direction) override;
|
void OnMouseWheel(float Direction) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void DrawViewport();
|
|
||||||
|
|
||||||
void StopTracking(bool Accept);
|
void StopTracking(bool Accept);
|
||||||
void OnButtonDown(lcTrackButton TrackButton);
|
void OnButtonDown(lcTrackButton TrackButton);
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,7 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
|
||||||
lcProfileEntry("Settings", "AxesColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_AXES_COLOR
|
lcProfileEntry("Settings", "AxesColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_AXES_COLOR
|
||||||
lcProfileEntry("Settings", "OverlayColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_OVERLAY_COLOR
|
lcProfileEntry("Settings", "OverlayColor", LC_RGBA(0, 0, 0, 255)), // LC_PROFILE_OVERLAY_COLOR
|
||||||
lcProfileEntry("Settings", "ActiveViewColor", LC_RGBA(41, 128, 185, 255)), // LC_PROFILE_ACTIVE_VIEW_COLOR
|
lcProfileEntry("Settings", "ActiveViewColor", LC_RGBA(41, 128, 185, 255)), // LC_PROFILE_ACTIVE_VIEW_COLOR
|
||||||
|
lcProfileEntry("Settings", "InactiveViewColor", LC_RGBA(69, 69, 69, 255)), // LC_PROFILE_INACTIVE_VIEW_COLOR
|
||||||
lcProfileEntry("Settings", "DrawEdgeLines", 1), // LC_PROFILE_DRAW_EDGE_LINES
|
lcProfileEntry("Settings", "DrawEdgeLines", 1), // LC_PROFILE_DRAW_EDGE_LINES
|
||||||
lcProfileEntry("Settings", "GridStuds", 1), // LC_PROFILE_GRID_STUDS
|
lcProfileEntry("Settings", "GridStuds", 1), // LC_PROFILE_GRID_STUDS
|
||||||
lcProfileEntry("Settings", "GridStudColor", LC_RGBA(24, 24, 24, 192)), // LC_PROFILE_GRID_STUD_COLOR
|
lcProfileEntry("Settings", "GridStudColor", LC_RGBA(24, 24, 24, 192)), // LC_PROFILE_GRID_STUD_COLOR
|
||||||
|
@ -128,18 +129,17 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
|
||||||
lcProfileEntry("POVRay", "Path", "/usr/bin/povray"), // LC_PROFILE_POVRAY_PATH
|
lcProfileEntry("POVRay", "Path", "/usr/bin/povray"), // LC_PROFILE_POVRAY_PATH
|
||||||
lcProfileEntry("POVRay", "LGEOPath", ""), // LC_PROFILE_POVRAY_LGEO_PATH
|
lcProfileEntry("POVRay", "LGEOPath", ""), // LC_PROFILE_POVRAY_LGEO_PATH
|
||||||
lcProfileEntry("POVRay", "Width", 1280), // LC_PROFILE_POVRAY_WIDTH
|
lcProfileEntry("POVRay", "Width", 1280), // LC_PROFILE_POVRAY_WIDTH
|
||||||
lcProfileEntry("POVRay", "Height", 720), // LC_PROFILE_POVRAY_HEIGHT
|
lcProfileEntry("POVRay", "Height", 720), // LC_PROFILE_POVRAY_HEIGHT
|
||||||
|
|
||||||
lcProfileEntry("Settings", "PreviewActiveColor", LC_RGBA(69, 69, 69, 255)), // LC_PROFILE_PREVIEW_ACTIVE_COLOR
|
lcProfileEntry("Settgins", "PreviewViewSphereEnabled", 1), // LC_PROFILE_PREVIEW_VIEW_SPHERE_ENABLED
|
||||||
lcProfileEntry("Settgins", "PreviewViewSphereEnabled", 1), // LC_PROFILE_PREVIEW_VIEW_SPHERE_ENABLED
|
lcProfileEntry("Settings", "PreviewViewSphereSize", 75), // LC_PROFILE_PREVIEW_VIEW_SPHERE_SIZE
|
||||||
lcProfileEntry("Settings", "PreviewViewSphereSize", 75), // LC_PROFILE_PREVIEW_VIEW_SPHERE_SIZE
|
|
||||||
lcProfileEntry("Settings", "PreviewViewSphereLocation", (int)lcViewSphereLocation::TopRight), // LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION
|
lcProfileEntry("Settings", "PreviewViewSphereLocation", (int)lcViewSphereLocation::TopRight), // LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION
|
||||||
lcProfileEntry("Settings", "PreviewEnabled", 1), // LC_PROFILE_PREVIEW_ENABLED
|
lcProfileEntry("Settings", "PreviewEnabled", 1), // LC_PROFILE_PREVIEW_ENABLED
|
||||||
lcProfileEntry("Settings", "PreviewSize", 300), // LC_PROFILE_PREVIEW_SIZE
|
lcProfileEntry("Settings", "PreviewSize", 300), // LC_PROFILE_PREVIEW_SIZE
|
||||||
lcProfileEntry("Settings", "PreviewLocation", (int)lcPreviewLocation::BottomRight), // LC_PROFILE_PREVIEW_LOCATION
|
lcProfileEntry("Settings", "PreviewLocation", (int)lcPreviewLocation::BottomRight), // LC_PROFILE_PREVIEW_LOCATION
|
||||||
lcProfileEntry("Settings", "PreviewPosition", (int)lcPreviewPosition::Dockable), // LC_PROFILE_PREVIEW_POSITION
|
lcProfileEntry("Settings", "PreviewPosition", (int)lcPreviewPosition::Dockable), // LC_PROFILE_PREVIEW_POSITION
|
||||||
lcProfileEntry("Settings", "DrawPreviewAxis", 0), // LC_PROFILE_PREVIEW_DRAW_AXES
|
lcProfileEntry("Settings", "DrawPreviewAxis", 0), // LC_PROFILE_PREVIEW_DRAW_AXES
|
||||||
lcProfileEntry("Settings", "DrawPreviewViewSphere",1) // LC_PROFILE_PREVIEW_DRAW_VIEW_SPHERE
|
lcProfileEntry("Settings", "DrawPreviewViewSphere",1) // LC_PROFILE_PREVIEW_DRAW_VIEW_SPHERE
|
||||||
};
|
};
|
||||||
|
|
||||||
void lcRemoveProfileKey(LC_PROFILE_KEY Key)
|
void lcRemoveProfileKey(LC_PROFILE_KEY Key)
|
||||||
|
|
|
@ -20,6 +20,7 @@ enum LC_PROFILE_KEY
|
||||||
LC_PROFILE_AXES_COLOR,
|
LC_PROFILE_AXES_COLOR,
|
||||||
LC_PROFILE_OVERLAY_COLOR,
|
LC_PROFILE_OVERLAY_COLOR,
|
||||||
LC_PROFILE_ACTIVE_VIEW_COLOR,
|
LC_PROFILE_ACTIVE_VIEW_COLOR,
|
||||||
|
LC_PROFILE_INACTIVE_VIEW_COLOR,
|
||||||
LC_PROFILE_DRAW_EDGE_LINES,
|
LC_PROFILE_DRAW_EDGE_LINES,
|
||||||
LC_PROFILE_GRID_STUDS,
|
LC_PROFILE_GRID_STUDS,
|
||||||
LC_PROFILE_GRID_STUD_COLOR,
|
LC_PROFILE_GRID_STUD_COLOR,
|
||||||
|
@ -78,7 +79,6 @@ enum LC_PROFILE_KEY
|
||||||
LC_PROFILE_POVRAY_WIDTH,
|
LC_PROFILE_POVRAY_WIDTH,
|
||||||
LC_PROFILE_POVRAY_HEIGHT,
|
LC_PROFILE_POVRAY_HEIGHT,
|
||||||
|
|
||||||
LC_PROFILE_PREVIEW_ACTIVE_COLOR,
|
|
||||||
LC_PROFILE_PREVIEW_VIEW_SPHERE_ENABLED,
|
LC_PROFILE_PREVIEW_VIEW_SPHERE_ENABLED,
|
||||||
LC_PROFILE_PREVIEW_VIEW_SPHERE_SIZE,
|
LC_PROFILE_PREVIEW_VIEW_SPHERE_SIZE,
|
||||||
LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION,
|
LC_PROFILE_PREVIEW_VIEW_SPHERE_LOCATION,
|
||||||
|
|
|
@ -323,29 +323,7 @@ void MinifigWizard::OnDraw()
|
||||||
|
|
||||||
DrawBackground();
|
DrawBackground();
|
||||||
|
|
||||||
// todo: temp viewport drawing code until this is merged with View
|
DrawViewport();
|
||||||
{
|
|
||||||
mContext->SetWorldMatrix(lcMatrix44Identity());
|
|
||||||
mContext->SetViewMatrix(lcMatrix44Translation(lcVector3(0.375, 0.375, 0.0)));
|
|
||||||
mContext->SetProjectionMatrix(lcMatrix44Ortho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f));
|
|
||||||
|
|
||||||
mContext->SetDepthWrite(false);
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
|
||||||
|
|
||||||
// if (gMainWindow->GetActiveView() == this)
|
|
||||||
{
|
|
||||||
mContext->SetMaterial(lcMaterialType::UnlitColor);
|
|
||||||
mContext->SetColor(lcVector4FromColor(lcGetPreferences().mActiveViewColor));
|
|
||||||
float Verts[8] = { 0.0f, 0.0f, mWidth - 1.0f, 0.0f, mWidth - 1.0f, mHeight - 1.0f, 0.0f, mHeight - 1.0f };
|
|
||||||
|
|
||||||
mContext->SetVertexBufferPointer(Verts);
|
|
||||||
mContext->SetVertexFormatPosition(2);
|
|
||||||
mContext->DrawPrimitives(GL_LINE_LOOP, 0, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
mContext->SetDepthWrite(true);
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
lcVector3 Min(FLT_MAX, FLT_MAX, FLT_MAX), Max(-FLT_MAX, -FLT_MAX, -FLT_MAX);
|
lcVector3 Min(FLT_MAX, FLT_MAX, FLT_MAX), Max(-FLT_MAX, -FLT_MAX, -FLT_MAX);
|
||||||
|
|
||||||
|
|
|
@ -1660,45 +1660,6 @@ void View::DrawGrid()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::DrawViewport()
|
|
||||||
{
|
|
||||||
mContext->SetWorldMatrix(lcMatrix44Identity());
|
|
||||||
mContext->SetViewMatrix(lcMatrix44Translation(lcVector3(0.375, 0.375, 0.0)));
|
|
||||||
mContext->SetProjectionMatrix(lcMatrix44Ortho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f));
|
|
||||||
|
|
||||||
mContext->SetDepthWrite(false);
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
|
||||||
|
|
||||||
if (gMainWindow->GetActiveView() == this)
|
|
||||||
{
|
|
||||||
mContext->SetMaterial(lcMaterialType::UnlitColor);
|
|
||||||
mContext->SetColor(lcVector4FromColor(lcGetPreferences().mActiveViewColor));
|
|
||||||
float Verts[8] = { 0.0f, 0.0f, mWidth - 1.0f, 0.0f, mWidth - 1.0f, mHeight - 1.0f, 0.0f, mHeight - 1.0f };
|
|
||||||
|
|
||||||
mContext->SetVertexBufferPointer(Verts);
|
|
||||||
mContext->SetVertexFormatPosition(2);
|
|
||||||
mContext->DrawPrimitives(GL_LINE_LOOP, 0, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* CameraName = mCamera->GetName();
|
|
||||||
|
|
||||||
if (CameraName[0])
|
|
||||||
{
|
|
||||||
mContext->SetMaterial(lcMaterialType::UnlitTextureModulate);
|
|
||||||
mContext->SetColor(0.0f, 0.0f, 0.0f, 1.0f);
|
|
||||||
mContext->BindTexture2D(gTexFont.GetTexture());
|
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
|
|
||||||
gTexFont.PrintText(mContext, 3.0f, (float)mHeight - 1.0f - 6.0f, 0.0f, CameraName);
|
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
|
||||||
}
|
|
||||||
|
|
||||||
mContext->SetDepthWrite(true);
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
void View::OnInitialUpdate()
|
void View::OnInitialUpdate()
|
||||||
{
|
{
|
||||||
gMainWindow->AddView(this);
|
gMainWindow->AddView(this);
|
||||||
|
|
|
@ -89,7 +89,6 @@ protected:
|
||||||
void DrawSelectZoomRegionOverlay();
|
void DrawSelectZoomRegionOverlay();
|
||||||
void DrawRotateViewOverlay();
|
void DrawRotateViewOverlay();
|
||||||
void DrawGrid();
|
void DrawGrid();
|
||||||
void DrawViewport();
|
|
||||||
|
|
||||||
void UpdateTrackTool();
|
void UpdateTrackTool();
|
||||||
bool IsTrackToolAllowed(lcTrackTool TrackTool, quint32 AllowedTransforms) const;
|
bool IsTrackToolAllowed(lcTrackTool TrackTool, quint32 AllowedTransforms) const;
|
||||||
|
|
|
@ -137,7 +137,6 @@ void lcQGLWidget::SetPreviewPosition(const QRect& ParentRect)
|
||||||
|
|
||||||
setMinimumSize(100,100);
|
setMinimumSize(100,100);
|
||||||
show();
|
show();
|
||||||
setFocus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcQGLWidget::resizeGL(int Width, int Height)
|
void lcQGLWidget::resizeGL(int Width, int Height)
|
||||||
|
@ -151,6 +150,22 @@ void lcQGLWidget::paintGL()
|
||||||
mWidget->OnDraw();
|
mWidget->OnDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lcQGLWidget::focusInEvent(QFocusEvent* FocusEvent)
|
||||||
|
{
|
||||||
|
if (mWidget)
|
||||||
|
mWidget->SetFocus(true);
|
||||||
|
|
||||||
|
QGLWidget::focusInEvent(FocusEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcQGLWidget::focusOutEvent(QFocusEvent* FocusEvent)
|
||||||
|
{
|
||||||
|
if (mWidget)
|
||||||
|
mWidget->SetFocus(false);
|
||||||
|
|
||||||
|
QGLWidget::focusOutEvent(FocusEvent);
|
||||||
|
}
|
||||||
|
|
||||||
void lcQGLWidget::keyPressEvent(QKeyEvent* KeyEvent)
|
void lcQGLWidget::keyPressEvent(QKeyEvent* KeyEvent)
|
||||||
{
|
{
|
||||||
if (KeyEvent->key() == Qt::Key_Control || KeyEvent->key() == Qt::Key_Shift)
|
if (KeyEvent->key() == Qt::Key_Control || KeyEvent->key() == Qt::Key_Shift)
|
||||||
|
|
|
@ -26,6 +26,8 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void resizeGL(int Width, int Height) override;
|
void resizeGL(int Width, int Height) override;
|
||||||
void paintGL() override;
|
void paintGL() override;
|
||||||
|
void focusInEvent(QFocusEvent* FocusEvent) override;
|
||||||
|
void focusOutEvent(QFocusEvent* FocusEvent) override;
|
||||||
void keyPressEvent(QKeyEvent* KeyEvent) override;
|
void keyPressEvent(QKeyEvent* KeyEvent) override;
|
||||||
void keyReleaseEvent(QKeyEvent* KeyEvent) override;
|
void keyReleaseEvent(QKeyEvent* KeyEvent) override;
|
||||||
void mousePressEvent(QMouseEvent* MouseEvent) override;
|
void mousePressEvent(QMouseEvent* MouseEvent) override;
|
||||||
|
|
Loading…
Reference in a new issue