Explorar o código

Merge branch 'master' into rendering-2

Conflicts:
	tools/compilers/resource-linker.cpp
Daniele Bartolini %!s(int64=12) %!d(string=hai) anos
pai
achega
fab1e0fb94
Modificáronse 42 ficheiros con 1507 adicións e 716 borrados
  1. 1 0
      .gitignore
  2. 8 7
      src/FileBundle.cpp
  3. 7 5
      src/FileBundle.h
  4. 6 8
      src/TextureResource.cpp
  5. 15 6
      src/TextureResource.h
  6. 69 7
      tools/CMakeLists.txt
  7. 29 0
      tools/Config.h.in
  8. 52 49
      tools/cli/resource-compiler.cpp
  9. 0 3
      tools/cli/resource-compiler.py
  10. 0 0
      tools/cli/resource-hash.cpp
  11. 0 41
      tools/compilers/CMakeLists.txt
  12. 25 114
      tools/compilers/Compiler.cpp
  13. 7 56
      tools/compilers/Compiler.h
  14. 0 210
      tools/compilers/resource-linker.cpp
  15. 77 84
      tools/compilers/tga/TGACompiler.cpp
  16. 11 16
      tools/compilers/tga/TGACompiler.h
  17. 0 90
      tools/compilers/txt/TXTCompiler.cpp
  18. 212 0
      tools/core/Args.cpp
  19. 123 0
      tools/core/Args.h
  20. 43 0
      tools/core/Assert.h
  21. 30 0
      tools/core/Types.h
  22. 98 0
      tools/core/formats/PixelFormat.h
  23. 51 0
      tools/core/formats/ResourceFormat.h
  24. 14 20
      tools/core/formats/TextureFormat.h
  25. 102 0
      tools/core/strings/Hash.h
  26. 300 0
      tools/core/strings/Path.h
  27. 227 0
      tools/core/strings/StringUtils.h
  28. 0 0
      tools/gui/fontgen/CMakeLists.txt
  29. 0 0
      tools/gui/fontgen/fontgen.cpp
  30. 0 0
      tools/gui/resource-browser/CMakeLists.txt
  31. 0 0
      tools/gui/resource-browser/resource-browser.py
  32. 0 0
      tools/gui/resource-browser/ui/resource-browser.glade
  33. 0 0
      tools/gui/toolchain/CMakeLists.txt
  34. 0 0
      tools/gui/toolchain/toolchain.py
  35. 0 0
      tools/gui/toolchain/ui/toolchain.glade
  36. 0 0
      tools/gui/world-editor/CMakeLists.txt
  37. 0 0
      tools/gui/world-editor/CrownDrawingArea.cpp
  38. 0 0
      tools/gui/world-editor/CrownDrawingArea.h
  39. 0 0
      tools/gui/world-editor/terrain/Heightfield.cpp
  40. 0 0
      tools/gui/world-editor/terrain/Heightfield.h
  41. 0 0
      tools/gui/world-editor/ui/world-editor.glade
  42. 0 0
      tools/gui/world-editor/world-editor.cpp

+ 1 - 0
.gitignore

@@ -3,6 +3,7 @@
 
 
 # Ignore CMake-generated config files
 # Ignore CMake-generated config files
 /src/Config.h
 /src/Config.h
+/tools/Config.h
 
 
 # Ignore some android directories
 # Ignore some android directories
 /android/bin
 /android/bin

+ 8 - 7
src/FileBundle.cpp

@@ -52,19 +52,20 @@ DiskFile* FileBundle::open(ResourceId name)
 {
 {
 	// Convert name/type into strings
 	// Convert name/type into strings
 	char resource_name[512];
 	char resource_name[512];
-
-	// Fixme
 	snprintf(resource_name, 512, "%.8X%.8X", name.name, name.type);
 	snprintf(resource_name, 512, "%.8X%.8X", name.name, name.type);
 
 
 	// Search the resource in the filesystem
 	// Search the resource in the filesystem
-	if (m_filesystem.exists(resource_name) == false)
-	{
-		return NULL;
-	}
+	bool exists = m_filesystem.exists(resource_name);
+	CE_ASSERT(exists == true, "Resource does not exist: %s", resource_name);
 
 
+	// Open the resource and check magic number/version
 	DiskFile* file = (DiskFile*)m_filesystem.open(resource_name, FOM_READ);
 	DiskFile* file = (DiskFile*)m_filesystem.open(resource_name, FOM_READ);
 
 
-	file->skip(sizeof(ResourceHeader));
+	ResourceHeader header;
+	file->read(&header, sizeof(ResourceHeader));
+
+	CE_ASSERT(header.magic == RESOURCE_MAGIC_NUMBER, "Resource is not valid: %s", resource_name);
+	CE_ASSERT(header.version == RESOURCE_VERSION, "Resource version mismatch: %s", resource_name);
 
 
 	return file;
 	return file;
 }
 }

+ 7 - 5
src/FileBundle.h

@@ -35,15 +35,17 @@ namespace crown
 class Filesystem;
 class Filesystem;
 class DiskFile;
 class DiskFile;
 
 
-// The header of every compiled resource file.
-// KEEP IN SYNC WITH CompiledResource struct in Compiler.h!
+const uint32_t	RESOURCE_MAGIC_NUMBER		= 0xCE010101;
+const uint32_t	RESOURCE_VERSION			= 2;
+
+/// Contains the header data common to all
+/// types of resources passing through the
+/// standard Compiler mechanics.
 struct ResourceHeader
 struct ResourceHeader
 {
 {
 	uint32_t	magic;		// Magic number used to identify the file
 	uint32_t	magic;		// Magic number used to identify the file
 	uint32_t	version;	// Version of the compiler used to compile the resource
 	uint32_t	version;	// Version of the compiler used to compile the resource
-	uint32_t	name;		// Name of the resource (murmur2_32 hash)
-	uint32_t	type;		// Type of the resource (murmur2_32 hash)
-	uint32_t	size;		// Size of the resource data _not_ including header (in bytes)
+	uint32_t	size;		// Size of the resource data _not_ including this header in bytes
 };
 };
 
 
 /// Source of resources
 /// Source of resources

+ 6 - 8
src/TextureResource.cpp

@@ -39,23 +39,21 @@ namespace crown
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 void* TextureResource::load(Allocator& allocator, Bundle& bundle, ResourceId id)
 void* TextureResource::load(Allocator& allocator, Bundle& bundle, ResourceId id)
 {
 {
-	DiskFile* stream = bundle.open(id);
+	DiskFile* file = bundle.open(id);
 
 
-	CE_ASSERT(stream != NULL, "Resource does not exist: %.8X%.8X", id.name, id.type);
+	CE_ASSERT(file != NULL, "Resource does not exist: %.8X%.8X", id.name, id.type);
 
 
 	TextureResource* resource = (TextureResource*)allocator.allocate(sizeof(TextureResource));
 	TextureResource* resource = (TextureResource*)allocator.allocate(sizeof(TextureResource));
 
 
-	stream->read(&resource->m_format, sizeof(PixelFormat));
-	stream->read(&resource->m_width, sizeof(uint16_t));
-	stream->read(&resource->m_height, sizeof(uint16_t));
+	file->read(&resource->m_header, sizeof(TextureHeader));
 
 
-	size_t size = resource->m_width * resource->m_height * Pixel::bytes_per_pixel(resource->m_format);
+	size_t size = resource->width() * resource->height() * Pixel::bytes_per_pixel(resource->format());
 
 
 	resource->m_data = (uint8_t*)allocator.allocate(sizeof(uint8_t) * size);
 	resource->m_data = (uint8_t*)allocator.allocate(sizeof(uint8_t) * size);
 
 
-	stream->read(resource->m_data, size);
+	file->read(resource->m_data, size);
 
 
-	bundle.close(stream);
+	bundle.close(file);
 
 
 	return resource;
 	return resource;
 }
 }

+ 15 - 6
src/TextureResource.h

@@ -34,6 +34,17 @@ OTHER DEALINGS IN THE SOFTWARE.
 namespace crown
 namespace crown
 {
 {
 
 
+// Bump the version whenever a change in the header is made
+const uint32_t TEXTURE_VERSION = 1;
+
+struct TextureHeader
+{
+	uint32_t	version;	// Texture file version
+	uint32_t	format;		// Format of the pixels
+	uint32_t	width;		// Width in pixels
+	uint32_t	height;		// Height in pixels
+};
+
 class Bundle;
 class Bundle;
 class Allocator;
 class Allocator;
 
 
@@ -48,16 +59,14 @@ public:
 
 
 public:
 public:
 
 
-	PixelFormat			format() const { return m_format; }
-	uint16_t			width() const { return m_width; }
-	uint16_t			height() const { return m_height; }
+	PixelFormat			format() const { return (PixelFormat) m_header.format; }
+	uint32_t			width() const { return m_header.width; }
+	uint32_t			height() const { return m_header.height; }
 	const uint8_t*		data() const { return m_data; }
 	const uint8_t*		data() const { return m_data; }
 
 
 private:
 private:
 
 
-	PixelFormat			m_format;
-	uint16_t			m_width;
-	uint16_t			m_height;
+	TextureHeader		m_header;
 	uint8_t*			m_data;
 	uint8_t*			m_data;
 };
 };
 
 

+ 69 - 7
tools/CMakeLists.txt

@@ -3,15 +3,77 @@ cmake_minimum_required(VERSION 2.8)
 project(crown-tools)
 project(crown-tools)
 
 
 set (INCLUDES
 set (INCLUDES
+	core
+	core/formats
+	core/strings
 	compilers
 	compilers
+	compilers/tga
 )
 )
 
 
