[BUG] PLS Options don't get updated when changing cameras

fiesch

27-10-2005 02:22:21

I have the following "flow" in my prog for testing right now:

start->"MainMenueMode"
This creates a camera, a viewport and a cegui sheet, on exit it calls

mRoot->getAutoCreatedWindow()->removeAllViewports();
mSceneMgr->destroyAllCameras();
mSceneMgr->getRootSceneNode()->removeAllChildren();


then its "MainMenueMode"-->"PlayMode"

which, again, creates a camera and a viewport.

This i where the app crashes, in
void PagingLandScapeOptions::calculateCFactor()
Line 672

because of an invalid Viewport Pointer "v"

i couldn't watch the camera pointer the whole app because this strangely enough only occurs if i don't start the app from vc but from the explorer..

but my guess is that the options kept the camera pointer to the first camera and didn't update to the second.

the cam used for updating in the sm that run was at 0x0f1607c0, the one in the options was at 0x0f160830 (similar but quite clearly not the same object)

tuan kuranes

27-10-2005 08:44:47

Thanks for the report.
Fixed in CVS.
If you're in a hurry read ogre-cvsmail mailing list for the patch or wait til tomorrow.

fiesch

27-10-2005 18:16:56

thanks for the fast fixes ;)

fiesch

28-10-2005 01:16:01

ahm i'm sure you overlooked this:


void PagingLandScapeSceneManager::destroyAllCameras(void)
{
mOptions.setPrimaryCamera (0);
PagingLandScapeOctreeSceneManager::destroyAllCameras();
}

leads to

void PagingLandScapeOptions::setPrimaryCamera(PagingLandScapeCamera *cam)
{
primaryCamera = cam;
calculateCFactor ();
}


leads to

void PagingLandScapeOptions::calculateCFactor()
{
// Const Real A = 1 / Math::Tan(Math::AngleUnitsToRadians(opts.primaryCamera->getFOVy()));
// Turn off detail compression at higher FOVs
const Real A = 1.0f;
assert (primaryCamera);
const Viewport *v = primaryCamera->getViewport();
if (v)
{
const int vertRes = v->getActualHeight();

assert (vertRes != 0);
const Real T = 2 * static_cast < Real >(maxPixelError) / vertRes;

CFactor = A / T;
}
}


and i don't see the assert getting through if you set it to 0 before ;)

tuan kuranes

28-10-2005 09:27:24

doh !

tuan kuranes

28-10-2005 09:38:41

Now fixed in CVS. Thanks for the patience.

I'm curious, if you're using CVS, do you get, in Release mode only, segfault when quitting PLSM2 ?

fiesch

28-10-2005 09:46:33

hm I can't tell -haven't had a release build of that project yet, that will be some time until that will happen, too i guess as there's still more work than i wanna see and i haven't even set up the paths for release yet...

btw.. did you write the CommonFileDialog for CEGUI in the MapEditor?

I'm looking for the author.
I want to use it in a commercial project and wanted to ask if that's ok with the author.

tuan kuranes

28-10-2005 09:56:00

I think it"s "spookyboo"
he made a wiki page on that: http://www.ogre3d.org/wiki/index.php/CE ... FileDialog