Daniele Bartolini vor 11 Jahren
Ursprung
Commit
dd9a5626e6
38 geänderte Dateien mit 205 neuen und 200 gelöschten Zeilen
  1. 1 1
      engine/compilers/bundle_compiler.cpp
  2. 34 0
      engine/compilers/compiler_types.h
  3. 1 1
      engine/core/json/json_parser.h
  4. 0 1
      engine/device.h
  5. 0 1
      engine/renderers/render_world.cpp
  6. 1 0
      engine/renderers/shader.cpp
  7. 1 1
      engine/resource/bundle.h
  8. 1 1
      engine/resource/file_bundle.cpp
  9. 1 2
      engine/resource/font_resource.cpp
  10. 2 1
      engine/resource/font_resource.h
  11. 1 0
      engine/resource/level_resource.cpp
  12. 2 2
      engine/resource/level_resource.h
  13. 1 1
      engine/resource/lua_resource.h
  14. 1 0
      engine/resource/material_resource.cpp
  15. 1 1
      engine/resource/material_resource.h
  16. 1 0
      engine/resource/mesh_resource.cpp
  17. 1 1
      engine/resource/mesh_resource.h
  18. 1 0
      engine/resource/package_resource.cpp
  19. 1 1
      engine/resource/package_resource.h
  20. 2 2
      engine/resource/physics_resource.cpp
  21. 2 1
      engine/resource/physics_resource.h
  22. 0 95
      engine/resource/resource.h
  23. 70 0
      engine/resource/resource_id.h
  24. 1 1
      engine/resource/resource_loader.h
  25. 0 6
      engine/resource/resource_manager.cpp
  26. 0 1
      engine/resource/resource_manager.h
  27. 0 1
      engine/resource/resource_package.h
  28. 4 1
      engine/resource/resource_registry.h
  29. 47 0
      engine/resource/resource_types.h
  30. 15 67
      engine/resource/sound_resource.cpp
  31. 2 1
      engine/resource/sound_resource.h
  32. 2 1
      engine/resource/sprite_resource.cpp
  33. 2 3
      engine/resource/sprite_resource.h
  34. 1 1
      engine/resource/texture_resource.cpp
  35. 2 2
      engine/resource/texture_resource.h
  36. 1 1
      engine/resource/unit_resource.cpp
  37. 1 1
      engine/resource/unit_resource.h
  38. 1 0
      engine/world/world_manager.cpp

+ 1 - 1
engine/compilers/bundle_compiler.cpp

@@ -31,11 +31,11 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "allocator.h"
 #include "os.h"
 #include "log.h"
-#include "resource.h"
 #include "path.h"
 #include "disk_filesystem.h"
 #include "compile_options.h"
 #include "resource_registry.h"
+#include "resource_id.h"
 #include <inttypes.h>
 
 namespace crown

+ 34 - 0
engine/compilers/compiler_types.h

