* [Gui] fix the FPS text visibilty issues * [Gui] code efficiency based on suggestions * [Gui] update color parameter * [Gui] Fix Lint feedback * [Gui] check if string is empty
This commit is contained in:
@@ -103,7 +103,7 @@ in the corner -- in % of height/width of viewport</string>
|
||||
<item row="1" column="3">
|
||||
<widget class="Gui::PrefColorButton" name="axisLetterColor">
|
||||
<property name="toolTip">
|
||||
<string>Axis letter color</string>
|
||||
<string>Axis letter and FPS counter color</string>
|
||||
</property>
|
||||
<property name="color" stdset="0">
|
||||
<color>
|
||||
|
||||
@@ -634,10 +634,11 @@ void SIM::Coin3D::Quarter::SoQTQuarterAdaptor::resetToHomePosition()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SIM::Coin3D::Quarter::SoQTQuarterAdaptor::draw2DString(const char* str,
|
||||
SbVec2s glsize,
|
||||
SbVec2f position)
|
||||
void SIM::Coin3D::Quarter::SoQTQuarterAdaptor::draw2DString(
|
||||
const char* str,
|
||||
SbVec2s glsize,
|
||||
SbVec2f position,
|
||||
App::Color color = App::Color(1.0F, 1.0F, 0.0F)) // retains yellow as default color
|
||||
{
|
||||
// Store GL state.
|
||||
glPushAttrib(GL_ENABLE_BIT|GL_CURRENT_BIT);
|
||||
@@ -668,7 +669,7 @@ SIM::Coin3D::Quarter::SoQTQuarterAdaptor::draw2DString(const char* str,
|
||||
// glRasterPos2f(position[0], position[1] - 1);
|
||||
// printString(str);
|
||||
|
||||
glColor3f(1.0, 1.0, 0.0);
|
||||
glColor3f(color.r, color.g, color.b);
|
||||
glRasterPos2f(position[0], position[1]);
|
||||
printString(str);
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include <Inventor/lists/SoCallbackList.h>
|
||||
#include <Inventor/sensors/SoTimerSensor.h>
|
||||
|
||||
#include <App/Color.h>
|
||||
|
||||
#include "QuarterWidget.h"
|
||||
|
||||
|
||||
@@ -150,7 +152,7 @@ private:
|
||||
SoNode * m_storedcamera = nullptr;
|
||||
|
||||
protected:
|
||||
static void draw2DString(const char * str, SbVec2s glsize, SbVec2f position);
|
||||
static void draw2DString(const char * str, SbVec2s glsize, SbVec2f position, App::Color color);
|
||||
static void printString(const char * str);
|
||||
SbVec2f framesPerSecond; // NOLINT
|
||||
};
|
||||
|
||||
@@ -2451,7 +2451,17 @@ void View3DInventorViewer::renderScene()
|
||||
stream.precision(1);
|
||||
stream.setf(std::ios::fixed | std::ios::showpoint);
|
||||
stream << framesPerSecond[0] << " ms / " << framesPerSecond[1] << " fps";
|
||||
draw2DString(stream.str().c_str(), SbVec2s(10, 10), SbVec2f(0.1F, 0.1F)); // NOLINT
|
||||
ParameterGrp::handle hGrpOverlayL = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/MainWindow/DockWindows/OverlayLeft");
|
||||
std::string overlayLeftWidgets = hGrpOverlayL->GetASCII("Widgets", "");
|
||||
ParameterGrp::handle hGrpView = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/View");
|
||||
unsigned long axisLetterColor =
|
||||
hGrpView->GetUnsigned("AxisLetterColor", 4294902015); // default FPS color (yellow)
|
||||
draw2DString(stream.str().c_str(),
|
||||
SbVec2s(10, 10),
|
||||
SbVec2f((overlayLeftWidgets.empty() ? 0.1f : 1.1f), 0.1f),
|
||||
App::Color(static_cast<uint32_t>(axisLetterColor))); // NOLINT
|
||||
}
|
||||
|
||||
if (naviCubeEnabled) {
|
||||
|
||||
Reference in New Issue
Block a user