[question] Terrain ready callback?

fantasticsid

09-09-2008 08:28:48

This is possibly a stupid question, but it doesn't seem to have been addressed (at least not in this form) before on this forum. I've looked.

When initially loading a PLSM2 terrain, one creates and places a camera at a certain position, and it is the camera (as I understand it) which tells PLSM2 which parts of the landscape to load. After each tile is loaded, a TileLoaded callback is called, providing the Page X and Z and the Tile X and Z for each tile loaded.

At some point (I haven't yet figured out when, exactly,) a PageLoaded callback is fired, and at some point after this, a PageShow callback is fired.

My question, then; how, exactly, am I to know that my terrain is ready for me to get rid of the loading screen and display the terrain? Right now, I haven't GOT a loading screen (for this reason,) and the first few seconds of interaction with the application allow interaction with an incompletely rendered terrain.

I've attempted to wait for the PageLoaded or PageShow callbacks for all of the pages which I _ASSUME_ are going to be loaded, but figuring out which pageloaded events to wait for based on a nothing more than the position of the primary camera sounds hard. Additionally, I'm not entirely sure that pageloaded/pageshow are being called at the right time, as i've attempted to tie a foliage loading system (per-page) into these callbacks, and have wound up drawing all the foliage at Y=0 because the height function isn't returning any useful data by the time the pageloaded or pageshow callback is fired.

What, exactly, am I missing? I'm entirely sure that it's something completely trivial....

TIA,

Sid

PS - I did note the 'terrainready' callback, and have not had any success bending this to my will, either. It seems to be called more or less at random.