mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 17:50:42 +02:00
Fixed coding standard and made getCursorPixelRangeMultiplier more clear
This commit is contained in:
parent
bef625d237
commit
94e58e9559
2 changed files with 13 additions and 5 deletions
|
@ -185,9 +185,14 @@ void SixenseManager::update(float deltaTime) {
|
||||||
#endif // HAVE_SIXENSE
|
#endif // HAVE_SIXENSE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const float MAXIMUM_PIXEL_RANGE_MULT = 2.0f;
|
||||||
|
const float MINIMUM_PIXEL_RANGE_MULT = 0.4f;
|
||||||
|
const float RANGE_MULT = (MAXIMUM_PIXEL_RANGE_MULT - MINIMUM_PIXEL_RANGE_MULT) * 0.01;
|
||||||
|
|
||||||
|
//Returns a multiplier to be applied to the cursor range for the controllers
|
||||||
float SixenseManager::getCursorPixelRangeMultiplier() const {
|
float SixenseManager::getCursorPixelRangeMultiplier() const {
|
||||||
//scales (0,100) to (0.4,2.0)
|
//scales (0,100) to (MINIMUM_PIXEL_RANGE_MULT, MAXIMUM_PIXEL_RANGE_MULT)
|
||||||
return ((Menu::getInstance()->getSixenseReticleMoveSpeed()) * 0.008f + 0.2f) * 2.0f;
|
return Menu::getInstance()->getSixenseReticleMoveSpeed() * RANGE_MULT + MINIMUM_PIXEL_RANGE_MULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SIXENSE
|
#ifdef HAVE_SIXENSE
|
||||||
|
@ -356,6 +361,7 @@ void SixenseManager::emulateMouse(PalmData* palm, int index) {
|
||||||
float xAngle = (atan2(direction.z, direction.x) + M_PI_2);
|
float xAngle = (atan2(direction.z, direction.x) + M_PI_2);
|
||||||
float yAngle = 0.5f - ((atan2(direction.z, direction.y) + M_PI_2));
|
float yAngle = 0.5f - ((atan2(direction.z, direction.y) + M_PI_2));
|
||||||
|
|
||||||
|
// Get the pixel range over which the xAngle and yAngle are scaled
|
||||||
float cursorRange = widget->width() * getCursorPixelRangeMultiplier();
|
float cursorRange = widget->width() * getCursorPixelRangeMultiplier();
|
||||||
|
|
||||||
pos.setX(widget->width() / 2.0f + cursorRange * xAngle);
|
pos.setX(widget->width() / 2.0f + cursorRange * xAngle);
|
||||||
|
|
|
@ -46,6 +46,8 @@ ApplicationOverlay::~ApplicationOverlay() {
|
||||||
|
|
||||||
const float WHITE_TEXT[] = { 0.93f, 0.93f, 0.93f };
|
const float WHITE_TEXT[] = { 0.93f, 0.93f, 0.93f };
|
||||||
|
|
||||||
|
const float RETICLE_COLOR[] = { 0.0f, 198.0f / 255.0f, 244.0f / 255.0f };
|
||||||
|
|
||||||
// Renders the overlays either to a texture or to the screen
|
// Renders the overlays either to a texture or to the screen
|
||||||
void ApplicationOverlay::renderOverlay(bool renderToTexture) {
|
void ApplicationOverlay::renderOverlay(bool renderToTexture) {
|
||||||
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "ApplicationOverlay::displayOverlay()");
|
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "ApplicationOverlay::displayOverlay()");
|
||||||
|
@ -222,7 +224,6 @@ void ApplicationOverlay::renderPointers() {
|
||||||
int mouseX = application->getMouseX();
|
int mouseX = application->getMouseX();
|
||||||
int mouseY = application->getMouseY();
|
int mouseY = application->getMouseY();
|
||||||
|
|
||||||
|
|
||||||
//lazily load crosshair texture
|
//lazily load crosshair texture
|
||||||
if (_crosshairTexture == 0) {
|
if (_crosshairTexture == 0) {
|
||||||
_crosshairTexture = Application::getInstance()->getGLWidget()->bindTexture(QImage(Application::resourcesPath() + "images/sixense-reticle.png"));
|
_crosshairTexture = Application::getInstance()->getGLWidget()->bindTexture(QImage(Application::resourcesPath() + "images/sixense-reticle.png"));
|
||||||
|
@ -274,6 +275,7 @@ void ApplicationOverlay::renderControllerPointers() {
|
||||||
float xAngle = (atan2(direction.z, direction.x) + M_PI_2) ;
|
float xAngle = (atan2(direction.z, direction.x) + M_PI_2) ;
|
||||||
float yAngle = 0.5f - ((atan2(direction.z, direction.y) + M_PI_2));
|
float yAngle = 0.5f - ((atan2(direction.z, direction.y) + M_PI_2));
|
||||||
|
|
||||||
|
// Get the pixel range over which the xAngle and yAngle are scaled
|
||||||
float cursorRange = glWidget->width() * application->getSixenseManager()->getCursorPixelRangeMultiplier();
|
float cursorRange = glWidget->width() * application->getSixenseManager()->getCursorPixelRangeMultiplier();
|
||||||
|
|
||||||
int mouseX = glWidget->width() / 2.0f + cursorRange * xAngle;
|
int mouseX = glWidget->width() / 2.0f + cursorRange * xAngle;
|
||||||
|
@ -303,7 +305,7 @@ void ApplicationOverlay::renderControllerPointers() {
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
|
|
||||||
glColor3f(0.0f, 198.0f/255.0f, 244.0f/255.0f);
|
glColor3f(RETICLE_COLOR[0], RETICLE_COLOR[1], RETICLE_COLOR[2]);
|
||||||
|
|
||||||
glTexCoord2d(0.0f, 0.0f); glVertex2i(mouseX, mouseY);
|
glTexCoord2d(0.0f, 0.0f); glVertex2i(mouseX, mouseY);
|
||||||
glTexCoord2d(1.0f, 0.0f); glVertex2i(mouseX + pointerWidth, mouseY);
|
glTexCoord2d(1.0f, 0.0f); glVertex2i(mouseX + pointerWidth, mouseY);
|
||||||
|
@ -361,7 +363,7 @@ void ApplicationOverlay::renderControllerPointersOculus() {
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
|
|
||||||
glColor3f(0.0f, 198.0f / 255.0f, 244.0f / 255.0f);
|
glColor3f(RETICLE_COLOR[0], RETICLE_COLOR[1], RETICLE_COLOR[2]);
|
||||||
|
|
||||||
glTexCoord2f(0.0f, 0.0f); glVertex3f(lX, tY, -tlZ);
|
glTexCoord2f(0.0f, 0.0f); glVertex3f(lX, tY, -tlZ);
|
||||||
glTexCoord2f(1.0f, 0.0f); glVertex3f(rX, tY, -trZ);
|
glTexCoord2f(1.0f, 0.0f); glVertex3f(rX, tY, -trZ);
|
||||||
|
|
Loading…
Reference in a new issue