-link_directories(${CROWN_BINARY_DIR} ${GTKMM_LIBRARY_DIRS})
-include_directories(${INCLUDES} ${GTKMM_INCLUDE_DIRS})
+set (CORE_SRC
+	core/Args.cpp
+)
 
 
-add_subdirectory(compilers)
-#add_subdirectory(editors/world-editor)
-add_subdirectory(editors/resource-browser)
-add_subdirectory(editors/toolchain)
-add_subdirectory(pycrown)
+set (CORE_HEADERS
+	core/Args.h
+	core/Assert.h
+	core/Types.h
+
+	core/formats/PixelFormat.h
+	core/formats/ResourceFormat.h
+	core/formats/TextureFormat.h
+
+	core/strings/StringUtils.h
+	core/strings/Hash.h
+	core/strings/Path.h
+)
+
+set (COMPILERS_SRC
+	compilers/Compiler.cpp
+	compilers/tga/TGACompiler.cpp
+#	compilers/ps/PSCompiler.cpp
+#	compilers/vs/VSCompiler.cpp
+)
+
+set (COMPILER_HEADERS
+	compilers/Compiler.h
+	compilers/tga/TGACompiler.h
+#	compilers/ps/PSCompiler.h
+#	compilers/vs/VSCompiler.h
+)
+
+set (TOOLS_SRC
+	${CORE_SRC}
+	${COMPILERS_SRC}
+)
 
 
+set (TOOLS_HEADERS
+	${CORE_HEADERS}
+	${COMPILERS_HEADERS}
+)
+
+include_directories(${INCLUDES})
+
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/Config.h)
+
+# tools library
+add_library(crown-tools ${TOOLS_SRC} ${TOOLS_HEADERS})
+
+# resource-hash
+add_executable(resource-hash cli/resource-hash.cpp)
+target_link_libraries(resource-hash crown-tools)
+
+# resource-compiler
+add_executable(resource-compiler cli/resource-compiler.cpp)
+target_link_libraries(resource-compiler crown-tools)
+
+install (TARGETS crown-tools DESTINATION lib/${CMAKE_PROJECT_NAME})
+
+install (TARGETS resource-hash DESTINATION bin)
+install (TARGETS resource-compiler DESTINATION bin)
+install (FILES cli/resource-compiler.py PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
+	GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE DESTINATION bin)
+
+add_subdirectory(gui/resource-browser)
+add_subdirectory(gui/toolchain)
+add_subdirectory(pycrown)

+ 29 - 0
tools/Config.h.in

@@ -0,0 +1,29 @@
+/*
+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.
+*/
+
+#cmakedefine LINUX
+#cmakedefine WINDOWS
+#cmakedefine CROWN_DEBUG

+ 52 - 49
tools/compilers/resource-compiler.cpp → tools/cli/resource-compiler.cpp

@@ -1,8 +1,36 @@
-#include "Crown.h"
-#include "tga/TGACompiler.h"
-#include "txt/TXTCompiler.h"
-#include "vs/VSCompiler.h"
-#include "ps/PSCompiler.h"
+/*
+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.
+*/
+
+#include <cstdio>
+
+#include "Args.h"
+#include "Path.h"
+#include "String.h"
+#include "Hash.h"
+#include "TGACompiler.h"
 
 
 using namespace crown;
 using namespace crown;
 
 
@@ -30,57 +58,32 @@ int main(int argc, char** argv)
 	// If there are no resources
 	// If there are no resources
 	if (first_resource >= argc)
 	if (first_resource >= argc)
 	{
 	{
-		Log::e("you have to specify at least one resource.");
+		printf("you have to specify at least one resource.");
 		exit(EXIT_FAILURE);
 		exit(EXIT_FAILURE);
 	}
 	}
 
 
-	TGACompiler tga(root_path, dest_path);
-	TXTCompiler txt(root_path, dest_path);
-	VSCompiler vs(root_path, dest_path);
-	PSCompiler ps(root_path, dest_path);
 
 
-	char resource_name[MAX_RESOURCE_NAME_LENGTH];
-	char resource_type[MAX_RESOURCE_TYPE_LENGTH];
+	TGACompiler tga;
+	// TXTCompiler txt(root_path, dest_path);
+	// VSCompiler vs(root_path, dest_path);
+	// PSCompiler ps(root_path, dest_path);
 
 
-	// Dispatch requests to the appropriate compiler
-	for (int32_t res = first_resource; res < argc; res++)
+	char out_name[1024];
+	char resource_name[1024];
+	char resource_type[1024];
+
+	for (int32_t i = 0; i < argc - first_resource; i++)
 	{
 	{
-		char* resource = argv[res];
+		path::filename_without_extension(argv[first_resource + i], resource_name, 1024);
+		path::extension(argv[first_resource + i], resource_type, 1024);
 
 
-		path::filename_without_extension(resource, resource_name, MAX_RESOURCE_NAME_LENGTH);
-		path::extension(resource, resource_type, MAX_RESOURCE_TYPE_LENGTH);
+		snprintf(out_name, 1024, "%.8X%.8X",
+			hash::murmur2_32(resource_name, string::strlen(resource_name), hash_seed),
+			hash::murmur2_32(resource_type, string::strlen(resource_type), 0));
 
 
-		uint32_t resource_name_hash = hash::murmur2_32(resource_name, string::strlen(resource_name), hash_seed);
-		uint32_t resource_type_hash = hash::murmur2_32(resource_type, string::strlen(resource_type), 0);
+		printf("%s <= %s\n", out_name, argv[first_resource + i]);
 
 
-		switch (resource_type_hash)
-		{
-			case TEXTURE_TYPE:
-			{
-				tga.compile(resource, resource_name_hash, resource_type_hash);
-				break;
-			}
-			case TEXT_TYPE:
-			{
-				txt.compile(resource, resource_name_hash, resource_type_hash);
-				break;
-			}
-			case VERTEX_SHADER_TYPE:
-			{
-				vs.compile(resource, resource_name_hash, resource_type_hash);
-				break;
-			}
-			case PIXEL_SHADER_TYPE:
-			{
-				ps.compile(resource, resource_name_hash, resource_type_hash);
-				break;	
-			}
-			default:
-			{
-				Log::e("Resource type not supported.");
-				break;
-			}
-		}
+		tga.compile(root_path, dest_path, argv[first_resource + i], out_name);
 	}
 	}
 
 
 	return 0;
 	return 0;
@@ -157,13 +160,13 @@ void check_arguments(const char* root_path, const char* dest_path)
 {
 {
 	if (root_path == NULL)
 	if (root_path == NULL)
 	{
 	{
-		Log::e("you have to specify the root path with `--root-path`\n");
+		printf("you have to specify the root path with `--root-path`\n");
 		exit(EXIT_FAILURE);
 		exit(EXIT_FAILURE);
 	}
 	}
 
 
 	if (dest_path == NULL)
 	if (dest_path == NULL)
 	{
 	{
-		Log::e("you have to specify the destination path with `--dest-path`\n");
+		printf("you have to specify the destination path with `--dest-path`\n");
 		exit(EXIT_FAILURE);
 		exit(EXIT_FAILURE);
 	}
 	}
 }
 }

+ 0 - 3
tools/compilers/resource-compiler.py → tools/cli/resource-compiler.py

@@ -85,9 +85,6 @@ class CompilerHelper:
 		print("Compiling resources...")
 		print("Compiling resources...")
 		self.m_compiler.compile_all()
 		self.m_compiler.compile_all()
 
 
-		print("Copying game library...")
-		shutil.copy(self.root_path() + "/" + GAME_LIBRARY_FILE, self.dest_path())
-
 		print("Writing perfect seed...")
 		print("Writing perfect seed...")
 		self.write_perfect_seed()
 		self.write_perfect_seed()
 
 

+ 0 - 0
tools/compilers/resource-hash.cpp → tools/cli/resource-hash.cpp


+ 0 - 41
tools/compilers/CMakeLists.txt

@@ -1,41 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-
-set (SRC
-	Compiler.cpp
-	tga/TGACompiler.cpp
-	txt/TXTCompiler.cpp
-	ps/PSCompiler.cpp
-	vs/VSCompiler.cpp
-)
-
-set (HEADERS
-	Compiler.h
-	tga/TGACompiler.h
-	txt/TXTCompiler.h
-	ps/PSCompiler.h
-	vs/VSCompiler.h
-)
-
-# utils
-add_library(crown-compiler-utils ${SRC} ${HEADERS})
-target_link_libraries(crown-compiler-utils crown)
-
-# resource-linker
-add_executable(resource-linker resource-linker.cpp)
-target_link_libraries(resource-linker crown)
-
-# resource-hash
-add_executable(resource-hash resource-hash.cpp)
-target_link_libraries(resource-hash crown)
-
-# resource-compiler
-add_executable(resource-compiler resource-compiler.cpp)
-target_link_libraries(resource-compiler crown crown-compiler-utils)
-
-install (TARGETS crown-compiler-utils DESTINATION lib/${CMAKE_PROJECT_NAME})
-
-install (TARGETS resource-linker DESTINATION bin)
-install (TARGETS resource-hash DESTINATION bin)
-install (TARGETS resource-compiler DESTINATION bin)
-install (FILES resource-compiler.py PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
-	GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE DESTINATION bin)

+ 25 - 114
tools/compilers/Compiler.cpp

@@ -26,147 +26,58 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 
 #include <cstring>
 #include <cstring>
 #include <cstdlib>
 #include <cstdlib>
+#include <iostream>
+
 #include "Compiler.h"
 #include "Compiler.h"
