"TileLoaded, TileHide, TileShow..." confusing..

Dibalo

29-11-2006 19:40:05

Hi Folks!

I have tried to play with PLSM2 about two weeks now. My opinion is that this is a wonderful and powerful plugin. Now I´m searching for change to attach some static geometry objects (trees, houses...) to maps. I have understood that PSML uses a few different methods to optimize the map rendering. These methods are (found from demo app):
- Terrain Ready
- pagePreloaded
- pageLoaded
- pageUnloaded
- pagePostunloaded
- PageDeformed
- pageShow
- pageHide
- tileLoaded
- tileUnloaded
- tileDeformed
- tileShow
- tileHide

I have also undestood that I can do some things I want, triggered by those methods (for ex. mySceneMgr->setOption( "addTerrainListener", myFunction ); . The problem is, that I have no clue, what those methods will do and when the renderer calls them. That´s why I´d be very happy, if you could explain more about those methods.

My goal is that my "object renderer" splits the object-areas into the tiles (equals to the terrain tiles), and shows or hides them at the same time as the PLSM. Because I´d like to save performance, I´m planning to preload all object-including-tiles to the memory when map is loaded. When map is deleted, the object-tiles will be deleted too. So: which method I have to use to trigger my own object-loading function? And which to trigger my deleting function? Object hiding? Showing?

I have also an additional question. If I know the point from the world (for ex. (2143, 0, -535)), how could I get to know what are the page numbers and the tile numbers, where that point lies?

tuan kuranes

30-11-2006 09:06:49

what those methods will do and when the renderer calls them. That´s why I´d be very happy, if you could explain more about those methods.
On those event it's up to you to act upon.
For instance if a pageHide happens, you might want to hide all objects you put on that page... or they will float into void...

which method I have to use to trigger my own object-loading function? And which to trigger my deleting function? Object hiding? Showing?
Load on load, and unload on unload...
Show, Hide may happens many times for the same tile, even multiples times per frame if using shadow mode that render scene using light perpective, that will hide/show some pages/tiles.
If I know the point from the world (for ex. (2143, 0, -535)), how could I get to know what are the page numbers and the tile numbers, where that point lies?
Check Wiki PLSM2 getOption/setOption for all kinds of methods helper related to terrain.

Dibalo

30-11-2006 10:19:08

Thank you for your answers. :)

I´m still a little bit confused. I ran the program and attached the debug text, which told me called methods (tileHide, tileShow..) during the run (equal to the demo app EventString). I noticed that there was a lot of tileHide and tileShow methods, but I also noticed that there were many tileUnload and tileLoad methods too (when I moved around the terrain).

My main question is: Why these tileLoad and tileUnload methods are called during "the main loop"? Why doesn´t PLSM call them only at the start of the program (terrain loading session) and at the end of the program (terrain deleting session)? Why these methods are called at the run time? Should I load and unload my objects during the main loop too? Doesn´t it cost too much performance?

Thanks beforehand!

tuan kuranes

30-11-2006 12:17:39

that's paging... goal of paging is to load pages/tiles on demand, because otherwise it takes way too much memory.

Dibalo

30-11-2006 13:08:06

that's paging... goal of paging is to load pages/tiles on demand, because otherwise it takes way too much memory.
So loadTile just loads the tile, not show it? And unloadTile just unloads the tile, not hide it? If that´s so, everything is clear now! :D

Thousands of thanks to you! :)