PLSM2, bug with MaterialPerPage?

Seregvan

29-10-2008 07:48:38

when I set up MaterialPerPage to yes, when I try to make some LODs for the terrain, PLSM2 crashes with the unexisting material ( only when I call PageUpdate, if not - there no errors... I'm also call LoadNow - without these lines there are some bugs with pages, not all of them are loaded, I need all pages to be loaded at the beginning. If I set up MaterialPerPage to no everything is fine ).

I found this place:

if (opt->materialPerPage)
{
// JEFF - all material settings configured through material script
mMaterial = MaterialManager::getSingleton().getByName(
mMaterialBaseName + commonName);
}


That is in the PagingLandScapeTexture::_loadMaterial() function...

there are null pointer becomes, because Ogre can't find this material...

After some debug time I found that:

MaterialManager::getSingleton().remove (resourceName);

That is in the end of the PagingLandScapeTexture::unload() function...

So, If MaterialPerPage turned off, PLSM2 clones the base material for every page and then in "unload" function deletes it, and then clones again... But if MaterialPerPage option enabled, PLSM2 deletes the base materials for each page and can't find it on the reload...

I made some changes in the PagingLandScapeTexture::unload() function to provide functionality I need, maybe it will be usefull, or maybe somebody will tell me the better way :D

CHANGES:

find PagingLandScapeTexture::unload() function, there find

MaterialManager::getSingleton().remove (resourceName);

and replace with

const PagingLandScapeOptions * const opt = mParent->getOptions();
if ( ! opt->materialPerPage ) MaterialManager::getSingleton().remove (resourceName);


Waiting for your minds =)


PS: sorry for my bad english :oops:

Seregvan

06-11-2008 06:31:57

tuan kuranes, please, answer me =)