forked from speed-dreams/speed-dreams-code
clean code in SDRender
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5362 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 6d271724a5b579422436141393f22cac7f19b9d5 Former-commit-id: cf9531ada91e4cf7d455f05b7b503d28895f40d5
This commit is contained in:
parent
44230e1752
commit
e646f5ae6a
4 changed files with 14 additions and 8 deletions
|
@ -176,7 +176,7 @@ void SDChangeScreen(void * vp)
|
|||
|
||||
int initView(int x, int y, int width, int height, int /* flag */, void *screen)
|
||||
{
|
||||
render = new SDRender();
|
||||
//render = new SDRender();
|
||||
screens = new SDScreens();
|
||||
|
||||
m_Winx = x;
|
||||
|
|
|
@ -43,8 +43,8 @@ static const double m_log01 = -log( 0.01 );
|
|||
static const double sqrt_m_log01 = sqrt( m_log01 );
|
||||
const GLfloat fog_exp2_density = sqrt_m_log01 / 11000;
|
||||
|
||||
static osg::ref_ptr<osg::Group> mRealRoot = new osg::Group;
|
||||
static osg::ref_ptr<osg::Group> mRoot = new osg::Group;
|
||||
//static osg::ref_ptr<osg::Group> mRealRoot = new osg::Group;
|
||||
//static osg::ref_ptr<osg::Group> mRoot = new osg::Group;
|
||||
|
||||
SDSky *thesky = NULL;
|
||||
static tTrack *grTrack;
|
||||
|
@ -81,7 +81,7 @@ static int NPlanets;
|
|||
static float sol_angle;
|
||||
static float moon_angle;
|
||||
|
||||
static osg::ref_ptr<osg::Group> RealRoot = new osg::Group;
|
||||
//static osg::ref_ptr<osg::Group> RealRoot = new osg::Group;
|
||||
|
||||
SDRender::SDRender(void)
|
||||
{
|
||||
|
@ -89,6 +89,7 @@ SDRender::SDRender(void)
|
|||
|
||||
SDRender::~SDRender(void)
|
||||
{
|
||||
delete thesky;
|
||||
}
|
||||
|
||||
SDSky * SDRender::getSky(){
|
||||
|
@ -101,7 +102,7 @@ SDSky * SDRender::getSky(){
|
|||
*
|
||||
* @return 0 if OK, -1 if something failed
|
||||
*/
|
||||
osg::Node* SDRender::Init(osg::Group *m_sceneroot, tTrack *track)
|
||||
osg::ref_ptr<osg::Node> SDRender::Init(osg::Group *m_sceneroot, tTrack *track)
|
||||
{
|
||||
//char buf[256];
|
||||
//void *hndl = grTrackHandle;
|
||||
|
@ -184,6 +185,7 @@ osg::Node* SDRender::Init(osg::Group *m_sceneroot, tTrack *track)
|
|||
APlanetsData, NStars, AStarsData);
|
||||
|
||||
osg::Group* sceneGroup = new osg::Group;
|
||||
osg::ref_ptr<osg::Group> mRoot = new osg::Group;
|
||||
sceneGroup->addChild(m_sceneroot);
|
||||
//sceneGroup->setNodeMask(~simgear::BACKGROUND_BIT);
|
||||
osg::StateSet* stateSet = sceneGroup->getOrCreateStateSet();
|
||||
|
|
|
@ -31,7 +31,7 @@ class SDRender
|
|||
{
|
||||
private:
|
||||
osg::ref_ptr<osg::Group> m_sceneroot;
|
||||
osg::ref_ptr<osg::Group> m_carroot;
|
||||
//osg::ref_ptr<osg::Group> m_carroot;
|
||||
|
||||
osg::Vec3f SkyColor;
|
||||
osg::Vec3f BaseFogColor;
|
||||
|
@ -47,7 +47,7 @@ public:
|
|||
SDRender(void);
|
||||
~SDRender(void);
|
||||
|
||||
osg::Node *Init(osg::Group* root, tTrack *track);
|
||||
osg::ref_ptr<osg::Node> Init(osg::Group* root, tTrack *track);
|
||||
void Update(float speedcar, tSituation *s);
|
||||
void UpdateTime(tSituation *s);
|
||||
void UpdateLight(void);
|
||||
|
|
|
@ -67,6 +67,8 @@ SDScenery::~SDScenery(void)
|
|||
//delete m_spectators;
|
||||
//delete m_trees;
|
||||
//delete m_pits;
|
||||
_background = NULL;
|
||||
_scenery = NULL;
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Node> SDScenery::LoadScene(tTrack *track)
|
||||
|
@ -120,7 +122,9 @@ osg::ref_ptr<osg::Node> SDScenery::LoadScene(tTrack *track)
|
|||
sprintf(buf, "tracks/%s/%s", grTrack->category, grTrack->internalname);
|
||||
strPath += buf;
|
||||
osg::ref_ptr<osg::Node> bg= m_background->build(_bgtype, _grWrldX, _grWrldY, _grWrldZ, strPath);
|
||||
bg->getOrCreateStateSet()->setRenderingHint( osg::StateSet::OPAQUE_BIN );
|
||||
osg::ref_ptr<osg::StateSet> bgstate = bg->getOrCreateStateSet();
|
||||
bgstate->setRenderBinDetails(-1, "RenderBin");
|
||||
//bg->getOrCreateStateSet()->setRenderingHint( osg::StateSet::OPAQUE_BIN );
|
||||
_scenery->addChild(bg);
|
||||
GfOut("Background loaded\n");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue