update OsgGraph
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5448 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 576b7d1ff0bca817867adbacd9ccbca7f7d1e8a8 Former-commit-id: d9fb3a2d57927c68ff0e663733eec6e93834de2f
This commit is contained in:
parent
7d9184c9ab
commit
74387c320c
5 changed files with 25 additions and 23 deletions
|
@ -61,7 +61,7 @@ class SDCars
|
|||
void updateCars();
|
||||
void unLoad();
|
||||
void updateShadingParameters(osg::Vec3f eye,osg::Matrixf modelview);
|
||||
osg::ref_ptr<osg::Node> getCarsNode(){ return cars_branch; }
|
||||
osg::Node* getCarsNode(){ return cars_branch.get(); }
|
||||
};
|
||||
|
||||
#endif /* _OSGCAR_H_ */
|
||||
|
|
|
@ -68,7 +68,7 @@ void * getScenery()
|
|||
//static osg::ref_ptr<osg::Group> m_sceneroot = NULL;
|
||||
//static osg::ref_ptr<osg::Group> m_carroot = NULL;
|
||||
static osg::Timer m_timer;
|
||||
//static osg::Timer_t m_start_tick;
|
||||
static osg::Timer_t m_start_tick;
|
||||
|
||||
int grMaxTextureUnits = 0;
|
||||
|
||||
|
@ -315,6 +315,7 @@ void shutdownCars(void)
|
|||
{
|
||||
cars->unLoad();
|
||||
delete cars;
|
||||
cars = NULL;
|
||||
//delete m_carroot;
|
||||
|
||||
/* int i;
|
||||
|
@ -372,12 +373,9 @@ int initTrack(tTrack *track)
|
|||
|
||||
scenery = new SDScenery;
|
||||
render = new SDRender;
|
||||
//sceneroot = new osg::Group;
|
||||
//m_sceneroot = new osg::Group;
|
||||
//m_sceneroot->removeChildren(0, m_sceneroot->getNumChildren());
|
||||
|
||||
scenery->LoadScene(track);
|
||||
render->Init(track);
|
||||
//m_sceneroot->addChild(render->getRoot());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -409,6 +407,7 @@ void shutdownTrack(void)
|
|||
{
|
||||
scenery->ShutdownScene();
|
||||
delete scenery;
|
||||
scenery = NULL;
|
||||
// Do the real track termination job.
|
||||
osgDB::Registry::instance()->clearObjectCache();
|
||||
//m_sceneroot = NULL;
|
||||
|
@ -426,6 +425,8 @@ shutdownView(void)
|
|||
{
|
||||
delete screens;
|
||||
delete render;
|
||||
screens = NULL;
|
||||
render = NULL;
|
||||
// delete viewer;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,17 +45,17 @@ SDScenery::SDScenery(void)
|
|||
grWrldY = 0;
|
||||
grWrldZ = 0;
|
||||
grWrldMaxSize = 0;
|
||||
_max_visibility = 0;
|
||||
_nb_cloudlayer = 0;
|
||||
_DynamicSkyDome = 0;
|
||||
_SkyDomeDistance = 0;
|
||||
_SkyDomeDistThresh = 12000;
|
||||
_max_visibility = 0;
|
||||
_nb_cloudlayer = 0;
|
||||
_DynamicSkyDome = 0;
|
||||
_SkyDomeDistance = 0;
|
||||
_SkyDomeDistThresh = 12000;
|
||||
|
||||
_bgtype = false;
|
||||
_bgsky = false;
|
||||
|
||||
_scenery = new osg::Group;
|
||||
_background = new osg::Group;
|
||||
_scenery = NULL;
|
||||
_background = NULL;
|
||||
//_spectators = 0;
|
||||
//_trees = 0;
|
||||
//_pits = 0;
|
||||
|
@ -125,7 +125,7 @@ void SDScenery::LoadScene(tTrack *track)
|
|||
osg::ref_ptr<osg::StateSet> bgstate = bg->getOrCreateStateSet();
|
||||
bgstate->setRenderBinDetails(-1, "RenderBin");
|
||||
//bg->getOrCreateStateSet()->setRenderingHint( osg::StateSet::OPAQUE_BIN );
|
||||
_scenery->addChild(bg);
|
||||
_scenery->addChild(bg.get());
|
||||
GfOut("Background loaded\n");
|
||||
}
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ void SDScenery::LoadScene(tTrack *track)
|
|||
0.0f, 0.0f, 0.0f, 1.0f);
|
||||
rot->setMatrix(mat);
|
||||
rot->addChild(pTrack);
|
||||
_scenery->addChild(rot);
|
||||
_scenery->addChild(rot.get());
|
||||
}
|
||||
|
||||
_scenery->addChild(pTrack.get());
|
||||
|
@ -221,15 +221,15 @@ bool SDScenery::LoadTrack(std::string strTrack)
|
|||
|
||||
std::string strTPath = GetDataDir();
|
||||
snprintf(buf, 4096, "data/textures/");
|
||||
strTPath += buf;
|
||||
loader.AddSearchPath(strTPath);
|
||||
strTPath += buf;
|
||||
loader.AddSearchPath(strTPath);
|
||||
|
||||
osg::ref_ptr<osg::Node> pTrack = loader.Load3dFile(strTrack, false);
|
||||
|
||||
if (pTrack)
|
||||
{
|
||||
pTrack->getOrCreateStateSet()->setRenderBinDetails(TRACKBIN,"RenderBin");
|
||||
_scenery->addChild(pTrack);
|
||||
_scenery->addChild(pTrack.get());
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
|
|
@ -78,9 +78,9 @@ void SDScreens::Init(int x,int y, int width, int height, osg::ref_ptr<osg::Node>
|
|||
Screens.insert(Screens.end(),view);
|
||||
|
||||
root = new osg::Group;
|
||||
root->addChild(m_sceneroot);
|
||||
root->addChild(m_sceneroot.get());
|
||||
root->addChild(mirrorCam);
|
||||
mirrorCam->addChild(m_sceneroot);
|
||||
mirrorCam->addChild(m_sceneroot.get());
|
||||
|
||||
//adding all otherer cams
|
||||
osg::ref_ptr<osg::Camera> screenCam;
|
||||
|
@ -107,11 +107,11 @@ void SDScreens::Init(int x,int y, int width, int height, osg::ref_ptr<osg::Node>
|
|||
|
||||
Screens.insert(Screens.end(),view);
|
||||
|
||||
root->addChild(screenCam);
|
||||
root->addChild(mirrorCam);
|
||||
root->addChild(screenCam.get());
|
||||
root->addChild(mirrorCam.get());
|
||||
}
|
||||
|
||||
viewer->setSceneData(root);
|
||||
viewer->setSceneData(root.get());
|
||||
viewer->realize();
|
||||
}
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ SDSky::~SDSky( void )
|
|||
delete moon;
|
||||
delete planets;
|
||||
delete stars;
|
||||
pre_root->removeChild(0, pre_root->getNumChildren());
|
||||
//delete pre_transform;
|
||||
//delete post_root;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue