diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index f22a0778d..73b761ff2 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -644,7 +644,7 @@ namespace MWRender for (int j = 0; j < h; ++j) for (int i = 0; i < w; ++i) - dest->setColor(getColorByDirection(cylindricalCoords(i / ((float) w), j / ((float) h))),i,j); + dest->setColor(getColorByDirection(sphericalCoords(i / ((float) w), j / ((float) h))),i,j); } osg::Vec3d cylindricalCoords(double x, double y) @@ -654,6 +654,17 @@ namespace MWRender return result; } + osg::Vec3d sphericalCoords(double x, double y) + { + x = x * 2 * osg::PI; + y = (y - 0.5) * osg::PI; + + osg::Vec3 result = osg::Vec3(0.0,cos(y),sin(y)); + result = osg::Vec3(cos(x) * result.y(),sin(x) * result.y(),result.z()); + + return result; + } + osg::Vec4 getColorByDirection(osg::Vec3d d) { double x, y;