Skip to content

Instantly share code, notes, and snippets.

@shurshur
Created September 3, 2019 22:38
Show Gist options
  • Save shurshur/3e5456bfd6f83404f386d6e996c979dd to your computer and use it in GitHub Desktop.
Save shurshur/3e5456bfd6f83404f386d6e996c979dd to your computer and use it in GitHub Desktop.
RRS patch for old versions of OpenSceneGraph
index b55c2cd..3a3e0bc 100644
--- a/viewer/viewer/src/analog-rotation.cpp
+++ b/viewer/viewer/src/analog-rotation.cpp
@@ -5,7 +5,7 @@
//------------------------------------------------------------------------------
AnalogRotation::AnalogRotation(osg::MatrixTransform *transform) : ProcAnimation (transform)
, min_angle(0.0f)
- , max_angle(osg::PIf)
+ , max_angle(osg::PI)
, angle(0.0f)
, cur_pos(0.0f)
, infinity(false)
@@ -78,6 +78,6 @@ void AnalogRotation::update()
if (!infinity)
angle = cut(angle, (*keypoints.begin()).value, (*(keypoints.end() - 1)).value);
- osg::Matrix rotate = osg::Matrixf::rotate(angle * osg::PIf / 180.0f, axis);
+ osg::Matrix rotate = osg::Matrixf::rotate(angle * osg::PI / 180.0f, axis);
transform->setMatrix(rotate * matrix);
}
diff --git a/viewer/viewer/src/lighting.cpp b/viewer/viewer/src/lighting.cpp
index b334ee3..a98b544 100644
--- a/viewer/viewer/src/lighting.cpp
+++ b/viewer/viewer/src/lighting.cpp
@@ -32,7 +32,7 @@ void initEnvironmentLight(osg::Group *root,
float dist = 1000.0f;
- float rad = osg::PIf / 180.0f;
+ float rad = osg::PI / 180.0f;
float x = dist * cosf(theta * rad) * sinf(psi * rad);
float y = dist * cosf(theta * rad) * cosf(psi * rad);
float z = dist * sinf(theta * rad);
diff --git a/viewer/viewer/src/train-exterior.cpp b/viewer/viewer/src/train-exterior.cpp
index 2e07ff3..4d62c4d 100644
--- a/viewer/viewer/src/train-exterior.cpp
+++ b/viewer/viewer/src/train-exterior.cpp
@@ -317,7 +317,7 @@ void TrainExteriorHandler::moveTrain(double ref_time, const network_data_t &nd)
vehicles_ext[i].position = routePath->getPosition(coord, vehicles_ext[i].attitude);
if (settings.direction == -1)
- vehicles_ext[i].attitude.z() = osg::PIf + vehicles_ext[i].attitude.z();
+ vehicles_ext[i].attitude.z() = osg::PI + vehicles_ext[i].attitude.z();
// Store current railway coordinate and wheels angle
vehicles_ext[i].coord = coord;
@@ -401,7 +401,7 @@ void TrainExteriorHandler::moveCamera(osgViewer::Viewer *viewer)
cp.attitude = vehicles_ext[static_cast<size_t>(cur_vehicle)].attitude;
cp.driver_pos = vehicles_ext[static_cast<size_t>(cur_vehicle)].driver_pos;
- cp.attitude.x() = - osg::PIf / 2.0f - cp.attitude.x() * settings.direction;
+ cp.attitude.x() = - osg::PI / 2.0f - cp.attitude.x() * settings.direction;
float viewer_coord = vehicles_ext[static_cast<size_t>(cur_vehicle)].coord +
settings.direction * settings.stat_cam_shift;
diff --git a/viewer/zds-route-loader/src/scene-loader.cpp b/viewer/zds-route-loader/src/scene-loader.cpp
index 311a90d..dcf1fde 100644
--- a/viewer/zds-route-loader/src/scene-loader.cpp
+++ b/viewer/zds-route-loader/src/scene-loader.cpp
@@ -228,9 +228,9 @@ ReadResult SceneLoader::loadObjectMap(std::istream &stream)
object.caption = delete_symbol(line, '\r');
- object.attitude.x() *= osg::PIf / 180.0f;
- object.attitude.y() *= osg::PIf / 180.0f;
- object.attitude.z() *= osg::PIf / 180.0f;
+ object.attitude.x() *= osg::PI / 180.0f;
+ object.attitude.y() *= osg::PI / 180.0f;
+ object.attitude.z() *= osg::PI / 180.0f;
if (objectRef[object.name].model_node.valid())
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment