- fix bug with srw-sector-p4 loaded wings
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6136 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 9f4b96f112dd2cd466fdf22779e34a863ac56ccd Former-commit-id: 8022443f05a2f582461260002bc800ec7b5ff0f5
This commit is contained in:
parent
dcc98ceb90
commit
22aed795ed
3 changed files with 21 additions and 20 deletions
|
@ -270,23 +270,15 @@ osg::ref_ptr<osg::Node> SDCar::loadCar(tCarElt *car, bool tracktype, bool subcat
|
||||||
// Add the rearwings
|
// Add the rearwings
|
||||||
for (int i = 1; i < nranges; i++)
|
for (int i = 1; i < nranges; i++)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Node> pWing1 = new osg::Node;
|
osg::ref_ptr<osg::Node> pWing1_branch = new osg::Node;
|
||||||
osg::ref_ptr<osg::MatrixTransform> position = new osg::MatrixTransform;
|
|
||||||
snprintf(path, nMaxTexPathSize, "%s/%s/%d", SECT_GROBJECTS, LST_REARWING, i);
|
snprintf(path, nMaxTexPathSize, "%s/%s/%d", SECT_GROBJECTS, LST_REARWING, i);
|
||||||
param = GfParmGetStr(handle, path, PRM_REARWINGMODEL, "");
|
param = GfParmGetStr(handle, path, PRM_REARWINGMODEL, "");
|
||||||
|
|
||||||
strPath = tmp+param;
|
strPath = tmp+param;
|
||||||
|
pWing1_branch = loader.Load3dFile(strPath, true);
|
||||||
|
GfLogInfo("Loading Wing animate %i - %s !\n", i, strPath.c_str());
|
||||||
|
|
||||||
GfLogInfo("Loading Wing animate %i - %s !\n", i, strPath.c_str());
|
pWing3->addChild(pWing1_branch.get());
|
||||||
|
|
||||||
tdble xpos = GfParmGetNum(handle, path, PRM_XPOS, NULL, 0.0);
|
|
||||||
tdble ypos = GfParmGetNum(handle, path, PRM_YPOS, NULL, 0.0);
|
|
||||||
tdble zpos = GfParmGetNum(handle, path, PRM_ZPOS, NULL, 0.0);
|
|
||||||
osg::Matrix pos = osg::Matrix::translate(xpos, ypos, zpos);
|
|
||||||
|
|
||||||
pWing1 = loader.Load3dFile(strPath, true);
|
|
||||||
position->addChild(pWing1.get());
|
|
||||||
pWing3->addChild(position.get());
|
|
||||||
strPath ="";
|
strPath ="";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,6 +406,8 @@ osg::ref_ptr<osg::Node> SDCar::loadCar(tCarElt *car, bool tracktype, bool subcat
|
||||||
tdble zpos = GfParmGetNum(handle, buf, PRM_ZPOS, NULL, 0.0);
|
tdble zpos = GfParmGetNum(handle, buf, PRM_ZPOS, NULL, 0.0);
|
||||||
osg::Matrix pos = osg::Matrix::translate(xpos, ypos, zpos);
|
osg::Matrix pos = osg::Matrix::translate(xpos, ypos, zpos);
|
||||||
|
|
||||||
|
position->setMatrix(pos);
|
||||||
|
|
||||||
driver_path = tmp+param;
|
driver_path = tmp+param;
|
||||||
driver_branch = loader.Load3dFile(driver_path, true);
|
driver_branch = loader.Load3dFile(driver_path, true);
|
||||||
GfLogInfo("Loading Animated Driver %i - %s \n", i, driver_path.c_str());
|
GfLogInfo("Loading Animated Driver %i - %s \n", i, driver_path.c_str());
|
||||||
|
@ -434,12 +428,14 @@ osg::ref_ptr<osg::Node> SDCar::loadCar(tCarElt *car, bool tracktype, bool subcat
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
gCar->addChild(pWing.get());
|
|
||||||
gCar->addChild(pWing3.get());
|
|
||||||
|
|
||||||
gCar->addChild(pCar.get());
|
gCar->addChild(pCar.get());
|
||||||
gCar->addChild(pDriver.get());
|
gCar->addChild(pDriver.get());
|
||||||
gCar->addChild(pSteer.get());
|
gCar->addChild(pSteer.get());
|
||||||
|
|
||||||
|
if(_wing1)
|
||||||
|
gCar->addChild(pWing.get());
|
||||||
|
if(_wing3)
|
||||||
|
gCar->addChild(pWing3.get());
|
||||||
#else
|
#else
|
||||||
|
|
||||||
osg::ref_ptr<osg::Group> gCar = new osg::Group;
|
osg::ref_ptr<osg::Group> gCar = new osg::Group;
|
||||||
|
|
|
@ -54,14 +54,17 @@ osg::Node *osgLoader::Load3dFile(std::string strFile, bool car)
|
||||||
{
|
{
|
||||||
osg::Node *pNode = NULL;
|
osg::Node *pNode = NULL;
|
||||||
std::string ext = osgDB::getFileExtension(strFile);
|
std::string ext = osgDB::getFileExtension(strFile);
|
||||||
if (car)
|
/*if (car)
|
||||||
m_ACCReader.SetCar(true);
|
m_ACCReader2.SetCar(true);*/
|
||||||
|
|
||||||
if (ext == "acc")
|
if (ext == "acc")
|
||||||
{
|
{
|
||||||
|
/*if(car)
|
||||||
|
osgDB::ReaderWriter::ReadResult rr = m_ACCReader2.readNode(strFile, m_pOpt);
|
||||||
|
else*/
|
||||||
//Use custom ACC file loader
|
//Use custom ACC file loader
|
||||||
osgDB::ReaderWriter::ReadResult rr = m_ACCReader.readNode(strFile, m_pOpt);
|
osgDB::ReaderWriter::ReadResult rr = m_ACCReader.readNode(strFile, m_pOpt);
|
||||||
GfOut("le test %d \n", rr.validNode());
|
GfOut("Object ACC load = %s - %d \n", strFile.c_str(), rr.validNode());
|
||||||
if (rr.validNode())
|
if (rr.validNode())
|
||||||
{
|
{
|
||||||
osg::Node *nod = rr.takeNode();
|
osg::Node *nod = rr.takeNode();
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <osgDB/ReadFile>
|
#include <osgDB/ReadFile>
|
||||||
|
|
||||||
#include "ReaderWriterACC.h"
|
#include "ReaderWriterACC.h"
|
||||||
|
//#include "ReaderWriterACC2.h"
|
||||||
|
|
||||||
class osgLoader
|
class osgLoader
|
||||||
{
|
{
|
||||||
|
@ -34,4 +35,5 @@ public:
|
||||||
protected:
|
protected:
|
||||||
osg::ref_ptr<osgDB::ReaderWriter::Options> m_pOpt;
|
osg::ref_ptr<osgDB::ReaderWriter::Options> m_pOpt;
|
||||||
ReaderWriterACC m_ACCReader;
|
ReaderWriterACC m_ACCReader;
|
||||||
|
//ReaderWriterACC2 m_ACCReader2;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue