Cann't work well with the lastest cvs PLSM

OgreSES

11-03-2008 09:24:35

Hello everyone:
I use the latest Ogre1.4.7, PG1.3 and latest cvs code PLSM version. When I use ImpostorPage,My app crashed. Finally I find the crash place is in PLSM:
PagingLandScapeSceneManager::destroyCamera(const String& name)
when rendering the scene this method destroy a camera named "ImpostorCam1" , I think this is the camera of ImpostorPage used for RTT. When I comment this line is ImpostorPage.cpp :
//renderCamera->getSceneManager()->destroyCamera(renderCamera);
My app can work well without crash.
To JohnJ:
Do you think PG should changed the code or PLSM should change. I have no idea.

JohnJ

12-03-2008 15:23:30

I think someone else encountered a similar problem and determined that PagedGeometry was not at fault. PLSM may have issues with destroying cameras used for render textures, but I'm not sure. I guess there may be something wrong with the way PagedGeometry handles the render camera, but I can't find it. Either way, PLSM shouldn't crash without a helpful error message at least.

Azatoth

13-03-2008 14:09:36

I think this is something I've fixed in my branch (I should really get the fixes over to the main PLSM2).
The file can be found through the web cvs interface at http://purple.worldforge.org/repositori ... anager.cpp, but you probably want to see the cvs diffs. Instructions here: http://worldforge.org/doc/faq/cvs
My commit message says
2008-02-03 Erik Hjortsberg <erik.hjortsberg@iteam.se>

* src/components/ogre/SceneManagers/EmberPagingSceneManager/src/OgrePagingLandScapeOctreeSceneManager.cpp: fixed a bug where deleting a camera would end up in a never ending loop

so I think that was the issue fixed.

joe

08-05-2008 22:08:05

Thanks for this, I had the same problem, and your code worked perfectly. For those who need to fix this, replace these functions in PagingLandscapeOctreeSceneManager.cpp, and recompile your plugin.

Starts at line 590:


//-----------------------------------------------------------------------
void PagingLandScapeOctreeSceneManager::destroyCamera(Camera *cam)
{
SceneManager::destroyCamera(cam);
}
//-----------------------------------------------------------------------
void PagingLandScapeOctreeSceneManager::destroyCamera(const String& name)
{
// Find in list
CameraList::iterator i = mCameras.find(name);
if (i != mCameras.end())
{
unregisterCamera (static_cast <PagingLandScapeOctreeCamera *> (i->second));
SceneManager::destroyCamera (name);
}
}
//-----------------------------------------------------------------------
void PagingLandScapeOctreeSceneManager::destroyAllCameras(void)
{
CameraList::iterator i = mCameras.begin();
for (; i != mCameras.end(); ++i)
{
unregisterCamera (static_cast <PagingLandScapeOctreeCamera *> (i->second));
// Notify render system
mDestRenderSystem->_notifyCameraRemoved(i->second);
delete i->second;
}
mCameras.clear ();
}