Skip to content

Commit

Permalink
#5679: Add X, Y, Z axis names when displaying the degrees value
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Aug 1, 2021
1 parent 6743a34 commit 8ca0654
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
17 changes: 14 additions & 3 deletions radiantcore/selection/manipulators/RotateManipulator.cpp
Expand Up @@ -156,17 +156,28 @@ void RotateManipulator::render(RenderableCollector& collector, const VolumeTest&
collector.addRenderable(*_pivotPointShader, *this, Matrix4::getIdentity());
}

std::string RotateManipulator::getRotationAxisName() const
{
if (_selectableX.isSelected()) return "X";
if (_selectableY.isSelected()) return "Y";
if (_selectableZ.isSelected()) return "Z";

return std::string();
}

void RotateManipulator::render(const RenderInfo& info) const
{
if (_selectableX.isSelected() || _selectableY.isSelected() ||
_selectableZ.isSelected() || _selectableScreen.isSelected())
if (_selectableX.isSelected() || _selectableY.isSelected() ||
_selectableZ.isSelected() || _selectableScreen.isSelected())
{
glColor3d(0.75, 0, 0);

glRasterPos3dv(_pivot2World._worldSpace.tCol().getVector3() - Vector3(10, 10, 10));

double angle = static_cast<double>(c_RAD2DEGMULT * _rotateAxis.getCurAngle());
_glFont->drawString(fmt::format("Rotate: {0:3.2f} degrees", angle));
auto rotationAxisName = getRotationAxisName();

_glFont->drawString(fmt::format("Rotate: {0:3.2f} degrees {1}", angle, rotationAxisName));
}
}

Expand Down
3 changes: 3 additions & 0 deletions radiantcore/selection/manipulators/RotateManipulator.h
Expand Up @@ -79,6 +79,9 @@ class RotateManipulator :
bool isSelected() const override;

void rotate(const Quaternion& rotation) override;

private:
std::string getRotationAxisName() const;
};

}

0 comments on commit 8ca0654

Please sign in to comment.