Forráskód Böngészése

Merge branch 'world' of https://github.com/taylor001/crown into world

mikymod 12 éve
szülő
commit
5edfeab2d2

+ 2 - 1
engine/Android.mk

@@ -151,6 +151,7 @@ LOCAL_SRC_FILES :=\
 	physics/Controller.cpp\
 	physics/PhysicsWorld.cpp\
 	physics/Trigger.cpp\
+	physics/Joint.cpp\
 \
 	renderers/backend/gl/egl/GLContext.cpp\
 	renderers/backend/gl/GLRenderer.cpp\
@@ -254,7 +255,7 @@ LOCAL_C_INCLUDES	:=\
 	$(LOCAL_PATH)/third/ARMv7/physx/include/RepXUpgrader\
 	$(LOCAL_PATH)/third/ARMv7/physx/include/vehicle\
 	
-LOCAL_CPPFLAGS := -fno-exceptions -std=c++03 -ansi -Wall -Wextra -Wno-long-long -Wno-variadic-macros -Wno-missing-braces -Wno-unused-parameter -Wno-unknown-pragmas -Wno-format
+LOCAL_CPPFLAGS := -fno-rtti -fno-exceptions -std=c++03 -ansi -Wall -Wextra -Wno-long-long -Wno-variadic-macros -Wno-missing-braces -Wno-unused-parameter -Wno-unknown-pragmas -Wno-format
 LOCAL_LDLIBS := -L$(LOCAL_PATH) -Wl,--start-group $(addprefix -l, $(PhysX_libraries)) -Wl,--end-group -llog -landroid -lEGL -lGLESv2 -lz -lOpenSLES
 LOCAL_SHARED_LIBRARIES := luajit-5.1
 LOCAL_STATIC_LIBRARIES := android_native_app_glue ogg vorbis

+ 12 - 12
engine/ConsoleServer.cpp

@@ -187,7 +187,7 @@ void ConsoleServer::process(TCPSocket client, const char* request)
 {
 	JSONParser parser(request);
 	DynamicString type; 
-	parser.root().key("type").string_value(type);
+	parser.root().key("type").to_string(type);
 
 	// Determine request type
 	if (type == "ping") process_ping(client, request);
@@ -211,7 +211,7 @@ void ConsoleServer::process_script(TCPSocket /*client*/, const char* msg)
 	JSONElement root = parser.root();
 
 	DynamicString script;
-	root.key("script").string_value(script);
+	root.key("script").to_string(script);
 	device()->lua_environment()->execute_string(script.c_str());
 }
 
@@ -249,7 +249,7 @@ void ConsoleServer::process_command(TCPSocket /*client*/, const char* msg)
 	JSONElement command = root.key("command");
 
 	DynamicString cmd;
-	command.string_value(cmd);
+	command.to_string(cmd);
 
 	if (cmd == "reload")
 	{
@@ -258,8 +258,8 @@ void ConsoleServer::process_command(TCPSocket /*client*/, const char* msg)
 
 		DynamicString resource_type;
 		DynamicString resource_name;
-		type.string_value(resource_type);
-		name.string_value(resource_name);
+		type.to_string(resource_type);
+		name.to_string(resource_name);
 
 		char t[256];
 		char n[256];
@@ -285,12 +285,12 @@ void ConsoleServer::processs_filesystem(TCPSocket client, const char* msg)
 	JSONElement filesystem = root.key("filesystem");
 
 	DynamicString cmd;
-	filesystem.string_value(cmd);
+	filesystem.to_string(cmd);
 
 	if (cmd == "size")
 	{
 		DynamicString file_name;
-		root.key("file").string_value(file_name);
+		root.key("file").to_string(file_name);
 
 		File* file = device()->filesystem()->open(file_name.c_str(), FOM_READ);
 		size_t file_size = file->size();
@@ -308,18 +308,18 @@ void ConsoleServer::processs_filesystem(TCPSocket client, const char* msg)
 		JSONElement file_size = root.key("size");
 
 		DynamicString file_name;
-		root.key("file").string_value(file_name);
+		root.key("file").to_string(file_name);
 
 		// Read the file data
 		File* file = device()->filesystem()->open(file_name.c_str(), FOM_READ);
-		char* bytes = (char*) default_allocator().allocate((size_t) file_size.int_value());
-		file->seek((size_t) file_position.int_value());
-		file->read(bytes, (size_t) file_size.int_value());
+		char* bytes = (char*) default_allocator().allocate((size_t) file_size.to_int());
+		file->seek((size_t) file_position.to_int());
+		file->read(bytes, (size_t) file_size.to_int());
 		device()->filesystem()->close(file);
 
 		// Encode data to base64
 		size_t dummy;
-		char* bytes_encoded = math::base64_encode((unsigned char*) bytes, (size_t) file_size.int_value(), &dummy);
+		char* bytes_encoded = math::base64_encode((unsigned char*) bytes, (size_t) file_size.to_int(), &dummy);
 
 		// Send data
 		TempAllocator4096 alloc;

+ 1 - 1
engine/Device.cpp

@@ -203,7 +203,7 @@ void Device::init()
 		pause();
 	}
 
-	Log::d("Total allocated size: %llu", m_allocator.allocated_size());
+	Log::d("Total allocated size: %ld", m_allocator.allocated_size());
 }
 
 //-----------------------------------------------------------------------------

+ 2 - 2
engine/core/filesystem/NetworkFile.cpp

@@ -97,7 +97,7 @@ void NetworkFile::read(void* buffer, size_t size)
 	JSONElement root = json.root();
 
 	DynamicString data_base64;
-	root.key("data").string_value(data_base64);
+	root.key("data").to_string(data_base64);
 
 	size_t out_len = 0;
 	unsigned char* data = math::base64_decode(data_base64.c_str(), data_base64.length(), &out_len);
@@ -160,7 +160,7 @@ size_t NetworkFile::size()
 	JSONParser parser(response.begin());
 	JSONElement root = parser.root();
 
-	return (size_t) root.key("size").int_value();
+	return (size_t) root.key("size").to_int();
 }
 
 //-----------------------------------------------------------------------------

+ 13 - 13
engine/core/json/JSONParser.cpp

@@ -210,34 +210,34 @@ bool JSONElement::is_key_unique(const char* k) const
 }
 
 //--------------------------------------------------------------------------
-bool JSONElement::bool_value() const
+bool JSONElement::to_bool() const
 {
 	const bool value = json::parse_bool(m_at);
 	return value;
 }
 
 //--------------------------------------------------------------------------
