- Update OsgGraph
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5981 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: ab1b91ea7c299795d1794f4fecc6faa126637d82 Former-commit-id: 0a147ec7309ca50ecce6529eae822004ad4c406f
This commit is contained in:
parent
6b201aa7e8
commit
c91fb90dcb
2 changed files with 21 additions and 22 deletions
|
@ -144,10 +144,10 @@ osg::ref_ptr<osg::Node> SDCar::loadCar(tCarElt *car, bool tracktype, bool subcat
|
|||
// selIndex = 0; /* current selector index */
|
||||
snprintf(buf, nMaxTexPathSize, "%s.ac",
|
||||
car->_carName); /* default car 3D model file */
|
||||
snprintf(path, 256, "%s/%s/1", SECT_GROBJECTS, LST_RANGES);
|
||||
snprintf(path, nMaxTexPathSize, "%s/%s/1", SECT_GROBJECTS, LST_RANGES);
|
||||
|
||||
std::string strPath = GetDataDir();
|
||||
sprintf(buf, "cars/models/%s/%s.acc", car->_carName, car->_carName);
|
||||
snprintf(buf, nMaxTexPathSize, "cars/models/%s/%s.acc", car->_carName, car->_carName);
|
||||
strPath+=buf;
|
||||
|
||||
std::string name = car->_carName;
|
||||
|
@ -184,7 +184,7 @@ osg::ref_ptr<osg::Node> SDCar::loadCar(tCarElt *car, bool tracktype, bool subcat
|
|||
GfLogInfo("Load Car ACC !\n");
|
||||
|
||||
/* Set a selector on the wing type MPA*/
|
||||
snprintf(path, 256, "%s/%s", SECT_GROBJECTS, SECT_WING_MODEL);
|
||||
snprintf(path, nMaxTexPathSize, "%s/%s", SECT_GROBJECTS, SECT_WING_MODEL);
|
||||
param = GfParmGetStr(handle, path, PRM_WING_1, NULL);
|
||||
if (param)
|
||||
{
|
||||
|
@ -195,7 +195,7 @@ osg::ref_ptr<osg::Node> SDCar::loadCar(tCarElt *car, bool tracktype, bool subcat
|
|||
_wing1 = true;
|
||||
|
||||
std::string tmp = GetDataDir();
|
||||
sprintf(buf, "cars/models/%s/", car->_carName);
|
||||
snprintf(buf, nMaxTexPathSize, "cars/models/%s/", car->_carName);
|
||||
tmp = tmp+buf;
|
||||
|
||||
param = GfParmGetStr(handle, path, PRM_WING_1, NULL);
|
||||
|
@ -248,14 +248,14 @@ osg::ref_ptr<osg::Node> SDCar::loadCar(tCarElt *car, bool tracktype, bool subcat
|
|||
}
|
||||
|
||||
// Separate rear wing models for animation according to rear wing angle ...
|
||||
snprintf(path, 256, "%s/%s", SECT_GROBJECTS, LST_REARWING);
|
||||
snprintf(path, nMaxTexPathSize, "%s/%s", SECT_GROBJECTS, LST_REARWING);
|
||||
nranges = GfParmGetEltNb(handle, path) + 1;
|
||||
|
||||
if (nranges > 1)
|
||||
{
|
||||
_wing3 = true;
|
||||
std::string tmp = GetDataDir();
|
||||
sprintf(buf, "cars/models/%s/", car->_carName);
|
||||
snprintf(buf, nMaxTexPathSize, "cars/models/%s/", car->_carName);
|
||||
tmp = tmp+buf;
|
||||
|
||||
// Add the rearwings
|
||||
|
@ -268,7 +268,6 @@ osg::ref_ptr<osg::Node> SDCar::loadCar(tCarElt *car, bool tracktype, bool subcat
|
|||
|
||||
strPath = tmp+param;
|
||||
|
||||
|
||||
GfLogInfo("Loading Wing animate %i - %s !\n", i, strPath.c_str());
|
||||
|
||||
tdble xpos = GfParmGetNum(handle, path, PRM_XPOS, NULL, 0.0);
|
||||
|
@ -294,14 +293,14 @@ osg::ref_ptr<osg::Node> SDCar::loadCar(tCarElt *car, bool tracktype, bool subcat
|
|||
|
||||
|
||||
// Cockpit separate object loaded ...
|
||||
snprintf(path, 256, "%s/%s", SECT_GROBJECTS, SECT_COCKPIT);
|
||||
snprintf(path, nMaxTexPathSize, "%s/%s", SECT_GROBJECTS, SECT_COCKPIT);
|
||||
param = GfParmGetStr(handle, path, PRM_MODELCOCKPIT, NULL);
|
||||
|
||||
if (param)
|
||||
{
|
||||
_cockpit = true;
|
||||
std::string tmp = GetDataDir();
|
||||
sprintf(buf, "cars/models/%s/", car->_carName);
|
||||
snprintf(buf, nMaxTexPathSize, "cars/models/%s/", car->_carName);
|
||||
tmp = tmp+buf;
|
||||
|
||||
osg::ref_ptr<osg::Node> cockpit = new osg::Node;
|
||||
|
@ -319,14 +318,14 @@ osg::ref_ptr<osg::Node> SDCar::loadCar(tCarElt *car, bool tracktype, bool subcat
|
|||
}
|
||||
|
||||
/* add Steering Wheel 0 (if one exists) */
|
||||
snprintf(path, 256, "%s/%s", SECT_GROBJECTS, SECT_STEERWHEEL);
|
||||
snprintf(path, nMaxTexPathSize, "%s/%s", SECT_GROBJECTS, SECT_STEERWHEEL);
|
||||
param = GfParmGetStr(handle, path, PRM_SW_MODEL, NULL);
|
||||
|
||||
if (param)
|
||||
{
|
||||
_steer = true;
|
||||
std::string tmpPath = GetDataDir();
|
||||
snprintf(buf, 256, "cars/models/%s/", car->_carName);
|
||||
snprintf(buf, nMaxTexPathSize, "cars/models/%s/", car->_carName);
|
||||
tmpPath = tmpPath+buf;
|
||||
|
||||
strPath = tmpPath + param;
|
||||
|
@ -349,14 +348,14 @@ osg::ref_ptr<osg::Node> SDCar::loadCar(tCarElt *car, bool tracktype, bool subcat
|
|||
GfLogTrace("Low Steer Loading \n");
|
||||
}
|
||||
|
||||
snprintf(path, 256, "%s/%s", SECT_GROBJECTS, SECT_STEERWHEEL);
|
||||
snprintf(path, nMaxTexPathSize, "%s/%s", SECT_GROBJECTS, SECT_STEERWHEEL);
|
||||
param = GfParmGetStr(handle, path, PRM_SW_MODELHR, NULL);
|
||||
|
||||
if (param)
|
||||
{
|
||||
_steer = true;
|
||||
std::string tmpPath = GetDataDir();
|
||||
snprintf(buf, 256, "cars/models/%s/", car->_carName);
|
||||
snprintf(buf, nMaxTexPathSize, "cars/models/%s/", car->_carName);
|
||||
tmpPath = tmpPath+buf;
|
||||
|
||||
strPath = tmpPath + param;
|
||||
|
@ -383,7 +382,7 @@ osg::ref_ptr<osg::Node> SDCar::loadCar(tCarElt *car, bool tracktype, bool subcat
|
|||
|
||||
|
||||
// separate driver models for animation according to steering wheel angle ...
|
||||
snprintf(path, 256, "%s/%s", SECT_GROBJECTS, LST_DRIVER);
|
||||
snprintf(path, nMaxTexPathSize, "%s/%s", SECT_GROBJECTS, LST_DRIVER);
|
||||
nranges = GfParmGetEltNb(handle, path) + 1;
|
||||
|
||||
if (nranges > 1)
|
||||
|
|
|
@ -84,7 +84,7 @@ void SDScenery::LoadScene(tTrack *track)
|
|||
|
||||
if(grHandle == NULL)
|
||||
{
|
||||
sprintf(buf, "%s%s", GetLocalDir(), GR_PARAM_FILE);
|
||||
snprintf(buf, 256, "%s%s", GetLocalDir(), GR_PARAM_FILE);
|
||||
grHandle = GfParmReadFile(buf, GFPARM_RMODE_STD | GFPARM_RMODE_REREAD);
|
||||
}//if grHandle
|
||||
|
||||
|
@ -126,7 +126,7 @@ void SDScenery::LoadScene(tTrack *track)
|
|||
{
|
||||
_bgtype = strcmp(GfParmGetStr(grHandle, GR_SCT_GRAPHIC, GR_ATT_BGSKYTYPE, GR_ATT_BGSKY_RING), GR_ATT_BGSKY_LAND) == 0;
|
||||
std::string strPath = PathTmp;
|
||||
sprintf(buf, "tracks/%s/%s", SDTrack->category, SDTrack->internalname);
|
||||
snprintf(buf, 256, "tracks/%s/%s/", SDTrack->category, SDTrack->internalname);
|
||||
strPath += buf;
|
||||
m_background->build(_bgtype, grWrldX, grWrldY, grWrldZ, strPath);
|
||||
GfOut("Background loaded\n");
|
||||
|
@ -134,7 +134,7 @@ void SDScenery::LoadScene(tTrack *track)
|
|||
}
|
||||
|
||||
std::string strPath = GetDataDir();
|
||||
sprintf(buf, "tracks/%s/%/", SDTrack->category, SDTrack->internalname);
|
||||
snprintf(buf, 256, "tracks/%s/%s/", SDTrack->category, SDTrack->internalname);
|
||||
|
||||
std::string ext = osgDB::getFileExtension(acname);
|
||||
|
||||
|
@ -154,7 +154,7 @@ void SDScenery::LoadScene(tTrack *track)
|
|||
strPath+=buf;
|
||||
|
||||
std::string strTPath = GetDataDir();
|
||||
snprintf(buf, 255, "data/textures/");
|
||||
snprintf(buf, 256, "data/textures/");
|
||||
strTPath += buf;
|
||||
osgDB::FilePathList pathList = osgDB::Registry::instance()->getDataFilePathList();
|
||||
pathList.push_back(strPath);
|
||||
|
@ -185,7 +185,7 @@ void SDScenery::LoadScene(tTrack *track)
|
|||
GfOut("OSG MODEL 3D = %s\n", osgname);
|
||||
strPath+=buf;
|
||||
std::string strTPath = GetDataDir();
|
||||
snprintf(buf, 4096, "data/textures/");
|
||||
snprintf(buf, 256, "data/textures/");
|
||||
strTPath += buf;
|
||||
|
||||
osgDB::FilePathList pathList = osgDB::Registry::instance()->getDataFilePathList();
|
||||
|
@ -225,7 +225,7 @@ void SDScenery::LoadGraphicsOptions()
|
|||
|
||||
if (!grHandle)
|
||||
{
|
||||
sprintf(buf, "%s%s", GfLocalDir(), GR_PARAM_FILE);
|
||||
snprintf(buf, 256, "%s%s", GfLocalDir(), GR_PARAM_FILE);
|
||||
grHandle = GfParmReadFile(buf, GFPARM_RMODE_STD | GFPARM_RMODE_REREAD);
|
||||
}//if grHandle
|
||||
|
||||
|
@ -243,14 +243,14 @@ void SDScenery::ShutdownScene(void)
|
|||
|
||||
bool SDScenery::LoadTrack(std::string strTrack)
|
||||
{
|
||||
char buf[4096];
|
||||
char buf[256];
|
||||
GfOut("Chemin Track : %s\n", strTrack.c_str());
|
||||
osgLoader loader;
|
||||
GfOut("Chemin Textures : %s\n", _strTexturePath.c_str());
|
||||
loader.AddSearchPath(_strTexturePath);
|
||||
|
||||
std::string strTPath = GetDataDir();
|
||||
snprintf(buf, 4096, "data/textures/");
|
||||
snprintf(buf, 256, "data/textures/");
|
||||
strTPath += buf;
|
||||
loader.AddSearchPath(strTPath);
|
||||
|
||||
|
|
Loading…
Reference in a new issue