update OsgGraph

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5435 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: a16189115b73b43ee91dd66f1a92f88688cc45e7
Former-commit-id: 2ff9735fac649dd7e187d1dcb36405cace902454
This commit is contained in:
torcs-ng 2013-05-09 14:24:40 +00:00
parent 90dc6c6436
commit c63e7a245c
6 changed files with 10 additions and 23 deletions

View file

@ -674,6 +674,7 @@ bool SDCloudLayer::reposition( const osg::Vec3f& p, double dt )
setTextureOffset(base);
last_pos = p;
scale = layer_scale;
}
}

View file

@ -86,7 +86,7 @@ public:
inline float getDirection() { return direction; }
inline void setSpeed(float sp)
{
// cout << "cloud speed = " << sp << endl;
//Out("cloud speed = %f\n", sp);
speed = sp;
}

View file

@ -118,13 +118,13 @@ void OsgGraph::unloadCars()
void OsgGraph::unloadTrack()
{
//GfLogDebug("SsgGraph::unloadTrack\n");
GfLogDebug("SsgGraph::unloadTrack\n");
::shutdownTrack();
}
void OsgGraph::shutdownView()
{
//GfLogDebug("SsgGraph::shutdownView\n");
GfLogDebug("SsgGraph::shutdownView\n");
::shutdownView();
}

View file

@ -416,11 +416,6 @@ void shutdownTrack(void)
GfParmReleaseHandle(grTrackHandle);
grTrackHandle = 0;
}
// And then the context termination job (should not be there, see initTrack).
//options.endLoad();
//grShutdownState();
}
void

View file

@ -95,7 +95,7 @@ SDSky * SDRender::getSky()
*/
void SDRender::Init(tTrack *track)
{
char buf[256];
//char buf[256];
//void *hndl = grTrackHandle;
grTrack = track;
@ -150,8 +150,6 @@ void SDRender::Init(tTrack *track)
const int timeOfDay = (int)grTrack->local.timeofday;
const double domeSizeRatio = SDSkyDomeDistance / 80000.0;
//SDMax_Visibility = 20000.0f;
GfLogInfo(" domeSizeRation : %d\n", domeSizeRatio);
thesky->build(datapath, SDSkyDomeDistance, SDSkyDomeDistance, 800,
@ -224,7 +222,6 @@ void SDRender::Init(tTrack *track)
osg::ref_ptr<osg::Group> sceneGroup = new osg::Group;
osg::ref_ptr<osg::Group> mRoot = new osg::Group;
sceneGroup->addChild(scenery->getScene());
//sceneGroup->setNodeMask(~simgear::BACKGROUND_BIT);
osg::ref_ptr<osg::StateSet> stateSet = sceneGroup->getOrCreateStateSet();
stateSet->setMode(GL_DEPTH_TEST, osg::StateAttribute::ON);
@ -235,16 +232,14 @@ void SDRender::Init(tTrack *track)
osg::ref_ptr<osg::LightSource> lightSource = new osg::LightSource;
lightSource->getLight()->setDataVariance(osg::Object::DYNAMIC);
lightSource->getLight()->setLightNum(0);
// relative because of CameraView being just a clever transform node
lightSource->setReferenceFrame(osg::LightSource::RELATIVE_RF);
lightSource->setLocalStateSetModes(osg::StateAttribute::ON);
lightSource->getLight()->setAmbient(osg::Vec4(0.0f, 0.0f, 0.0f, 0.0f));
lightSource->getLight()->setDiffuse(osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f));
lightSource->getLight()->setDiffuse(osg::Vec4( 0.2f, 0.2f, 0.2f, 1.0f));
lightSource->getLight()->setSpecular(osg::Vec4(0.0f, 0.0f, 0.0f, 0.0f));
//sceneGroup->addChild(lightSource);
//assert(dynamic_cast<osg::LightSource*>(mRoot));
//osg::LightSource lightSource = static_cast<osg::LightSource*>(mRoot);
sceneGroup->addChild(lightSource);
// we need a white diffuse light for the phase of the moon
osg::ref_ptr<osg::LightSource> sunLight = new osg::LightSource;
@ -271,8 +266,6 @@ void SDRender::Init(tTrack *track)
mRoot->addChild(sceneGroup.get());
mRoot->setStateSet(setFogState().get());
mRoot->addChild(sunLight.get());
//mRoot->addChild(lightSource);
// Clouds are added to the scene graph later
stateSet = mRoot->getOrCreateStateSet();
@ -284,15 +277,13 @@ void SDRender::Init(tTrack *track)
m_scene->addChild(mRoot.get());
GfOut("LE POINTEUR %d\n",mRoot.get());
//return mRoot.get();
}//SDRender::Init
void SDRender::UpdateLight( void )
{
sol_angle = (float)thesky->getSA();
moon_angle = (float)thesky->getMA();
float deg = sol_angle * SD_RADIANS_TO_DEGREES;
//float deg = sol_angle * SD_RADIANS_TO_DEGREES;
float sky_brightness = (float)(1.0 + cos(sol_angle)) / 2.0f;
GfOut("Sun Angle in Render = %f - sky brightness = %f\n", sol_angle, sky_brightness);

View file

@ -22,7 +22,7 @@
#include <osg/Group>
#include <track.h> //tTrack
#include <track.h> //tTrack
#include <raceman.h> // tSituation
class SDSky;