-int32_t JSONElement::int_value() const
+int32_t JSONElement::to_int() const
 {
 	const int32_t value = json::parse_int(m_at);
 	return value;
 }
 
 //--------------------------------------------------------------------------
-float JSONElement::float_value() const
+float JSONElement::to_float() const
 {
 	const float value = json::parse_float(m_at);
 	return value;
 }
 
 //--------------------------------------------------------------------------
-void JSONElement::string_value(DynamicString& str) const
+void JSONElement::to_string(DynamicString& str) const
 {
 	json::parse_string(m_at, str);
 }
 
 //--------------------------------------------------------------------------
-StringId32 JSONElement::string_id_value() const
+StringId32 JSONElement::to_string_id() const
 {
 	TempAllocator1024 alloc;
 	DynamicString str(alloc);
@@ -246,7 +246,7 @@ StringId32 JSONElement::string_id_value() const
 }
 
 //--------------------------------------------------------------------------
-void JSONElement::array_value(List<bool>& array) const
+void JSONElement::to_array(List<bool>& array) const
 {
 	List<const char*> temp(default_allocator());
 
@@ -259,7 +259,7 @@ void JSONElement::array_value(List<bool>& array) const
 }
 
 //--------------------------------------------------------------------------
-void JSONElement::array_value(List<int16_t>& array) const
+void JSONElement::to_array(List<int16_t>& array) const
 {
 	List<const char*> temp(default_allocator());
 
@@ -272,7 +272,7 @@ void JSONElement::array_value(List<int16_t>& array) const
 }
 
 //--------------------------------------------------------------------------
-void JSONElement::array_value(List<uint16_t>& array) const
+void JSONElement::to_array(List<uint16_t>& array) const
 {
 	List<const char*> temp(default_allocator());
 
@@ -285,7 +285,7 @@ void JSONElement::array_value(List<uint16_t>& array) const
 }
 
 //--------------------------------------------------------------------------
-void JSONElement::array_value(List<int32_t>& array) const
+void JSONElement::to_array(List<int32_t>& array) const
 {
 	List<const char*> temp(default_allocator());
 
@@ -298,7 +298,7 @@ void JSONElement::array_value(List<int32_t>& array) const
 }
 
 //--------------------------------------------------------------------------
-void JSONElement::array_value(List<uint32_t>& array) const
+void JSONElement::to_array(List<uint32_t>& array) const
 {
 	List<const char*> temp(default_allocator());
 
@@ -311,7 +311,7 @@ void JSONElement::array_value(List<uint32_t>& array) const
 }
 
 //--------------------------------------------------------------------------
-void JSONElement::array_value(List<float>& array) const
+void JSONElement::to_array(List<float>& array) const
 {
 	List<const char*> temp(default_allocator());
 
@@ -324,7 +324,7 @@ void JSONElement::array_value(List<float>& array) const
 }
 
 //--------------------------------------------------------------------------
-void JSONElement::array_value(Vector<DynamicString>& array) const
+void JSONElement::to_array(Vector<DynamicString>& array) const
 {
 	List<const char*> temp(default_allocator());
 
@@ -339,7 +339,7 @@ void JSONElement::array_value(Vector<DynamicString>& array) const
 }
 
 //--------------------------------------------------------------------------
-void JSONElement::key_value(Vector<DynamicString>& keys) const
+void JSONElement::to_keys(Vector<DynamicString>& keys) const
 {
 	List<JSONPair> object(default_allocator());
 	json::parse_object(m_at, object);

+ 19 - 19
engine/core/json/JSONParser.h

@@ -107,19 +107,19 @@ public:
 	uint32_t			size() const;
 
 	/// Returns the boolean value of the element.
-	bool				bool_value() const;
+	bool				to_bool() const;
 
 	/// Returns the integer value of the element.
-	int32_t				int_value() const;
+	int32_t				to_int() const;
 
 	/// Returns the float value of the element.
-	float				float_value() const;
+	float				to_float() const;
 
 	/// Returns the string value of the element.
-	void				string_value(DynamicString& str) const;
+	void				to_string(DynamicString& str) const;
 
 	/// Returns the string id value hashed to hash::murmur2_32() of the element.
-	StringId32			string_id_value() const;
+	StringId32			to_string_id() const;
 
 	/// Returns the array value of the element.
 	/// @note
@@ -127,28 +127,28 @@ public:
 	/// array elements by JSONElement::operator[] and it is the very preferred way
 	/// for retrieving array elemets. However, you have to be sure that the array
 	/// contains only items of the given @array type.
-	void				array_value(List<bool>& array) const;
+	void				to_array(List<bool>& array) const;
 
-	/// @copydoc JSONElement::array_value(List<bool>&)
-	void				array_value(List<int16_t>& array) const;
+	/// @copydoc JSONElement::to_array(List<bool>&)
+	void				to_array(List<int16_t>& array) const;
 
-	/// @copydoc JSONElement::array_value(List<bool>&)
-	void				array_value(List<uint16_t>& array) const;
+	/// @copydoc JSONElement::to_array(List<bool>&)
+	void				to_array(List<uint16_t>& array) const;
 
-	/// @copydoc JSONElement::array_value(List<bool>&)
-	void				array_value(List<int32_t>& array) const;
+	/// @copydoc JSONElement::to_array(List<bool>&)
+	void				to_array(List<int32_t>& array) const;
 
-	/// @copydoc JSONElement::array_value(List<bool>&)
-	void				array_value(List<uint32_t>& array) const;
+	/// @copydoc JSONElement::to_array(List<bool>&)
+	void				to_array(List<uint32_t>& array) const;
 
-	/// @copydoc JSONElement::array_value(List<bool>&)
-	void				array_value(List<float>& array) const;
+	/// @copydoc JSONElement::to_array(List<bool>&)
+	void				to_array(List<float>& array) const;
 
-	/// @copydoc JSONElement::array_value(List<bool>&)
-	void				array_value(Vector<DynamicString>& array) const;
+	/// @copydoc JSONElement::to_array(List<bool>&)
+	void				to_array(Vector<DynamicString>& array) const;
 
 	/// Returns all the keys of the element.
-	void				key_value(Vector<DynamicString>& keys) const;
+	void				to_keys(Vector<DynamicString>& keys) const;
 
 private:
 

+ 3 - 3
engine/os/linux/main.cpp

@@ -611,7 +611,7 @@ public:
 		if (root.has_key("boot"))
 		{
 			DynamicString boot;
-			root.key("boot").string_value(boot);
+			root.key("boot").to_string(boot);
 
 			string::strncpy(m_boot_file, boot.c_str(), (boot.length() > MAX_PATH_LENGTH) ? MAX_PATH_LENGTH : boot.length() + 1);
 		}
@@ -619,13 +619,13 @@ public:
 		// Window width
 		if (root.has_key("window_width"))
 		{
-			m_width = root.key("window_width").int_value();
+			m_width = root.key("window_width").to_int();
 		}
 
 		// Window height
 		if (root.has_key("window_height"))
 		{
-			m_height = root.key("window_height").int_value();
+			m_height = root.key("window_height").to_int();
 		}
 	}
 

