]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/xywindow.cpp
drag-resizing for doom3/quake4 light_radius
[xonotic/netradiant.git] / radiant / xywindow.cpp
index b0c2c055e3fe9fd0bf26121714d7a5052ca68cb1..50dbf879c42a4705d471651918b3afda3887bfd2 100644 (file)
@@ -474,6 +474,7 @@ inline unsigned int buttons_for_state(guint state)
 void XYWnd::SetScale(float f)
 {
   m_fScale = f;
+  updateProjection();
   updateModelview();
   XYWnd_Update(*this);
 }
@@ -844,6 +845,7 @@ XYWnd::XYWnd() :
 
   Map_addValidCallback(g_map, DeferredDrawOnMapValidChangedCaller(m_deferredDraw));
 
+  updateProjection();
   updateModelview();
 
   AddSceneChangeCallback(ReferenceCaller<XYWnd, &XYWnd_Update>(*this));
@@ -2086,7 +2088,7 @@ void XYWnd::updateProjection()
 {
   m_projection[0] = 1.0f / static_cast<float>(m_nWidth / 2);
   m_projection[5] = 1.0f / static_cast<float>(m_nHeight / 2);
-  m_projection[10] = 1.0f / g_MaxWorldCoord;
+  m_projection[10] = 1.0f / (g_MaxWorldCoord * m_fScale);
 
   m_projection[12] = 0.0f;
   m_projection[13] = 0.0f;
@@ -2109,6 +2111,7 @@ void XYWnd::updateProjection()
   m_view.Construct(m_projection, m_modelview, m_nWidth, m_nHeight);
 }
 
+// note: modelview matrix must have a uniform scale, otherwise strange things happen when rendering the rotation manipulator.
 void XYWnd::updateModelview()
 {
   int nDim1 = (m_viewType == YZ) ? 1 : 0;
@@ -2117,7 +2120,7 @@ void XYWnd::updateModelview()
   // translation
   m_modelview[12] = -m_vOrigin[nDim1] * m_fScale;
   m_modelview[13] = -m_vOrigin[nDim2] * m_fScale;
-  m_modelview[14] = static_cast<float>(g_MaxWorldCoord);
+  m_modelview[14] = g_MaxWorldCoord * m_fScale;
 
   // axis base
   switch(m_viewType)
@@ -2133,7 +2136,7 @@ void XYWnd::updateModelview()
 
     m_modelview[8]  =  0;
     m_modelview[9]  =  0;
-    m_modelview[10] = -1.0;
+    m_modelview[10] = -m_fScale;
     break;
   case XZ:
     m_modelview[0]  =  m_fScale;
@@ -2142,7 +2145,7 @@ void XYWnd::updateModelview()
 
     m_modelview[4]  =  0;
     m_modelview[5]  =  0;
-    m_modelview[6]  =  1.0;
+    m_modelview[6]  =  m_fScale;
 
     m_modelview[8]  =  0;
     m_modelview[9]  =  m_fScale;
@@ -2151,7 +2154,7 @@ void XYWnd::updateModelview()
   case YZ:
     m_modelview[0]  =  0;
     m_modelview[1]  =  0;
-    m_modelview[2]  = -1.0;
+    m_modelview[2]  = -m_fScale;
 
     m_modelview[4]  =  m_fScale;
     m_modelview[5]  =  0;