hydrax reload problem

whw0828

06-01-2010 06:56:49

i'm using a sence editor and meet a problem .first time the hydrax run fine,save and reload hydrax ,the hydrax'depth get a problem this is my code

Ogre::ResourceGroupManager *mngr = Ogre::ResourceGroupManager::getSingletonPtr();
Ogre::String value = OgitorsRoot::getSingletonPtr()->GetProjectOptions()->ProjectDir + OgitorsRoot::getSingletonPtr()->GetProjectOptions()->HydraxDirectory;
mngr->addResourceLocation(value,"FileSystem","Hydrax");

m_Handle = new Hydrax::Hydrax(mSceneMgr, mCamera, mViewport);

// Create our projected grid module
m_Module = new Hydrax::Module::ProjectedGrid(// Hydrax parent pointer
m_Handle,
// Noise module
new Hydrax::Noise::Perlin(/*Generic one*/),
// Base plane
Ogre::Plane(Ogre::Vector3(0,1,0), Ogre::Vector3(0,0,0)),
// Normal mode
Hydrax::MaterialManager::NM_VERTEX,
// Projected grid options
Hydrax::Module::ProjectedGrid::Options(64));

// Set our module
m_Handle->setModule(static_cast<Hydrax::Module::Module*>(m_Module));

// Load all parameters from config file
// Remarks: The config file must be in Hydrax resource group.
// All parameters can be set/updated directly by code(Like previous versions),
// but due to the high number of customizable parameters, Hydrax 0.4 allows save/load config files.
m_Handle->loadCfg(m_ConfigFile);
// Create water
m_Handle->create();
m_Handle->getMesh()->getEntity()->setQueryFlags(0);
Ogre::Vector3 colvalue = m_Handle->getWaterColor();
m_OriginalWaterColour = Ogre::ColourValue(colvalue.x, colvalue.y, colvalue.z);

Ogre::MaterialPtr pMat = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().getByName(matname));

int num= pMat->getNumTechniques();//whw for test
for(unsigned int i = 0;i < pMat->getNumTechniques();i++)
{
if(pMat->getTechnique(i)->getSchemeName() == "HydraxDepth") return;
}
//if(m_Handle->isCreated())
m_Handle->getMaterialManager()->addDepthTechnique(pMat->createTechnique());