Crash in PagingLandScapeOctreeSceneManager::registerCamera()

Maxi

01-11-2007 20:59:26

Hi

I'm using the last stable CVS Ogre & PLSM2 and I wanted to use PLSM2 with the example framework, but the aplication crashes while creating a camera.

I had no problems creating the sceneManager with

mSceneMgr = mRoot->createSceneManager("PagingLandScapeSceneManager");

but

mCamera = mSceneMgr->createCamera("PlayerCam");


fails in PagingLandScapeOctreescenemanager.cpp on line 1158

mPagingLandScapeOctree->traversal(RegisterCameraTraversal(c), 0);

The debugger says that mPagingLandScapeOctree has adress 0x00000000
and I think it's an PLSM internal problem but there for I have no idea how to fix it.

Maxi

01-11-2007 23:14:30

I looked into the code a little further and found the following constructor code for PagingLandScapeSceneManager:


PagingLandScapeSceneManager::PagingLandScapeSceneManager(const String& name) :

#ifndef _PLSM_OCTREE
OctreeSceneManager(name),
#else //_PLSM_OCTREE
PagingLandScapeOctreeSceneManager(name),
#endif //_PLSM_OCTREE
...


Since _PLSM_OCTREE seems to be defined nowhere in the code PagingLandScapeSceneManager is derived from OctreeSceneManager, but the createCamera method uses the member mPagingLandScapeOctree which is only defined in PagingLandScapeOctreeSceneManager(name).

So the Question ist why, where and when should _PLSM_OCTREE be defined?

tuan kuranes

02-11-2007 13:36:52

Didn"t understood the bug report. if _PLSM_OCTREE is not defined, it's not compiling ?

Anyway If you need OctreeCHCmanager (CHC is a visiblity query thing) define it, otherwise don't and you'll be using default octree scene manager

Maxi

02-11-2007 14:38:47

The problem is that the class PagingLandScapeSceneManager is derived from OctreeSceneManager by default, but when I call the scene managers createCamera() method it uses the member mPagingLandScapeOctree which is only defined in PagingLandScapeOctreeSceneManager.

My application compiles without any errors.

When I started the topic I did not even know that PLSM can be based on two different octree scene managers, and now I wonder what I have to do that PLSM uses PagingLandScapeOctreeSceneManager.

tuan kuranes

02-11-2007 16:07:49


it uses the member mPagingLandScapeOctree which is only defined in PagingLandScapeOctreeSceneManager. ...
My application compiles without any errors.


How can that be, if it's defined only by CHC octree ? it should raise a compilation error.
You did recompile all. perhaps it's a precompiled header problem.

Maxi

02-11-2007 18:52:46

Meanwhile I found the critical line of code, it's

static_cast <PagingLandScapeOctreeSceneManager *> (getSceneManager ())->registerCamera(this);

in


void PagingLandScapeOctreeCamera::updateRegistrationInOcclusionSystem()
{
if (needRegistrationInOcclusionSystem() && !isRegisteredInOcclusionSystem())
{
static_cast <PagingLandScapeOctreeSceneManager *> (getSceneManager ())->registerCamera(this);
setRegisteredInOcclusionSystem (true);
}
else if (!needRegistrationInOcclusionSystem() && isRegisteredInOcclusionSystem())
{
static_cast <PagingLandScapeOctreeSceneManager *> (getSceneManager ())->unregisterCamera(this);
setRegisteredInOcclusionSystem (false);
}
}


You cannot cast the sceneManager pointer this way if you use OctreeSceneManager as base class, only if you use OctreeCHCmanager.
There seems to be be some

#ifndef _PLSM_OCTREE
do some OctreeSceneManager stuff
#else //_PLSM_OCTREE
do some PagingLandScapeOctreeSceneManager stuff
#endif //_PLSM_OCTREE


missing in the camera creation code.

Sorry for bothering you with that problem so intensively :D

By the way: the error only occurs if I use OctreeSceneManager, using OctreeCHCManager works fine

michaelg1987

11-01-2008 00:00:47

So how does one rectify this problem? I am having the same issue.

Edit: Nevermind, found your answer in another post. Define _PLSM_OCTREE for the project settings. Compiling now, will complain more if I encounter problems.

tuan kuranes

09-07-2008 15:26:29

Same as before PLSM_OCTREE is suppose to enable CHC octree scene manager which is not mandatory and may be more prone to bugs than original one (which is why I recommend removing it when looking for bugs.).

Here I compile PLSM2 here without _PLSM_OCTREE enabled and everything works.