@@ -0,0 +1,34 @@
+/*
+Copyright (c) 2013 Daniele Bartolini, Michele Rossi
+Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#pragma once
+
+namespace crown
+{
+
+struct CompileOptions;
+
+} // namespace crown

+ 1 - 1
engine/core/json/json_parser.h

@@ -32,7 +32,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "matrix4x4.h"
 #include "quaternion.h"
 #include "macros.h"
-#include "resource.h"
+#include "resource_id.h"
 
 namespace crown
 {

+ 0 - 1
engine/device.h

@@ -30,7 +30,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "config.h"
 #include "os.h"
 #include "linear_allocator.h"
-#include "resource.h"
 #include "world_types.h"
 
 namespace crown

+ 0 - 1
engine/renderers/render_world.cpp

@@ -28,7 +28,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "device.h"
 #include "allocator.h"
 #include "camera.h"
-#include "resource.h"
 #include "log.h"
 #include "sprite_resource.h"
 #include "sprite.h"

+ 1 - 0
engine/renderers/shader.cpp

@@ -30,6 +30,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "os.h"
 #include "reader_writer.h"
 #include "config.h"
+#include "resource_types.h"
 
 #if CROWN_DEBUG
 		#define SHADERC_NAME "shadercDebug"

+ 1 - 1
engine/resource/bundle.h

@@ -26,7 +26,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "resource.h"
+#include "resource_id.h"
 
 namespace crown
 {

+ 1 - 1
engine/resource/file_bundle.cpp

@@ -30,7 +30,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "memory.h"
 #include "bundle.h"
 #include "filesystem.h"
-#include "resource.h"
+
 #include "string_utils.h"
 #include "types.h"
 #include "os.h"

+ 1 - 2
engine/resource/font_resource.cpp

@@ -29,8 +29,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "allocator.h"
 #include "filesystem.h"
 #include "string_utils.h"
-#include "bundle.h"
-#include "types.h"
+#include "compile_options.h"
 
 namespace crown
 {

+ 2 - 1
engine/resource/font_resource.h

@@ -26,10 +26,11 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "resource.h"
+#include "types.h"
 #include "memory_types.h"
 #include "resource_types.h"
 #include "filesystem_types.h"
+#include "compiler_types.h"
 
 namespace crown
 {

+ 1 - 0
engine/resource/level_resource.cpp

@@ -29,6 +29,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "memory.h"
 #include "json_parser.h"
 #include "filesystem.h"
+#include "compile_options.h"
 
 namespace crown
 {

+ 2 - 2
engine/resource/level_resource.h

@@ -26,11 +26,11 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "resource.h"
 #include "memory_types.h"
-#include "resource_types.h"
 #include "filesystem_types.h"
 #include "math_types.h"
+#include "resource_types.h"
+#include "compiler_types.h"
 
 namespace crown
 {

+ 1 - 1
engine/resource/lua_resource.h

@@ -26,10 +26,10 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "resource.h"
 #include "memory_types.h"
 #include "resource_types.h"
 #include "filesystem_types.h"
+#include "compiler_types.h"
 
 namespace crown
 {

+ 1 - 0
engine/resource/material_resource.cpp

@@ -33,6 +33,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "reader_writer.h"
 #include "resource_manager.h"
 #include "vector.h"
+#include "compile_options.h"
 #include <bgfx.h>
 
 namespace crown

+ 1 - 1
engine/resource/material_resource.h

@@ -26,11 +26,11 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "resource.h"
 #include "memory_types.h"
 #include "resource_types.h"
 #include "filesystem_types.h"
 #include "math_types.h"
+#include "compiler_types.h"
 
 namespace crown
 {

+ 1 - 0
engine/resource/mesh_resource.cpp

@@ -32,6 +32,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "temp_allocator.h"
 #include "vector3.h"
 #include "resource_manager.h"
+#include "compile_options.h"
 
 namespace crown
 {

+ 1 - 1
engine/resource/mesh_resource.h

@@ -26,10 +26,10 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "resource.h"
 #include "memory_types.h"
 #include "resource_types.h"
 #include "filesystem_types.h"
+#include "compiler_types.h"
 #include <bgfx.h>
 
 namespace crown

+ 1 - 0
engine/resource/package_resource.cpp

@@ -30,6 +30,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "package_resource.h"
 #include "temp_allocator.h"
 #include "reader_writer.h"
+#include "compile_options.h"
 
 namespace crown
 {

+ 1 - 1
engine/resource/package_resource.h

@@ -26,10 +26,10 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "resource.h"
 #include "memory_types.h"
 #include "resource_types.h"
 #include "filesystem_types.h"
+#include "compiler_types.h"
 
 namespace crown
 {

+ 2 - 2
engine/resource/physics_resource.cpp

@@ -24,8 +24,6 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#include <algorithm>
-#include "allocator.h"
 #include "filesystem.h"
 #include "string_utils.h"
 #include "json_parser.h"
@@ -34,6 +32,8 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "dynamic_string.h"
 #include "map.h"
 #include "quaternion.h"
+#include "compile_options.h"
+#include <algorithm>
 
 namespace crown
 {

+ 2 - 1
engine/resource/physics_resource.h

@@ -26,11 +26,12 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "resource.h"
 #include "memory_types.h"
 #include "resource_types.h"
 #include "filesystem_types.h"
 #include "math_types.h"
+#include "compiler_types.h"
+#include "resource_id.h"
 
 namespace crown
 {

+ 0 - 95
engine/resource/resource.h

@@ -1,95 +0,0 @@
-/*
-Copyright (c) 2013 Daniele Bartolini, Michele Rossi
-Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-#pragma once
-
-#include "types.h"
-#include "compile_options.h"
-
-namespace crown
-{
-
-/// Hashed values for supported resource types
-#define FONT_EXTENSION				"font"
-#define LEVEL_EXTENSION				"level"
-#define LUA_EXTENSION				"lua"
-#define MATERIAL_EXTENSION			"material"
-#define MESH_EXTENSION				"mesh"
-#define PACKAGE_EXTENSION			"package"
-#define PHYSICS_CONFIG_EXTENSION	"physics_config"
-#define PHYSICS_EXTENSION			"physics"
-#define SHADER_EXTENSION			"shader"
-#define SOUND_EXTENSION				"sound"
-#define SPRITE_ANIMATION_EXTENSION	"sprite_animation"
-#define SPRITE_EXTENSION			"sprite"
-#define TEXTURE_EXTENSION			"texture"
-#define UNIT_EXTENSION				"unit"
-
-#define FONT_TYPE					uint64_t(0x9efe0a916aae7880)
-#define LEVEL_TYPE					uint64_t(0x2a690fd348fe9ac5)
-#define LUA_TYPE					uint64_t(0xa14e8dfa2cd117e2)
-#define MATERIAL_TYPE				uint64_t(0xeac0b497876adedf)
-#define MESH_TYPE					uint64_t(0x48ff313713a997a1)
-#define PACKAGE_TYPE				uint64_t(0xad9c6d9ed1e5e77a)
-#define PHYSICS_CONFIG_TYPE			uint64_t(0x72e3cc03787a11a1)
-#define PHYSICS_TYPE				uint64_t(0x5f7203c8f280dab8)
-#define SHADER_TYPE					uint64_t(0xcce8d5b5f5ae333f)
-#define SOUND_TYPE					uint64_t(0x90641b51c98b7aac)
-#define SPRITE_ANIMATION_TYPE		uint64_t(0x487e78e3f87f238d)
-#define SPRITE_TYPE					uint64_t(0x8d5871f9ebdb651c)
-#define TEXTURE_TYPE				uint64_t(0xcd4238c6a0c69e32)
-#define UNIT_TYPE					uint64_t(0xe0a48d0be9a7453f)
-
-/*#define CONFIG_VERSION				uint32_t(1)
-#define FONT_VERSION				uint32_t(1)
-#define LEVEL_VERSION				uint32_t(1)
-#define LUA_VERSION					uint32_t(1)
-#define MATERIAL_VERSION			uint32_t(1)
-#define MESH_VERSION				uint32_t(1)
-#define PACKAGE_VERSION				uint32_t(1)
-#define PHYSICS_CONFIG_VERSION		uint32_t(1)
-#define PHYSICS_VERSION				uint32_t(1)
-#define SHADER_VERSION				uint32_t(1)
-#define SOUND_VERSION				uint32_t(1)
-#define SPRITE_ANIMATION_VERSION	uint32_t(1)
-#define SPRITE_VERSION				uint32_t(1)
-#define TEXTURE_VERSION				uint32_t(1)
-#define UNIT_VERSION				uint32_t(1)*/
-
-struct ResourceId
-{
-	ResourceId() : type(0), name(0) {}
-	ResourceId(uint64_t type, uint64_t name) : type(type), name(name) {}
-	ResourceId(const char* type, const char* name);
-
-	bool operator==(const ResourceId& a) const { return type == a.type && name == a.name; }
-	bool operator<(const ResourceId& a) const { return type < a.type || (type == a.type && name < a.name); }
-
-	uint64_t type;
-	uint64_t name;
-};
-
-} // namespace crown

