Sfoglia il codice sorgente

Use raw quaternion representation

Daniele Bartolini 10 anni fa
parent
commit
f010f2f9ec
2 ha cambiato i file con 7 aggiunte e 9 eliminazioni
  1. 6 8
      src/core/json/sjson.cpp
  2. 1 1
      src/core/json/sjson.h

+ 6 - 8
src/core/json/sjson.cpp

@@ -438,14 +438,12 @@ namespace sjson
 		JsonArray array(ta);
 		JsonArray array(ta);
 		sjson::parse_array(json, array);
 		sjson::parse_array(json, array);
 
 
-		Vector3 axis;
-		axis.x = sjson::parse_float(array[0]);
-		axis.y = sjson::parse_float(array[1]);
-		axis.z = sjson::parse_float(array[2]);
-
-		f32 angle = sjson::parse_float(array[3]);
-
-		return quaternion(axis, angle);
+		Quaternion q;
+		q.x = sjson::parse_float(array[0]);
+		q.y = sjson::parse_float(array[1]);
+		q.z = sjson::parse_float(array[2]);
+		q.w = sjson::parse_float(array[3]);
+		return q;
 	}
 	}
 
 
 	Matrix4x4 parse_matrix4x4(const char* json)
 	Matrix4x4 parse_matrix4x4(const char* json)

+ 1 - 1
src/core/json/sjson.h

@@ -64,7 +64,7 @@ namespace sjson
 	Vector4 parse_vector4(const char* json);
 	Vector4 parse_vector4(const char* json);
 
 
 	/// Returns the array @a json as Quaternion.
 	/// Returns the array @a json as Quaternion.
-	/// @note Quaternion = [x, y, z, angle]
+	/// @note Quaternion = [x, y, z, w]
 	Quaternion parse_quaternion(const char* json);
 	Quaternion parse_quaternion(const char* json);
 
 
 	/// Returns the array @a json as Matrix4x4.
 	/// Returns the array @a json as Matrix4x4.