update static shadow car (better but not good for moment)

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5470 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 4f3c92bc235270463c55d5c3696a5440e8e82566
Former-commit-id: e0173acb25e11c3c4f1f53d06e766a07cf71ab9e
This commit is contained in:
torcs-ng 2013-05-22 21:56:29 +00:00
parent dc0091b1f9
commit a0a08af4f7
4 changed files with 40 additions and 4 deletions

View file

@ -1,8 +1,9 @@
INCLUDE(../../../../cmake/macros.cmake) INCLUDE(../../../../cmake/macros.cmake)
SET(OSGGRAPH_HEADERS OsgVectorArrayAdapter.h OsgColor.h OsgAtomic.h SET(OSGGRAPH_HEADERS OsgVectorArrayAdapter.h OsgColor.h OsgAtomic.h
OsgReferenced.h OsgSharedPtr.h OsgSphere.h OsgSun.h OsgReferenced.h #OsgSharedPtr.h
OsgMoon.h OsgStars.h OsgDome.h #OsgStateAttributeFactory.h OsgSphere.h OsgSun.h OsgMoon.h OsgStars.h OsgDome.h
#OsgStateAttributeFactory.h
OsgCloud.h OsgSky.h OsgCloud.h OsgSky.h
AccGeode.h AccException.h ReaderWriterACC.h AccGeode.h AccException.h ReaderWriterACC.h
OsgLoader.h OsgScenery.h OsgRender.h OsgMath.h OsgMain.h OsgLoader.h OsgScenery.h OsgRender.h OsgMath.h OsgMain.h

View file

@ -421,7 +421,7 @@ void SDCar::updateCar()
{ {
osg::Vec3 vtx = *itr; osg::Vec3 vtx = *itr;
osg::Vec4 tvtx = osg::Vec4(vtx,1.0f)*mat; 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::Matrix iv = osg::Matrix::inverse(mat);
osg::Vec4 vtxw = tvtx*iv; osg::Vec4 vtxw = tvtx*iv;
vtxw._v[2] = vtxw.z(); vtxw._v[2] = vtxw.z();

View file

@ -31,7 +31,7 @@ namespace osg
class DrawElementsUShort; class DrawElementsUShort;
} }
class SDSkyDome : public SDReferenced class SDSkyDome
{ {
osg::ref_ptr<osg::MatrixTransform> dome_transform; osg::ref_ptr<osg::MatrixTransform> dome_transform;
double asl; double asl;

View file

@ -52,6 +52,7 @@ osg::ref_ptr<osg::Node> SDWheels::initWheels(tCarElt *car,void *handle)
osg::ref_ptr<osg::MatrixTransform> SDWheels::initWheel(int wheelIndex, const char * wheel_mod_name) osg::ref_ptr<osg::MatrixTransform> SDWheels::initWheel(int wheelIndex, const char * wheel_mod_name)
{ {
#if 1
osgLoader loader; osgLoader loader;
char wheel_file_name[32]; char wheel_file_name[32];
char buf[4096]; char buf[4096];
@ -84,7 +85,41 @@ osg::ref_ptr<osg::MatrixTransform> SDWheels::initWheel(int wheelIndex, const cha
wheels_switches[wheelIndex]->addChild(wheel,false); wheels_switches[wheelIndex]->addChild(wheel,false);
} }
} }
#else
char wheel_file_name[32];
char buf[4096];
std::string LocalPath = GetDataDir();
osg::ref_ptr<osgDB::Options> 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<osg::Node> 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<osg::MatrixTransform> whlsize = new osg::MatrixTransform; osg::ref_ptr<osg::MatrixTransform> whlsize = new osg::MatrixTransform;
float wheelRadius = car->_rimRadius(wheelIndex) + car->_tireHeight(wheelIndex); float wheelRadius = car->_rimRadius(wheelIndex) + car->_tireHeight(wheelIndex);