-#include "Hash.h"
-#include "Path.h"
-#include "DiskFile.h"
-#include "Log.h"
+#include "ResourceFormat.h"
 
 
 namespace crown
 namespace crown
 {
 {
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-Compiler::Compiler(const char* root_path, const char* dest_path, uint32_t type_expected) :
-	m_root_fs(root_path),
-	m_dest_fs(dest_path),
-	m_type_expected(type_expected)
-{
-	memset(m_resource_name, 0, MAX_RESOURCE_NAME_LENGTH);
-}
-
-//-----------------------------------------------------------------------------
-Compiler::~Compiler()
-{
-}
-
-//-----------------------------------------------------------------------------
-size_t Compiler::compile(const char* resource, uint32_t name, uint32_t type)
+size_t Compiler::compile(const char* root_path, const char* dest_path, const char* name_in, const char* name_out)
 {
 {
-	string::strncpy(m_resource_name, resource, MAX_RESOURCE_NAME_LENGTH);
-	string::strncpy(m_resource_path, m_root_fs.os_path(resource), MAX_RESOURCE_PATH_LENGTH);
-
-	char resource_name[MAX_RESOURCE_NAME_LENGTH];
-	char resource_type[MAX_RESOURCE_TYPE_LENGTH];
-
-	path::filename_without_extension(resource, resource_name, MAX_RESOURCE_NAME_LENGTH);
-	path::extension(resource, resource_type, MAX_RESOURCE_TYPE_LENGTH);
+	std::string path_in = std::string(root_path) + "/" + std::string(name_in);
+	std::string path_out = std::string(dest_path) + "/" + std::string(name_out);
 
 
-	char output_name[17];
-	snprintf(output_name, 17, "%.8X%.8X", name, type);
-
-	Log::i("%s <= %s", output_name, resource);
-
-	if (type != m_type_expected)
+	// The compilation fails when returned size is zero
+	size_t resource_size = 0;
+	if ((resource_size = compile_impl(path_in.c_str())) == 0)
 	{
 	{
-		Log::e("'%s': resource type does not match expected type.", resource);
+		std::cout << "Compilation failed." << std::endl;
 		return 0;
 		return 0;
 	}
 	}
 
 
-	if (!m_root_fs.exists(resource))
-	{
-		Log::e("'%s': resource does not exist.");
-		return 0;
-	}
-
-	// Read source file
-	DiskFile* input_file = m_root_fs.open(resource, FOM_READ);
-
-	size_t header_size = read_header(input_file);
-	size_t resource_size = read_resource(input_file);
+	// Setup resource header
+	ResourceHeader resource_header;
+	resource_header.magic = RESOURCE_MAGIC_NUMBER;
+	resource_header.version = RESOURCE_VERSION;
+	resource_header.size = resource_size;
 
 
-	// Write compiled file
-	DiskFile* output_file;
+	// Open destination file and write the header
+	std::fstream out_file;
+	out_file.open(path_out.c_str(), std::fstream::out | std::fstream::binary);
 
 
-	if (m_dest_fs.exists(output_name))
+	if (!out_file.is_open())
 	{
 	{
-		m_dest_fs.delete_file(output_name);
+		std::cout << "Unable to write compiled file." << std::endl;
+		return 0;
 	}
 	}
 
 
-	m_dest_fs.create_file(output_name);
-	output_file = m_dest_fs.open(output_name, FOM_WRITE);
+	out_file.write((char*)&resource_header, sizeof(ResourceHeader));
 
 
-	write_header(output_file, name, type, resource_size);
-	write_resource(output_file);
+	// Write resource-specific data
+	write_impl(out_file);
 
 
-	m_root_fs.close(input_file);
-	m_dest_fs.close(output_file);
+	out_file.close();
 
 
 	// Cleanup
 	// Cleanup
 	cleanup();
 	cleanup();
 }
 }
 
 
-//-----------------------------------------------------------------------------
-size_t Compiler::read_header(DiskFile* in_file)
-{
-	return read_header_impl(in_file);
-}
-
-//-----------------------------------------------------------------------------
-size_t Compiler::read_resource(DiskFile* in_file)
-{
-	return read_resource_impl(in_file);
-}
-
-//-----------------------------------------------------------------------------
-void Compiler::write_header(DiskFile* out_file, uint32_t name, uint32_t type, uint32_t resource_size)
-{
-	CompiledHeader header;
-	header.magic = COMPILED_HEADER_MAGIC_NUMBER;
-	header.version = COMPILER_VERSION;
-	header.name = name;
-	header.type = type;
-	header.size = resource_size;
-
-	out_file->write(&header, sizeof(CompiledHeader));
-
-	write_header_impl(out_file);
-}
-
-//-----------------------------------------------------------------------------
-void Compiler::write_resource(DiskFile* out_file)
-{
-	write_resource_impl(out_file);
-}
-
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 void Compiler::cleanup()
 void Compiler::cleanup()
 {
 {
-	cleanup_impl();
-
-	string::strncpy(m_resource_name, "", MAX_RESOURCE_NAME_LENGTH);
-}
-
-//-----------------------------------------------------------------------------
-const char* Compiler::root_path() const
-{
-	return m_root_fs.root_path();
-}
-
-//-----------------------------------------------------------------------------
-const char* Compiler::dest_path() const
-{
-	return m_dest_fs.root_path();
-}
-
-//-----------------------------------------------------------------------------
-const char* Compiler::resource_name() const
-{
-	return m_resource_name;
-}
-
-const char* Compiler::resource_path() const
-{
-	return m_resource_path;
 }
 }
 
 
 } // namespace crown
 } // namespace crown

+ 7 - 56
tools/compilers/Compiler.h

@@ -26,33 +26,13 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 
 #pragma once
 #pragma once
 
 
-#include "Types.h"
-#include "Filesystem.h"
+#include <string>
+#include <fstream>
+#include <cstdint>
 
 
 namespace crown
 namespace crown
 {
 {
 
 
-const size_t	MAX_RESOURCE_NAME_LENGTH			= 1024;
-const size_t	MAX_RESOURCE_TYPE_LENGTH			= 64;
-const size_t	MAX_RESOURCE_PATH_LENGTH			= 2048;
-
-const uint32_t	COMPILED_HEADER_MAGIC_NUMBER		= 0xCE010101;
-const uint32_t	COMPILER_VERSION					= 1;
-
-/// Contains the header data common to all
-/// types of resources passing through the
-/// standard Compiler mechanics.
-struct CompiledHeader
-{
-	uint32_t	magic;		// Magic number used to identify the file
-	uint32_t	version;	// Version of the compiler used to compile the resource
-	uint32_t	name;		// Name of the resource (murmur2_32 hash)
-	uint32_t	type;		// Type of the resource (murmur2_32 hash)
-	uint32_t	size;		// Size of the resource data _not_ including header (in bytes)
-};
-
-class DiskFile;
-
 /// Resource compiler interface.
 /// Resource compiler interface.
 /// Every specific resource compiler must inherith from this
 /// Every specific resource compiler must inherith from this
 /// interface and implement its methods accordingly.
 /// interface and implement its methods accordingly.
@@ -60,44 +40,15 @@ class Compiler
 {
 {
 public:
 public:
 
 
-							Compiler(const char* root_path, const char* dest_path, uint32_t type_expected);
-	virtual					~Compiler();
-
-	size_t					compile(const char* resource, uint32_t name, uint32_t type);
-
-	size_t					read_header(DiskFile* in_file);
-	size_t					read_resource(DiskFile* in_file);
-
-	void					write_header(DiskFile* out_file, uint32_t name, uint32_t type, uint32_t resource_size);
-	void					write_resource(DiskFile* out_file);
+	virtual					~Compiler() {}
 
 
+	size_t					compile(const char* root_path, const char* dest_path, const char* name_in, const char* name_out);
 	void					cleanup();
 	void					cleanup();
 
 
-	const char*				root_path() const;
-	const char*				dest_path() const;
-	const char*				resource_name() const;
-	const char*				resource_path() const;
-
 protected:
 protected:
 
 
-	virtual size_t			read_header_impl(DiskFile* in_file) = 0;
-	virtual size_t			read_resource_impl(DiskFile* in_file) = 0;
-
-	virtual void			write_header_impl(DiskFile* out_file) = 0;
-	virtual void			write_resource_impl(DiskFile* out_file) = 0;
-
-	virtual void			cleanup_impl() = 0;
-
-private:
-
-	// Filesystems
-	Filesystem			m_root_fs;
-	Filesystem			m_dest_fs;
-
-	uint32_t			m_type_expected;
-
-	char				m_resource_name[MAX_RESOURCE_NAME_LENGTH];
-	char 				m_resource_path[MAX_RESOURCE_PATH_LENGTH];
+	virtual size_t			compile_impl(const char* resource_path) = 0;
+	virtual void			write_impl(std::fstream& out_file) = 0;
 };
 };
 
 
 } // namespace crown
 } // namespace crown

+ 0 - 210
tools/compilers/resource-linker.cpp

