55 MMechostr(MSKDEBUG,
"SO3AddResourceLocationURL\n");
59 int group = MMget(m, 0);
66 const char* resourceLocation = MMstartstr(m, MTOP(p));
68 std::string groupResource;
70 groupResource = Ogre::RGN_DEFAULT;
72 groupResource = std::string(MMstartstr(m, MTOP(group)));
78 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(resourceLocation,
"URL", groupResource);
79 Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup(groupResource);
80 Ogre::ResourceGroupManager::getSingleton().loadResourceGroup(groupResource);
84 Ogre::FileInfoListPtr finfo;
85 Ogre::FileInfoList::iterator it;
86 finfo = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(groupResource,
"*");
87 Ogre::ResourceGroupManager::getSingleton().clearResourceGroup(groupResource);
88 for (it = finfo->begin(); it != finfo->end(); ++it)
90 if (!Ogre::ResourceGroupManager::getSingleton().resourceExists(groupResource, it->basename)) Ogre::ResourceGroupManager::getSingleton().addResourceLocation(it->archive->getName().c_str(), it->archive->getType(), groupResource);
92 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(resourceLocation,
"URL", groupResource);
93 Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup(groupResource);
98 catch (Ogre::Exception &e)
100 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
120 MMechostr(MSKDEBUG,
"SO3AddResourceLocationZIP\n");
126 int group = MMget(m, 0);
133 std::string pathStd = MMstartstr(m, MTOP(p));
134 if (pathStd.find(
".zip") == std::string::npos)
136 MMechostr(MSKRUNTIME,
"SO3AddResourceLocationZIP the file %s is not a .zip file", pathStd.c_str());
141 std::string groupResource;
143 groupResource = Ogre::RGN_DEFAULT;
145 groupResource = std::string(MMstartstr(m, MTOP(group)));
149 MMechostr(MSKRUNTIME,
"SO3AddResourceLocationZIP the group %s does not exist", groupResource.c_str());
156 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(pathStd,
"Zip", groupResource,
true);
157 Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup(groupResource);
159 catch (Ogre::Exception &e)
161 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
166 MMset(m, 0, ITOM(1));
187 int group = MMpull(m);
189 if ((group == NIL) || (s == NIL))
195 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
202 std::string groupResource = std::string(MMstartstr(m, MTOP(group)));
203 groupResource = scene->GetName() + groupResource;
207 MMechostr(MSKDEBUG,
"SO3Engine Exception : Group is Protected \n");
220 SRoot::getSingletonPtr()->AddManualRessourceGroup(groupResource);
221 MMset(m, 0, ITOM(1));
223 catch (Ogre::Exception &e)
225 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
234 packdir mypack = (packdir)SCgetExtra(
"FirstPack");
236 std::vector<string> partitions;
240 pathStd = mypack->path;
241 for (
unsigned int i = 0; i < pathStd.length(); i++)
243 if (pathStd.substr(i, 1) ==
"\\")
244 pathStd.replace(i, 1,
"/");
246 partitions.push_back(pathStd);
247 mypack = mypack->next;
252 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"Plugins/Ogre_Redist/OgreCore.zip",
"Zip", groupResource,
true);
253 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"Plugins/Ogre_Redist/rtshaderlib.zip",
"Zip", groupResource,
true);
254#elif defined(ANDROID)
255 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"ogre_redist/ogrecore.zip",
"APKZip", groupResource,
true);
256 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"ogre_redist/rtshaderlib.zip",
"APKZip", groupResource,
true);
257#elif defined(SO3_USE_OPENGLES2)
258 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"ogre_redist/ogrecore.zip",
"Zip", groupResource,
true);
259 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
"ogre_redist/rtshaderlib.zip",
"Zip", groupResource,
true);
261std::string baseDir = (
char*)SCgetExtra(
"scolExecDir");
262 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(baseDir +
"/ogre_redist/ogrecore.zip",
"Zip", groupResource,
true);
263 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(baseDir +
"/ogre_redist/rtshaderlib.zip",
"Zip", groupResource,
true);
266 std::vector<string>::iterator iPartition = partitions.begin();
267 while (iPartition != partitions.end())
269 Ogre::ResourceGroupManager::getSingleton().addResourceLocation((*iPartition),
"ScolFileSystem", groupResource,
false);
301 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
308 Ogre::StringVector myStr = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
309 std::vector<std::string> sceneGroups;
311 for (
unsigned int i = 0; i < myStr.size(); i++)
313 std::string loc = myStr[i];
314 if ((loc.compare(0, scene->GetName().length(), scene->GetName()) == 0) && (loc.compare(scene->GetName().length(), loc.length(), Ogre::RGN_DEFAULT) != 0))
316 loc = loc.substr(scene->GetName().length());
317 sceneGroups.push_back(loc);
318 if (k = Mpushstrbloc(m, (
char*)loc.c_str()))
326 for (
unsigned int i = 0; i < sceneGroups.size(); i++)
328 if (MMpush(m, 2 * 2))
352 int group = MMpull(m);
354 if ((group == NIL) || (s == NIL))
360 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
367 std::string groupResource(MMstartstr(m, MTOP(group)));
368 groupResource = scene->GetName() + groupResource;
372 MMechostr(MSKRUNTIME,
"SO3GroupDelete : Group is Protected \n");
380 MMechostr(MSKRUNTIME,
"SO3GroupDelete : Group %s do not exist\n", groupResource.c_str());
385 const SNodeMap nodesListCopy = scene->GetNodeList();
386 SNodeMap::const_iterator iNodeList = nodesListCopy.begin();
387 while (iNodeList != nodesListCopy.end())
389 if (iNodeList->second->GetNodeType() == SNode::ENTITY_TYPE_ID)
391 SEntity* entity =
static_cast <SEntity*
> (iNodeList->second);
392 if (entity->GetGroupName() == groupResource)
405 Ogre::RTShader::ShaderGenerator::getSingletonPtr()->removeAllShaderBasedTechniques();
407 catch (Ogre::Exception &e)
409 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
414 const SMaterialMap* matmap = scene->GetMaterials(groupResource);
417 SMaterialMap matmapCopy = (*matmap);
418 SMaterialMap::iterator iMaterialList = matmapCopy.begin();
419 while (iMaterialList != matmapCopy.end())
421 MMechostr(MSKDEBUG,
":>>> Delete SMaterial : %s\n", iMaterialList->second->GetName().c_str());
422 OBJdelTH(m,
SO3MATERIAL, SCOL_PTR(iMaterialList->second));
426 scene->CleanGroupMaterials(groupResource);
428 const STextureMap* texmap = scene->GetTextures(groupResource);
431 STextureMap texmapCopy = (*texmap);
432 STextureMap::iterator iTextureList = texmapCopy.begin();
433 while (iTextureList != texmapCopy.end())
435 OBJdelTH(m,
SO3TEXTURE, SCOL_PTR(iTextureList->second));
439 scene->CleanGroupTextures(groupResource);
443 Ogre::ParticleSystemManager::getSingleton().removeTemplatesByResourceGroup(groupResource);
445 catch (Ogre::Exception &e)
447 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
452 SRoot::getSingletonPtr()->RemoveManualRessourceGroup(groupResource);
453 MMset(m, 0, ITOM(1));
455 catch (Ogre::Exception &e)
457 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
480 int group = MMpull(m);
482 if ((group == NIL) || (s == NIL))
488 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
495 std::string groupResource(MMstartstr(m, MTOP(group)));
496 groupResource = scene->GetName() + groupResource;
500 MMechostr(MSKDEBUG,
"SO3Engine Exception : Group is Protected \n");
513 Ogre::ResourceGroupManager::getSingleton().unloadResourceGroup(groupResource);
514 Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup(groupResource);
515 Ogre::ResourceGroupManager::getSingleton().loadResourceGroup(groupResource);
516 Ogre::GpuProgramManager::getSingletonPtr()->reloadAll(
true);
517 Ogre::GpuProgramManager::getSingletonPtr()->reloadAll(
true);
518 scene->O3TextureManager->reloadAll(
true);
519 scene->O3MaterialManager->reloadAll(
true);
520 scene->O3MeshManager->reloadAll(
true);
521 scene->ReloadEntities();
522 MMset(m, 0, ITOM(1));
524 catch (Ogre::Exception &e)
526 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
548 MMechostr(MSKDEBUG,
"SO3AddResourceLocationDirectory\n");
552 int group = MMget(m, 0);
561 const char* groupResource;
563 groupResource = Ogre::RGN_DEFAULT;
565 groupResource = MMstartstr(m, MTOP(group));
567 const char* resourceLocation = MMstartstr(m, MTOP(p));
571 packdir mypack = (packdir)SCgetExtra(
"FirstPack");
573 std::vector<string> partitions;
576 pathStd = mypack->path;
578 for (
unsigned int i = 0; i < pathStd.length(); i++)
580 if (pathStd.substr(i, 1) ==
"\\") pathStd.replace(i, 1,
"/");
583 partitions.push_back(pathStd);
584 mypack = mypack->next;
588 std::vector<string>::reverse_iterator iPartition = partitions.rbegin();
589 while (iPartition != partitions.rend())
591 (*iPartition) += resourceLocation;
592 Ogre::ResourceGroupManager::getSingleton().addResourceLocation((*iPartition),
"ScolFileSystem", groupResource,
true);
596 MMset(m, 0, ITOM(1));
599 catch (Ogre::Exception &e)
601 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());