+ 70 - 0
engine/resource/resource_id.h

@@ -0,0 +1,70 @@
+/*
+Copyright (c) 2013 Daniele Bartolini, Michele Rossi
+Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#pragma once
+
+#include "string_utils.h"
+
+namespace crown
+{
+
+struct ResourceId
+{
+	ResourceId()
+		: type(0)
+		, name(0)
+	{
+	}
+
+	ResourceId(const char* type, const char* name)
+		: type(murmur2_64(type, strlen(type), SEED))
+		, name(murmur2_64(name, strlen(name), SEED))
+	{
+	}
+
+	ResourceId(uint64_t type, uint64_t name)
+		: type(type)
+		, name(name)
+	{
+	}
+
+	bool operator==(const ResourceId& a) const
+	{
+		return type == a.type && name == a.name;
+	}
+
+	bool operator<(const ResourceId& a) const
+	{
+		return type < a.type || (type == a.type && name < a.name);
+	}
+
+	static const uint64_t SEED = 0;
+
+	uint64_t type;
+	uint64_t name;
+};
+
+} // namespace crown

+ 1 - 1
engine/resource/resource_loader.h

@@ -27,11 +27,11 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #include "types.h"
-#include "resource.h"
 #include "thread.h"
 #include "container_types.h"
 #include "mutex.h"
 #include "memory_types.h"
+#include "resource_id.h"
 
 namespace crown
 {

+ 0 - 6
engine/resource/resource_manager.cpp

@@ -39,12 +39,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 {
 
-ResourceId::ResourceId(const char* type, const char* name)
-	: type(murmur2_64(type, strlen(type), 0))
-	, name(murmur2_64(name, strlen(name), 0))
-{
-}
-
 ResourceManager::ResourceManager(Bundle& bundle)
 	: _resource_heap("resource", default_allocator())
 	, _loader(bundle, _resource_heap)

+ 0 - 1
engine/resource/resource_manager.h

@@ -28,7 +28,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #include "types.h"
 #include "container_types.h"
-#include "resource.h"
 #include "proxy_allocator.h"
 #include "resource_loader.h"
 

+ 0 - 1
engine/resource/resource_package.h

@@ -29,7 +29,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "types.h"
 #include "resource_manager.h"
 #include "package_resource.h"
-#include "resource.h"
 
 namespace crown
 {

+ 4 - 1
engine/resource/resource_registry.h

@@ -26,8 +26,11 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "resource.h"
+#include "types.h"
+#include "memory_types.h"
 #include "resource_types.h"
+#include "compiler_types.h"
+#include "filesystem_types.h"
 
 namespace crown
 {

+ 47 - 0
engine/resource/resource_types.h

@@ -24,6 +24,53 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
 */
 
