]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/brush.h
Automatically determine the number of threads on linux
[xonotic/netradiant.git] / radiant / brush.h
index 319bcf2262acb0fc050ddac56e6ddf6393b0d974..158077fd37e86237dc17d7ffd62e10a50930fcd9 100644 (file)
@@ -1193,9 +1193,7 @@ public:
   void transform(const Matrix4& matrix, bool mirror)
   {
     if(g_brush_texturelock_enabled)
-    {
       Texdef_transformLocked(m_texdefTransformed, m_shader.width(), m_shader.height(), m_plane.plane3(), matrix);
-    }
 
     m_planeTransformed.transform(matrix, mirror);
 
@@ -1203,6 +1201,9 @@ public:
     ASSERT_MESSAGE(projectionaxis_for_normal(normal) == projectionaxis_for_normal(plane3().normal()), "bleh");
 #endif
     m_observer->planeChanged();
+
+    if(g_brush_texturelock_enabled)
+      Brush_textureChanged();
   }
 
   void assign_planepts(const PlanePoints planepts)
@@ -1541,10 +1542,13 @@ void add_brush_filter(BrushFilter& filter, int mask, bool invert = false);
 
 
 /// \brief Returns true if 'self' takes priority when building brush b-rep.
-inline bool plane3_inside(const Plane3& self, const Plane3& other)
+inline bool plane3_inside(const Plane3& self, const Plane3& other, bool selfIsLater)
 {
   if(vector3_equal_epsilon(self.normal(), other.normal(), 0.001))
   {
+    // same plane? prefer the one with smaller index
+    if(self.dist() == other.dist())
+      return selfIsLater;
     return self.dist() < other.dist();
   }
   return true;
@@ -2110,12 +2114,12 @@ public:
     if(m_type == eBrushTypeQuake3BP || m_type == eBrushTypeDoom3 || m_type == eBrushTypeQuake4)
     {
       g_bp_globals.m_texdefTypeId = TEXDEFTYPEID_BRUSHPRIMITIVES;
-      g_brush_texturelock_enabled = true;
+      // g_brush_texturelock_enabled = true; // bad idea, this overrides user setting
     }
     else if(m_type == eBrushTypeHalfLife)
     {
       g_bp_globals.m_texdefTypeId = TEXDEFTYPEID_HALFLIFE;
-      g_brush_texturelock_enabled = true;
+      // g_brush_texturelock_enabled = true; // bad idea, this overrides user setting
     }
 
     Face::m_quantise = (m_type == eBrushTypeQuake) ? quantiseInteger : quantiseFloating;
@@ -2419,7 +2423,7 @@ private:
     // duplicate plane
     for(std::size_t i = 0; i < m_faces.size(); ++i)
     {
-      if(index != i && !plane3_inside(m_faces[index]->plane3(), m_faces[i]->plane3()))
+      if(index != i && !plane3_inside(m_faces[index]->plane3(), m_faces[i]->plane3(), index < i))
       {
         return false;
       }
@@ -3268,7 +3272,7 @@ public:
       // also draw a line indicating the direction of the cut
          Vector3 lineverts[2];
          Winding_Centroid(m_winding, m_plane, lineverts[0]);
-         lineverts[1] = vector3_added(lineverts[0], vector3_scaled(m_plane.normal(), g_MaxWorldCoord * 4));
+         lineverts[1] = vector3_added(lineverts[0], vector3_scaled(m_plane.normal(), Brush::m_maxWorldCoord * 4));
 
          glVertexPointer(3, GL_FLOAT, sizeof(Vector3), &lineverts[0]);
          glDrawArrays(GL_LINES, 0, GLsizei(2));