The following piece of code used to work in 1.8
Code: Select all
void OgreBuilder::setFogToMaterials(const Ogre::ColourValue &backgroundColour, const Ogre::Real &expDensity) {
Ogre::MaterialManager::ResourceMapIterator it = Ogre::MaterialManager::getSingleton().getResourceIterator();
while (it.hasMoreElements()) {
Ogre::MaterialPtr mat = it.getNext();
setFogToMaterial(mat, backgroundColour, expDensity);
}
}
error C2439: 'Ogre::SharedPtr<T>::pRep' : member could not be initialized \ogremain\include\ogresharedptr.h
The error occuss in the following code
Code: Select all
SharedPtr(const SharedPtr<Y>& r)
: pRep(r.getPointer())
, pInfo(r.pInfo)
{
if (pRep)
{
++pInfo->useCount;
}
}
Cast from base to derived requires dynamic_cast or static_cast
1> \src\ogrebuilder.cpp(186) : see reference to function template instantiation 'Ogre::SharedPtr<T>::SharedPtr<Ogre::Resource>(const Ogre::SharedPtr<Ogre::Resource> &)' being compiled
1> with
1> [
1> T=Ogre::Material
1> ]
A simpler example that worked with 1.8 and fails with 1.9 is
Code: Select all
Ogre::ResourcePtr resource;
Ogre::MaterialPtr mat = resource;