+#pragma once
+
+#define FONT_EXTENSION             "font"
+#define LEVEL_EXTENSION            "level"
+#define LUA_EXTENSION              "lua"
+#define MATERIAL_EXTENSION         "material"
+#define MESH_EXTENSION             "mesh"
+#define PACKAGE_EXTENSION          "package"
+#define PHYSICS_CONFIG_EXTENSION   "physics_config"
+#define PHYSICS_EXTENSION          "physics"
+#define SHADER_EXTENSION           "shader"
+#define SOUND_EXTENSION            "sound"
+#define SPRITE_ANIMATION_EXTENSION "sprite_animation"
+#define SPRITE_EXTENSION           "sprite"
+#define TEXTURE_EXTENSION          "texture"
+#define UNIT_EXTENSION             "unit"
+
+#define FONT_TYPE                  uint64_t(0x9efe0a916aae7880)
+#define LEVEL_TYPE                 uint64_t(0x2a690fd348fe9ac5)
+#define LUA_TYPE                   uint64_t(0xa14e8dfa2cd117e2)
+#define MATERIAL_TYPE              uint64_t(0xeac0b497876adedf)
+#define MESH_TYPE                  uint64_t(0x48ff313713a997a1)
+#define PACKAGE_TYPE               uint64_t(0xad9c6d9ed1e5e77a)
+#define PHYSICS_CONFIG_TYPE        uint64_t(0x72e3cc03787a11a1)
+#define PHYSICS_TYPE               uint64_t(0x5f7203c8f280dab8)
+#define SHADER_TYPE                uint64_t(0xcce8d5b5f5ae333f)
+#define SOUND_TYPE                 uint64_t(0x90641b51c98b7aac)
+#define SPRITE_ANIMATION_TYPE      uint64_t(0x487e78e3f87f238d)
+#define SPRITE_TYPE                uint64_t(0x8d5871f9ebdb651c)
+#define TEXTURE_TYPE               uint64_t(0xcd4238c6a0c69e32)
+#define UNIT_TYPE                  uint64_t(0xe0a48d0be9a7453f)
+
+// #define FONT_VERSION               uint32_t(1)
+// #define LEVEL_VERSION              uint32_t(1)
+// #define LUA_VERSION                uint32_t(1)
+// #define MATERIAL_VERSION           uint32_t(1)
+// #define MESH_VERSION               uint32_t(1)
+// #define PACKAGE_VERSION            uint32_t(1)
+// #define PHYSICS_CONFIG_VERSION     uint32_t(1)
+// #define PHYSICS_VERSION            uint32_t(1)
+// #define SHADER_VERSION             uint32_t(1)
+// #define SOUND_VERSION              uint32_t(1)
+// #define SPRITE_ANIMATION_VERSION   uint32_t(1)
+// #define SPRITE_VERSION             uint32_t(1)
+// #define TEXTURE_VERSION            uint32_t(1)
+// #define UNIT_VERSION               uint32_t(1)
+
 namespace crown
 {
 	class ResourceManager;

+ 15 - 67
engine/resource/sound_resource.cpp

@@ -24,18 +24,11 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#include <stdio.h>
-#include <limits.h>
-#include <errno.h>
-
-#include "allocator.h"
-#include "config.h"
+#include "sound_resource.h"
 #include "dynamic_string.h"
 #include "filesystem.h"
-#include "os.h"
-#include "sound_resource.h"
-#include "string_utils.h"
 #include "json_parser.h"
+#include "compile_options.h"
 
 namespace crown
 {
@@ -43,66 +36,21 @@ namespace sound_resource
 {
 	struct WAVHeader
 	{
-		char 			riff[4];				// Should contain 'RIFF'
-		int32_t			chunk_size;				// Not Needed
-		char 			wave[4];				// Should contain 'WAVE'
-		char 			fmt[4];					// Should contain 'fmt '
-		int32_t			fmt_size;				// Size of format chunk
-		int16_t			fmt_tag;				// Identifies way data is stored, 1 means no compression
-		int16_t			fmt_channels;			// Channel, 1 means mono, 2 means stereo
-		int32_t			fmt_sample_rate;		// Samples per second
-		int32_t			fmt_avarage;			// Avarage bytes per sample
-		int16_t			fmt_block_align;		// Block alignment
-		int16_t			fmt_bits_ps;			// Number of bits per sample
-		char 			data[4];				// Should contain 'data'
-		int32_t			data_size;				// Data dimension
+		char    riff[4];			// Should contain 'RIFF'
+		int32_t chunk_size;			// Not Needed
+		char    wave[4];			// Should contain 'WAVE'
+		char    fmt[4];				// Should contain 'fmt '
+		int32_t fmt_size;			// Size of format chunk
+		int16_t fmt_tag;			// Identifies way data is stored, 1 means no compression
+		int16_t fmt_channels;		// Channel, 1 means mono, 2 means stereo
+		int32_t fmt_sample_rate;	// Samples per second
+		int32_t fmt_avarage;		// Avarage bytes per sample
+		int16_t fmt_block_align;	// Block alignment
+		int16_t fmt_bits_ps;		// Number of bits per sample
+		char    data[4];			// Should contain 'data'
+		int32_t data_size;			// Data dimension
 	};
 
-	// size_t compile_if_ogg(Filesystem& fs, const char* resource_path)
-	// {
-	// 	// Retrieves resource absolute path
-	// 	DynamicString s(default_allocator());
-	// 	fs.get_absolute_path(resource_path, s);
-	// 	const char* abs_path = s.c_str();
-
-	// 	OggVorbis_File ogg_stream;
-
-	// 	bool result = ov_fopen(os::normalize_path(abs_path), &ogg_stream) == 0;
-
-	// 	if (result == false)
-	// 	{
-	// 		return 0;
-	// 	}
-
-	// 	vorbis_info* info = ov_info(&ogg_stream, -1);
-
-	// 	int64_t size = ov_raw_total(&ogg_stream, -1);
-	// 	int32_t rate = info->rate;
-	// 	int32_t channels = info->channels;
-
-	// 	ov_clear(&ogg_stream);
-
-	// 	File* in_file = fs.open(resource_path, FOM_READ);
-
-	// 	m_sound_header.version = SOUND_VERSION;
-	// 	m_sound_header.size = size;
-	// 	m_sound_header.sample_rate = rate;
-	// 	m_sound_header.block_size = (channels * 16) / 8;
-	// 	m_sound_header.avg_bytes_ps = rate * ((channels * 16) / 8);
-	// 	m_sound_header.channels = channels;
-	// 	m_sound_header.bits_ps = 16;
-	// 	m_sound_header.sound_type = SoundType::OGG;
-
-	// 	m_sound_data_size = size;
-	// 	m_sound_data = (uint8_t*)default_allocator().allocate(m_sound_data_size);
-
-	// 	in_file->read((char*)m_sound_data, m_sound_data_size);
-
-	// 	fs.close(in_file);
-
-	// 	return sizeof(SoundHeader) + m_sound_data_size;
-	// }
-
 	void compile(const char* path, CompileOptions& opts)
 	{
 		const uint32_t VERSION = 1;

+ 2 - 1
engine/resource/sound_resource.h

@@ -26,10 +26,11 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "resource.h"
+#include "types.h"
 #include "memory_types.h"
 #include "resource_types.h"
 #include "filesystem_types.h"
+#include "compiler_types.h"
 
 namespace crown
 {

+ 2 - 1
engine/resource/sprite_resource.cpp

@@ -36,10 +36,11 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "vector2.h"
 #include "vector4.h"
 #include "resource_manager.h"
+#include "compile_options.h"
 #include <cfloat>
 #include <cstring>
 #include <inttypes.h>
-#include "log.h"
+
 
 namespace crown
 {

+ 2 - 3
engine/resource/sprite_resource.h

@@ -26,12 +26,11 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "resource.h"
+#include "types.h"
 #include "memory_types.h"
 #include "resource_types.h"
 #include "filesystem_types.h"
-#include <cstring>
-#include <inttypes.h>
+#include "compiler_types.h"
 #include <bgfx.h>
 
 namespace crown

+ 1 - 1
engine/resource/texture_resource.cpp

@@ -24,7 +24,6 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#include "allocator.h"
 #include "filesystem.h"
 #include "texture_resource.h"
 #include "reader_writer.h"
@@ -32,6 +31,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "math_utils.h"
 #include "resource_manager.h"
 #include "log.h"
+#include "compile_options.h"
 
 namespace crown
 {

+ 2 - 2
engine/resource/texture_resource.h

@@ -26,11 +26,11 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "resource.h"
 #include "memory_types.h"
 #include "resource_types.h"
 #include "filesystem_types.h"
-#include "memory.h"
+#include "memory_types.h"
+#include "compiler_types.h"
 #include <bgfx.h>
 
 namespace crown

+ 1 - 1
engine/resource/unit_resource.cpp

@@ -34,7 +34,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "matrix4x4.h"
 #include "physics_types.h"
 #include "quaternion.h"
-#include "resource.h"
+#include "compile_options.h"
 #include "temp_allocator.h"
 #include "types.h"
 #include "vector3.h"

+ 1 - 1
engine/resource/unit_resource.h

@@ -26,11 +26,11 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #pragma once
 
-#include "resource.h"
 #include "memory_types.h"
 #include "resource_types.h"
 #include "filesystem_types.h"
 #include "math_types.h"
+#include "compiler_types.h"
 
 namespace crown
 {

+ 1 - 0
engine/world/world_manager.cpp

@@ -26,6 +26,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #include "world_manager.h"
 #include "world.h"
+#include "memory.h"
 
 namespace crown
 {