- Update osggraph

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

Former-commit-id: e2dadf022de2447ea225127d61858a44ae3834f3
Former-commit-id: 11dfe3c60b8c909da77211b04e07a405cc3a92f0
This commit is contained in:
torcs-ng 2015-04-23 23:16:02 +00:00
parent 19e2decf82
commit 081cf829b9
7 changed files with 60 additions and 46 deletions

View file

@ -68,7 +68,10 @@ public:
CameraPreCallback *pre_cam = new CameraPreCallback;
CameraPostCallback *post_cam = new CameraPostCallback;
SDReflectionMapping::SDReflectionMapping(SDCar *c):car(c)
SDReflectionMapping::SDReflectionMapping(SDCar *c):
camerasRoot(NULL),
reflectionMap(NULL),
car(c)
{
SDRender *render = (SDRender *)getRender();
unsigned reflectionShader = render->getShader();
@ -88,25 +91,24 @@ SDReflectionMapping::SDReflectionMapping(SDCar *c):car(c)
imagePosZ->setInternalTextureFormat(GL_RGB);
imageNegZ->setInternalTextureFormat(GL_RGB);
osg::ref_ptr<osg::TextureCubeMap> reflectionMap;
osg::ref_ptr<osg::TextureCubeMap> reflectionmap = new osg::TextureCubeMap;
reflectionMap = new osg::TextureCubeMap;
this->reflectionMap = reflectionMap;
this->reflectionMap = reflectionmap;
reflectionMap->setImage(osg::TextureCubeMap::POSITIVE_X, imagePosX);
reflectionMap->setImage(osg::TextureCubeMap::NEGATIVE_X, imageNegX);
reflectionMap->setImage(osg::TextureCubeMap::POSITIVE_Y, imagePosY);
reflectionMap->setImage(osg::TextureCubeMap::NEGATIVE_Y, imageNegY);
reflectionMap->setImage(osg::TextureCubeMap::POSITIVE_Z, imagePosZ);
reflectionMap->setImage(osg::TextureCubeMap::NEGATIVE_Z, imageNegZ);
reflectionmap->setImage(osg::TextureCubeMap::POSITIVE_X, imagePosX);
reflectionmap->setImage(osg::TextureCubeMap::NEGATIVE_X, imageNegX);
reflectionmap->setImage(osg::TextureCubeMap::POSITIVE_Y, imagePosY);
reflectionmap->setImage(osg::TextureCubeMap::NEGATIVE_Y, imageNegY);
reflectionmap->setImage(osg::TextureCubeMap::POSITIVE_Z, imagePosZ);
reflectionmap->setImage(osg::TextureCubeMap::NEGATIVE_Z, imageNegZ);
reflectionMap->setTextureSize( 256, 256 );
reflectionMap->setInternalFormat( GL_RGB);
reflectionMap->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
reflectionMap->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
reflectionMap->setWrap(osg::Texture::WRAP_R, osg::Texture::CLAMP_TO_EDGE);
reflectionMap->setFilter(osg::TextureCubeMap::MIN_FILTER,osg::TextureCubeMap::LINEAR);
reflectionMap->setFilter(osg::TextureCubeMap::MAG_FILTER,osg::TextureCubeMap::LINEAR);
reflectionmap->setTextureSize( 256, 256 );
reflectionmap->setInternalFormat( GL_RGB);
reflectionmap->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
reflectionmap->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
reflectionmap->setWrap(osg::Texture::WRAP_R, osg::Texture::CLAMP_TO_EDGE);
reflectionmap->setFilter(osg::TextureCubeMap::MIN_FILTER,osg::TextureCubeMap::LINEAR);
reflectionmap->setFilter(osg::TextureCubeMap::MAG_FILTER,osg::TextureCubeMap::LINEAR);
camerasRoot = new osg::Group;

View file

@ -72,9 +72,21 @@ static const int NbShadersValues = sizeof(ShadersValues) / sizeof(ShadersValues[
static const int CloudsTextureIndices[TR_CLOUDS_FULL+1] = {1, 3, 5, 7, 8};
static const int NCloudsTextureIndices = sizeof(CloudsTextureIndices) / sizeof(int);
SDRender::SDRender(void)
:AStarsData(NULL),
APlanetsData(NULL)
SDRender::SDRender(void) :
m_RealRoot(NULL),
m_scene(NULL),
m_CarRoot(NULL),
skyGroup(NULL),
stateSet(NULL),
skySS(NULL),
lightSource(NULL),
sunLight(NULL),
shadowRoot(NULL),
AStarsData(NULL),
APlanetsData(NULL),
thesky(NULL),
scenery(NULL),
SDTrack(NULL)
{
BaseSkyColor = osg::Vec3f( 0.31f, 0.43f, 0.69f );
BaseFogColor = osg::Vec3f( 0.84f, 0.84f, 1.0f );
@ -105,9 +117,6 @@ SDRender::SDRender(void)
sol_angle = 0.0;
moon_angle = 0.0;
sky_brightness = 0.0;
m_scene = NULL;
thesky = NULL;
SDTrack = NULL;
}
SDRender::~SDRender(void)

View file

@ -24,7 +24,7 @@
#include "OsgScenery.h"
SDPit::SDPit(void)
/*SDPit::SDPit(void)
{
}
@ -53,4 +53,4 @@ void SDPit::build(const std::string TrackPath)
_osgpit = new osg::Group;
_osgpit->addChild(_pit_transform.get());
}
}*/

View file

@ -33,7 +33,10 @@
#include <robottools.h> //RtXXX()
#include <portability.h>
SDScenery::SDScenery(void)
SDScenery::SDScenery(void) :
m_background(NULL),
_scenery(NULL),
SDTrack(NULL)
{
grWrldX = 0;
grWrldY = 0;
@ -49,16 +52,12 @@ SDScenery::SDScenery(void)
_bgsky = false;
_speedWay = false;
_speedWayLong = false;
_scenery = NULL;
SDTrack = NULL;
}
SDScenery::~SDScenery(void)
{
delete m_background;
delete m_pit;
//delete m_pit;
delete SDTrack;
_scenery = NULL;
@ -75,7 +74,7 @@ void SDScenery::LoadScene(tTrack *track)
GfOut("Initialisation class SDScenery\n");
m_background = new SDBackground;
m_pit = new SDPit;
//m_pit = new SDPit;
_scenery = new osg::Group;
SDTrack = track;
@ -196,8 +195,8 @@ void SDScenery::LoadScene(tTrack *track)
osg::ref_ptr<osg::Node> pTrack = osgDB::readNodeFile( osgname );
_scenery->addChild(pTrack.get());
m_pit->build(strPath);
_scenery->addChild(m_pit->getPit());
//m_pit->build(strPath);
//_scenery->addChild(m_pit->getPit());
}
osgDB::Registry::instance()->clearObjectCache();

View file

@ -28,8 +28,8 @@
#include <osg/Group>
class SDBackground;
class SDPit;
class SDTrackLights;
//class SDPit;
//class SDTrackLights;
class SDScenery;
class osgLoader;
@ -55,7 +55,7 @@ public:
osg::ref_ptr<osg::Group> getBackground() { return _background.get(); }
};
class SDPit
/*class SDPit
{
osg::ref_ptr<osg::Group> _osgpit;
bool _number;
@ -87,7 +87,7 @@ public:
void build(const std::string strTrack);
osg::ref_ptr<osg::Group> getTrackLight() { return _osgtracklight.get(); }
};
};*/
static int grWrldX=0;
static int grWrldY=0;
@ -98,8 +98,8 @@ class SDScenery
{
private:
SDBackground *m_background;
SDPit *m_pit;
SDTrackLights *m_tracklights;
//SDPit *m_pit;
//SDTrackLights *m_tracklights;
osg::ref_ptr<osg::Group> _scenery;
@ -142,8 +142,8 @@ public:
osg::ref_ptr<osg::Group> getScene() { return _scenery.get(); }
osg::ref_ptr<osg::Group> getBackground() { return m_background->getBackground(); }
osg::ref_ptr<osg::Group> getPit() { return m_pit->getPit(); }
osg::ref_ptr<osg::Group> getTracklight() { return m_tracklights->getTrackLight(); }
//osg::ref_ptr<osg::Group> getPit() { return m_pit->getPit(); }
//osg::ref_ptr<osg::Group> getTracklight() { return m_tracklights->getTrackLight(); }
};
#endif //_OSGSCENERY_H_

View file

@ -25,7 +25,7 @@
#include "OsgScenery.h"
SDTrackLights::SDTrackLights(void)
/*SDTrackLights::SDTrackLights(void)
{
}
@ -38,4 +38,4 @@ SDTrackLights::~SDTrackLights(void)
void SDTrackLights::build(const std::string TrackPath)
{
osg::ref_ptr<osg::StateSet> state;
}
}*/

View file

@ -31,8 +31,12 @@
#include "OsgMain.h"
#include "OsgCar.h"
SDScreens::SDScreens()
:m_CurrentScreenIndex(0)
SDScreens::SDScreens() :
root(NULL),
mirrorScene(NULL),
prerenderRoot(NULL),
m_CurrentScreenIndex(0)
{
debugHUD = new SDDebugHUD();
//viewer = static_cast<osgViewer::Viewer *> (GfScrGetViewer());