PLSM2 problems

dudeabot

11-01-2008 02:05:54

im having problems with nitegrating PLSM2 and pagedgeometry

i got it working ok with terrain scene manager

but im getting a crash with PLSM2 on this file, xtree


_Nodeptr _Lbound(const key_type& _Keyval) const
{ // find leftmost node not less than _Keyval
_Nodeptr _Pnode = _Root();
_Nodeptr _Wherenode = _Myhead; // end() if search fails

while (!_Isnil(_Pnode))
crash here -----> if (_DEBUG_LT_PRED(this->comp, _Key(_Pnode), _Keyval))
_Pnode = _Right(_Pnode); // descend right subtree
else
{ // _Pnode not less than _Keyval, remember it
_Wherenode = _Pnode;
_Pnode = _Left(_Pnode); // descend left subtree
}

return (_Wherenode); // return best remembered candidate
}


which i have no idea whats about

i also modified the getterrainheight to return a constant so its not the problem apparently

when i comment trees->update(); it works ok, but the trees dont show up (which is kind obvious)

is there anything that has to be modified? how can i be sure that the terrain got loaded before pagedGeometry? (just setting setWorldGeometry before? if so that didnt help)

thanks!

JohnJ

11-01-2008 15:26:26

I'm really not sure how to help you, since I don't have PLSM2 myself. I've heard that PLSM2 works with PagedGeometry but requires a little work to get working right because you need to make sure PLSM2 has loaded the terrain before you place the trees (otherwise the height function won't work). Another way to do it is to use TreeLoader3D without the height function and precalculate tree heights.

how can i be sure that the terrain got loaded before pagedGeometry?
I think some people waited a few frames before calling PagedGeometry::update().

i also modified the getterrainheight to return a constant so its not the problem apparently
I'm just guessing, but the error might have something to do with the height function setup code also. Try taking the TreeLoader3D example and commenting out the height function initialization line, and replace the line where it gets the terrain height with a constant.

Maxi

11-01-2008 17:51:43

how can i be sure that the terrain got loaded before pagedGeometry?
You can hook into the PLSM2 event system and register functions for page/tile load/unload events.

Especially the setOption/getOption mechanism of PLSM2 is far from being well documented, but you could look at this post for some example code:
http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=3564

dudeabot

11-01-2008 18:47:12

ok, thanks for the suggetions ill try when i get home :)

klanger13

13-01-2008 21:15:06

I was wondering if ouy had any luck with this as this is where I am currently? Presumably, the paged landscape manager is being asked to remove the cameras and is trying to destroy the imposter cam which it shouldn't? So I stopped the PLSM from removing the imposter cams and it runs, but I get no rendering of trees.

dudeabot

13-01-2008 21:41:59

no.. i guess ill have to wait plsm3 :(

i tried many different combinations without luck :|

klanger13

13-01-2008 22:20:59

So I put in a little condition to stop it deleting the imposter cameras in the paging landscape manager. It worked.

dudeabot

13-01-2008 23:25:55

So I put in a little condition to stop it deleting the imposter cameras in the paging landscape manager. It worked.

hi can you expand a little more in the changes you did to the plugin?

thanks!

ps: and its working with pagedgeometry?

klanger13

14-01-2008 10:55:03

Yeah, I just modified the destry Camera to check that the name of the camera didn't contain the word imposter. Not great but it worked. I'm going to look for a more elegant solution tonight hopefully. I'll let you know if I find one.

JohnJ

14-01-2008 15:51:46

That's really strange that preventing the impostor camera from being deleted would fix the problem with PLSM2. Every time an impostor is rendered, the impostor camera is created, the impostors are rendered, and the impostor camera is deleted. If the camera is not deleted, you'll have a memory leak for sure (although once the impostors are rendered this shouldn't be a problem). Maybe PLSM2 has a problem with deleting cameras?

klanger13

14-01-2008 20:51:48

Actually, it was the OgreMain_d.dll that was calling the destroyCamera method in plsm2 to destroy the imposter camera. I don't have the Ogre DLL set up for debugging but having a quick look through the code, destroy camera gets called in the scene manager by destroyShadowTextures, which could be a candidate?

If I get a chance, once I've set up the DLL to debug, I might have another look. Although, this might be a better thread for plsm2 now.

crazyFramp

19-04-2008 00:53:30

:roll:
I think i have the same problem than dudeaboy (topic creator).

I don't understant what happens with Impostor Cam ? Have you solve the problem ? Can you see the trees ?

I have the same config than dudeaboy, but I want to precise that when it crashs, it says :
Creating viewport on target 'rtt/ImpostorTexture1/234341384', rendering from camera 'ImpostorCam2', relative dimensions L: 0.00 T: 0.00 W: 1.00 H: 1.00 ZOrder: 0
Creating resource group BinFolder
Added resource location '.' of type 'FileSystem' to resource group 'BinFolder'
Texture: Impostor.HKSHDSOJOKUYFPGCRGIKVPHHWDUCIZTF.128.png: Loading 1 faces(PF_A8R8G8B8,1024x512x1) with 10 hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,1024x512x1.
Erreur de segmentation (core dumped)


Thank you for your help...

ps: could you show me the code about Impostor Cam ?
ps2: I'm a Linux user (I cannot use Windows for that project)