Skip to content

Commit

Permalink
#5436: Migrate RotateManipulator to use IGLFont
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Dec 3, 2020
1 parent a141544 commit 55b292f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions install/user.xml
Expand Up @@ -63,6 +63,8 @@
<dragResizeEntitiesSymmetrically value="1" />
<transientComponentSelection value="1" />
<offsetClonedObjects value="1" />
<manipulatorFontSize value="14" />
<manipulatorFontStyle value="Sans" />
<transformDialog>
<window xPosition="150" yPosition="200" width="260" height="314" />
<rotXStep value="45" />
Expand Down
12 changes: 12 additions & 0 deletions radiantcore/selection/RadiantSelectionSystem.cpp
Expand Up @@ -30,6 +30,12 @@
namespace selection
{

namespace
{
const std::string RKEY_MANIPULATOR_FONTSTYLE = "user/ui/manipulatorFontStyle";
const std::string RKEY_MANIPULATOR_FONTSIZE = "user/ui/manipulatorFontSize";
}

// --------- RadiantSelectionSystem Implementation ------------------------------------------

RadiantSelectionSystem::RadiantSelectionSystem() :
Expand Down Expand Up @@ -862,10 +868,15 @@ const Matrix4& RadiantSelectionSystem::getPivot2World()

void RadiantSelectionSystem::captureShaders()
{
auto manipulatorFontStyle = registry::getValue<std::string>(RKEY_MANIPULATOR_FONTSTYLE) == "Sans" ?
IGLFont::Style::Sans : IGLFont::Style::Mono;
auto manipulatorFontSize = registry::getValue<int>(RKEY_MANIPULATOR_FONTSIZE);

TranslateManipulator::_stateWire = GlobalRenderSystem().capture("$WIRE_OVERLAY");
TranslateManipulator::_stateFill = GlobalRenderSystem().capture("$FLATSHADE_OVERLAY");
RotateManipulator::_stateOuter = GlobalRenderSystem().capture("$WIRE_OVERLAY");
RotateManipulator::_pivotPointShader = GlobalRenderSystem().capture("$POINT");
RotateManipulator::_glFont = GlobalOpenGL().getFont(manipulatorFontStyle, manipulatorFontSize);
ModelScaleManipulator::_lineShader = GlobalRenderSystem().capture("$WIRE_OVERLAY");
ModelScaleManipulator::_pointShader = GlobalRenderSystem().capture("$POINT");
}
Expand All @@ -874,6 +885,7 @@ void RadiantSelectionSystem::releaseShaders()
{
TranslateManipulator::_stateWire.reset();
TranslateManipulator::_stateFill.reset();
RotateManipulator::_glFont.reset();
RotateManipulator::_stateOuter.reset();
RotateManipulator::_pivotPointShader.reset();
ModelScaleManipulator::_lineShader.reset();
Expand Down
3 changes: 2 additions & 1 deletion radiantcore/selection/manipulators/RotateManipulator.cpp
Expand Up @@ -166,7 +166,7 @@ void RotateManipulator::render(const RenderInfo& info) const
glRasterPos3dv(_pivot2World._worldSpace.t().getVector3() - Vector3(10, 10, 10));

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

Expand Down Expand Up @@ -306,5 +306,6 @@ void RotateManipulator::rotate(const Quaternion& rotation)
// Static members
ShaderPtr RotateManipulator::_stateOuter;
ShaderPtr RotateManipulator::_pivotPointShader;
IGLFont::Ptr RotateManipulator::_glFont;

}
1 change: 1 addition & 0 deletions radiantcore/selection/manipulators/RotateManipulator.h
Expand Up @@ -55,6 +55,7 @@ class RotateManipulator :
public:
static ShaderPtr _stateOuter;
static ShaderPtr _pivotPointShader;
static IGLFont::Ptr _glFont;

// Constructor
RotateManipulator(ManipulationPivot& pivot, std::size_t segments, float radius);
Expand Down

0 comments on commit 55b292f

Please sign in to comment.