Daniele Bartolini 13 vuotta sitten
vanhempi
sitoutus
2988326303
2 muutettua tiedostoa jossa 6 lisäystä ja 4 poistoa
  1. 4 3
      src/ResourceLoader.cpp
  2. 2 1
      src/ResourceManager.cpp

+ 4 - 3
src/ResourceLoader.cpp

@@ -1,6 +1,7 @@
 #include "ResourceLoader.h"
 #include "ResourceManager.h"
 #include "String.h"
+#include "Hash.h"
 #include "TextureResource.h"
 #include <stdio.h>
 #include <unistd.h>
@@ -12,9 +13,9 @@ ResourceLoader::ResourceLoader(ResourceManager* resource_manager) :
 	m_resource_manager(resource_manager),
 	m_resources(m_allocator)
 {
-	m_config_hash = string::Hash32("config");
-	m_texture_hash = string::Hash32("tga");
-	m_mesh_hash = string::Hash32("mesh");
+	m_config_hash = hash::fnv1a_32("config", string::strlen("config"));
+	m_texture_hash = hash::fnv1a_32("tga", string::strlen("tga"));
+	m_mesh_hash = hash::fnv1a_32("mesh", string::strlen("mesh"));
 }
 
 ResourceLoader::~ResourceLoader()

+ 2 - 1
src/ResourceManager.cpp

@@ -27,6 +27,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "ResourceManager.h"
 #include "ResourceLoader.h"
 #include "String.h"
+#include "Hash.h"
 #include <algorithm>
 
 namespace crown
@@ -47,7 +48,7 @@ ResourceManager::~ResourceManager()
 //-----------------------------------------------------------------------------
 ResourceId ResourceManager::load(const char* name)
 {
-	uint32_t name_hash = string::Hash32(name);
+	uint32_t name_hash = hash::fnv1a_32(name, string::strlen(name));
 
 	return load(name_hash);
 }