]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/select.cpp
fixed arbitrary rotation
[xonotic/netradiant.git] / radiant / select.cpp
index 09f0709c83007a13d186a757f422d439c589ddf5..496d96a45b5200635dfcf2347fa8476d481de738 100644 (file)
@@ -228,7 +228,7 @@ void UpdateWorkzone_ForSelection()
 }
 
 // update the workzone to the current selection
-void UpdateWorkzone_ForSelection(const Selectable& selectable)
+void UpdateWorkzone_ForSelectionChanged(const Selectable& selectable)
 {
   if(selectable.isSelected())
   {
@@ -735,9 +735,12 @@ SignalHandlerId Selection_boundsChanged;
 
 void Selection_construct()
 {
-  GlobalSelectionSystem().addSelectionChangeCallback(FreeCaller1<const Selectable&, SceneSelectionChange>());
-  GlobalSelectionSystem().addSelectionChangeCallback(FreeCaller1<const Selectable&, UpdateWorkzone_ForSelection>());
-  Selection_boundsChanged = GlobalSceneGraph().addBoundsChangedCallback(FreeCaller<UpdateWorkzone_ForSelection>());
+  typedef FreeCaller1<const Selectable&, SceneSelectionChange> SceneSelectionChangeCaller;
+  GlobalSelectionSystem().addSelectionChangeCallback(SceneSelectionChangeCaller());
+  typedef FreeCaller1<const Selectable&, UpdateWorkzone_ForSelectionChanged> UpdateWorkzoneForSelectionChangedCaller;
+  GlobalSelectionSystem().addSelectionChangeCallback(UpdateWorkzoneForSelectionChangedCaller());
+  typedef FreeCaller<UpdateWorkzone_ForSelection> UpdateWorkzoneForSelectionCaller;
+  Selection_boundsChanged = GlobalSceneGraph().addBoundsChangedCallback(UpdateWorkzoneForSelectionCaller());
 }
 
 void Selection_destroy()
@@ -753,8 +756,20 @@ void Selection_destroy()
 #include <gtk/gtklabel.h>
 #include <gdk/gdkkeysyms.h>
 
+
 inline Quaternion quaternion_for_euler_xyz_degrees(const Vector3& eulerXYZ)
 {
+#if 0
+  return quaternion_for_matrix4_rotation(matrix4_rotation_for_euler_xyz_degrees(eulerXYZ));
+#elif 0
+  return quaternion_multiplied_by_quaternion(
+    quaternion_multiplied_by_quaternion(
+      quaternion_for_z(degrees_to_radians(eulerXYZ[2])),
+      quaternion_for_y(degrees_to_radians(eulerXYZ[1]))
+    ),
+    quaternion_for_x(degrees_to_radians(eulerXYZ[0]))
+  );
+#elif 1
   double cx = cos(degrees_to_radians(eulerXYZ[0] * 0.5));
   double sx = sin(degrees_to_radians(eulerXYZ[0] * 0.5));
   double cy = cos(degrees_to_radians(eulerXYZ[1] * 0.5));
@@ -763,11 +778,12 @@ inline Quaternion quaternion_for_euler_xyz_degrees(const Vector3& eulerXYZ)
   double sz = sin(degrees_to_radians(eulerXYZ[2] * 0.5));
 
   return Quaternion(
-    static_cast<float>(cx * sy * cz - sx * cy * sz),
-    static_cast<float>(cx * sy * sz + sx * cy * cz),
-    static_cast<float>(cx * cy * sz - sx * sy * cz),
-    static_cast<float>(cx * cy * cz + sx * sy * sz)
+    cz * cy * sx - sz * sy * cx,
+    cz * sy * cx + sz * cy * sx,
+    sz * cy * cx - cz * sy * sx,
+    cz * cy * cx + sz * sy * sx
   );
+#endif
 }
 
 struct RotateDialog