fix: Rename camera state members to avoid name conflicts

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-02-09 18:13:41 -07:00
parent 7955af77be
commit b0a32940b0
2 changed files with 47 additions and 47 deletions

View File

@@ -32,47 +32,47 @@ void ViewportWidget::setDocument(Document* document)
m_featureBrowser->setDocument(document); m_featureBrowser->setDocument(document);
} }
float ViewportWidget::xRotation() const { return xRot; } float ViewportWidget::xRotation() const { return m_xRot; }
void ViewportWidget::setXRotation(float angle) void ViewportWidget::setXRotation(float angle)
{ {
if (angle != xRot) { if (angle != m_xRot) {
xRot = angle; m_xRot = angle;
update(); update();
} }
} }
float ViewportWidget::yRotation() const { return yRot; } float ViewportWidget::yRotation() const { return m_yRot; }
void ViewportWidget::setYRotation(float angle) void ViewportWidget::setYRotation(float angle)
{ {
if (angle != yRot) { if (angle != m_yRot) {
yRot = angle; m_yRot = angle;
update(); update();
} }
} }
float ViewportWidget::zoom() const { return zoom; } float ViewportWidget::zoom() const { return m_zoom; }
void ViewportWidget::setZoom(float value) void ViewportWidget::setZoom(float value)
{ {
if (value != zoom) { if (value != m_zoom) {
zoom = value; m_zoom = value;
update(); update();
} }
} }
float ViewportWidget::panX() const { return panX; } float ViewportWidget::panX() const { return m_panX; }
void ViewportWidget::setPanX(float value) void ViewportWidget::setPanX(float value)
{ {
if (value != panX) { if (value != m_panX) {
panX = value; m_panX = value;
update(); update();
} }
} }
float ViewportWidget::panY() const { return panY; } float ViewportWidget::panY() const { return m_panY; }
void ViewportWidget::setPanY(float value) void ViewportWidget::setPanY(float value)
{ {
if (value != panY) { if (value != m_panY) {
panY = value; m_panY = value;
update(); update();
} }
} }
@@ -96,9 +96,9 @@ void ViewportWidget::paintGL()
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
QMatrix4x4 model; QMatrix4x4 model;
model.translate(panX, panY, zoom); model.translate(m_panX, m_panY, m_zoom);
model.rotate(xRot / 16.0f, 1, 0, 0); model.rotate(m_xRot / 16.0f, 1, 0, 0);
model.rotate(yRot / 16.0f, 0, 1, 0); model.rotate(m_yRot / 16.0f, 0, 1, 0);
// For simplicity, we'll use a fixed-function pipeline style for drawing. // For simplicity, we'll use a fixed-function pipeline style for drawing.
// In a real app, this would use shaders. // In a real app, this would use shaders.
@@ -114,8 +114,8 @@ void ViewportWidget::paintGL()
// View cube rendering // View cube rendering
QMatrix4x4 viewCubeModel; QMatrix4x4 viewCubeModel;
viewCubeModel.rotate(xRot / 16.0f, 1, 0, 0); viewCubeModel.rotate(m_xRot / 16.0f, 1, 0, 0);
viewCubeModel.rotate(yRot / 16.0f, 0, 1, 0); viewCubeModel.rotate(m_yRot / 16.0f, 0, 1, 0);
m_viewCube->paintGL(viewCubeModel, width(), height()); m_viewCube->paintGL(viewCubeModel, width(), height());
glViewport(0, 0, width(), height()); glViewport(0, 0, width(), height());
@@ -147,12 +147,12 @@ void ViewportWidget::mouseMoveEvent(QMouseEvent *event)
if (event->buttons() & Qt::MiddleButton) { if (event->buttons() & Qt::MiddleButton) {
if (QApplication::keyboardModifiers() & Qt::ShiftModifier) { if (QApplication::keyboardModifiers() & Qt::ShiftModifier) {
// Pan // Pan
panX += dx / 100.0f; m_panX += dx / 100.0f;
panY -= dy / 100.0f; m_panY -= dy / 100.0f;
} else { } else {
// Rotate // Rotate
xRot += 8 * dy; m_xRot += 8 * dy;
yRot += 8 * dx; m_yRot += 8 * dx;
} }
} }
lastPos = event->pos(); lastPos = event->pos();
@@ -163,7 +163,7 @@ void ViewportWidget::wheelEvent(QWheelEvent *event)
{ {
QPoint numDegrees = event->angleDelta() / 8; QPoint numDegrees = event->angleDelta() / 8;
if (!numDegrees.isNull()) { if (!numDegrees.isNull()) {
zoom += numDegrees.y() / 5.0f; m_zoom += numDegrees.y() / 5.0f;
} }
update(); update();
} }
@@ -172,14 +172,14 @@ void ViewportWidget::startSketch(SketchPlane plane)
{ {
m_currentPlane = plane; m_currentPlane = plane;
m_savedXRot = xRot; m_savedXRot = m_xRot;
m_savedYRot = yRot; m_savedYRot = m_yRot;
m_savedPanX = panX; m_savedPanX = m_panX;
m_savedPanY = panY; m_savedPanY = m_panY;
m_savedZoom = zoom; m_savedZoom = m_zoom;
float targetXRot = xRot; float targetXRot = m_xRot;
float targetYRot = yRot; float targetYRot = m_yRot;
switch (plane) { switch (plane) {
case SketchPlane::XY: // Front view case SketchPlane::XY: // Front view
targetXRot = 0; targetXRot = 0;
@@ -201,35 +201,35 @@ void ViewportWidget::startSketch(SketchPlane plane)
auto* xRotAnim = new QPropertyAnimation(this, "xRotation"); auto* xRotAnim = new QPropertyAnimation(this, "xRotation");
xRotAnim->setDuration(300); xRotAnim->setDuration(300);
xRotAnim->setStartValue(xRot); xRotAnim->setStartValue(m_xRot);
xRotAnim->setEndValue(targetXRot); xRotAnim->setEndValue(targetXRot);
xRotAnim->setEasingCurve(QEasingCurve::InOutQuad); xRotAnim->setEasingCurve(QEasingCurve::InOutQuad);
animGroup->addAnimation(xRotAnim); animGroup->addAnimation(xRotAnim);
auto* yRotAnim = new QPropertyAnimation(this, "yRotation"); auto* yRotAnim = new QPropertyAnimation(this, "yRotation");
yRotAnim->setDuration(300); yRotAnim->setDuration(300);
yRotAnim->setStartValue(yRot); yRotAnim->setStartValue(m_yRot);
yRotAnim->setEndValue(targetYRot); yRotAnim->setEndValue(targetYRot);
yRotAnim->setEasingCurve(QEasingCurve::InOutQuad); yRotAnim->setEasingCurve(QEasingCurve::InOutQuad);
animGroup->addAnimation(yRotAnim); animGroup->addAnimation(yRotAnim);
auto* panXAnim = new QPropertyAnimation(this, "panX"); auto* panXAnim = new QPropertyAnimation(this, "panX");
panXAnim->setDuration(300); panXAnim->setDuration(300);
panXAnim->setStartValue(panX); panXAnim->setStartValue(m_panX);
panXAnim->setEndValue(0.0f); panXAnim->setEndValue(0.0f);
panXAnim->setEasingCurve(QEasingCurve::InOutQuad); panXAnim->setEasingCurve(QEasingCurve::InOutQuad);
animGroup->addAnimation(panXAnim); animGroup->addAnimation(panXAnim);
auto* panYAnim = new QPropertyAnimation(this, "panY"); auto* panYAnim = new QPropertyAnimation(this, "panY");
panYAnim->setDuration(300); panYAnim->setDuration(300);
panYAnim->setStartValue(panY); panYAnim->setStartValue(m_panY);
panYAnim->setEndValue(0.0f); panYAnim->setEndValue(0.0f);
panYAnim->setEasingCurve(QEasingCurve::InOutQuad); panYAnim->setEasingCurve(QEasingCurve::InOutQuad);
animGroup->addAnimation(panYAnim); animGroup->addAnimation(panYAnim);
auto* zoomAnim = new QPropertyAnimation(this, "zoom"); auto* zoomAnim = new QPropertyAnimation(this, "zoom");
zoomAnim->setDuration(300); zoomAnim->setDuration(300);
zoomAnim->setStartValue(zoom); zoomAnim->setStartValue(m_zoom);
zoomAnim->setEndValue(-20.0f); zoomAnim->setEndValue(-20.0f);
zoomAnim->setEasingCurve(QEasingCurve::InOutQuad); zoomAnim->setEasingCurve(QEasingCurve::InOutQuad);
animGroup->addAnimation(zoomAnim); animGroup->addAnimation(zoomAnim);
@@ -243,35 +243,35 @@ void ViewportWidget::saveSketch()
auto* xRotAnim = new QPropertyAnimation(this, "xRotation"); auto* xRotAnim = new QPropertyAnimation(this, "xRotation");
xRotAnim->setDuration(300); xRotAnim->setDuration(300);
xRotAnim->setStartValue(xRot); xRotAnim->setStartValue(m_xRot);
xRotAnim->setEndValue(m_savedXRot); xRotAnim->setEndValue(m_savedXRot);
xRotAnim->setEasingCurve(QEasingCurve::InOutQuad); xRotAnim->setEasingCurve(QEasingCurve::InOutQuad);
animGroup->addAnimation(xRotAnim); animGroup->addAnimation(xRotAnim);
auto* yRotAnim = new QPropertyAnimation(this, "yRotation"); auto* yRotAnim = new QPropertyAnimation(this, "yRotation");
yRotAnim->setDuration(300); yRotAnim->setDuration(300);
yRotAnim->setStartValue(yRot); yRotAnim->setStartValue(m_yRot);
yRotAnim->setEndValue(m_savedYRot); yRotAnim->setEndValue(m_savedYRot);
yRotAnim->setEasingCurve(QEasingCurve::InOutQuad); yRotAnim->setEasingCurve(QEasingCurve::InOutQuad);
animGroup->addAnimation(yRotAnim); animGroup->addAnimation(yRotAnim);
auto* panXAnim = new QPropertyAnimation(this, "panX"); auto* panXAnim = new QPropertyAnimation(this, "panX");
panXAnim->setDuration(300); panXAnim->setDuration(300);
panXAnim->setStartValue(panX); panXAnim->setStartValue(m_panX);
panXAnim->setEndValue(m_savedPanX); panXAnim->setEndValue(m_savedPanX);
panXAnim->setEasingCurve(QEasingCurve::InOutQuad); panXAnim->setEasingCurve(QEasingCurve::InOutQuad);
animGroup->addAnimation(panXAnim); animGroup->addAnimation(panXAnim);
auto* panYAnim = new QPropertyAnimation(this, "panY"); auto* panYAnim = new QPropertyAnimation(this, "panY");
panYAnim->setDuration(300); panYAnim->setDuration(300);
panYAnim->setStartValue(panY); panYAnim->setStartValue(m_panY);
panYAnim->setEndValue(m_savedPanY); panYAnim->setEndValue(m_savedPanY);
panYAnim->setEasingCurve(QEasingCurve::InOutQuad); panYAnim->setEasingCurve(QEasingCurve::InOutQuad);
animGroup->addAnimation(panYAnim); animGroup->addAnimation(panYAnim);
auto* zoomAnim = new QPropertyAnimation(this, "zoom"); auto* zoomAnim = new QPropertyAnimation(this, "zoom");
zoomAnim->setDuration(300); zoomAnim->setDuration(300);
zoomAnim->setStartValue(zoom); zoomAnim->setStartValue(m_zoom);
zoomAnim->setEndValue(m_savedZoom); zoomAnim->setEndValue(m_savedZoom);
zoomAnim->setEasingCurve(QEasingCurve::InOutQuad); zoomAnim->setEasingCurve(QEasingCurve::InOutQuad);
animGroup->addAnimation(zoomAnim); animGroup->addAnimation(zoomAnim);

View File

@@ -72,11 +72,11 @@ private:
FeatureBrowser* m_featureBrowser = nullptr; FeatureBrowser* m_featureBrowser = nullptr;
SketchPlane m_currentPlane = SketchPlane::NONE; SketchPlane m_currentPlane = SketchPlane::NONE;
float xRot = 0; float m_xRot = 0;
float yRot = 0; float m_yRot = 0;
float zoom = -5.0f; float m_zoom = -5.0f;
float panX = 0; float m_panX = 0;
float panY = 0; float m_panY = 0;
QPoint lastPos; QPoint lastPos;
float m_savedXRot = 0; float m_savedXRot = 0;