+ 3 - 3
engine/os/win/main.cpp

@@ -839,7 +839,7 @@ public:
 		if (root.has_key("boot"))
 		{
 			DynamicString boot;
-			root.key("boot").string_value(boot);
+			root.key("boot").to_string(boot);
 
 			string::strncpy(m_boot_file, boot, (boot.length() > MAX_PATH_LENGTH) ? MAX_PATH_LENGTH : boot.length() + 1);
 		}
@@ -847,13 +847,13 @@ public:
 		// Window width
 		if (root.has_key("window_width"))
 		{
-			m_width = root.key("window_width").int_value();
+			m_width = root.key("window_width").to_int();
 		}
 
 		// Window height
 		if (root.has_key("window_height"))
 		{
-			m_height = root.key("window_height").int_value();
+			m_height = root.key("window_height").to_int();
 		}
 	}
 

+ 10 - 10
engine/resource/GuiResource.cpp

@@ -50,9 +50,9 @@ void parse_rect(JSONElement rect, List<float>& positions, List<float>& sizes, Li
 	JSONElement size 		= rect.key("size");
 	JSONElement color 		= rect.key("color");
 
-	position.array_value(positions);
-	size.array_value(sizes);
-	color.array_value(colors);
+	position.to_array(positions);
+	size.to_array(sizes);
+	color.to_array(colors);
 }
 
 //-----------------------------------------------------------------------------
@@ -61,8 +61,8 @@ void parse_triangle(JSONElement triangle, List<float>& points, List<float>& colo
 	JSONElement point	= triangle.key("points");
 	JSONElement color 	= triangle.key("color");
 
-	point.array_value(points);
-	color.array_value(colors);
+	point.to_array(points);
+	color.to_array(colors);
 }
 
 //-----------------------------------------------------------------------------
@@ -73,12 +73,12 @@ void parse_image(JSONElement image, StringId64& material, List<float>& positions
 	JSONElement size 		= image.key("size");
 
 	DynamicString material_name;
-	mat.string_value(material_name);
+	mat.to_string(material_name);
 	material_name += ".material";
 
 	material = hash::murmur2_64(material_name.c_str(), string::strlen(material_name.c_str()), 0);
-	position.array_value(positions);
-	size.array_value(sizes);
+	position.to_array(positions);
+	size.to_array(sizes);
 }
 
 //-----------------------------------------------------------------------------
@@ -100,8 +100,8 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 	List<float>			m_gui_position(default_allocator());
 	List<float>			m_gui_size(default_allocator());
 
-	root.key("position").array_value(m_gui_position);
-	root.key("size").array_value(m_gui_size);
+	root.key("position").to_array(m_gui_position);
+	root.key("size").to_array(m_gui_size);
 
 	// Parse & compile all rects
 	if (root.has_key("rects"))

+ 1 - 1
engine/resource/MaterialResource.cpp

@@ -53,7 +53,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 	for (uint32_t i = 0; i < tl.size(); i++)
 	{
 		DynamicString tex;
-		tl[i].string_value(tex); tex += ".texture";
+		tl[i].to_string(tex); tex += ".texture";
 		ResourceId tex_id; tex_id.id = hash::murmur2_64(tex.c_str(), tex.length(), 0);
 		texture_layers.push_back(tex_id);
 	}

+ 6 - 6
engine/resource/MeshResource.cpp

@@ -82,21 +82,21 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 		return;
 	}
 	List<float> position_array(default_allocator());
-	position.array_value(position_array);
+	position.to_array(position_array);
 
 
 	List<float> normal_array(default_allocator());
 	if (!normal.is_nil())
 	{
 		m_has_normal = true;
-		normal.array_value(normal_array);
+		normal.to_array(normal_array);
 	}
 
 	List<float> texcoord_array(default_allocator());
 	if (!texcoord.is_nil())
 	{
 		m_has_texcoord = true;
-		texcoord.array_value(texcoord_array);
+		texcoord.to_array(texcoord_array);
 	}
 
 	// Read index arrays
@@ -111,16 +111,16 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 	List<uint16_t> normal_index(default_allocator());
 	List<uint16_t> texcoord_index(default_allocator());
 
-	index[0].array_value(position_index);
+	index[0].to_array(position_index);
 
 	if (m_has_normal)
 	{
-		index[1].array_value(normal_index);
+		index[1].to_array(normal_index);
 	}
 
 	if (m_has_texcoord)
 	{
-		index[2].array_value(texcoord_index);
+		index[2].to_array(texcoord_index);
 	}
 
 	// Generate vb/ib

+ 9 - 9
engine/resource/PackageResource.cpp