@@ -1,210 +0,0 @@
-#include <stdio.h>
-#include "Filesystem.h"
-#include "File.h"
-#include "Path.h"
-#include "StringUtils.h"
-#include "Hash.h"
-#include "Resource.h"
-#include "Bundle.h"
-#include "DiskFile.h"
-#include <cstring>
-
-using namespace crown;
-
-/// Resource linker links together individual compiled resources into a
-/// single binary blob ready to be loaded by Crown Engine.
-/// Usage: resource-linker <root-path> [resource1, resource2, ..., resourceN]
-/// The resources are put into the archive in the order they appear in the command line.
-/// This allows to simplify the code and to decouple the linking process from the
-/// placement optimization of the resources in the final archive.
-int main(int argc, char** argv)
-{
-	//-------------------------------------------------------------------------
-	// Preliminary checks
-	//-------------------------------------------------------------------------
-	
-	if (argc != 3)
-	{
-		printf("Usage: %s /path/to/compiled resource.abc.o\n", argv[0]);
-		return -1;
-	}
-	
-	Filesystem fs_root(argv[1]);
-	const char* resource_name = argv[2];
-	
-	// FIXME Check the existence of the resource!!!
-	
-	//-------------------------------------------------------------------------
-	// Read the archive
-	//-------------------------------------------------------------------------
-	
-	// Open the archive file for reading or create if does not exist
-	if (!fs_root.exists("archive.bin"))
-	{
-		fs_root.create_file("archive.bin");
-	}
-
-	// Open the archive file for both reading and writing
-	DiskFile* archive = (DiskFile*)fs_root.open("archive.bin", (FileOpenMode)(FOM_READ | FOM_WRITE));
-	
-	// The archive header used throughout the code
-	ArchiveHeader header;
-	memset(&header, 0, sizeof(ArchiveHeader));
-	
-	// If the archive is empty
-	if (archive->size() == 0)
-	{
-		// Initializes the archive header
-		header.version = ARCHIVE_VERSION;
-		header.entries_count = 0;
-		header.checksum = 0; // FIXME Implement checksum
-	}
-	else if (archive->size() < sizeof(ArchiveHeader))
-	{
-		// If the archive is malformed (i.e. its size is lesser than sizeof(ArchiveHeader))
-		printf("Fatal: the archive file is malformed. Aborting.\n");
-		return -1;
-	}
-	else
-	{
-		// If the archive is well-formed, read the archive header
-		archive->read(&header, sizeof(ArchiveHeader));
-	}
-
-	// In-Memory representation of the table of entries
-	ArchiveEntry* entries = NULL;
-	uint32_t entries_count = 0;
-	
-	// Read the table of entries if present
-	if (header.entries_count > 0)
-	{
-		entries = new ArchiveEntry[header.entries_count];
-		archive->read(entries, sizeof(ArchiveEntry) * header.entries_count);
-		entries_count = header.entries_count;
-	}
-
-	//-------------------------------------------------------------------------
-	// Read the resource
-	//-------------------------------------------------------------------------
-
-	// Open the resource
-	DiskFile* resource = (DiskFile*)fs_root.open(resource_name, FOM_READ);
-	
-	// If the resource is malformed, abort
-	if (resource->size() < sizeof(ArchiveEntry))
-	{
-		printf("Fatal: the resource file is malformed. Aborting.\n");
-		return -1;
-	}
-	
-	// The resource entry used throughout the code
-	ArchiveEntry resource_entry;
-
-	// Read the resource entry
-	resource->read(&resource_entry, sizeof(ArchiveEntry));
-
-	// In-Memory representation of the resource data
-	uint8_t* resource_data = NULL;
-	size_t resource_data_size = 0;
-	
-	// Read the resource data if present
-	if (resource_entry.size > 0)
-	{
-		resource_data = new uint8_t[resource_entry.size];
-		resource->read(resource_data, resource_entry.size);
-		resource_data_size = resource_entry.size;
-	}
-
-	//-------------------------------------------------------------------------
-	// Patch the resource offset and update the archive header
-	//-------------------------------------------------------------------------
-	
-	// 1) Obtain the total resource data size
-	size_t total_resource_data_size = 0;
-	
-	for (uint32_t i = 0; i < entries_count; i++)
-	{		
-		total_resource_data_size += entries[i].size;
-	}
-	
-	// 2) Read the total resource data in memory (FIXME: ouch... need better strategy, potentially source of
-	//    troubles in case of very large archive files!)
-	uint8_t* total_resource_data = NULL;
-	
-	// Read the data only if it is actually there...
-	if (total_resource_data_size > 0)
-	{
-		total_resource_data = new uint8_t[total_resource_data_size];
-		
-		// The file cursor is right at the start of data section :)
-		archive->read(total_resource_data, total_resource_data_size);
-	}
-	
-	// 3) Patch the previous resource entry offsets
-	for (uint32_t i = 0; i < entries_count; i++)
-	{
-		// Shift everything "down" by the size of the new ArchiveEntry
-		entries[i].offset += sizeof(ArchiveEntry);
-	}
-
-	// 4) Patch the new resource entry offset
-	resource_entry.offset = + sizeof(ArchiveHeader) + sizeof(ArchiveEntry) * (entries_count + 1) + total_resource_data_size;
-	
-	// 5) Path the archive header
-	header.entries_count += 1;
-	
-	// 6) Write the new header, the previous entries, the new entry, the previos resource data and the new resource data
-	//    _IN_THAT_ORDER_
-	
-	archive->seek(0);
-
-	// Write the new header
-	archive->write(&header, sizeof(ArchiveHeader));
-	
-	// Write the previous entries only if they exist
-	if (entries_count > 0)
-	{
-		archive->write(entries, sizeof(ArchiveEntry) * entries_count);
-	}
-
-	// Write the new resource entry
-	archive->write(&resource_entry, sizeof(ArchiveEntry));
-	
-	// Write previous total resource data only if it exist
-	if (total_resource_data_size > 0)
-	{
-		archive->write(total_resource_data, total_resource_data_size);
-	}
-
-	// Write the new resource data only if if exists (a new resource could have no data associated with it)
-	if (resource_data_size > 0)
-	{
-		archive->write(resource_data, resource_data_size);
-	}
-	
-	//-------------------------------------------------------------------------
-	// Free data and close streams
-	//-------------------------------------------------------------------------
-	
-	if (entries != NULL)
-	{
-		delete[] entries;
-	}
-	
-	if (total_resource_data != NULL)
-	{
-		delete[] total_resource_data;
-	}
-	
-	if (resource_data != NULL)
-	{
-		delete[] resource_data;
-	}
-
-	// Close the files, we are done
-	fs_root.close(resource);
-	fs_root.close(archive);
-	
-	return 0;
-}
-

+ 77 - 84
tools/compilers/tga/TGACompiler.cpp

@@ -24,75 +24,88 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
 OTHER DEALINGS IN THE SOFTWARE.
 */
 */
 
 
+#include <fstream>
+#include <iostream>
+
 #include "TGACompiler.h"
 #include "TGACompiler.h"
-#include "DiskFile.h"
 #include "PixelFormat.h"
 #include "PixelFormat.h"
