[Help] Having Problems using PLSM2

kungfoomasta

04-10-2006 07:44:27

Hi all,

I ran into some problems substituting PLSM2 for my TerrainSceneManager.

Here is what I've done:
1) #include "OgrePagingLandScapeSceneManager.h"
2) added include path to E:\ogreaddons\paginglandscape\PlugIns\PagingLandScape2\include
3) added lib path to E:\ogreaddons\paginglandscape\PlugIns\PagingLandScape2\bin\Release
4) added lib file, (OgreMain.lib and Plugin_PagingLandScapeSceneManager2.lib)
5) Changed a line to mSceneManager = mRoot->createSceneManager(Ogre::SceneType::ST_EXTERIOR_REAL_FAR);
6) Compiled with no errors

But my app crashes with the following warning:

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Ogre.Root.renderOneFrame(Root* )


If I debug, I find the line it crashed at:

void PagingLandScapeSceneManager::_updateSceneGraph(Camera * cam)
{
// entry into here could come before setWorldGeometry
// got called which could be disastrous
// so check for init
assert(mPageManager);
if (isRenderQueueToBeProcessed(mPageManager->getPageRenderQueue()))
{


The pointer is on the if statement, so I assume the crash is from the assert. Also the mPageManager seems to be NULL, so that pretty much tells me I'm not doing something right.

:?: Am I missing some includes?

:?: Do I need include Plugin_OctreeSceneManager.dll in Plugins.cfg, or include the .lib of this plugin?

:?: What am I doing wrong?

Thanks for any help,

KungFooMasta

kungfoomasta

08-10-2006 09:07:18

Has anybody tried using the PagingLandScapeSceneManager, but not calling "setWorldGeometry(...)"? In other words, an application that is just a blank screen (empty scene).

This is my setup function... I can't see why my app is crashing:

mSceneManager = static_cast<Ogre::PagingLandScapeSceneManager*>(mRoot->createSceneManager("PagingLandScapeSceneManager"));

Ogre::Camera* mCamera = mSceneManager->createCamera("PLSM2Cam");


// Viewport Setup
mViewport = mRenderWindow->addViewport(mCamera);
mViewport->setBackgroundColour(Ogre::ColourValue(0.3,0.3,0.3,1.0));


If somebody could try using PLSM2 and not setting world geometry and let me know the results, that would be helpful.

KungFooMasta

kungfoomasta

08-10-2006 21:00:29

I finally got terrain to load! man that was painful!

:?: It seems like the file paginglandscape2.cfg, which is equivalent to maptool.cfg, is what is given to the "setWorldGeometry" function, which loads the DefaultMap. Is there any way to directly specify a terrain to load? For example, "setWorldGeometry("MyMap.cfg");

:?: I am still seeing a crash occuring when loading up PLSM2 with an empty screen. Anybody seeing the same thing?

Another problem I am having is a linker error, which occurs from this line of code:

mSceneManager->resetScene();

1>BaseForm.obj : error LNK2001: unresolved external symbol "public: void __thiscall Ogre::PagingLandScapeSceneManager::resetScene(void)" (?resetScene@PagingLandScapeSceneManager@Ogre@@$$FQAEXXZ)
1>E:\SceneCreator\Release\SceneCreator.exe : fatal error LNK1120: 1 unresolved externals


What I don't get is that I am including OgrePagingLandScapeSceneManager.h, and adding Plugin_PagingLandScapeSceneManager2.lib to Project Input Dependencies. My Environment is not set to include any of these libs, so I can't see any possible collisions with differing libs. Hope somebody can point out my noob mistake.

[Edit]I got this error to go away when setting the Plugin_PagingLandScapeSceneManager2 Project to produce only a static lib, however the lib was ~26MB, and the app crashes on run. Normally, when the project is set to create a DLL, a lib is produced also, which is 118kb. Is something strange going on with the .lib file? Has anybody else been able to call PLSM specific functions?[/Edit]

Thanks,

KungFooMasta

HexiDave

09-10-2006 16:53:52

I don't think I ever got it to load without setWorldGeometry due to all the concurrent systems that are loaded or need to be loaded - what I did was load a very small map out of view (maybe 0,0,0 scale) using setWorldGeometry then load the new map the same way (just create a seperate .cfg that has only the new map in it.)

kungfoomasta

09-10-2006 17:20:33

Yah, I figured out how to get a blank screen by first loading in some terrain, tsmTerrain for example, and then calling clear screen.

Are you able to use PLSM specific functions, like "reset()"? I'm getting linker errors and I don't know how to solve them..

KungFooMasta

OvermindDL1

09-10-2006 18:54:31

Don't link to PLSM2 in your app. Everything you should need to do can be done using the set/getoptions interface in the standard base class.

kungfoomasta

09-10-2006 19:49:53

The reset function claims to clear only the terrain tiles/pages, and not get rid of other movable objects (cameras, entities, lights, etc) in the scene. I was hoping to be able to use this function. Can this be done through set/get options functions?

Also, the set/get options are explained on the wiki only right? I remember looking through the source last night and couldn't find any of the option parameters.

KungFooMasta

Bekas

09-10-2006 21:24:35

Also, the set/get options are explained on the wiki only right? I remember looking through the source last night and couldn't find any of the option parameters.
Search for:
PagingLandScapeSceneManager::getOption
PagingLandScapeSceneManager::setOption
PagingLandScapeOctreeSceneManager::getOption
PagingLandScapeOctreeSceneManager::setOption
PagingLandScapeOptions::getOption
PagingLandScapeOptions::setOption
PagingLandScapeListenerManager::setOption

There are *a lot* of options, look through the code to get an idea what each option does.

kungfoomasta

09-10-2006 23:56:13

Thanks for providing areas for me to look. I will do that tonight.

Don't forget about my issue with making a call to resetScene()! I don't see how any get/set Option calls can get this function to be called.

KungFooMasta

Bekas

10-10-2006 06:04:59

The closest is calling SceneManager::setOption with "LoadMap" option, which calls resetScene() and loadScene().

tuan kuranes

16-10-2006 13:37:21

It seems like the file paginglandscape2.cfg, which is equivalent to maptool.cfg, is what is given to the "setWorldGeometry" function, which loads the DefaultMap. Is there any way to directly specify a terrain to load? For example, "setWorldGeometry("MyMap.cfg");
That's indeed LoadMap setOption().
Perhaps I can support both setWorldGeometry("MyMap.cfg"); and setWorldGeometry("paginglandscape2.cfg");
mSceneManager->resetScene();
that method is not publicy available, as scenemanager derivates from Oger scenemanager and only can expose what standard scenemanager exposes (hence the setOption/getOption mechanism). In fact you don't need to include any plsm2 headers, unless you use plsm2 callbacks to get some page/tile events.
You shouldn't be linking to the .lib.
ah, I figured out how to get a blank screen by first loading in some terrain, tsmTerrain for example, and then calling clear screen.
you should be able to load an empty terrain. (no heighmap data.)

PagingLandScapeSceneManager::resetscene should be calling
PagingLandScapeOctreeSceneManager::clearScene();
I'll add that in CVS and next version.

kungfoomasta

16-10-2006 17:13:38

I just wanted a way to clear only the terrain data, and not the rest of the objects in the scene. I have my own classes that will do cleanup correctly. Is this possible? I believe the PagingLandScapeOctreeSceneManager::clearScene() function clears everything (entities/cameras/scenendoes/etc).

Can there be an option to clear the terrain data? I thought the reset function did this.

Something like:

if (strKey == "ResetScene")
{
if( * static_cast < const bool * > (pValue) )
PagingLandScapeSceneManager::resetScene();

return true;
}


Thanks for the help with the lib and get/set options, I won't include the lib.

KungFooMasta

tuan kuranes

16-10-2006 17:56:43

added in CVS.