MSVC: fix warnings and build failure

This commit is contained in:
wmayer
2023-09-23 19:03:53 +02:00
committed by wwmayer
parent 15b11bc360
commit 5a81fcd7a5
6 changed files with 30 additions and 13 deletions

View File

@@ -29,6 +29,7 @@
# include <pwd.h>
# include <sys/types.h>
# elif defined(__MINGW32__)
# undef WINVER
# define WINVER 0x502 // needed for SetDllDirectory
# include <Windows.h>
# endif

View File

@@ -969,16 +969,22 @@ SbRotation NaviCubeImplementation::getNearestOrientation(PickId pickId) {
angle *= -1;
}
static const float pi = boost::math::constants::pi<float>();
static const float pi2 = boost::math::constants::two_pi<float>();
static const float pi1_2 = boost::math::constants::half_pi<float>();
static const float pi1_3 = boost::math::constants::third_pi<float>();
static const float pi2_3 = boost::math::constants::two_thirds_pi<float>();
// Make angle positive
if (angle < 0) {
angle += 2 * M_PI;
angle += pi2;
}
// f is a small value used to control orientation priority when the camera is almost exactly between two
// orientations (e.g. +45 and -45 degrees). The standard orientation is preferred compared to
// +90 and -90 degree orientations and the +90 and -90 degree orientations are preferred compared to an
// upside down standard orientation
float f = 0.00001;
float f = 0.00001F;
// Find the angle to rotate to the nearest orientation
if (m_Faces[pickId].type == ShapeId::Corner) {
@@ -987,19 +993,19 @@ SbRotation NaviCubeImplementation::getNearestOrientation(PickId pickId) {
angle = 0;
}
else if (angle <= (M_PI_2 + f)) {
angle = M_PI / 3;
angle = pi1_3;
}
else if (angle < (5 * M_PI / 6 - f)) {
angle = 2 * M_PI / 3;
angle = pi2_3;
}
else if (angle <= (M_PI + M_PI / 6 + f)) {
angle = M_PI;
angle = pi;
}
else if (angle < (M_PI + M_PI_2 - f)) {
angle = M_PI + M_PI / 3;
angle = pi + pi1_3;
}
else if (angle < (M_PI + 5 * M_PI / 6 - f)) {
angle = M_PI + 2 * M_PI / 3;
angle = pi + pi2_3;
}
else {
angle = 0;
@@ -1011,13 +1017,13 @@ SbRotation NaviCubeImplementation::getNearestOrientation(PickId pickId) {
angle = 0;
}
else if (angle <= (3 * M_PI_4 + f)) {
angle = M_PI_2;
angle = pi1_2;
}
else if (angle < (M_PI + M_PI_4 - f)) {
angle = M_PI;
angle = pi;
}
else if (angle < (M_PI + 3 * M_PI_4 - f)) {
angle = M_PI + M_PI_2;
angle = pi + pi1_2;
}
else {
angle = 0;

View File

@@ -186,7 +186,7 @@ SoGroup* TDragger::buildGeometry()
cylinderSeparator->addChild(cylinder);
//cone
float coneBottomRadius = 0.8;
float coneBottomRadius = 0.8F;
float coneHeight = 2.5;
auto coneSeparator = new SoSeparator();
root->addChild(coneSeparator);
@@ -779,7 +779,7 @@ SoGroup* RDragger::buildGeometry()
root->addChild(sphereTranslation);
auto sphere = new SoSphere();
sphere->radius.setValue(0.8);
sphere->radius.setValue(0.8F);
root->addChild(sphere);
return root;

View File

@@ -21,8 +21,10 @@
***************************************************************************/
#include "ViewProviderPython.h"
// clang-format off
#include "PreCompiled.h"
#include "ViewProviderPython.h"
// clang-format on
namespace Gui
{

View File

@@ -20,6 +20,10 @@
* *
***************************************************************************/
#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
#include <algorithm>
#define DEBUG_DERIVS 0
#if DEBUG_DERIVS

View File

@@ -20,6 +20,10 @@
* *
***************************************************************************/
#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
#include <iostream>
#include <iterator>