MisterMayhem
28-01-2008 00:57:55
My project is designed to load terrains, then clean them up and load different ones if necessary. I'm running into a problem where I can load the terrain fine, edit it and unload it. However loading subsequent terrains runs into trouble. the shadow map and splatting is left behind. The shadows and splat maps can no longer be changed either.
if an ET::SplattingManager instance constructor requires the dimensions, it seems logical that you need to create it and delete it when loading and unloading the terrain. The same with loading and unloading the light map. This way you can handle differing dimensions on subsequent loads.
When loading the terrain, I use the following code to set up splatting and the light map:
To clean up the splat and light maps when unloading, I use the following:
Has anyone else dealt with loading and loading terrain this way? The problems aren't present if I don't new and delete the ET::SplattingManager instance with each new map and I don't remove the light map texture, but then I'm stuck with the same texture dimensions.
if an ET::SplattingManager instance constructor requires the dimensions, it seems logical that you need to create it and delete it when loading and unloading the terrain. The same with loading and unloading the light map. This way you can handle differing dimensions on subsequent loads.
When loading the terrain, I use the following code to set up splatting and the light map:
// create the splatting manager
mSplatMgr = new ET::SplattingManager("ETSplatting", "General", 512, 512, 3);
// specify number of splatting textures we need to handle
mSplatMgr->setNumTextures(6);
// create a manual lightmap texture
TexturePtr lightmapTex = TextureManager::getSingleton().createManual(
"ETLightmap", "General", TEX_TYPE_2D, 256, 256, 1, PF_BYTE_RGB);
To clean up the splat and light maps when unloading, I use the following:
delete mSplatMgr; mSplatMgr = 0;
TextureManager::getSingleton().remove("ETLightmap");
Has anyone else dealt with loading and loading terrain this way? The problems aren't present if I don't new and delete the ET::SplattingManager instance with each new map and I don't remove the light map texture, but then I'm stuck with the same texture dimensions.