From 2415d07771b1792397a752d2a98f6356e9969982 Mon Sep 17 00:00:00 2001 From: torcs-ng Date: Sun, 2 Dec 2012 21:56:03 +0000 Subject: [PATCH] fix good orientation on background or land object git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5062 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: a030a17bc46f8336374f9f077689b2d159afb304 Former-commit-id: 68630537f453eaab720b3ffe6ff17a670a951198 --- .../graphic/osggraph/OsgBackground.cpp | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/modules/graphic/osggraph/OsgBackground.cpp b/src/modules/graphic/osggraph/OsgBackground.cpp index 54e3bfd57..3b01cc560 100644 --- a/src/modules/graphic/osggraph/OsgBackground.cpp +++ b/src/modules/graphic/osggraph/OsgBackground.cpp @@ -45,17 +45,24 @@ osg::Node *SDBackground::build(bool type, int grWrldX, int grWrldY, const std::s pathList.push_back(TrackPath); pathList.push_back(LocalPath+"data/objects"); pathList.push_back(LocalPath+"data/textures"); - osgDB::Registry::instance()->setDataFilePathList(pathList); - - osg::Node *m_background = osgDB::readNodeFile("background-sky.ac"); + osgDB::Registry::instance()->setDataFilePathList(pathList); + _background_transform = new osg::MatrixTransform; + osg::Matrix mat( 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f); + if (!land) { - _background_transform = new osg::MatrixTransform; + osg::Node *m_background = osgDB::readNodeFile("background-sky.ac"); + _background_transform->setMatrix(mat); _background_transform->addChild( m_background ); } - - return m_background; + else + { + osg::Node *m_background = osgDB::readNodeFile("land.ac"); + _background_transform->setMatrix(mat); + _background_transform->addChild( m_background ); + } + + return _background_transform.get(); } - -