mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-01-21 05:00:06 -05:00
--Code changes
-Tabify.
This commit is contained in:
parent
8c4d9fd866
commit
73efd76bdd
@ -114,8 +114,8 @@ public:
|
||||
bool ApplyAll();
|
||||
void SetRotation(double rot, bool stealth);
|
||||
void SetScale(double scale);
|
||||
void SetPitch(double pitch);
|
||||
void SetYaw(double yaw);
|
||||
void SetPitch(double pitch);
|
||||
void SetYaw(double yaw);
|
||||
void SetCoordinateStatus(int rasX, int rasY, float worldX, float worldY);
|
||||
void CenterScrollbars();
|
||||
|
||||
|
@ -58,7 +58,7 @@ void Fractorium::InitParamsUI()
|
||||
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_CenterYSpin, spinHeight, -dmax, dmax, 0.05, SIGNAL(valueChanged(double)), SLOT(OnCenterYChanged(double)), true, 0, 0, 0);
|
||||
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_ScaleSpin, spinHeight, 10, dmax, 20, SIGNAL(valueChanged(double)), SLOT(OnScaleChanged(double)), true, 240, 240, 240);
|
||||
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_ZoomSpin, spinHeight, 0, 25, 0.2, SIGNAL(valueChanged(double)), SLOT(OnZoomChanged(double)), true, 0, 0, 0);
|
||||
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_RotateSpin, spinHeight, -dmax, dmax, 10, SIGNAL(valueChanged(double)), SLOT(OnRotateChanged(double)), true, 0, 0, 0);
|
||||
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_RotateSpin, spinHeight, -dmax, dmax, 10, SIGNAL(valueChanged(double)), SLOT(OnRotateChanged(double)), true, 0, 0, 0);
|
||||
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_ZPosSpin, spinHeight, -1000, 1000, 0.1, SIGNAL(valueChanged(double)), SLOT(OnZPosChanged(double)), true, 0, 1, 0);
|
||||
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_PerspectiveSpin, spinHeight, -500, 500, 0.01, SIGNAL(valueChanged(double)), SLOT(OnPerspectiveChanged(double)), true, 0, 1, 0);
|
||||
SetupSpinner<DoubleSpinBox, double>(table, this, row, 1, m_PitchSpin, spinHeight, -dmax, dmax, 1, SIGNAL(valueChanged(double)), SLOT(OnPitchChanged(double)), true, 0, 45, 0);
|
||||
@ -423,12 +423,12 @@ template <typename T> void FractoriumEmberController<T>::RotateChanged(double d)
|
||||
}
|
||||
void Fractorium::OnRotateChanged(double d)
|
||||
{
|
||||
if(d < -180)
|
||||
d = 180 - ((-d + m_RotateSpin->value()) - (180 + m_RotateSpin->value()));
|
||||
else if(d > 180)
|
||||
d = -180 + ((d - m_RotateSpin->value()) - (180 - m_RotateSpin->value()));
|
||||
if (d < -180)
|
||||
d = 180 - ((-d + m_RotateSpin->value()) - (180 + m_RotateSpin->value()));
|
||||
else if (d > 180)
|
||||
d = -180 + ((d - m_RotateSpin->value()) - (180 - m_RotateSpin->value()));
|
||||
|
||||
m_Controller->RotateChanged(d); // d is ever between -180 and +180
|
||||
m_Controller->RotateChanged(d); // d is ever between -180 and +180
|
||||
}
|
||||
|
||||
template <typename T> void FractoriumEmberController<T>::ZPosChanged(double d)
|
||||
@ -935,7 +935,7 @@ void Fractorium::SetScale(double scale)
|
||||
/// <param name="pitch">The pitch value</param>
|
||||
void Fractorium::SetPitch(double pitch)
|
||||
{
|
||||
m_PitchSpin->setValue(pitch);
|
||||
m_PitchSpin->setValue(pitch);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -945,7 +945,7 @@ void Fractorium::SetPitch(double pitch)
|
||||
/// <param name="yaw">The yaw value</param>
|
||||
void Fractorium::SetYaw(double yaw)
|
||||
{
|
||||
m_YawSpin->setValue(yaw);
|
||||
m_YawSpin->setValue(yaw);
|
||||
}
|
||||
|
||||
template class FractoriumEmberController<float>;
|
||||
|
@ -137,8 +137,8 @@ private:
|
||||
T m_CenterDownY;
|
||||
T m_RotationDown;
|
||||
T m_ScaleDown;
|
||||
T m_PitchDown;
|
||||
T m_YawDown;
|
||||
T m_PitchDown;
|
||||
T m_YawDown;
|
||||
v4T m_BoundsDown;
|
||||
|
||||
v3T m_MouseWorldPos;
|
||||
|
@ -891,7 +891,7 @@ void GLEmberController<T>::MousePress(QMouseEvent* e)
|
||||
m_DragState = eDragState::DragNone;
|
||||
}
|
||||
}
|
||||
else if (e->button() == Qt::MiddleButton || (e->button() == Qt::RightButton && e->modifiers() & Qt::ShiftModifier && !(e->modifiers() & Qt::AltModifier)))//Middle button or right button with shift key, do whole image translation.
|
||||
else if (e->button() == Qt::MiddleButton || (e->button() == Qt::RightButton && e->modifiers() & Qt::ShiftModifier && !(e->modifiers() & Qt::AltModifier)))//Middle button or right button with shift key, do whole image translation.
|
||||
{
|
||||
m_CenterDownX = ember->m_CenterX;//Capture where the center of the image is because this value will change when panning.
|
||||
m_CenterDownY = ember->m_CenterY;
|
||||
@ -901,21 +901,21 @@ void GLEmberController<T>::MousePress(QMouseEvent* e)
|
||||
{
|
||||
if (m_Fractorium->DrawImage())
|
||||
{
|
||||
m_CenterDownX = ember->m_CenterX;//Capture these because they will change when rotating and scaling.
|
||||
m_CenterDownY = ember->m_CenterY;
|
||||
m_CenterDownX = ember->m_CenterX;//Capture these because they will change when rotating and scaling.
|
||||
m_CenterDownY = ember->m_CenterY;
|
||||
|
||||
if(GetAlt() && GetShift())
|
||||
{
|
||||
m_PitchDown = ember->m_CamPitch * RAD_2_DEG_T;
|
||||
m_YawDown = ember->m_CamYaw * RAD_2_DEG_T;
|
||||
m_DragState = eDragState::DragPitchYaw;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_RotationDown = ember->m_Rotate;
|
||||
m_ScaleDown = ember->m_PixelsPerUnit;
|
||||
m_DragState = eDragState::DragRotateScale;
|
||||
}
|
||||
if (GetAlt() && GetShift())
|
||||
{
|
||||
m_PitchDown = ember->m_CamPitch * RAD_2_DEG_T;
|
||||
m_YawDown = ember->m_CamYaw * RAD_2_DEG_T;
|
||||
m_DragState = eDragState::DragPitchYaw;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_RotationDown = ember->m_Rotate;
|
||||
m_ScaleDown = ember->m_PixelsPerUnit;
|
||||
m_DragState = eDragState::DragRotateScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1064,26 +1064,26 @@ void GLEmberController<T>::MouseMove(QMouseEvent* e)
|
||||
m_Fractorium->SetRotation(ember->m_Rotate, true);
|
||||
m_Fractorium->SetScale(std::max(T(10), m_ScaleDown + scale));//Will restart the rendering process.
|
||||
}
|
||||
else if (m_DragState == eDragState::DragPitchYaw)//Pitching and yawing the whole image.
|
||||
{
|
||||
T pitch;
|
||||
T yaw;
|
||||
auto rotate = ember->m_Rotate;
|
||||
else if (m_DragState == eDragState::DragPitchYaw)//Pitching and yawing the whole image.
|
||||
{
|
||||
T pitch;
|
||||
T yaw;
|
||||
auto rotate = ember->m_Rotate;
|
||||
|
||||
if((rotate <= 45 && rotate >= -45) || (rotate >= 135) || (rotate <= -135))
|
||||
{
|
||||
pitch = m_PitchDown + (m_MouseWorldPos.y - m_MouseDownWorldPos.y) * 100;
|
||||
yaw = m_YawDown + (m_MouseWorldPos.x - m_MouseDownWorldPos.x) * 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
pitch = m_PitchDown + (m_MouseWorldPos.x - m_MouseDownWorldPos.x) * 100;
|
||||
yaw = m_YawDown + (m_MouseWorldPos.y - m_MouseDownWorldPos.y) * 100;
|
||||
}
|
||||
if ((rotate <= 45 && rotate >= -45) || (rotate >= 135) || (rotate <= -135))
|
||||
{
|
||||
pitch = m_PitchDown + (m_MouseWorldPos.y - m_MouseDownWorldPos.y) * 100;
|
||||
yaw = m_YawDown + (m_MouseWorldPos.x - m_MouseDownWorldPos.x) * 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
pitch = m_PitchDown + (m_MouseWorldPos.x - m_MouseDownWorldPos.x) * 100;
|
||||
yaw = m_YawDown + (m_MouseWorldPos.y - m_MouseDownWorldPos.y) * 100;
|
||||
}
|
||||
|
||||
m_Fractorium->SetPitch(pitch);
|
||||
m_Fractorium->SetYaw(yaw);
|
||||
}
|
||||
m_Fractorium->SetPitch(pitch);
|
||||
m_Fractorium->SetYaw(yaw);
|
||||
}
|
||||
else
|
||||
{
|
||||
//If the user doesn't already have a key down, and they aren't dragging, clear the keys to be safe.
|
||||
@ -1392,21 +1392,21 @@ void GLWidget::DrawUnitSquare()
|
||||
GLfloat vertices[] =//Should these be of type T?//TODO
|
||||
{
|
||||
-1, -1,
|
||||
1, -1,
|
||||
-1, 1,
|
||||
1, 1,
|
||||
-1, -1,
|
||||
-1, 1,
|
||||
1, -1,
|
||||
1, 1
|
||||
};
|
||||
1, -1,
|
||||
-1, 1,
|
||||
1, 1,
|
||||
-1, -1,
|
||||
-1, 1,
|
||||
1, -1,
|
||||
1, 1
|
||||
};
|
||||
QVector4D col(1.0f, 1.0f, 1.0f, 0.25f);
|
||||
DrawPointOrLine(col, vertices, 8, GL_LINES);
|
||||
GLfloat vertices2[] =//Should these be of type T?//TODO
|
||||
{
|
||||
-1, 0,
|
||||
1, 0
|
||||
};
|
||||
1, 0
|
||||
};
|
||||
QVector4D col2(1.0f, 0.0f, 0.0f, 0.5f);
|
||||
DrawPointOrLine(col2, vertices2, 2, GL_LINES);
|
||||
GLfloat vertices3[] =//Should these be of type T?//TODO
|
||||
|
Loading…
Reference in New Issue
Block a user