- Update OsgGraph

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

Former-commit-id: e4e30592404b6f3a9376790fe33510bebc47382c
Former-commit-id: c5cbe8d19419e40e8ece35cac1196883e7fbdc9d
This commit is contained in:
torcs-ng 2015-04-21 12:16:46 +00:00
parent efcd77176b
commit 230949176c
4 changed files with 8 additions and 8 deletions

View file

@ -487,7 +487,7 @@ osg::ref_ptr<osg::Node> SDCar::loadCar(tCarElt *car, bool tracktype, bool subcat
this->shader = new SDCarShader(pCar.get(), this); this->shader = new SDCarShader(pCar.get(), this);
if (carshader) if (carshader > 1)
this->reflectionMappingMethod = REFLECTIONMAPPING_DYNAMIC; this->reflectionMappingMethod = REFLECTIONMAPPING_DYNAMIC;
else else
this->reflectionMappingMethod = REFLECTIONMAPPING_OFF; this->reflectionMappingMethod = REFLECTIONMAPPING_OFF;

View file

@ -127,12 +127,12 @@ SDReflectionMapping::SDReflectionMapping(SDCar *c):car(c)
camerasRoot->addChild(camera); camerasRoot->addChild(camera);
cameras.push_back(camera); cameras.push_back(camera);
if (reflectionShader == 1) if (reflectionShader > 1)
camera->setNodeMask(0); camera->setNodeMask(0);
} }
//ACTIVATE to enable Environment MApping <= temporary hack. //ACTIVATE to enable Environment MApping <= temporary hack.
if (reflectionShader == 1) if (reflectionShader > 1)
{ {
SDScreens * screens = (SDScreens*)getScreens(); SDScreens * screens = (SDScreens*)getScreens();
screens->registerViewDependantPreRenderNode(this->getCamerasRoot()); screens->registerViewDependantPreRenderNode(this->getCamerasRoot());

View file

@ -28,7 +28,7 @@
#include "OsgCar.h" #include "OsgCar.h"
#include "OsgSky.h" #include "OsgSky.h"
SDCarShader::SDCarShader(osg::Node *car, SDCar *c) SDCarShader::SDCarShader(osg::Group *car, SDCar *c)
{ {
std::string TmpPath = GetDataDir(); std::string TmpPath = GetDataDir();
osg::ref_ptr<osg::Shader> vertShader = new osg::Shader( osg::Shader::VERTEX); osg::ref_ptr<osg::Shader> vertShader = new osg::Shader( osg::Shader::VERTEX);
@ -39,7 +39,7 @@ SDCarShader::SDCarShader(osg::Node *car, SDCar *c)
program->addShader( vertShader.get() ); program->addShader( vertShader.get() );
program->addShader( fragShader.get() ); program->addShader( fragShader.get() );
pCar= car; pCar= dynamic_cast<osg::Group *> (car);
this->pSdCar = c; this->pSdCar = c;
stateset = pCar->getOrCreateStateSet(); stateset = pCar->getOrCreateStateSet();
stateset->setAttributeAndModes(program); stateset->setAttributeAndModes(program);

View file

@ -45,7 +45,7 @@ private :
osg::ref_ptr<osg::Uniform> reflectionMapStaticOffsetCoords; osg::ref_ptr<osg::Uniform> reflectionMapStaticOffsetCoords;
public : public :
SDCarShader(osg::Node *car, SDCar *c); SDCarShader(osg::Group *car, SDCar *c);
void update(osg::Matrixf view); void update(osg::Matrixf view);
}; };