diff --git a/src/modules/graphic/osggraph/CMakeLists.txt b/src/modules/graphic/osggraph/CMakeLists.txt index 020eeeaec..6167a40eb 100644 --- a/src/modules/graphic/osggraph/CMakeLists.txt +++ b/src/modules/graphic/osggraph/CMakeLists.txt @@ -1,8 +1,9 @@ INCLUDE(../../../../cmake/macros.cmake) SET(OSGGRAPH_HEADERS OsgVectorArrayAdapter.h OsgColor.h OsgAtomic.h - OsgReferenced.h OsgSharedPtr.h OsgSphere.h OsgSun.h - OsgMoon.h OsgStars.h OsgDome.h #OsgStateAttributeFactory.h + OsgReferenced.h #OsgSharedPtr.h + OsgSphere.h OsgSun.h OsgMoon.h OsgStars.h OsgDome.h + #OsgStateAttributeFactory.h OsgCloud.h OsgSky.h AccGeode.h AccException.h ReaderWriterACC.h OsgLoader.h OsgScenery.h OsgRender.h OsgMath.h OsgMain.h diff --git a/src/modules/graphic/osggraph/OsgCar.cpp b/src/modules/graphic/osggraph/OsgCar.cpp index 424abf38e..16066f25d 100644 --- a/src/modules/graphic/osggraph/OsgCar.cpp +++ b/src/modules/graphic/osggraph/OsgCar.cpp @@ -421,7 +421,7 @@ void SDCar::updateCar() { osg::Vec3 vtx = *itr; osg::Vec4 tvtx = osg::Vec4(vtx,1.0f)*mat; - tvtx._v[2] = RtTrackHeightG(car->_trkPos.seg, tvtx.x(), tvtx.y()); + tvtx._v[2] = RtTrackHeightG(car->_trkPos.seg, tvtx.x(), tvtx.y())+ 0.0699; osg::Matrix iv = osg::Matrix::inverse(mat); osg::Vec4 vtxw = tvtx*iv; vtxw._v[2] = vtxw.z(); diff --git a/src/modules/graphic/osggraph/OsgDome.h b/src/modules/graphic/osggraph/OsgDome.h index 1adacd67d..49de94cfb 100644 --- a/src/modules/graphic/osggraph/OsgDome.h +++ b/src/modules/graphic/osggraph/OsgDome.h @@ -31,7 +31,7 @@ namespace osg class DrawElementsUShort; } -class SDSkyDome : public SDReferenced +class SDSkyDome { osg::ref_ptr dome_transform; double asl; diff --git a/src/modules/graphic/osggraph/OsgWheel.cpp b/src/modules/graphic/osggraph/OsgWheel.cpp index dee4b0650..3eca19dd9 100644 --- a/src/modules/graphic/osggraph/OsgWheel.cpp +++ b/src/modules/graphic/osggraph/OsgWheel.cpp @@ -52,6 +52,7 @@ osg::ref_ptr SDWheels::initWheels(tCarElt *car,void *handle) osg::ref_ptr SDWheels::initWheel(int wheelIndex, const char * wheel_mod_name) { +#if 1 osgLoader loader; char wheel_file_name[32]; char buf[4096]; @@ -84,7 +85,41 @@ osg::ref_ptr SDWheels::initWheel(int wheelIndex, const cha wheels_switches[wheelIndex]->addChild(wheel,false); } } +#else + char wheel_file_name[32]; + char buf[4096]; + std::string LocalPath = GetDataDir(); + + osg::ref_ptr options = new::osgDB::ReaderWriter::Options(); + //options = new osgDB::ReaderWriter::Options; + options->getDatabasePathList().push_back(LocalPath+"data/objects/"); + + snprintf(buf, 4096, "drivers/%s/%d/", car->_modName, car->_driverIndex); + options->getDatabasePathList().push_back(LocalPath+buf); + + snprintf(buf, 4096, "cars/models/%s/", car->_carName); + options->getDatabasePathList().push_back(LocalPath+buf); + + options->getDatabasePathList().push_back(LocalPath+"data/textures/"); + + wheels_switches[wheelIndex] = new osg::Switch; + + // Load speed-dependant 3D wheel model if available + for(int j=0;j<4;j++) + { + osg::ref_ptr wheel = 0; + if (wheel_mod_name && strlen(wheel_mod_name)) + { + snprintf(wheel_file_name, 32, "%s%d.osg", wheel_mod_name, j); + wheel = osgDB::readNodeFile(wheel_file_name, options); + wheels_switches[wheelIndex]->addChild(wheel,false); + } + } + + options->getDatabasePathList().clear(); + options = NULL; +#endif osg::ref_ptr whlsize = new osg::MatrixTransform; float wheelRadius = car->_rimRadius(wheelIndex) + car->_tireHeight(wheelIndex);