-#include "Resource.h"
-#include "Log.h"
+#include "TextureFormat.h"
 
 
 namespace crown
 namespace crown
 {
 {
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-TGACompiler::TGACompiler(const char* root_path, const char* dest_path) :
-	Compiler(root_path, dest_path, TEXTURE_TYPE),
-	m_image_format(PF_UNKNOWN),
-	m_image_channels(0),
-	m_image_size(0),
-	m_image_data(NULL)
+TGACompiler::TGACompiler() :
+	m_texture_data_size(0),
+	m_texture_data(NULL)
 {
 {
-	memset(&m_tga_header, 0, sizeof(TGAHeader));
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 TGACompiler::~TGACompiler()
 TGACompiler::~TGACompiler()
 {
 {
-	cleanup_impl();
+	if (m_texture_data)
+	{
+		delete[] m_texture_data;
+	}
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-size_t TGACompiler::read_header_impl(DiskFile* in_file)
+size_t TGACompiler::compile_impl(const char* resource_path)
 {
 {
+	std::fstream in_file;
+	in_file.open(resource_path, std::fstream::in | std::fstream::binary);
+
+	if (!in_file.is_open())
+	{
+		std::cout << "Unable to open file: " << resource_path << std::endl;
+		return 0;
+	}
+
 	// Read the header
 	// Read the header
-	in_file->read(&m_tga_header, sizeof(TGAHeader));
+	if (!in_file.read((char*)(char*)&m_tga_header, sizeof(TGAHeader)))
+	{
+		std::cout << "Unable to read the TGA header." << std::endl;
+		return 0;
+	}
 
 
 	// Skip TGA ID
 	// Skip TGA ID
-	in_file->skip(m_tga_header.id_length);
+	in_file.seekg(m_tga_header.id_length);
 
 
-	return sizeof(TGAHeader) + m_tga_header.id_length;
-}
+	// Compute color channels
+	m_tga_channels = m_tga_header.pixel_depth / 8;
+	m_tga_size = m_tga_header.width * m_tga_header.height;
 
 
-//-----------------------------------------------------------------------------
-size_t TGACompiler::read_resource_impl(DiskFile* in_file)
-{
-	// Compute color channels	
-	m_image_channels = m_tga_header.pixel_depth / 8;
-	
-	// Compute image size
-	m_image_size = m_tga_header.width * m_tga_header.height;
+	m_texture_header.version = TEXTURE_VERSION;
+	m_texture_header.width = m_tga_header.width;
+	m_texture_header.height = m_tga_header.height;
 
 
 	// Select the appropriate pixel format and allocate
 	// Select the appropriate pixel format and allocate
 	// resource data based on tga size and channels
 	// resource data based on tga size and channels
-	switch (m_image_channels)
+	switch (m_tga_channels)
 	{
 	{
 		case 2:
 		case 2:
 		case 3:
 		case 3:
 		{
 		{
-			m_image_format = PF_RGB_8;
-			m_image_data = (uint8_t*)default_allocator().allocate(m_image_size * 3 * sizeof(uint8_t));
+			m_texture_header.format = PF_RGB_8;
+
+			m_texture_data_size = m_tga_size * 3;
+			m_texture_data = new uint8_t[m_texture_data_size];
 
 
 			break;
 			break;
 		}
 		}
 		case 4:
 		case 4:
 		{
 		{
-			m_image_format = PF_RGBA_8;
-			m_image_data = (uint8_t*)default_allocator().allocate(m_image_size * m_image_channels * sizeof(uint8_t));
+			m_texture_header.format = PF_RGBA_8;
+
+			m_texture_data_size = m_tga_size * m_tga_channels;
+			m_texture_data = new uint8_t[m_texture_data_size];
 			
 			
 			break;
 			break;
 		}
 		}
 		default:
 		default:
 		{
 		{
-			Log::e("Unable to determine TGA channels.");
+			std::cout << "Unable to determine TGA channels." << std::endl;
 			return 0;
 			return 0;
 		}
 		}
 	}
 	}
@@ -102,7 +115,7 @@ size_t TGACompiler::read_resource_impl(DiskFile* in_file)
 	{
 	{
 		case 0:
 		case 0:
 		{
 		{
-			Log::e("Fatal: The resource does not contain image data.");
+			std::cout << "The file does not contain image data: " << resource_path << std::endl;
 			return 0;
 			return 0;
 		}
 		}
 		case 2:
 		case 2:
@@ -119,73 +132,54 @@ size_t TGACompiler::read_resource_impl(DiskFile* in_file)
 
 
 		default:
 		default:
 		{
 		{
-			Log::e("Fatal: Image type not supported.");
+			std::cout << "Image type not supported." << std::endl;
 			return 0;
 			return 0;
 		}
 		}
 	}
 	}
 
 
 	// Return the total resource size
 	// Return the total resource size
-	return m_image_size * m_image_channels + sizeof(PixelFormat) + sizeof(uint16_t) + sizeof(uint16_t);
-}
-
-//-----------------------------------------------------------------------------
-void TGACompiler::write_header_impl(DiskFile* out_file)
-{
-	// Write the texture header
-	out_file->write(&m_image_format, sizeof(PixelFormat));
-	out_file->write(&m_tga_header.width, sizeof(uint16_t));
-	out_file->write(&m_tga_header.height, sizeof(uint16_t));
-}
-
-//-----------------------------------------------------------------------------
-void TGACompiler::write_resource_impl(DiskFile* out_file)
-{
-	// Write out the data
-	out_file->write(m_image_data, m_image_size * m_image_channels);
+	return sizeof(TextureHeader) + m_texture_data_size;
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-void TGACompiler::cleanup_impl()
+void TGACompiler::write_impl(std::fstream& out_file)
 {
 {
-	if (m_image_data)
-	{
-		default_allocator().deallocate(m_image_data);
-		m_image_data = NULL;
-	}
+	out_file.write((char*)&m_texture_header, sizeof(TextureHeader));
+	out_file.write((char*)m_texture_data, m_texture_data_size);
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-void TGACompiler::load_uncompressed(DiskFile* in_file)
+void TGACompiler::load_uncompressed(std::fstream& in_file)
 {
 {
 	uint64_t size = m_tga_header.width * m_tga_header.height;
 	uint64_t size = m_tga_header.width * m_tga_header.height;
 
 
-	if (m_image_channels == 2)
+	if (m_tga_channels == 2)
 	{
 	{
 		int32_t j = 0;
 		int32_t j = 0;
 
 
-		for (uint64_t i = 0; i < size * m_image_channels; i++)
+		for (uint64_t i = 0; i < size * m_tga_channels; i++)
 		{
 		{
 			uint16_t pixel_data;
 			uint16_t pixel_data;
 			
 			
-			in_file->read(&pixel_data, sizeof(pixel_data));
+			in_file.read((char*)&pixel_data, sizeof(pixel_data));
 			
 			
-			m_image_data[j + 0] = (pixel_data & 0x7c) >> 10;
-			m_image_data[j + 1] = (pixel_data & 0x3e) >> 5;
-			m_image_data[j + 2] = (pixel_data & 0x1f);
+			m_texture_data[j + 0] = (pixel_data & 0x7c) >> 10;
+			m_texture_data[j + 1] = (pixel_data & 0x3e) >> 5;
+			m_texture_data[j + 2] = (pixel_data & 0x1f);
 			
 			
 			j += 3;
 			j += 3;
 		}
 		}
 	}
 	}
 	else
 	else
 	{
 	{
-		in_file->read(m_image_data, (size_t)(size * m_image_channels));
+		in_file.read((char*)m_texture_data, (size_t)(size * m_tga_channels));
 
 
 		swap_red_blue();
 		swap_red_blue();
 	}
 	}
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-void TGACompiler::load_compressed(DiskFile* in_file)
+void TGACompiler::load_compressed(std::fstream& in_file)
 {
 {
 	uint8_t rle_id = 0;
 	uint8_t rle_id = 0;
 	uint32_t i = 0;
 	uint32_t i = 0;
@@ -197,28 +191,28 @@ void TGACompiler::load_compressed(DiskFile* in_file)
 
 
 	while (i < size)
 	while (i < size)
 	{
 	{
-		in_file->read(&rle_id, sizeof(uint8_t));
+		in_file.read((char*)&rle_id, sizeof(uint8_t));
 
 
 		// If MSB == 1
 		// If MSB == 1
 		if (rle_id & 0x80)
 		if (rle_id & 0x80)
 		{
 		{
 			rle_id -= 127;
 			rle_id -= 127;
 			
 			
-			in_file->read(&colors, m_image_channels);
+			in_file.read((char*)&colors, m_tga_channels);
 
 
 			while (rle_id)
 			while (rle_id)
 			{
 			{
-				m_image_data[colors_read + 0] = colors[2];
-				m_image_data[colors_read + 1] = colors[1];
-				m_image_data[colors_read + 2] = colors[0];
+				m_texture_data[colors_read + 0] = colors[2];
+				m_texture_data[colors_read + 1] = colors[1];
+				m_texture_data[colors_read + 2] = colors[0];
 
 
-				if (m_image_channels == 4)
+				if (m_tga_channels == 4)
 				{
 				{
-					m_image_data[colors_read + 3] = colors[3];
+					m_texture_data[colors_read + 3] = colors[3];
 				}
 				}
 
 
 				rle_id--;
 				rle_id--;
-				colors_read += m_image_channels;
+				colors_read += m_tga_channels;
 				i++;
 				i++;
 			}
 			}
 		}
 		}
@@ -228,19 +222,19 @@ void TGACompiler::load_compressed(DiskFile* in_file)
 
 
 			while (rle_id)
 			while (rle_id)
 			{
 			{
-				in_file->read(colors, m_image_channels);
+				in_file.read((char*)colors, m_tga_channels);
 				
 				
-				m_image_data[colors_read + 0] = colors[2];
-				m_image_data[colors_read + 1] = colors[1];
-				m_image_data[colors_read + 2] = colors[0];
+				m_texture_data[colors_read + 0] = colors[2];
+				m_texture_data[colors_read + 1] = colors[1];
+				m_texture_data[colors_read + 2] = colors[0];
 
 
-				if (m_image_channels == 4)
+				if (m_tga_channels == 4)
 				{
 				{
-					m_image_data[colors_read + 3] = colors[3];
+					m_texture_data[colors_read + 3] = colors[3];
 				}
 				}
 
 
 				rle_id--;
 				rle_id--;
-				colors_read += m_image_channels;
+				colors_read += m_tga_channels;
 				i++;
 				i++;
 			}
 			}
 		}
 		}
@@ -250,13 +244,12 @@ void TGACompiler::load_compressed(DiskFile* in_file)
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 void TGACompiler::swap_red_blue()
 void TGACompiler::swap_red_blue()
 {
 {
-	for (uint64_t i = 0; i < m_image_size * m_image_channels; i += m_image_channels)
+	for (uint64_t i = 0; i < m_tga_size * m_tga_channels; i += m_tga_channels)
 	{
 	{
-		m_image_data[i + 0] ^= m_image_data[i + 2];
-		m_image_data[i + 2] ^= m_image_data[i + 0];
-		m_image_data[i + 0] ^= m_image_data[i + 2];
+		m_texture_data[i + 0] ^= m_texture_data[i + 2];
+		m_texture_data[i + 2] ^= m_texture_data[i + 0];
+		m_texture_data[i + 0] ^= m_texture_data[i + 2];
 	}
 	}
 }
 }
 
 
 } // namespace crown
 } // namespace crown
-

+ 11 - 16
tools/compilers/tga/TGACompiler.h

@@ -27,8 +27,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 #pragma once
 
 
 #include "Compiler.h"
 #include "Compiler.h"
-#include "DiskFile.h"
-#include "PixelFormat.h"
+#include "TextureFormat.h"
 
 
 namespace crown
 namespace crown
 {
 {
@@ -52,31 +51,27 @@ class TGACompiler : public Compiler
 {
 {
 public:
 public:
 
 
-					TGACompiler(const char* root_path, const char* dest_path);
+					TGACompiler();
 					~TGACompiler();
 					~TGACompiler();
 
 
-	size_t			read_header_impl(DiskFile* in_file);
-	size_t			read_resource_impl(DiskFile* in_file);
-
-	void			write_header_impl(DiskFile* out_file);
-	void			write_resource_impl(DiskFile* out_file);
-
-	void			cleanup_impl();
+	size_t			compile_impl(const char* resource_path);
+	void			write_impl(std::fstream& out_file);
 
 
 private:
 private:
 
 
-	void			load_uncompressed(DiskFile* in_file);
-	void			load_compressed(DiskFile* in_file);
+	void			load_uncompressed(std::fstream& in_file);
+	void			load_compressed(std::fstream& in_file);
 	void			swap_red_blue();
 	void			swap_red_blue();
 
 
 private:
 private:
 
 
 	TGAHeader		m_tga_header;
 	TGAHeader		m_tga_header;
+	uint32_t		m_tga_channels;
+	uint32_t		m_tga_size;
 
 
-	PixelFormat		m_image_format;
-	uint32_t		m_image_channels;
-	uint64_t		m_image_size;
-	uint8_t*		m_image_data;
+	TextureHeader	m_texture_header;
+	size_t			m_texture_data_size;
+	uint8_t*		m_texture_data;
 };
 };
 
 
 } // namespace crown
 } // namespace crown

+ 0 - 90
tools/compilers/txt/TXTCompiler.cpp

@@ -1,90 +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.
-*/
-
-#include "TXTCompiler.h"
-#include "DiskFile.h"
-#include "Resource.h"
-
-namespace crown
-{
-
-//-----------------------------------------------------------------------------
-TXTCompiler::TXTCompiler(const char* root_path, const char* dest_path) :
-	Compiler(root_path, dest_path, TEXT_TYPE),
-	m_file_size(0),
-	m_file_data(NULL)
-{
-}
-
-//-----------------------------------------------------------------------------
-TXTCompiler::~TXTCompiler()
-{
-	cleanup_impl();
-}
-
-//-----------------------------------------------------------------------------
-size_t TXTCompiler::read_header_impl(DiskFile* in_file)
-{
-	(void) in_file;
-	return 0;
-}
-
-//-----------------------------------------------------------------------------
-size_t TXTCompiler::read_resource_impl(DiskFile* in_file)
-{
-	m_file_size = in_file->size();
-
-	m_file_data = (char*)default_allocator().allocate(m_file_size * sizeof(char));
-	
-	// Copy the entire file into the buffer
-	in_file->read(m_file_data, m_file_size);
-
-	// Return the total resource size
-	return m_file_size + sizeof(uint32_t);
-}
-
-//-----------------------------------------------------------------------------
-void TXTCompiler::write_header_impl(DiskFile* out_file)
-{
-	out_file->write(&m_file_size, sizeof(uint32_t));
-}
-
-//-----------------------------------------------------------------------------
-void TXTCompiler::write_resource_impl(DiskFile* out_file)
-{
-	out_file->write(m_file_data, m_file_size);
-}
-
-void TXTCompiler::cleanup_impl()
-{
-	if (m_file_data)
-	{
-		default_allocator().deallocate(m_file_data);
-		m_file_data = NULL;
-	}
-}
-
-} // namespace crown

+ 212 - 0
tools/core/Args.cpp

@@ -0,0 +1,212 @@
+/*
+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.
+*/
+
+#include <cstdio>
+
+#include "Args.h"
+
+namespace crown
+{
+
+//-----------------------------------------------------------------------------
+Args::Args(int argc, char** argv, const char* shortopts, const ArgsOption* longopts) :
+	m_argc(argc),
+	m_argv(argv),
+	m_shortopts(shortopts),
+	m_longopts(longopts),
+	m_optind(1),				// Do not consider argv[0]
+	m_scope(argc),
+	m_optarg(NULL)
+{
+	CE_ASSERT(argv != NULL, "Argument vector must be != NULL");
+	CE_ASSERT(shortopts != NULL, "Short argument list must be != NULL");
+	// longopts could be NULL
+}
+
+//-----------------------------------------------------------------------------
+Args::~Args()
+{
+}
+
+//-----------------------------------------------------------------------------
+int32_t Args::getopt()
+{
+	// Always reset optarg
+	m_optarg = NULL;
+
+	// End of arguments
+	if (m_optind >= m_scope)
+	{
+		return -1;
+	}
+
+	switch (option_type(m_argv[m_optind]))
+	{
+		case AOT_SHORT:
+		{
+			return short_option(m_argv[m_optind]);
+		}
+		case AOT_LONG:
+		{
+			return long_option(m_argv[m_optind]);
+		}
+		case AOT_NOT_OPTION:
+		{
+			not_option();
+			return getopt();
+		}
+		default:
+		{
+			return '?';
+		}
+	}
+}
+
+//-----------------------------------------------------------------------------
+int32_t Args::optind() const
+{
+	return m_optind;
+}
+
+//-----------------------------------------------------------------------------
+const char* Args::optarg() const
+{
+	return m_optarg;
+}
+
+//-----------------------------------------------------------------------------
+void Args::set_optind(int32_t index)
+{
+	m_optind = index;
+}
+
+//-----------------------------------------------------------------------------
+ArgsOptionType Args::option_type(const char* option)
+{
+	const size_t option_len = string::strlen(option);
+
+	if (option_len == 2 && option[0] == '-' && option[1] != '-')
+	{
+		return AOT_SHORT;
+	}
+	else if (option_len > 2 && option[0] == '-' && option[1] == '-')
+	{
+		return AOT_LONG;
+	}
+
+	return AOT_NOT_OPTION;
+}
+
+//-----------------------------------------------------------------------------
+int32_t Args::long_option(const char* option)
+{
+	const ArgsOption* current_option = m_longopts;
+
+	// Loop through all the long options
+	while (!end_of_longopts(current_option))
+	{
+		if (string::strcmp(current_option->name, &option[2]) == 0)
+		{
+			// If the option requires an argument
+			if (current_option->has_arg == AOA_REQUIRED_ARGUMENT)
+			{
+				// Read the argument if it exists
+				if ((m_optind + 1) < m_scope)
+				{
+					// Read the argument and skip the following parameter
+					m_optarg = m_argv[m_optind + 1];
+					m_optind += 2;
+				}
+				else
+				{
+					printf("%s: option requires an argument -- '%s'", m_argv[0], current_option->name);
+
+					// Missing option
+					m_optind += 1;
+					return '?';
+				}
+			}
+			// If the option does not require an argument
+			else
+			{
+				m_optind++;
+			}
+
+			if (current_option->flag == NULL)
+			{
+				return current_option->val;
+			}
+			else
+			{
+				(*current_option->flag) = current_option->val;
+
+				return 0;
+			}
+		}
+
+		current_option++;
+	}
+
+	// Found a long option but was not included in longopts
+	printf("%s: invalid option -- '%s'", m_argv[0], &option[2]);
+	m_optind++;
+	return '?';
+}
+
+//-----------------------------------------------------------------------------
+int32_t Args::short_option(const char* option)
+{
+	(void)option;
+
+	printf("%s: invalid option -- '%s'", m_argv[0], &option[1]);
+	m_optind++;
+	return '?';
+}
+
+//-----------------------------------------------------------------------------
+void Args::not_option()
+{
+	char* current_option = m_argv[m_optind];
+
+	for (int32_t i = m_optind; i < (m_argc - 1); i++)
+	{
+		m_argv[i] = m_argv[i + 1];
+	}
+
+	m_argv[m_argc - 1] = current_option;
+
+	// Reduce the number of true arguments
+	m_scope--;
+}
+
+//-----------------------------------------------------------------------------
+bool Args::end_of_longopts(const ArgsOption* option) const
+{
+	return (option->name == NULL && option->has_arg == 0 && option->flag == NULL && option->val == 0);
+}
+
+
+} // namespace crown

+ 123 - 0
tools/core/Args.h

@@ -0,0 +1,123 @@
+/*
+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 "Assert.h"
+#include "Types.h"
+#include "StringUtils.h"
+
+namespace crown
+{
+
+enum ArgsOptionType
+{
+	AOT_SHORT,
+	AOT_LONG,
+	AOT_NOT_OPTION
+};
+
+enum ArgsOptionArgument
+{
+	AOA_NO_ARGUMENT,
+	AOA_REQUIRED_ARGUMENT
+};
+
+struct ArgsOption
+{
+	const char*				name;
+	int32_t					has_arg;
+	int32_t*				flag;
+	int32_t					val;
+};
+
+/// Parses the command line arguments in a way very similar to GNU getopt.
+class Args
+{
+public:
+
+						Args(int argc, char** argv, const char* shortopts, const ArgsOption* longopts);
+						~Args();
+
+	/// Finds the next option character and returns it.
+	/// If there are no more option characters, it returns -1 and optind()
+	/// returns the index in argv[] of the first argv-element that is not
+	/// an option.
+	/// If it finds an option that was not included in shortopts or longopts,
+	/// or if it finds a missing option argument, it returns '?' character.
+	int32_t				getopt();
+
+	/// Returns the index of the next argument to be processed.
+	int32_t				optind() const;
+
+	/// Returns the text of the following argv-element in respect
+	/// to the current optind().
+	const char*			optarg() const;
+
+
+	/// Sets the @a index into argv[] from where to start option scanning.
+	/// If @a index >= argc nothing will be scanned.
+	void				set_optind(int32_t index);
+
+private:
+
+	// Returns the @a option type
+	// Returns AOT_SHORT if option is of the form "-x" where 'x' is the option.
+	// Returns AOT_LONG if option is of the form "--option" where "option" is the option.
+	// Returns AOT_NOT_OPTION in all other cases.
+	ArgsOptionType		option_type(const char* option);
+
+	// Parses a long option
+	int32_t				long_option(const char* option);
+
+	// Parses a short option
+	int32_t				short_option(const char* option);
+
+	void				not_option();
+
+	// Returns whether the given option is the last one
+	bool				end_of_longopts(const ArgsOption* option) const;
+
+private:
+
+	int					m_argc;
+	char**				m_argv;
+
+	const char*			m_shortopts;
+	const ArgsOption*	m_longopts;
+
+	// Index of the next argument to be processed
+	int32_t				m_optind;
+
+	// Number of "true" arguments
+	int32_t				m_scope;
+
+	// The text of the following argv-element to argv[optind]
+	char*				m_optarg;
+};
+
+} // namespace crown
+

+ 43 - 0
tools/core/Assert.h

@@ -0,0 +1,43 @@
+/*
+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.
+*/
+
+#include <cstdlib>
+#include <cstdio>
+#include "Config.h"
+
+#pragma once
+
+#ifdef CROWN_DEBUG
+	#define CE_ERROR(file, line, message, ...) do { printf(message, __VA_ARGS__);\
+				printf("\n\tIn %s:%d\n\n", file, line); abort(); } while(0)
+	#define CE_ASSERT(condition, message, ...) do { if (!(condition)) { CE_ERROR(__FILE__, __LINE__,\
+				"Assertion failed: %s\n\t" message, #condition, ##__VA_ARGS__); } } while(0)
+#else
+	#define CE_ASSERT(condition, message, ...) ((void)0)
+#endif
+
+#define CE_ASSERT_NOT_NULL(x) CE_ASSERT(x != NULL, "Parameter must be not null")
+

+ 30 - 0
tools/core/Types.h

@@ -0,0 +1,30 @@
+/*
+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 <cstddef>
+#include <cstdint>

+ 98 - 0
tools/core/formats/PixelFormat.h

@@ -0,0 +1,98 @@
+/*
+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
+{
+
+// [0 - 2]		-> 8-bit
+// [3 - 11] 	-> 16-bit
+// [12 - 13]	-> 24-bit
+// [14 - 23]	-> 32-bit
+// [24 - 25]	-> 48-bit
+// [26 - 31]	-> 64-bit
+// [32 - 35]	-> 96-bit
+// [36 - 39]	-> 128-bit
+// 40			-> Unknown (0-bit)
+
+
+/// Enumerates pixel formats.
+enum PixelFormat
+{
+	PF_L_8 = 0,				///< Luminance only, 8-bit
+	PF_L_16 = 3,			///< Luminance only, 16-bit
+	PF_L_32 = 14,			///< Luminance only, 32-bit integer
+	PF_L_FLOAT_32 = 15,		///< Luminance only, 32-bit flaoting point
+
+	PF_LA_8 = 4,			///< Luminance and alpha, 8-bit each
+	PF_LA_16 = 16,			///< Luminance and alpha, 16-bit each
+	PF_LA_32 = 26,			///< Luminance and alpha, 32-bit integer each
+	PF_LA_FLOAT_32 = 27,	///< Luminance and alpha, 32-bit floating point each
+
+	PF_AL_8 = 5,			///< Luminance and alpha, 8-bit each
+	PF_AL_16 = 17,			///< Luminance and alpha, 16-bit each
+	PF_AL_32 = 28,			///< Luminance and alpha, 32-bit integer each
+	PF_AL_FLOAT_32 = 29,	///< Luminance and alpha, 32-bit floating point each
+
+	PF_RGB_8 = 12,			///< RGB values, 8-bit each
+	PF_RGB_16 = 24,			///< RGB values, 16-bit each
+	PF_RGB_32 = 32,			///< RGB values, 32-bit integer each
+	PF_RGB_FLOAT_32 = 33,	///< RGB values, 32-bit floating point each
+
+	PF_RGB_3_3_2 = 1,		///< Packed 8-bit RGB values
+	PF_RGB_5_6_5 = 6,		///< Packed 16-bit RGB values
+
+	PF_BGR_8 = 13,			///< BGR values, 8-bit each
+	PF_BGR_16 = 25,			///< BGR values, 16-bit each
+	PF_BGR_32 = 34,			///< BGR values, 32-bit integer each
+	PF_BGR_FLOAT_32 = 35,	///< BGR values, 32-bit floating point each
+
+	PF_BGR_2_3_3 = 2,		///< Packed 8-bit BGR values
+	PF_BGR_5_6_5 = 7,		///< Packed 16-bit BGR values
+
+	PF_RGBA_8 = 18,			///< RGBA values, 8-bit each
+	PF_RGBA_16 = 30,		///< RGBA values, 16-bit each
+	PF_RGBA_32 = 36,		///< RGBA values, 32-bit integer each
+	PF_RGBA_FLOAT_32 = 37,	///< RGBA values, 32-bit floating point each
+
+	PF_RGBA_4_4_4_4 = 8,	///< Packed 16-bit RGBA values
+	PF_RGBA_5_5_5_1 = 9,	///< Packed 16-bit RGBA values
+	PF_RGBA_8_8_8_8 = 19,	///< Packed 32-bit RGBA values
+	PF_RGBA_10_10_10_2 = 20,///< Packed 32-bit RGBA values
+
+	PF_ABGR_8 = 21,			///< ABGR values, 8-bit each
+	PF_ABGR_16 = 31,		///< ABGR values, 16-bit each
+	PF_ABGR_32 = 38,		///< ABGR values, 32-bit integer each
+	PF_ABGR_FLOAT_32 = 39,	///< ABGR values, 32-bit floating point each
+
+	PF_ABGR_4_4_4_4 = 10,	///< Packed 16-bit ABGR values
+	PF_ABGR_1_5_5_5 = 11,	///< Packed 16-bit ABGR values
+	PF_ABGR_8_8_8_8 = 22,	///< Packed 32-bit ABGR values
+	PF_ABGR_2_10_10_10 = 23,///< Packed 32-bit ABGR values
+
+	PF_UNKNOWN = 40
+};

+ 51 - 0
tools/core/formats/ResourceFormat.h

@@ -0,0 +1,51 @@
+/*
+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.
+*/
+
+namespace crown
+{
+
+const uint32_t	RESOURCE_MAGIC_NUMBER		= 0xCE010101;
+const uint32_t	RESOURCE_VERSION			= 2;
+
+/// Contains the header data common to all
+/// types of resources passing through the
+/// standard Compiler mechanics.
+struct ResourceHeader
+{
+	uint32_t	magic;		// Magic number used to identify the file
+	uint32_t	version;	// Version of the compiler used to compile the resource
+	uint32_t	size;		// Size of the resource data _not_ including this header in bytes
+};
+
+// Resource format:
+//
+// [ResourceHeader]
+// [ResourceData]
+//
+// The ResourceHeader is common to all resource types.
+// Every resource appends its data after the resource header.
+
+} // namespace crown

+ 14 - 20
tools/compilers/txt/TXTCompiler.h → tools/core/formats/TextureFormat.h

@@ -26,32 +26,26 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 
 #pragma once
 #pragma once
 
 
-#include "Compiler.h"
-#include "DiskFile.h"
+#include <cstdint>
 
 
 namespace crown
 namespace crown
 {
 {
 
 
-class TXTCompiler : public Compiler
-{
-public:
-
-					TXTCompiler(const char* root_path, const char* dest_path);
-					~TXTCompiler();
-
-	size_t			read_header_impl(DiskFile* in_file);
-	size_t			read_resource_impl(DiskFile* in_file);
-
-	void			write_header_impl(DiskFile* out_file);
-	void			write_resource_impl(DiskFile* out_file);
+// Texture format
+//
+// [ResourceHeader]
+// [TextureHeader]
+// [TextureData]
 
 
-	void			cleanup_impl();
+// Bump the version whenever a change in the header is made
+const uint32_t TEXTURE_VERSION = 1;
 
 
-private:
-
-	uint32_t		m_file_size;
-	char*			m_file_data;
+struct TextureHeader
+{
+	uint32_t	version;	// Texture file version
+	uint32_t	format;		// Format of the pixels
+	uint32_t	width;		// Width in pixels
+	uint32_t	height;		// Height in pixels
 };
 };
 
 
 } // namespace crown
 } // namespace crown
-

+ 102 - 0
tools/core/strings/Hash.h

@@ -0,0 +1,102 @@
+/*
+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 "Assert.h"
+#include "Types.h"
+
+namespace crown
+{
+
+/// String hashing.
+namespace hash
+{
+
+//-----------------------------------------------------------------------------
+/// MurmurHash2, by Austin Appleby
+///
+/// @note
+/// This code makes a few assumptions about how your machine behaves
+///
+/// 1. We can read a 4-byte value from any address without crashing
+/// 2. sizeof(int) == 4
+///
+/// And it has a few limitations -
+///
+/// 1. It will not work incrementally.
+/// 2. It will not produce the same results on little-endian and big-endian
+///    machines.
+inline uint32_t murmur2_32(const void* key, size_t len, uint32_t seed)
+{
+	CE_ASSERT(key != NULL, "Key must be != NULL");
+
+	// 'm' and 'r' are mixing constants generated offline.
+	// They're not really 'magic', they just happen to work well.
+	const unsigned int m = 0x5bd1e995;
+	const int r = 24;
+
+	// Initialize the hash to a 'random' value
+	unsigned int h = seed ^ len;
+
+	// Mix 4 bytes at a time into the hash
+	const unsigned char * data = (const unsigned char *)key;
+
+	while(len >= 4)
+	{
+		unsigned int k = *(unsigned int *)data;
+
+		k *= m; 
+		k ^= k >> r; 
+		k *= m; 
+		
+		h *= m; 
+		h ^= k;
+
+		data += 4;
+		len -= 4;
+	}
+	
+	// Handle the last few bytes of the input array
+	switch(len)
+	{
+		case 3: h ^= data[2] << 16;
+		case 2: h ^= data[1] << 8;
+		case 1: h ^= data[0];
+	        h *= m;
+	};
+
+	// Do a few final mixes of the hash to ensure the last few
+	// bytes are well-incorporated.
+	h ^= h >> 13;
+	h *= m;
+	h ^= h >> 15;
+
+	return h;
+}
+
+} // namespace hash
+} // namespace crown

+ 300 - 0
tools/core/strings/Path.h

@@ -0,0 +1,300 @@
+/*
+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 "StringUtils.h"
+
+namespace crown
+{
+namespace path
+{
+
+bool is_valid_segment(const char* segment);
+bool is_valid_path(const char* path);
+bool is_absolute_path(const char* path);
+
+void pathname(const char* path, char* str, size_t len);
+void filename(const char* path, char* str, size_t len);
+void basename(const char* path, char* str, size_t len);
+void extension(const char* path, char* str, size_t len);
+void filename_without_extension(const char* path, char* str, size_t len);
+
+//bool segments(const char* path, List<Str>& ret);
+inline void strip_trailing_separator(const char* path, char* ret, size_t len);
+
+/// Returns whether the segment is valid.
+/// @note
+/// The rules for valid segments are as follows:
+/// a) The empty string is not valid.
+/// b) Any string containing the slash character ('/') is not valid.
+/// c) Common notations for current ('.') and parent ('..') directory are forbidden.
+/// d) Any string containing segment or device separator characters on the local file system,
+/// such as the backslash ('\') and colon (':') on some file systems.
+/// (Thanks org.eclipse.core.runtime for the documentation ;D).
+inline bool is_valid_segment(const char* segment)
+{
+	CE_ASSERT(segment != NULL, "Segment must be != NULL");
+	
+	size_t segment_len = string::strlen(segment);
+
+	// Empty segment is not valid
+	if (segment_len == 0)
+	{
+		return false;
+	}
+
+	// Segments containing only '.' are non valid
+	if (segment_len == 1 && segment[0] == '.')
+	{
+		return false;
+	}
+
+	// Segments containing only ".." are not valid
+	if (segment_len == 2 && segment[0] == '.' && segment[1] == '.')
+	{
+		return false;
+	}
+
+	// The segment does not have to contain any forward slashes ('/')
+	// nor back slashes ('\'), nor colon signs (':')
+	for (size_t i = 0; i < segment_len; i++)
+	{
+		if (segment[i] == '/' ||
+			segment[i] == '\\' ||
+			segment[i] == ':')
+		{
+			return false;
+		}
+	}
+
+	return true;
+}
+
+/// Returns whether the path is valid.
+/// @note
+/// The rules for valid paths are as follows:
+/// a) The empty string is not valid.
+/// b) If the path is absolute, it mustn't contain any leading character.
+inline bool is_valid_path(const char* path)
+{
+	(void)path;
+//	size_t path_len = string::strlen(path);
+
+//	if (pathLen == 0)
+//	{
+//		return false;
+//	}
+
+//	if (is_root_path(path))
+//	{
+//		return true;
+//	}
+
+//	List<Str> segmentList;
+//	if (!get_segments(Str(path), segmentList))
+//	{
+//		return false;
+//	}
+
+//	size_t i = 0;
+//	if (IsAbsolutePath(path) && path[0] != '/')
+//	{
+//		i = 1;
+//	}
+
+//	for (; i < segmentList.GetSize(); i++)
+//	{
+//		if (!IsValidSegment(segmentList[i].c_str()))
+//		{
+//			return false;
+//		}
+//	}
+
+	return true;
+}
+
+/// Returns the pathname of the path.
+/// @note
+/// e.g. "/home/project/texture.tga" -> "/home/project"
+/// e.g. "/home/project" -> "/home"
+/// e.g. "/home" -> "/"
+/// e.g. "home" -> ""
+/// 
+/// The @a path must be valid.
+inline void pathname(const char* path, char* str, size_t len)
+{
+	CE_ASSERT(path != NULL, "Path must be != NULL");
+	CE_ASSERT(str != NULL, "Str must be != NULL");
+
+	const char* last_separator = string::find_last(path, '/');
+
+	if (last_separator == string::end(path))
+	{
+		string::strncpy(str, "", len);
+	}
+	else
+	{
+		string::substring(string::begin(path), last_separator, str, len);
+	}
+}
+
+/// Returns the filename of the path.
+/// @note
+/// e.g. "/home/project/texture.tga" -> "texture.tga"
+/// e.g. "/home/project/texture" -> "texture"
+/// e.g. "/home -> "home"
+/// e.g. "/" -> ""
+///
+/// The @a path must be valid.
+inline void filename(const char* path, char* str, size_t len)
+{
+	CE_ASSERT(path != NULL, "Path must be != NULL");
+	CE_ASSERT(str != NULL, "Str must be != NULL");
+
+	const char* last_separator = string::find_last(path, '/');
+	
+	if (last_separator == string::end(path))
+	{
+		string::strncpy(str, "", len);
+	}
+	else
+	{
+		string::substring(last_separator + 1, string::end(path), str, len);
+	}
+}
+
+/// Returns the basename of the path.
+/// @note
+/// e.g. "/home/project/texture.tga" -> "texture"
+/// e.g. "/home/project" -> "project"
+/// e.g. "/" -> ""
+///
+/// The @a path must be valid.
+inline void basename(const char* path, char* str, size_t len)
+{
+	CE_ASSERT(path != NULL, "Path must be != NULL");
+	CE_ASSERT(str != NULL, "Str must be != NULL");
+
+	const char* last_separator = string::find_last(path, '/');
+	const char* last_dot = string::find_last(path, '.');
+
+	if (last_separator == string::end(path) && last_dot != string::end(path))
+	{
+		string::substring(string::begin(path), last_dot, str, len);
+	}
+	else if (last_separator != string::end(path) && last_dot == string::end(path))
+	{
+		string::substring(last_separator + 1, string::end(path), str, len);
+	}
+	else if (last_separator == string::end(path) && last_dot == string::end(path))
+	{
+		string::strncpy(str, path, len);
+	}
+	else
+	{
+		string::substring(last_separator + 1, last_dot, str, len);
+	}
+}
+
+/// Returns the extension of the path.
+/// @note
+/// e.g. "/home/project/texture.tga" -> "tga"
+/// e.g. "/home/project.x/texture" -> ""
+///
+/// The @a path must be valid.
+inline void extension(const char* path, char* str, size_t len)
+{
+	CE_ASSERT(path != NULL, "Path must be != NULL");
+	CE_ASSERT(str != NULL, "Str must be != NULL");
+	
+	const char* last_dot = string::find_last(path, '.');
+	
+	if (last_dot == string::end(path))
+	{
+		string::strncpy(str, "", len);
+	}
+	else
+	{
+		string::substring(last_dot + 1, string::end(path), str, len);
+	}
+}
+
+/// Returns the filename without the extension.
+/// @note
+/// e.g. "/home/project/texture.tga" -> "/home/project/texture"
+/// e.g. "/home/project/texture" -> "/home/project/texture"
+///
+/// The @a path must be valid.
+inline void filename_without_extension(const char* path, char* str, size_t len)
+{
+	CE_ASSERT(path != NULL, "Path must be != NULL");
+	CE_ASSERT(str != NULL, "Str must be != NULL");
+	
+	const char* last_dot = string::find_last(path, '.');
+	
+	string::substring(string::begin(path), last_dot, str, len);
+}
+
+/// Returns the segments contained in path.
+//bool segments(const char* path, List<Str>& ret)
+//{
+//	path.Split(os::PATH_SEPARATOR, ret);
+
+//	if (ret.GetSize() > 0)
+//	{
+//		return true;
+//	}
+
+//	return false;
+//}
+
+/// Fills 'ret' with the same path but without the trailing directory separator.
+/// @note
+/// e.g. "/home/project/texture.tga/" -> "/home/project/texture.tga"
+/// e.g. "/home/project/texture.tga" -> "/home/project/texture.tga"
+///
+/// The @a path must be valid.
+inline void strip_trailing_separator(const char* path, char* str, size_t len)
+{
+	CE_ASSERT(path != NULL, "Path must be != NULL");
+	CE_ASSERT(str != NULL, "Str must be != NULL");
+	
+	size_t path_len = string::strlen(path);
+	
+	if (path[path_len - 1] == '/')
+	{
+		string::substring(string::begin(path), string::end(path) - 2, str, len);
+	}
+	else
+	{
+		string::substring(string::begin(path), string::end(path), str, len);
+	}
+}
+
+} // namespace path
+} // namespace crown
+

+ 227 - 0
tools/core/strings/StringUtils.h

@@ -0,0 +1,227 @@
+/*
+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 <cstdio>
+#include <cstring>
+
+#include "Assert.h"
+#include "Types.h"
+
+namespace crown
+{
+namespace string
+{
+
+const char* const	EMPTY = "";
+
+bool				is_alpha(char c);
+bool				is_digit(char c);
+bool				is_upper(char c);
+bool				is_lower(char c);
+bool				is_whitespace(char c);
+
+size_t				strlen(const char* str);
+const char*			strstr(const char* str1, const char* str2);
+int32_t				strcmp(const char* str1, const char* str2);
+char*				strcpy(char* dest, const char* src);
+char*				strncpy(char* dest, const char* src, size_t len);
+char* 				strcat(char* dest, const char* src);
+char*				strncat(char* dest, const char* src, size_t len);
+
+const char*			begin(const char* str);
+const char*			end(const char* str);
+
+const char*			find_first(const char* str, char c);
+const char*			find_last(const char* str, char c);
+void				substring(const char* begin, const char* end, char* out, size_t len);
+
+//-----------------------------------------------------------------------------
+inline bool is_alpha(char c)
+{
+	return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
+}
+
+//-----------------------------------------------------------------------------
+inline bool is_digit(char c)
+{
+	return !(c < '0' || c > '9');
+}
+
+//-----------------------------------------------------------------------------
+inline bool is_upper(char c)
+{
+	return (c >= 'A' && c <= 'Z');
+}
+
+//-----------------------------------------------------------------------------
+inline bool is_lower(char c)
+{
+	return (c >= 'a' && c <= 'z');
+}
+
+//-----------------------------------------------------------------------------
+inline bool is_whitespace(char c)
+{
+	return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
+}
+
+//-----------------------------------------------------------------------------
+inline size_t strlen(const char* str)
+{
+	size_t chars = 0;
+
+	while(*str)
+	{
+		if ((*str & 0xC0) != 0x80)
+		{
+			chars++;
+		}
+		str++;
+	}
+
+	return chars;
+}
+
+//-----------------------------------------------------------------------------
+inline const char* strstr(const char* str1, const char* str2)
+{
+	return ::strstr(str1, str2);
+}
+
+//-----------------------------------------------------------------------------
+inline int32_t strcmp(const char* str1, const char* str2)
+{
+	return ::strcmp(str1, str2);
+}
+
+//-----------------------------------------------------------------------------
+inline char* strcpy(char* dest, const char* src)
+{
+	return ::strcpy(dest, src);
+}
+
+//-----------------------------------------------------------------------------
+inline char* strncpy(char* dest, const char* src, size_t len)
+{
+	return ::strncpy(dest, src, len);
+}
+
+//-----------------------------------------------------------------------------
+inline char* strcat(char* dest, const char* src)
+{
+	return ::strcat(dest, src);
+}
+
+//-----------------------------------------------------------------------------
+inline char* strncat(char* dest, const char* src, size_t len)
+{
+	return ::strncat(dest, src, len);
+}
+
+//-----------------------------------------------------------------------------
+inline const char* begin(const char* str)
+{
+	CE_ASSERT(str != NULL, "Str must be != NULL");
+	
+	return str;
+}
+
+//-----------------------------------------------------------------------------
+inline const char* end(const char* str)
+{
+	CE_ASSERT(str != NULL, "Str must be != NULL");
+	
+	return str + string::strlen(str) + 1;
+}
+
+//-----------------------------------------------------------------------------
+inline const char* find_first(const char* str, char c)
+{
+	CE_ASSERT(str != NULL, "Str must be != NULL");
+
+	const char* str_begin = string::begin(str);
+	
+	while (str_begin != string::end(str))
+	{
+		if ((*str_begin) == c)
+		{
+			return str_begin;
+		}
+		
+		str_begin++;
+	}
+	
+	return string::end(str);
+}
+
+//-----------------------------------------------------------------------------
+inline const char* find_last(const char* str, char c)
+{
+	CE_ASSERT(str != NULL, "Str must be != NULL");
+	
+	const char* str_end = string::end(str) - 1;
+	
+	while (str_end != string::begin(str) - 1)
+	{
+		if ((*str_end) == c)
+		{
+			return str_end;
+		}
+		
+		str_end--;
+	}
+	
+	return string::end(str);
+}
+
+//-----------------------------------------------------------------------------
+inline void substring(const char* begin, const char* end, char* out, size_t len)
+{
+	CE_ASSERT(begin != NULL, "Begin must be != NULL");
+	CE_ASSERT(end != NULL, "End must be != NULL");
+	CE_ASSERT(out != NULL, "Out must be != NULL");
+	
+	size_t i = 0;
+	
+	char* out_iterator = out;
+
+	while (begin != end && i < len)
+	{
+		(*out_iterator) = (*begin);
+		
+		begin++;
+		out_iterator++;
+		i++;
+	}
+
+	out[i] = '\0';
+}
+
+} // namespace string
+} // namespace crown
+

+ 0 - 0
tools/editors/fontgen/CMakeLists.txt → tools/gui/fontgen/CMakeLists.txt


+ 0 - 0
tools/editors/fontgen/fontgen.cpp → tools/gui/fontgen/fontgen.cpp


+ 0 - 0
tools/editors/resource-browser/CMakeLists.txt → tools/gui/resource-browser/CMakeLists.txt


+ 0 - 0
tools/editors/resource-browser/resource-browser.py → tools/gui/resource-browser/resource-browser.py


+ 0 - 0
tools/editors/resource-browser/ui/resource-browser.glade → tools/gui/resource-browser/ui/resource-browser.glade


+ 0 - 0
tools/editors/toolchain/CMakeLists.txt → tools/gui/toolchain/CMakeLists.txt


+ 0 - 0
tools/editors/toolchain/toolchain.py → tools/gui/toolchain/toolchain.py


+ 0 - 0
tools/editors/toolchain/ui/toolchain.glade → tools/gui/toolchain/ui/toolchain.glade


+ 0 - 0
tools/editors/world-editor/CMakeLists.txt → tools/gui/world-editor/CMakeLists.txt


+ 0 - 0
tools/editors/world-editor/CrownDrawingArea.cpp → tools/gui/world-editor/CrownDrawingArea.cpp


+ 0 - 0
tools/editors/world-editor/CrownDrawingArea.h → tools/gui/world-editor/CrownDrawingArea.h


+ 0 - 0
tools/editors/world-editor/terrain/Heightfield.cpp → tools/gui/world-editor/terrain/Heightfield.cpp


+ 0 - 0
tools/editors/world-editor/terrain/Heightfield.h → tools/gui/world-editor/terrain/Heightfield.h


+ 0 - 0
tools/editors/world-editor/ui/world-editor.glade → tools/gui/world-editor/ui/world-editor.glade


+ 0 - 0
tools/editors/world-editor/world-editor.cpp → tools/gui/world-editor/world-editor.cpp