update osggraph
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5340 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: ae87d460da629d99c2f345014db79136660b09a2 Former-commit-id: a27b0fbef2ad185d027dcf2e5bc31e12f403c9f7
This commit is contained in:
parent
fc6149db81
commit
91039b2fa7
4 changed files with 25 additions and 26 deletions
|
@ -349,8 +349,8 @@ int initTrack(tTrack *track)
|
|||
|
||||
scenery = new SDScenery;
|
||||
render = new SDRender;
|
||||
osg::ref_ptr<osg::Group> sceneroot = new osg::Group();
|
||||
m_sceneroot = new osg::Group();
|
||||
osg::ref_ptr<osg::Group> sceneroot = new osg::Group;
|
||||
m_sceneroot = new osg::Group;
|
||||
sceneroot->addChild(scenery->LoadScene(track));
|
||||
|
||||
m_sceneroot->addChild(render->Init(sceneroot, track));
|
||||
|
|
|
@ -69,7 +69,7 @@ SDScenery::~SDScenery(void)
|
|||
//delete m_pits;
|
||||
}
|
||||
|
||||
osg::Node* SDScenery::LoadScene(tTrack *track)
|
||||
osg::ref_ptr<osg::Node> SDScenery::LoadScene(tTrack *track)
|
||||
{
|
||||
void *hndl = grTrackHandle;
|
||||
const char *acname;
|
||||
|
@ -119,9 +119,8 @@ osg::Node* SDScenery::LoadScene(tTrack *track)
|
|||
std::string strPath = PathTmp;
|
||||
sprintf(buf, "tracks/%s/%s", grTrack->category, grTrack->internalname);
|
||||
strPath += buf;
|
||||
osg::Node * bg= m_background->build(_bgtype, _grWrldX, _grWrldY, _grWrldZ, strPath);
|
||||
bg->getOrCreateStateSet()->setRenderingHint(
|
||||
osg::StateSet::OPAQUE_BIN );
|
||||
osg::ref_ptr<osg::Node> bg= m_background->build(_bgtype, _grWrldX, _grWrldY, _grWrldZ, strPath);
|
||||
bg->getOrCreateStateSet()->setRenderingHint( osg::StateSet::OPAQUE_BIN );
|
||||
_scenery->addChild(bg);
|
||||
GfOut("Background loaded\n");
|
||||
}
|
||||
|
@ -135,7 +134,7 @@ osg::Node* SDScenery::LoadScene(tTrack *track)
|
|||
if (ext == "acc")
|
||||
{
|
||||
strPath+=buf;
|
||||
_strTexturePath = strPath;
|
||||
_strTexturePath = strPath;
|
||||
strPath+="/";
|
||||
strPath+=acname;
|
||||
|
||||
|
@ -144,26 +143,26 @@ osg::Node* SDScenery::LoadScene(tTrack *track)
|
|||
else
|
||||
{
|
||||
strPath+=buf;
|
||||
osg::ref_ptr<osgDB::Options> options = new osgDB::Options();
|
||||
options->getDatabasePathList().push_back(strPath);
|
||||
std::string strTPath = GetDataDir();
|
||||
snprintf(buf, 4096, "data/textures/");
|
||||
strTPath += buf;
|
||||
options->getDatabasePathList().push_back(strTPath);
|
||||
osg::ref_ptr<osg::Node> pTrack = osgDB::readNodeFile(acname, options);
|
||||
osg::ref_ptr<osgDB::Options> options = new osgDB::Options();
|
||||
options->getDatabasePathList().push_back(strPath);
|
||||
std::string strTPath = GetDataDir();
|
||||
snprintf(buf, 4096, "data/textures/");
|
||||
strTPath += buf;
|
||||
options->getDatabasePathList().push_back(strTPath);
|
||||
osg::ref_ptr<osg::Node> pTrack = osgDB::readNodeFile(acname, options);
|
||||
|
||||
if (ext =="ac")
|
||||
{
|
||||
osg::ref_ptr<osg::MatrixTransform> rot = new osg::MatrixTransform;
|
||||
osg::Matrix mat( 1.0f, 0.0f, 0.0f, 0.0f,
|
||||
if (ext =="ac")
|
||||
{
|
||||
osg::ref_ptr<osg::MatrixTransform> rot = 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);
|
||||
rot->setMatrix(mat);
|
||||
rot->addChild(pTrack);
|
||||
_scenery->addChild(rot);
|
||||
return _scenery;
|
||||
}
|
||||
rot->setMatrix(mat);
|
||||
rot->addChild(pTrack);
|
||||
_scenery->addChild(rot);
|
||||
return _scenery;
|
||||
}
|
||||
|
||||
_scenery->addChild(pTrack);
|
||||
}
|
||||
|
@ -223,7 +222,7 @@ bool SDScenery::LoadTrack(std::string strTrack)
|
|||
strTPath += buf;
|
||||
loader.AddSearchPath(strTPath);
|
||||
|
||||
osg::Node *pTrack = loader.Load3dFile(strTrack, false);
|
||||
osg::ref_ptr<osg::Node> pTrack = loader.Load3dFile(strTrack, false);
|
||||
|
||||
if (pTrack)
|
||||
{
|
||||
|
|
|
@ -131,7 +131,7 @@ public:
|
|||
/* Destructor */
|
||||
~SDScenery(void);
|
||||
|
||||
osg::Node *LoadScene(tTrack *track);
|
||||
osg::ref_ptr<osg::Node> LoadScene(tTrack *track);
|
||||
void CreatePit(tTrack *track);
|
||||
//void addSpectators(SDSpectators->build(number, tTrack *track));
|
||||
//void addTrees(SDTrees->build(tTrack *track));
|
||||
|
|
|
@ -384,7 +384,7 @@ bool SDSun::reposition( osg::Vec3d p, double angle)
|
|||
|
||||
osg::Vec4f SDSun::get_color()
|
||||
{
|
||||
return osg::Vec4f((*sun_cl)[0][0], (*sun_cl)[0][1], (*sun_cl)[0][2], (*sun_cl)[0][3]);
|
||||
return osg::Vec4f((*ohalo_cl)[0][0], (*ohalo_cl)[0][1], (*ohalo_cl)[0][2], (*ohalo_cl)[0][3]);
|
||||
}
|
||||
|
||||
osg::Vec4f SDSun::get_scene_color()
|
||||
|
|
Loading…
Reference in a new issue