Code: Select all
Root::getSingleton().addResourceLocation (relativePath, "FileSystem");
ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

Code: Select all
Root::getSingleton().addResourceLocation (relativePath, "FileSystem");
ResourceGroupManager::getSingleton().initialiseAllResourceGroups();


Code: Select all
_assert(void * 0x01184448 `string', void * 0x011843e4 `string', unsigned int 93) line 256
Ogre::SharedPtr<Ogre::Material>::operator->() line 93 + 58 bytes
Ogre::TerrainSceneManager::setupTerrainMaterial() line 365 + 10 bytes
Ogre::TerrainSceneManager::setWorldGeometry(const _STL::basic_string<char,_STL::char_traits<char>,_STL::allocator<char> > & {...}) line 457
World::Terrain::load(_STL::basic_string<char,_STL::char_traits<char>,_STL::allocator<char> > {...}, TiXmlElement * 0x00000000) line 1310 + 26 bytes
World::Terrain::init(Ogre::Root * 0x016e8108, Ogre::Camera * 0x017150f0, Ogre::SceneManager * 0x01704fd8, Ogre::RenderWindow * 0x0170ba98, _STL::basic_string<char,_STL::char_traits<char>,_STL::allocator<char> > {...}) line 936
World::GuiApplication::createScene() line 871
ExampleApplication::setup() line 95 + 13 bytes
ExampleApplication::go() line 55 + 13 bytes
WinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x00142436, HINSTANCE__ * 0x00000000) line 22
WinMainCRTStartup() line 330 + 54 bytes
KERNEL32! 77e5eb69()


Code: Select all
// Clear out any existing world resources (if not default)
if (ResourceGroupManager::getSingleton().getWorldResourceGroupName() !=
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME)
{
ResourceGroupManager::getSingleton().clearResourceGroup(
ResourceGroupManager::getSingleton().getWorldResourceGroupName());
}
Code: Select all
MaterialManager::getSingleton().load (projectMaterial, projectName);

Once loaded, resources can freely be shared among groups. However, if you try to use a texture which is not in your group's resource locations, and the texture isn't loaded yet, of course it can't find it. Mixing & matching resources from different groups once they're loaded is fine, but be careful since unloading happens on group boundaries. If you're sharing a lot, perhaps you haven't structured your groups in a practical way - they should be grouping resources which have a common use.spookyboo wrote: 1. I didn't realise that a material file defined in a certain group can only use textures from that group. Sharing textures between groups seems impossible (I think this can be solved by also adding the path containing 'shared textures' to the new group)
No, it's not forcing you to use the default. Look at the code again - it's firstly checking to see if the 'world resource group' is set to the default group. If it is, it does nothing. If, however the world resource group has been set to something dedicated, it clears the resource group out since it knows that the group is dedicated to it's world geometry.2. The TerrainSceneManager forces me to use the default group (method setWorldGeometry)I didn't want that, so I commented the clear part. This seems to fix the problemCode: Select all
// Clear out any existing world resources (if not default) if (ResourceGroupManager::getSingleton().getWorldResourceGroupName() != ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME) { ResourceGroupManager::getSingleton().clearResourceGroup( ResourceGroupManager::getSingleton().getWorldResourceGroupName()); }
Again this is because you're not structuring your groups along natural loading batch lines. What's happened is that you've put the material in another group so it can't locate it unless it's already loaded. If you want the terrain to use another group, call ResourceGroupManager::setWorldResourceGroupName to tell it which to use. If you're mixing and matching world resource groups and different material resource groups such that you have to force pre-loading, I'd have to ask why - if the material is for the terrain it should be in the same group, or if it's shared among lots of things, put it in a preloaded Common group.3. I also had to load the material before calling setWorldGeometryThe TerrainSceneManager searches the material by name and apparently it returns null (well, the isNull method does) if the material isn't loaded firstCode: Select all
MaterialManager::getSingleton().load (projectMaterial, projectName);


That's kind of the point. By calling setWorldResourceGroupName you're saying that that's the resource group which all the world resources wil be in, and that when the world group is cleared, they get cleared too. If you don't want the material cleared then it shouldn't be in the same group as the world resources, simple as that. You'll need to put it in another more persistent group which is initialised before you call setWorldGeometry.I still don't see it Sad , maybe I have to put it aside for a while. I have been adding my material and textures in a dedicated group and have been calling setWorldResourceGroupName. Then the clearResourceGroup method in the TerrainSceneManager removes my loaded material again, because the group != DEFAULT_RESOURCE_GROUP_NAME
