Просмотр исходного кода

Load now requires resource names as a pair (type, name) of strings

Daniele Bartolini 12 лет назад
Родитель
Сommit
e6632d6077
2 измененных файлов с 4 добавлено и 11 удалено
  1. 3 10
      engine/resource/ResourceManager.cpp
  2. 1 1
      engine/resource/ResourceManager.h

+ 3 - 10
engine/resource/ResourceManager.cpp

@@ -33,7 +33,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Allocator.h"
 #include "StringUtils.h"
 #include "Hash.h"
-#include "Path.h"
 #include "Device.h"
 #include "Filesystem.h"
 #include "TextReader.h"
@@ -71,16 +70,10 @@ ResourceManager::~ResourceManager()
 }
 
 //-----------------------------------------------------------------------------
-ResourceId ResourceManager::load(const char* name)
+ResourceId ResourceManager::load(const char* type, const char* name)
 {
-	char basename[512];
-	char extension[512];
-
-	path::filename_without_extension(name, basename, 512);
-	path::extension(name, extension, 512);
-
-	uint32_t name_hash = hash::murmur2_32(basename, string::strlen(basename), m_seed);
-	uint32_t type_hash = hash::murmur2_32(extension, string::strlen(extension), 0);
+	uint32_t type_hash = hash::murmur2_32(type, string::strlen(type), 0);
+	uint32_t name_hash = hash::murmur2_32(name, string::strlen(name), m_seed);
 
 	return load(name_hash, type_hash);
 }

+ 1 - 1
engine/resource/ResourceManager.h

@@ -60,7 +60,7 @@ public:
 	/// Loads the resource by @a name and returns its ResourceId.
 	/// @note
 	/// Call is_loaded() method to check if the loading process is actually completed.
-	ResourceId				load(const char* name);
+	ResourceId				load(const char* type, const char* name);
 
 	/// Unloads the @a resource, freeing up all the memory associated by it
 	/// and eventually any global object associated with it.