|
@@ -37,7 +37,7 @@ ResourceManager::~ResourceManager() {
|
|
|
resources.clear();
|
|
resources.clear();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void ResourceManager::parseShaders(String dirPath, bool recursive) {
|
|
|
|
|
|
|
+void ResourceManager::parseShaders(const String& dirPath, bool recursive) {
|
|
|
vector<OSFileEntry> resourceDir;
|
|
vector<OSFileEntry> resourceDir;
|
|
|
resourceDir = OSBasics::parseFolder(dirPath, false);
|
|
resourceDir = OSBasics::parseFolder(dirPath, false);
|
|
|
|
|
|
|
@@ -76,7 +76,7 @@ void ResourceManager::addShaderModule(PolycodeShaderModule *module) {
|
|
|
shaderModules.push_back(module);
|
|
shaderModules.push_back(module);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void ResourceManager::parsePrograms(String dirPath, bool recursive) {
|
|
|
|
|
|
|
+void ResourceManager::parsePrograms(const String& dirPath, bool recursive) {
|
|
|
vector<OSFileEntry> resourceDir;
|
|
vector<OSFileEntry> resourceDir;
|
|
|
resourceDir = OSBasics::parseFolder(dirPath, false);
|
|
resourceDir = OSBasics::parseFolder(dirPath, false);
|
|
|
for(int i=0; i < resourceDir.size(); i++) {
|
|
for(int i=0; i < resourceDir.size(); i++) {
|
|
@@ -99,7 +99,7 @@ void ResourceManager::parsePrograms(String dirPath, bool recursive) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void ResourceManager::parseMaterials(String dirPath, bool recursive) {
|
|
|
|
|
|
|
+void ResourceManager::parseMaterials(const String& dirPath, bool recursive) {
|
|
|
vector<OSFileEntry> resourceDir;
|
|
vector<OSFileEntry> resourceDir;
|
|
|
resourceDir = OSBasics::parseFolder(dirPath, false);
|
|
resourceDir = OSBasics::parseFolder(dirPath, false);
|
|
|
|
|
|
|
@@ -130,7 +130,7 @@ void ResourceManager::parseMaterials(String dirPath, bool recursive) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void ResourceManager::parseCubemaps(String dirPath, bool recursive) {
|
|
|
|
|
|
|
+void ResourceManager::parseCubemaps(const String& dirPath, bool recursive) {
|
|
|
vector<OSFileEntry> resourceDir;
|
|
vector<OSFileEntry> resourceDir;
|
|
|
resourceDir = OSBasics::parseFolder(dirPath, false);
|
|
resourceDir = OSBasics::parseFolder(dirPath, false);
|
|
|
|
|
|
|
@@ -167,7 +167,7 @@ void ResourceManager::addResource(Resource *resource) {
|
|
|
resources.push_back(resource);
|
|
resources.push_back(resource);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void ResourceManager::parseTextures(String dirPath, bool recursive) {
|
|
|
|
|
|
|
+void ResourceManager::parseTextures(const String& dirPath, bool recursive) {
|
|
|
vector<OSFileEntry> resourceDir;
|
|
vector<OSFileEntry> resourceDir;
|
|
|
resourceDir = OSBasics::parseFolder(dirPath, false);
|
|
resourceDir = OSBasics::parseFolder(dirPath, false);
|
|
|
for(int i=0; i < resourceDir.size(); i++) {
|
|
for(int i=0; i < resourceDir.size(); i++) {
|
|
@@ -187,7 +187,7 @@ void ResourceManager::parseTextures(String dirPath, bool recursive) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void ResourceManager::parseOthers(String dirPath, bool recursive) {
|
|
|
|
|
|
|
+void ResourceManager::parseOthers(const String& dirPath, bool recursive) {
|
|
|
vector<OSFileEntry> resourceDir;
|
|
vector<OSFileEntry> resourceDir;
|
|
|
resourceDir = OSBasics::parseFolder(dirPath, false);
|
|
resourceDir = OSBasics::parseFolder(dirPath, false);
|
|
|
for(int i=0; i < resourceDir.size(); i++) {
|
|
for(int i=0; i < resourceDir.size(); i++) {
|
|
@@ -204,7 +204,7 @@ void ResourceManager::parseOthers(String dirPath, bool recursive) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-void ResourceManager::addArchive(String zipPath) {
|
|
|
|
|
|
|
+void ResourceManager::addArchive(const String& zipPath) {
|
|
|
// if(PHYSFS_addToSearchPath(zipPath.c_str(), 1, getThreadID()) == 0) {
|
|
// if(PHYSFS_addToSearchPath(zipPath.c_str(), 1, getThreadID()) == 0) {
|
|
|
if(PHYSFS_addToSearchPath(zipPath.c_str(), 1) == 0) {
|
|
if(PHYSFS_addToSearchPath(zipPath.c_str(), 1) == 0) {
|
|
|
Logger::log("Error adding archive to resource manager... %s\n", PHYSFS_getLastError());
|
|
Logger::log("Error adding archive to resource manager... %s\n", PHYSFS_getLastError());
|
|
@@ -213,7 +213,7 @@ void ResourceManager::addArchive(String zipPath) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void ResourceManager::addDirResource(String dirPath, bool recursive) {
|
|
|
|
|
|
|
+void ResourceManager::addDirResource(const String& dirPath, bool recursive) {
|
|
|
parseTextures(dirPath, recursive);
|
|
parseTextures(dirPath, recursive);
|
|
|
parsePrograms(dirPath, recursive);
|
|
parsePrograms(dirPath, recursive);
|
|
|
parseShaders(dirPath, recursive);
|
|
parseShaders(dirPath, recursive);
|
|
@@ -222,7 +222,7 @@ void ResourceManager::addDirResource(String dirPath, bool recursive) {
|
|
|
parseOthers(dirPath, recursive);
|
|
parseOthers(dirPath, recursive);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-Resource *ResourceManager::getResource(int resourceType, String resourceName) {
|
|
|
|
|
|
|
+Resource *ResourceManager::getResource(int resourceType, const String& resourceName) const {
|
|
|
Logger::log("requested %s\n", resourceName.c_str());
|
|
Logger::log("requested %s\n", resourceName.c_str());
|
|
|
for(int i =0; i < resources.size(); i++) {
|
|
for(int i =0; i < resources.size(); i++) {
|
|
|
// Logger::log("is it %s?\n", resources[i]->getResourceName().c_str());
|
|
// Logger::log("is it %s?\n", resources[i]->getResourceName().c_str());
|
|
@@ -233,4 +233,4 @@ Resource *ResourceManager::getResource(int resourceType, String resourceName) {
|
|
|
Logger::log("return NULL\n");
|
|
Logger::log("return NULL\n");
|
|
|
// need to add some sort of default resource for each type
|
|
// need to add some sort of default resource for each type
|
|
|
return NULL;
|
|
return NULL;
|
|
|
-}
|
|
|
|
|
|
|
+}
|