@@ -70,7 +70,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 		for (uint32_t i = 0; i < texture_array_size; i++)
 		{
 			DynamicString texture_name;
-			texture_array[i].string_value(texture_name); texture_name += ".texture";
+			texture_array[i].to_string(texture_name); texture_name += ".texture";
 
 			if (!fs.is_file(texture_name.c_str()))
 			{
@@ -94,7 +94,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 		for (uint32_t i = 0; i < lua_array_size; i++)
 		{
 			DynamicString lua_name;
-			lua_array[i].string_value(lua_name); lua_name += ".lua";
+			lua_array[i].to_string(lua_name); lua_name += ".lua";
 
 			if (!fs.is_file(lua_name.c_str()))
 			{
@@ -117,7 +117,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 		for (uint32_t i = 0; i < sound_array_size; i++)
 		{
 			DynamicString sound_name;
-			sound_array[i].string_value(sound_name); sound_name += ".sound";
+			sound_array[i].to_string(sound_name); sound_name += ".sound";
 
 			if (!fs.is_file(sound_name.c_str()))
 			{
@@ -140,7 +140,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 		for (uint32_t i = 0; i < mesh_array_size; i++)
 		{
 			DynamicString mesh_name;
-			mesh_array[i].string_value(mesh_name); mesh_name += ".mesh";
+			mesh_array[i].to_string(mesh_name); mesh_name += ".mesh";
 
 			if (!fs.is_file(mesh_name.c_str()))
 			{
@@ -163,7 +163,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 		for (uint32_t i = 0; i < unit_array_size; i++)
 		{
 			DynamicString unit_name;
-			unit_array[i].string_value(unit_name); unit_name += ".unit";
+			unit_array[i].to_string(unit_name); unit_name += ".unit";
 
 			if (!fs.is_file(unit_name.c_str()))
 			{
@@ -185,7 +185,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 		for (uint32_t i = 0; i < sprite_array_size; i++)
 		{
 			DynamicString sprite_name;
-			sprite_array[i].string_value(sprite_name); sprite_name += ".sprite";
+			sprite_array[i].to_string(sprite_name); sprite_name += ".sprite";
 
 			if (!fs.is_file(sprite_name.c_str()))
 			{
@@ -208,7 +208,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 		for (uint32_t i = 0; i < physics_array_size; i++)
 		{
 			DynamicString physics_name;
-			physics_array[i].string_value(physics_name); physics_name += ".physics";
+			physics_array[i].to_string(physics_name); physics_name += ".physics";
 
 			if (!fs.is_file(physics_name.c_str()))
 			{
@@ -231,7 +231,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 		for (uint32_t i = 0; i < materials_array_size; i++)
 		{
 			DynamicString materials_name;
-			materials_array[i].string_value(materials_name); materials_name += ".material";
+			materials_array[i].to_string(materials_name); materials_name += ".material";
 
 			if (!fs.is_file(materials_name.c_str()))
 			{
@@ -254,7 +254,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 		for (uint32_t i = 0; i < guis_array_size; i++)
 		{
 			DynamicString guis_name;
-			guis_array[i].string_value(guis_name); guis_name += ".gui";
+			guis_array[i].to_string(guis_name); guis_name += ".gui";
 
 			if (!fs.is_file(guis_name.c_str()))
 			{

+ 53 - 53
engine/resource/PhysicsResource.cpp

@@ -75,20 +75,20 @@ void parse_controller(JSONElement e, PhysicsController& controller)
 	JSONElement contact_offset 		= e.key("contact_offset");
 	JSONElement collision_filter 	= e.key("collision_filter");
 
-	controller.name = name.string_id_value();
-	controller.height = height.float_value();
-	controller.radius = radius.float_value();
-	controller.slope_limit = slope_limit.float_value();
-	controller.step_offset = step_offset.float_value();
-	controller.contact_offset = contact_offset.float_value();
-	controller.collision_filter = collision_filter.string_id_value();
+	controller.name = name.to_string_id();
+	controller.height = height.to_float();
+	controller.radius = radius.to_float();
+	controller.slope_limit = slope_limit.to_float();
+	controller.step_offset = step_offset.to_float();
+	controller.contact_offset = contact_offset.to_float();
+	controller.collision_filter = collision_filter.to_string_id();
 }
 
 //-----------------------------------------------------------------------------
 void parse_shapes(JSONElement e, List<PhysicsShape>& shapes)
 {
 	Vector<DynamicString> keys(default_allocator());
-	e.key_value(keys);
+	e.to_keys(keys);
 
 	for (uint32_t k = 0; k < keys.size(); k++)
 	{
@@ -99,9 +99,9 @@ void parse_shapes(JSONElement e, List<PhysicsShape>& shapes)
 
 		PhysicsShape ps;
 		ps.name = keys[k].to_string_id();
-		ps.shape_class = clasz.string_id_value();
-		ps.material = material.string_id_value();
-		DynamicString stype; type.string_value(stype);
+		ps.shape_class = clasz.to_string_id();
+		ps.material = material.to_string_id();
+		DynamicString stype; type.to_string(stype);
 		ps.type = shape_type_to_enum(stype.c_str());
 
 		switch (ps.type)
@@ -109,7 +109,7 @@ void parse_shapes(JSONElement e, List<PhysicsShape>& shapes)
 			case PhysicsShapeType::SPHERE:
 			{
 				JSONElement radius = shape.key("radius");
-				ps.data_0 = radius.float_value();
+				ps.data_0 = radius.to_float();
 				break;
 			}
 			case PhysicsShapeType::CAPSULE:
@@ -123,9 +123,9 @@ void parse_shapes(JSONElement e, List<PhysicsShape>& shapes)
 				JSONElement half_y = shape.key("half_y");
 				JSONElement half_z = shape.key("half_z");
 
-				ps.data_0 = half_x.float_value();
-				ps.data_1 = half_y.float_value();
-				ps.data_2 = half_z.float_value();
+				ps.data_0 = half_x.to_float();
+				ps.data_1 = half_y.to_float();
+				ps.data_2 = half_z.to_float();
 
 				break;
 			}
@@ -144,7 +144,7 @@ void parse_shapes(JSONElement e, List<PhysicsShape>& shapes)
 void parse_actors(JSONElement e, List<PhysicsActor>& actors, List<PhysicsShape>& actor_shapes, List<uint32_t>& shape_indices)
 {
 	Vector<DynamicString> keys(default_allocator());
-	e.key_value(keys);
+	e.to_keys(keys);
 
 	for (uint32_t k = 0; k < keys.size(); k++)
 	{
@@ -155,8 +155,8 @@ void parse_actors(JSONElement e, List<PhysicsActor>& actors, List<PhysicsShape>&
 
 		PhysicsActor pa;
 		pa.name = keys[k].to_string_id();
-		pa.node = node.string_id_value();
-		pa.actor_class = clasz.string_id_value();
+		pa.node = node.to_string_id();
+		pa.actor_class = clasz.to_string_id();
 		pa.num_shapes = shapes.size();
 
 		actors.push_back(pa);
@@ -170,7 +170,7 @@ void parse_actors(JSONElement e, List<PhysicsActor>& actors, List<PhysicsShape>&
 void parse_joints(JSONElement e, List<PhysicsJoint>& joints)
 {
 	Vector<DynamicString> keys(default_allocator());
-	e.key_value(keys);
+	e.to_keys(keys);
 
 	for (uint32_t k = 0; k < keys.size(); k++)
 	{
@@ -190,19 +190,19 @@ void parse_joints(JSONElement e, List<PhysicsJoint>& joints)
 
 		PhysicsJoint pj;
 		pj.name = keys[k].to_string_id();
-		DynamicString jtype; type.string_value(jtype);
+		DynamicString jtype; type.to_string(jtype);
 		pj.type = joint_type_to_enum(jtype.c_str());
-		pj.actor_0 = actor_0.string_id_value();
-		pj.actor_1 = actor_1.string_id_value();
-		pj.anchor_0 = Vector3(anchor_0[0].float_value(), anchor_0[1].float_value(), anchor_0[2].float_value());
-		pj.anchor_1 = Vector3(anchor_1[0].float_value(), anchor_1[1].float_value(), anchor_1[2].float_value());
-		pj.restitution = restitution.is_nil() 	? 0.5 : restitution.float_value();
-		pj.spring = spring.is_nil() 			? 100.0 : spring.float_value();
-		pj.damping = damping.is_nil() 			? 0.0 : damping.float_value();
-		pj.distance = distance.is_nil() 		? 1.0 : distance.float_value();
-		pj.breakable = breakable.is_nil() 		? false : breakable.bool_value();
-		pj.break_force = break_force.is_nil() 	? 3000.0 : break_force.float_value();
-		pj.break_torque = break_torque.is_nil() ? 1000.0 : break_torque.float_value();
+		pj.actor_0 = actor_0.to_string_id();
+		pj.actor_1 = actor_1.to_string_id();
+		pj.anchor_0 = Vector3(anchor_0[0].to_float(), anchor_0[1].to_float(), anchor_0[2].to_float());
+		pj.anchor_1 = Vector3(anchor_1[0].to_float(), anchor_1[1].to_float(), anchor_1[2].to_float());
+		pj.restitution = restitution.is_nil() 	? 0.5 : restitution.to_float();
+		pj.spring = spring.is_nil() 			? 100.0 : spring.to_float();
+		pj.damping = damping.is_nil() 			? 0.0 : damping.to_float();
+		pj.distance = distance.is_nil() 		? 1.0 : distance.to_float();
+		pj.breakable = breakable.is_nil() 		? false : breakable.to_bool();
+		pj.break_force = break_force.is_nil() 	? 3000.0 : break_force.to_float();
+		pj.break_torque = break_torque.is_nil() ? 1000.0 : break_torque.to_float();
 
 		switch (pj.type)
 		{
@@ -216,9 +216,9 @@ void parse_joints(JSONElement e, List<PhysicsJoint>& joints)
 				JSONElement z_limit_angle = joint.key_or_nil("z_limit_angle");
 				JSONElement contact_dist = joint.key_or_nil("contact_dist");
 
-				pj.y_limit_angle = y_limit_angle.is_nil() ? math::HALF_PI : y_limit_angle.float_value();
-				pj.z_limit_angle = z_limit_angle.is_nil() ? math::HALF_PI : z_limit_angle.float_value();
-				pj.contact_dist = contact_dist.is_nil() ? 0.0 : contact_dist.float_value();
+				pj.y_limit_angle = y_limit_angle.is_nil() ? math::HALF_PI : y_limit_angle.to_float();
+				pj.z_limit_angle = z_limit_angle.is_nil() ? math::HALF_PI : z_limit_angle.to_float();
+				pj.contact_dist = contact_dist.is_nil() ? 0.0 : contact_dist.to_float();
 
 				break;
 			}
@@ -229,16 +229,16 @@ void parse_joints(JSONElement e, List<PhysicsJoint>& joints)
 				JSONElement upper_limit = joint.key_or_nil("upper_limit");
 				JSONElement contact_dist = joint.key_or_nil("contact_dist");
 
-				pj.lower_limit = lower_limit.is_nil() ? 0.0 : lower_limit.float_value();
-				pj.upper_limit = upper_limit.is_nil() ? 0.0 : upper_limit.float_value();
-				pj.contact_dist = contact_dist.is_nil() ? 0.0 : contact_dist.float_value();
+				pj.lower_limit = lower_limit.is_nil() ? 0.0 : lower_limit.to_float();
+				pj.upper_limit = upper_limit.is_nil() ? 0.0 : upper_limit.to_float();
+				pj.contact_dist = contact_dist.is_nil() ? 0.0 : contact_dist.to_float();
 
 				break;
 			}
 			case PhysicsJointType::DISTANCE:
 			{
 				JSONElement max_distance = joint.key_or_nil("max_distance");
-				pj.max_distance = max_distance.is_nil() ? 0.0 : max_distance.float_value();
+				pj.max_distance = max_distance.is_nil() ? 0.0 : max_distance.to_float();
 
 				break;
 			}
@@ -384,7 +384,7 @@ namespace physics_config_resource
 	void parse_materials(JSONElement e, List<ObjectName>& names, List<PhysicsMaterial>& objects)
 	{
 		Vector<DynamicString> keys(default_allocator());
-		e.key_value(keys);
+		e.to_keys(keys);
 
 		for (uint32_t i = 0; i < keys.size(); i++)
 		{
@@ -400,9 +400,9 @@ namespace physics_config_resource
 
 			// Read material object
 			PhysicsMaterial mat;
-			mat.static_friction = static_friction.float_value();
-			mat.dynamic_friction = dynamic_friction.float_value();
-			mat.restitution = restitution.float_value();
+			mat.static_friction = static_friction.to_float();
+			mat.dynamic_friction = dynamic_friction.to_float();
+			mat.restitution = restitution.to_float();
 
 			names.push_back(mat_name);
 			objects.push_back(mat);
@@ -412,7 +412,7 @@ namespace physics_config_resource
 	void parse_shapes(JSONElement e, List<NameToMask>& name_to_mask, List<ObjectName>& names, List<PhysicsShape2>& objects)
 	{
 		Vector<DynamicString> keys(default_allocator());
-		e.key_value(keys);
+		e.to_keys(keys);
 
 		for (uint32_t i = 0; i < keys.size(); i++)
 		{
@@ -427,8 +427,8 @@ namespace physics_config_resource
 
 			// Read shape object
 			PhysicsShape2 ps2;
-			ps2.trigger = trigger.bool_value();
-			DynamicString cfilter; collision_filter.string_value(cfilter);
+			ps2.trigger = trigger.to_bool();
+			DynamicString cfilter; collision_filter.to_string(cfilter);
 			ps2.collision_filter = collision_filter_to_mask(cfilter.c_str(), name_to_mask);
 
 			names.push_back(shape_name);
@@ -439,7 +439,7 @@ namespace physics_config_resource
 	void parse_actors(JSONElement e, List<ObjectName>& names, List<PhysicsActor2>& objects)
 	{
 		Vector<DynamicString> keys(default_allocator());
-		e.key_value(keys);
+		e.to_keys(keys);
 
 		for (uint32_t i = 0; i < keys.size(); i++)
 		{
@@ -458,20 +458,20 @@ namespace physics_config_resource
 			// Read actor object
 			PhysicsActor2 pa2;
 			//actor.collision_filter = coll_filter.to_string_id();
-			pa2.linear_damping = linear_damping.is_nil() ? 0.0 : linear_damping.float_value();
-			pa2.angular_damping = angular_damping.is_nil() ? 0.05 : angular_damping.float_value();
+			pa2.linear_damping = linear_damping.is_nil() ? 0.0 : linear_damping.to_float();
+			pa2.angular_damping = angular_damping.is_nil() ? 0.05 : angular_damping.to_float();
 			pa2.flags = 0;
 			if (!dynamic.is_nil())
 			{
-				pa2.flags |= dynamic.bool_value() ? : 0;
+				pa2.flags |= dynamic.to_bool() ? : 0;
 			}
 			if (!kinematic.is_nil())
 			{
-				pa2.flags |= kinematic.bool_value() ? PhysicsActor2::KINEMATIC : 0;
+				pa2.flags |= kinematic.to_bool() ? PhysicsActor2::KINEMATIC : 0;
 			}
 			if (!disable_gravity.is_nil())
 			{
-				pa2.flags |= disable_gravity.bool_value() ? PhysicsActor2::DISABLE_GRAVITY : 0;
+				pa2.flags |= disable_gravity.to_bool() ? PhysicsActor2::DISABLE_GRAVITY : 0;
 			}
 
 			names.push_back(actor_name);
@@ -482,7 +482,7 @@ namespace physics_config_resource
 	void parse_collision_filters(JSONElement e, List<ObjectName>& names, List<PhysicsCollisionFilter>& objects, List<NameToMask>& name_to_mask)
 	{
 		Vector<DynamicString> keys(default_allocator());
-		e.key_value(keys);
+		e.to_keys(keys);
 
 		// Assign a unique mask to each collision filter
 		for (uint32_t i = 0; i < keys.size(); i++)
@@ -505,7 +505,7 @@ namespace physics_config_resource
 
 			// Build mask
 			Vector<DynamicString> collides_with_vector(default_allocator());
-			collides_with.array_value(collides_with_vector);
+			collides_with.to_array(collides_with_vector);
 
 			PhysicsCollisionFilter pcf;
 			pcf.mask = collides_with_to_mask(collides_with_vector, name_to_mask);

+ 11 - 11
engine/resource/SpriteResource.cpp

@@ -58,18 +58,18 @@ void parse_frame(JSONElement frame, List<StringId32>& names, List<FrameData>& re
 	JSONElement scale = frame.key("scale");
 
 	DynamicString frame_name;
-	name.string_value(frame_name);
+	name.to_string(frame_name);
 
 	StringId32 name_hash = hash::murmur2_32(frame_name.c_str(), frame_name.length(), 0);
 	FrameData fd;
-	fd.x0 = region[0].float_value();
-	fd.y0 = region[1].float_value();
-	fd.x1 = region[2].float_value();
-	fd.y1 = region[3].float_value();
-	fd.offset_x = offset[0].float_value();
-	fd.offset_y = offset[1].float_value();
-	fd.scale_x = scale[0].float_value();
-	fd.scale_y = scale[1].float_value();
+	fd.x0 = region[0].to_float();
+	fd.y0 = region[1].to_float();
+	fd.x1 = region[2].to_float();
+	fd.y1 = region[3].to_float();
+	fd.offset_x = offset[0].to_float();
+	fd.offset_y = offset[1].to_float();
+	fd.scale_x = scale[0].to_float();
+	fd.scale_y = scale[1].to_float();
 
 	names.push_back(name_hash);
 	regions.push_back(fd);
@@ -93,8 +93,8 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 	List<uint16_t>			m_indices(default_allocator());
 
 	// Read width/height
-	width = root.key("width").float_value();
-	height = root.key("height").float_value();
+	width = root.key("width").to_float();
+	height = root.key("height").to_float();
 
 	// Read frames
 	JSONElement frames = root.key("frames");

+ 17 - 30
engine/resource/UnitResource.cpp

@@ -122,7 +122,7 @@ int32_t find_node_parent_index(uint32_t node, const List<GraphNode>& nodes, cons
 void parse_nodes(JSONElement e, List<GraphNode>& nodes, List<GraphNodeDepth>& node_depths)
 {
 	Vector<DynamicString> keys(default_allocator());
-	e.key_value(keys);
+	e.to_keys(keys);
 
 	for (uint32_t k = 0; k < keys.size(); k++)
 	{
@@ -136,14 +136,14 @@ void parse_nodes(JSONElement e, List<GraphNode>& nodes, List<GraphNodeDepth>& no
 		if (!node.key("parent").is_nil())
 		{
 			DynamicString parent_name;
-			node.key("parent").string_value(parent_name);
+			node.key("parent").to_string(parent_name);
 			gn.parent = hash::murmur2_32(parent_name.c_str(), parent_name.length(), 0);
 		}
 
 		JSONElement pos = node.key("position");
 		JSONElement rot = node.key("rotation");
-		gn.position = Vector3(pos[0].float_value(), pos[1].float_value(), pos[2].float_value());
-		gn.rotation = Quaternion(Vector3(rot[0].float_value(), rot[1].float_value(), rot[2].float_value()), rot[3].float_value());
+		gn.position = Vector3(pos[0].to_float(), pos[1].to_float(), pos[2].to_float());
+		gn.rotation = Quaternion(Vector3(rot[0].to_float(), rot[1].to_float(), rot[2].to_float()), rot[3].to_float());
 
 		GraphNodeDepth gnd;
 		gnd.name = gn.name;
@@ -159,7 +159,7 @@ void parse_nodes(JSONElement e, List<GraphNode>& nodes, List<GraphNodeDepth>& no
 void parse_cameras(JSONElement e, List<UnitCamera>& cameras, const List<GraphNodeDepth>& node_depths)
 {
 	Vector<DynamicString> keys(default_allocator());
-	e.key_value(keys);
+	e.to_keys(keys);
 
 	for (uint32_t k = 0; k < keys.size(); k++)
 	{
@@ -167,7 +167,7 @@ void parse_cameras(JSONElement e, List<UnitCamera>& cameras, const List<GraphNod
 		JSONElement camera = e.key(camera_name);
 
 		DynamicString node_name;
-		camera.key("node").string_value(node_name);
+		camera.key("node").to_string(node_name);
 
 		StringId32 node_name_hash = hash::murmur2_32(node_name.c_str(), node_name.length());
 
@@ -183,23 +183,23 @@ void parse_cameras(JSONElement e, List<UnitCamera>& cameras, const List<GraphNod
 void parse_renderables(JSONElement e, List<UnitRenderable>& renderables, const List<GraphNodeDepth>& node_depths)
 {
 	Vector<DynamicString> keys(default_allocator());
-	e.key_value(keys);
+	e.to_keys(keys);
 
 	for (uint32_t k = 0; k < keys.size(); k++)
 	{
 		const char* renderable_name = keys[k].c_str();
 		JSONElement renderable = e.key(renderable_name);
 
-		DynamicString node_name; renderable.key("node").string_value(node_name);
+		DynamicString node_name; renderable.key("node").to_string(node_name);
 		StringId32 node_name_hash = hash::murmur2_32(node_name.c_str(), node_name.length(), 0);
 
 		UnitRenderable rn;
 		rn.name = hash::murmur2_32(renderable_name, string::strlen(renderable_name), 0);
 		rn.node = find_node_index(node_name_hash, node_depths);
-		rn.visible = renderable.key("visible").bool_value();
+		rn.visible = renderable.key("visible").to_bool();
 
-		DynamicString res_type; renderable.key("type").string_value(res_type);
-		DynamicString resource_name; renderable.key("resource").string_value(resource_name);
+		DynamicString res_type; renderable.key("type").to_string(res_type);
+		DynamicString resource_name; renderable.key("resource").to_string(resource_name);
 		DynamicString res_name;
 
 		if (res_type == "mesh")
@@ -293,9 +293,7 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 	uint32_t offt = sizeof(UnitHeader);
 	h.renderables_offset         = offt; offt += sizeof(UnitRenderable) * h.num_renderables;
 	h.cameras_offset             = offt; offt += sizeof(UnitCamera) * h.num_cameras;
-	h.scene_graph_names_offset   = offt; offt += sizeof(StringId32) * h.num_scene_graph_nodes;
-	h.scene_graph_poses_offset   = offt; offt += sizeof(Matrix4x4) * h.num_scene_graph_nodes;
-	h.scene_graph_parents_offset = offt; offt += sizeof(int32_t) * h.num_scene_graph_nodes;
+	h.scene_graph_nodes_offset   = offt; offt += sizeof(UnitNode) * h.num_scene_graph_nodes;
 
 	// Write header
 	out_file->write((char*) &h, sizeof(UnitHeader));
@@ -308,27 +306,16 @@ void compile(Filesystem& fs, const char* resource_path, File* out_file)
 	if (m_cameras.size())
 		out_file->write((char*) m_cameras.begin(), sizeof(UnitCamera) * h.num_cameras);
 
-	// Write node names
-	for (uint32_t i = 0; i < h.num_scene_graph_nodes; i++)
-	{
-		StringId32 name = m_node_depths[i].name;
-		out_file->write((char*) &name, sizeof(StringId32));
-	}
-
 	// Write node poses
 	for (uint32_t i = 0; i < h.num_scene_graph_nodes; i++)
 	{
 		uint32_t node_index = m_node_depths[i].index;
 		GraphNode& node = m_nodes[node_index];
-		Matrix4x4 pose(node.rotation, node.position);
-		out_file->write((char*) pose.to_float_ptr(), sizeof(float) * 16);
-	}
-
-	// Write parent hierarchy
-	for (uint32_t i = 0; i < h.num_scene_graph_nodes; i++)
-	{
-		int32_t parent = find_node_parent_index(i, m_nodes, m_node_depths);
-		out_file->write((char*) &parent, sizeof(int32_t));
+		UnitNode un;
+		un.name = node.name;
+		un.parent = find_node_parent_index(i, m_nodes, m_node_depths);
+		un.pose = Matrix4x4(node.rotation, node.position);
+		out_file->write((char*) &un, sizeof(UnitNode));
 	}
 }
 

+ 10 - 43
engine/resource/UnitResource.h

@@ -47,9 +47,7 @@ struct UnitHeader
 	uint32_t num_cameras;
 	uint32_t cameras_offset;
 	uint32_t num_scene_graph_nodes;
-	uint32_t scene_graph_names_offset;
-	uint32_t scene_graph_poses_offset;
-	uint32_t scene_graph_parents_offset;
+	uint32_t scene_graph_nodes_offset;
 };
 
 struct UnitRenderable
@@ -67,6 +65,13 @@ struct UnitCamera
 	int32_t node;
 };
 
+struct UnitNode
+{
+	StringId32 name;
+	Matrix4x4 pose;
+	int32_t parent;
+};
+
 struct UnitResource
 {
 	//-----------------------------------------------------------------------------
@@ -151,48 +156,10 @@ struct UnitResource
 	}
 
 	//-----------------------------------------------------------------------------
-	StringId32* scene_graph_names() const
-	{
-		UnitHeader* h = (UnitHeader*) this;
-		return (StringId32*) (((char*) this) + h->scene_graph_names_offset);
-	}
-
-	//-----------------------------------------------------------------------------
-	Matrix4x4* scene_graph_poses() const
-	{
-		UnitHeader* h = (UnitHeader*) this;
-		return (Matrix4x4*) (((char*) this) + h->scene_graph_poses_offset);
-	}
-
-	//-----------------------------------------------------------------------------
-	int32_t* scene_graph_parents() const
-	{
-		UnitHeader* h = (UnitHeader*) this;
-		return (int32_t*) (((char*) this) + h->scene_graph_parents_offset);
-	}
-
-	//-----------------------------------------------------------------------------
-	StringId32 scene_graph_name(uint32_t i) const
-	{
-		UnitHeader* h = (UnitHeader*) this;
-		StringId32* begin = (StringId32*) (((char*) this) + h->scene_graph_names_offset);
-		return begin[i];
-	}
-
-	//-----------------------------------------------------------------------------
-	Matrix4x4 scene_graph_pose(uint32_t i) const
-	{
-		UnitHeader* h = (UnitHeader*) this;
-		Matrix4x4* begin = (Matrix4x4*) (((char*) this) + h->scene_graph_poses_offset);
-		return begin[i];
-	}
-
-	//-----------------------------------------------------------------------------
-	int32_t scene_graph_parent(uint32_t i) const
+	UnitNode* scene_graph_nodes() const
 	{
 		UnitHeader* h = (UnitHeader*) this;
-		int32_t* begin = (int32_t*) (((char*) this) + h->scene_graph_parents_offset);
-		return begin[i];
+		return (UnitNode*) (((char*) this) + h->scene_graph_nodes_offset);
 	}
 
 private:

+ 3 - 3
engine/tests/json.cpp

@@ -33,9 +33,9 @@ int main()
 
     CE_ASSERT(root.has_key("glossary"), "'glossary' not found!");
 
-    Log::i("%s", root.key("glossary").key("GlossDiv").key("title").string_value());
-    Log::i("%s", root.key("glossary").key("title").string_value());
-    Log::i("%s", root.key("glossary").key("GlossDiv").key("GlossList").key("GlossEntry").key("GlossTerm").string_value());
+    Log::i("%s", root.key("glossary").key("GlossDiv").key("title").to_string());
+    Log::i("%s", root.key("glossary").key("title").to_string());
+    Log::i("%s", root.key("glossary").key("GlossDiv").key("GlossList").key("GlossEntry").key("GlossTerm").to_string());
 
 
 	return 0;

+ 17 - 13
engine/world/SceneGraph.cpp

@@ -52,22 +52,23 @@ SceneGraph::SceneGraph(Allocator& a, uint32_t index)
 }
 
 //-----------------------------------------------------------------------------
-void SceneGraph::create(const Matrix4x4& root, uint32_t count, const StringId32* name, const Matrix4x4* local, int32_t* parent)
+void SceneGraph::create(const Matrix4x4& root, uint32_t count, UnitNode* nodes)
 {
-	char* mem = (char*) m_allocator->allocate(count * (sizeof(uint8_t) + sizeof(Matrix4x4) + sizeof(Matrix4x4) + sizeof(int32_t) + sizeof(StringId32)));
-
 	m_num_nodes = count;
 
-	m_flags = (uint8_t*) mem; mem += sizeof(uint8_t) * count;
-	m_world_poses = (Matrix4x4*) mem; mem += sizeof(Matrix4x4) * count;
-	m_local_poses = (Matrix4x4*) mem; mem += sizeof(Matrix4x4) * count;
-	m_parents = (int32_t*) mem; mem += sizeof(int32_t) * count;
-	m_names = (StringId32*) mem; mem += sizeof(StringId32) * count;
+	m_flags = (uint8_t*) m_allocator->allocate(sizeof(uint8_t) * count);
+	m_world_poses = (Matrix4x4*) m_allocator->allocate(sizeof(Matrix4x4) * count);
+	m_local_poses = (Matrix4x4*) m_allocator->allocate(sizeof(Matrix4x4) * count);
+	m_parents = (int32_t*) m_allocator->allocate(sizeof(int32_t) * count);
+	m_names = (StringId32*) m_allocator->allocate(sizeof(StringId32) * count);
 
-	memset(m_flags, (int) CLEAN, sizeof(uint8_t) * count);
-	memcpy(m_local_poses, local, sizeof(Matrix4x4) * count);
-	memcpy(m_parents, parent, sizeof(int32_t) * count);
-	memcpy(m_names, name, sizeof(StringId32) * count);
+	for (uint32_t i = 0; i < count; i++)
+	{
+		m_flags[i] = (int) CLEAN;
+		m_local_poses[i] = nodes[i].pose;
+		m_parents[i] = -1;
+		m_names[i] = nodes[i].name;
+	}
 
 	// Compute initial world poses
 	for (uint32_t i = 1; i < m_num_nodes; i++)
@@ -84,8 +85,11 @@ void SceneGraph::create(const Matrix4x4& root, uint32_t count, const StringId32*
 //-----------------------------------------------------------------------------
 void SceneGraph::destroy()
 {
-	// m_flags is the start of allocated memory
 	m_allocator->deallocate(m_flags);
+	m_allocator->deallocate(m_world_poses);
+	m_allocator->deallocate(m_local_poses);
+	m_allocator->deallocate(m_parents);
+	m_allocator->deallocate(m_names);
 }
 
 //-----------------------------------------------------------------------------

+ 2 - 1
engine/world/SceneGraph.h

@@ -30,6 +30,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Vector3.h"
 #include "Matrix4x4.h"
 #include "Quaternion.h"
+#include "UnitResource.h"
 
 namespace crown
 {
@@ -44,7 +45,7 @@ struct SceneGraph
 	/// @a name, @a local and @parent are the array containing the name of the nodes,
 	/// the local poses of the nodes and the links between the nodes respectively.
 	/// A parent of -1 means "no parent".
-	void			create(const Matrix4x4& root, uint32_t count, const StringId32* name, const Matrix4x4* local, int32_t* parent);
+	void			create(const Matrix4x4& root, uint32_t count, UnitNode* nodes);
 
 	/// Destroys the graph deallocating memory if necessary.
 	void			destroy();

+ 1 - 2
engine/world/Unit.cpp

@@ -84,8 +84,7 @@ const UnitResource*	Unit::resource() const
 void Unit::create_objects(const Matrix4x4& pose)
 {
 	// Create the scene graph
-	m_scene_graph.create(pose, m_resource->num_scene_graph_nodes(), m_resource->scene_graph_names(),
-							m_resource->scene_graph_poses(), m_resource->scene_graph_parents());
+	m_scene_graph.create(pose, m_resource->num_scene_graph_nodes(), m_resource->scene_graph_nodes());
 
 	create_camera_objects();
 	create_renderable_objects();

+ 5 - 5
engine/world/Unit.h

@@ -72,11 +72,11 @@ struct Mesh;
 struct Sprite;
 struct UnitResource;
 
-#define MAX_CAMERA_COMPONENTS 8
-#define MAX_MESH_COMPONENTS 8
-#define MAX_SPRITE_COMPONENTS 8
-#define MAX_ACTOR_COMPONENTS 8
-#define MAX_MATERIAL_COMPONENTS 8
+#define MAX_CAMERA_COMPONENTS 16
+#define MAX_MESH_COMPONENTS 16
+#define MAX_SPRITE_COMPONENTS 16
+#define MAX_ACTOR_COMPONENTS 16
+#define MAX_MATERIAL_COMPONENTS 16
 
 struct Unit
 {