]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge branch 'master' of git://de.git.xonotic.org/xonotic/netradiant
authorRudolf Polzer <divVerent@xonotic.org>
Mon, 17 Oct 2011 04:47:47 +0000 (06:47 +0200)
committerRudolf Polzer <divVerent@xonotic.org>
Mon, 17 Oct 2011 04:47:47 +0000 (06:47 +0200)
.gitattributes
radiant/patch.cpp
radiant/patch.h
radiant/patchmanip.cpp
radiant/renderstate.cpp
tools/quake3/q3map2/bsp.c
tools/quake3/q3map2/q3map2.h
tools/quake3/q3map2/surface_meta.c

index ec3bfe3d1054e3a7f5ebd372dee7c3b00e766d3a..bf8bf302160967d1887e0490d3d16b3d6fe1d3a1 100644 (file)
@@ -1,5 +1,4 @@
 * -crlf
-
 *.0 -diff -crlf
 *.1 crlf=input
 *.3 crlf=input
@@ -27,7 +26,7 @@ branch-manager crlf=input
 BSDmakefile crlf=input
 bsp2ent crlf=input
 *.bsp -diff -crlf
-*.cache -diff -crlf
+*.cache crlf=input
 *.cbp -crlf
 *.cbp -diff -crlf
 *.c crlf=input
@@ -44,15 +43,20 @@ COPYING crlf=input
 *.cpp crlf=input
 create crlf=input
 *.cron crlf=input
+crypto-keygen-standalone -diff -crlf
 *.css crlf=input
 *.cvswrappers crlf=input
+*.d0ir crlf=input
 *.d0pk -diff -crlf
-*.db -diff -crlf
+*.db crlf=input
+*.db.* crlf=input
+*.def2ent crlf=input
 *.default crlf=input
 *.def crlf=input
 *.dem -diff -crlf
 *.dev -crlf
 dir -diff -crlf
+*.directory crlf=input
 djpeg -diff -crlf
 *.dll -diff -crlf
 DOCS -diff -crlf
@@ -68,9 +72,13 @@ Doxyfile crlf=input
 *.dylib -diff -crlf
 empty -diff -crlf
 *.EncoderPlugin crlf=input
+*.ent crlf=input
+etc_svc_git-daemon_run crlf=input
 *.flac -diff -crlf
+*.flp -diff -crlf
 *.form crlf=input
 *.framegroups crlf=input
+*.fteqccfail -diff -crlf
 *.game crlf=input
 *.gdb crlf=input
 gendox crlf=input
@@ -92,10 +100,13 @@ git-svn-update crlf=input
 git-update-octopus crlf=input
 *.glp crlf=input
 *.glsl crlf=input
+GPL-2 crlf=input
+GPL-3 crlf=input
 GPL crlf=input
 *.hardwired crlf=input
 *.h crlf=input
 *.hs crlf=input
+*.htaccess crlf=input
 *.html crlf=input
 *.html-part crlf=input
 *.icns -diff -crlf
@@ -108,7 +119,7 @@ GPL crlf=input
 *.info-2 -diff -crlf
 *.info -diff -crlf
 *.inl crlf=input
-*.instantaction crlf=input
+*.iOS crlf=input
 *.iqm -diff -crlf
 *.java crlf=input
 *.jhm crlf=input
@@ -140,25 +151,31 @@ makespr32 crlf=input
 *.mkdir -diff -crlf
 *.mmpz -diff -crlf
 *.modules crlf=input
+*.mp3 -diff -crlf
 *.nib -crlf
 *.obj -crlf
 OFFSETS -diff -crlf
 *.ogg -diff -crlf
 *.options crlf=input
+*.otf -diff -crlf
 pangorc crlf=input
+*.part crlf=input
 *.patch crlf=input
 *.patchsets crlf=input
+*.pbxproj crlf=input
 *.pc crlf=input
-*.pcx -diff -crlf
 *.pfb -diff -crlf
 *.pfm -diff -crlf
+*.php crlf=input
 *.pk3 -diff -crlf
 PkgInfo crlf=input
 *.pl crlf=input
 *.plist crlf=input
 *.pm crlf=input
 *.png -diff -crlf
+*.po crlf=input
 POSITIONS -diff -crlf
+*.pot crlf=input
 *.proj -crlf
 *.properties crlf=input
 *.psd -diff -crlf
@@ -167,17 +184,19 @@ POSITIONS -diff -crlf
 *.qc crlf=input
 *.qdt crlf=input
 *.qh crlf=input
+*.rar -diff -crlf
 *.rb crlf=input
 *.rc2 crlf=input
 *.rc -crlf
 rdjpgcom -diff -crlf
 *.readme crlf=input
 README crlf=input
-*.rtlights -diff -crlf
+*.rtlights crlf=input
 SCHEMA crlf=input
 *.scm crlf=input
 sdl-config crlf=input
 SDL -diff -crlf
+*.sfd -diff -crlf
 *.shader crlf=input
 *.sh crlf=input
 *.skin crlf=input
@@ -196,15 +215,16 @@ TMAP -diff -crlf
 todo crlf=input
 TODO crlf=input
 *.ttf -diff -crlf
-*.TTF -diff -crlf
 *.txt crlf=input
+*.txt.* crlf=input
 update-shaderlists crlf=input
 *.vbs -crlf
 *.vcproj -crlf
+*.vcxproj crlf=input
 versionbuilder crlf=input
+*.vhost crlf=input
 *.wav -diff -crlf
-*.waypoints -diff -crlf
-w crlf=input
+*.waypoints crlf=input
 *.width crlf=input
 *.workspace -crlf
 wrjpgcom -diff -crlf
@@ -214,9 +234,9 @@ wrjpgcom -diff -crlf
 xonotic-map-compiler-autobuild crlf=input
 xonotic-map-compiler crlf=input
 xonotic-map-screenshot crlf=input
-xonotic-osx-agl crlf=input
 xonotic-osx-sdl crlf=input
 *.xpm crlf=input
+*.xrns -diff -crlf
 *.zip -diff -crlf
 zipdiff crlf=input
 *.zym -diff -crlf
index ac96240f5ece058873618d06d37088c8be52df74..5b2622bb201c78de903a782c344df5f77e99058e 100644 (file)
@@ -1400,6 +1400,90 @@ void Patch::ConstructPrefab(const AABB& aabb, EPatchPrefab eType, int axis, std:
       return;
     }
   }
+  else if (eType == eXactCylinder)
+  {
+       int n = (width - 1) / 2; // n = number of segments
+       setDims(width, height);
+
+       // vPos[0] = vector3_subtracted(aabb.origin, aabb.extents);
+       // vPos[1] = aabb.origin;
+       // vPos[2] = vector3_added(aabb.origin, aabb.extents);
+
+       int i, j;
+       float f = 1 / cos(M_PI / n);
+       for(i = 0; i < width; ++i)
+       {
+               float angle = (M_PI * i) / n; // 0 to 2pi
+               float x = vPos[1][0] + (vPos[2][0] - vPos[1][0]) * cos(angle) * ((i&1) ? f : 1.0f);
+               float y = vPos[1][1] + (vPos[2][1] - vPos[1][1]) * sin(angle) * ((i&1) ? f : 1.0f);
+               for(j = 0; j < height; ++j)
+               {
+                       float z = vPos[0][2] + (vPos[2][2] - vPos[0][2]) * (j / (float)(height - 1));
+                       PatchControl *v;
+                       v = &m_ctrl.data()[j*width+i];
+                       v->m_vertex[0] = x;
+                       v->m_vertex[1] = y;
+                       v->m_vertex[2] = z;
+               }
+       }
+  }
+  else if (eType == eXactCone)
+  {
+       int n = (width - 1) / 2; // n = number of segments
+       setDims(width, height);
+
+       // vPos[0] = vector3_subtracted(aabb.origin, aabb.extents);
+       // vPos[1] = aabb.origin;
+       // vPos[2] = vector3_added(aabb.origin, aabb.extents);
+
+       int i, j;
+       float f = 1 / cos(M_PI / n);
+       for(i = 0; i < width; ++i)
+       {
+               float angle = (M_PI * i) / n;
+               for(j = 0; j < height; ++j)
+               {
+                       float x = vPos[1][0] + (1.0f - (j / (float)(height - 1))) * (vPos[2][0] - vPos[1][0]) * cos(angle) * ((i&1) ? f : 1.0f);
+                       float y = vPos[1][1] + (1.0f - (j / (float)(height - 1))) * (vPos[2][1] - vPos[1][1]) * sin(angle) * ((i&1) ? f : 1.0f);
+                       float z = vPos[0][2] + (vPos[2][2] - vPos[0][2]) * (j / (float)(height - 1));
+                       PatchControl *v;
+                       v = &m_ctrl.data()[j*width+i];
+                       v->m_vertex[0] = x;
+                       v->m_vertex[1] = y;
+                       v->m_vertex[2] = z;
+               }
+       }
+  }
+  else if (eType == eXactSphere)
+  {
+       int n = (width - 1) / 2; // n = number of segments (yaw)
+       int m = (height - 1) / 2; // m = number of segments (pitch)
+       setDims(width, height);
+
+       // vPos[0] = vector3_subtracted(aabb.origin, aabb.extents);
+       // vPos[1] = aabb.origin;
+       // vPos[2] = vector3_added(aabb.origin, aabb.extents);
+
+       int i, j;
+       float f = 1 / cos(M_PI / n);
+       float g = 1 / cos(M_PI / (2*m));
+       for(i = 0; i < width; ++i)
+       {
+               float angle = (M_PI * i) / n;
+               for(j = 0; j < height; ++j)
+               {
+                       float angle2 = (M_PI * j) / (2*m);
+                       float x = vPos[1][0] + (vPos[2][0] - vPos[1][0]) *  sin(angle2) * ((j&1) ? g : 1.0f) * cos(angle) * ((i&1) ? f : 1.0f);
+                       float y = vPos[1][1] + (vPos[2][1] - vPos[1][1]) *  sin(angle2) * ((j&1) ? g : 1.0f) * sin(angle) * ((i&1) ? f : 1.0f);
+                       float z = vPos[1][2] + (vPos[2][2] - vPos[1][2]) * -cos(angle2) * ((j&1) ? g : 1.0f);
+                       PatchControl *v;
+                       v = &m_ctrl.data()[j*width+i];
+                       v->m_vertex[0] = x;
+                       v->m_vertex[1] = y;
+                       v->m_vertex[2] = z;
+               }
+       }
+  }
   else if  (eType == eBevel)
   {
     unsigned char *pIndex;
index d55e712b97547e31abb39c15e4fd1e6b0eb20035..403c43bcc02ee7e920e1dabd1b85a530e90b586b 100644 (file)
@@ -102,6 +102,9 @@ enum EPatchPrefab
   eSqCylinder,
   eCone,
   eSphere,
+  eXactCylinder,
+  eXactSphere,
+  eXactCone,
 };
 
 enum EMatrixMajor
index b8bccee63d735ad3c8bb40279880f08ca13d4624..6829fee7db3455e3b9025f0974bb63d5a60610df 100644 (file)
@@ -432,6 +432,29 @@ AABB PatchCreator_getBounds()
   return AABB(Vector3(0, 0, 0), Vector3(64, 64, 64));
 }
 
+void DoNewPatchDlg(EPatchPrefab prefab, int minrows, int mincols, int defrows, int defcols, int maxrows, int maxcols);
+
+void Patch_XactCylinder()
+{
+  UndoableCommand undo("patchCreateXactCylinder");
+
+  DoNewPatchDlg(eXactCylinder, 3, 7, 3, 13, 0, 0);
+}
+
+void Patch_XactSphere()
+{
+  UndoableCommand undo("patchCreateXactSphere");
+
+  DoNewPatchDlg(eXactSphere, 5, 7, 7, 13, 0, 0);
+}
+
+void Patch_XactCone()
+{
+  UndoableCommand undo("patchCreateXactCone");
+
+  DoNewPatchDlg(eXactCone, 3, 7, 3, 13, 0, 0);
+}
+
 void Patch_Cylinder()
 {
   UndoableCommand undo("patchCreateCylinder");
@@ -496,13 +519,11 @@ void Patch_Cone()
   Scene_PatchConstructPrefab(GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader(GlobalTextureBrowser()), eCone, GlobalXYWnd_getCurrentViewType());
 }
 
-void DoNewPatchDlg();
-
 void Patch_Plane()
 {
   UndoableCommand undo("patchCreatePlane");
 
-  DoNewPatchDlg();
+  DoNewPatchDlg(ePlane, 3, 3, 3, 3, 0, 0);
 }
 
 void Patch_InsertInsertColumn()
@@ -746,6 +767,9 @@ void Patch_registerCommands()
   GlobalCommands_insert("PatchDenseCylinder", FreeCaller<Patch_DenseCylinder>());
   GlobalCommands_insert("PatchVeryDenseCylinder", FreeCaller<Patch_VeryDenseCylinder>());
   GlobalCommands_insert("PatchSquareCylinder", FreeCaller<Patch_SquareCylinder>());
+  GlobalCommands_insert("PatchXactCylinder", FreeCaller<Patch_XactCylinder>());
+  GlobalCommands_insert("PatchXactSphere", FreeCaller<Patch_XactSphere>());
+  GlobalCommands_insert("PatchXactCone", FreeCaller<Patch_XactCone>());
   GlobalCommands_insert("PatchEndCap", FreeCaller<Patch_Endcap>());
   GlobalCommands_insert("PatchBevel", FreeCaller<Patch_Bevel>());
   GlobalCommands_insert("PatchSquareBevel", FreeCaller<Patch_SquareBevel>());
@@ -788,6 +812,7 @@ void Patch_constructMenu(GtkMenu* menu)
     create_menu_item_with_mnemonic(menu_in_menu, "Dense Cylinder", "PatchDenseCylinder");
     create_menu_item_with_mnemonic(menu_in_menu, "Very Dense Cylinder", "PatchVeryDenseCylinder");
     create_menu_item_with_mnemonic(menu_in_menu, "Square Cylinder", "PatchSquareCylinder");
+    create_menu_item_with_mnemonic(menu_in_menu, "Exact Cylinder...", "PatchXactCylinder");
   }
   menu_separator (menu);
   create_menu_item_with_mnemonic(menu, "End cap", "PatchEndCap");
@@ -801,7 +826,10 @@ void Patch_constructMenu(GtkMenu* menu)
   }
   menu_separator (menu);
   create_menu_item_with_mnemonic(menu, "Cone", "PatchCone");
+  create_menu_item_with_mnemonic(menu, "Exact Cone...", "PatchXactCone");
+  menu_separator (menu);
   create_menu_item_with_mnemonic(menu, "Sphere", "PatchSphere");
+  create_menu_item_with_mnemonic(menu, "Exact Sphere...", "PatchXactSphere");
   menu_separator (menu);
   create_menu_item_with_mnemonic(menu, "Simple Patch Mesh...", "SimplePatchMesh");
   menu_separator (menu);
@@ -866,7 +894,7 @@ void Patch_constructMenu(GtkMenu* menu)
 #include "gtkutil/dialog.h"
 #include "gtkutil/widget.h"
 
-void DoNewPatchDlg()
+void DoNewPatchDlg(EPatchPrefab prefab, int minrows, int mincols, int defrows, int defcols, int maxrows, int maxcols)
 {
   ModalDialog dialog;
   GtkComboBox* width;
@@ -902,21 +930,23 @@ void DoNewPatchDlg()
 
       {
         GtkComboBox* combo = GTK_COMBO_BOX(gtk_combo_box_new_text());
-        gtk_combo_box_append_text(combo, "3");
-        gtk_combo_box_append_text(combo, "5");
-        gtk_combo_box_append_text(combo, "7");
-        gtk_combo_box_append_text(combo, "9");
-        gtk_combo_box_append_text(combo, "11");
-        gtk_combo_box_append_text(combo, "13");
-        gtk_combo_box_append_text(combo, "15");
-        gtk_combo_box_append_text(combo, "17");
-        gtk_combo_box_append_text(combo, "19");
-        gtk_combo_box_append_text(combo, "21");
-        gtk_combo_box_append_text(combo, "23");
-        gtk_combo_box_append_text(combo, "25");
-        gtk_combo_box_append_text(combo, "27");
-        gtk_combo_box_append_text(combo, "29");
-        gtk_combo_box_append_text(combo, "31"); // MAX_PATCH_SIZE is 32, so we should be able to do 31...
+#define D_ITEM(x) if(x >= mincols && (!maxcols || x <= maxcols)) gtk_combo_box_append_text(combo, #x)
+       D_ITEM(3);
+        D_ITEM(5);
+        D_ITEM(7);
+        D_ITEM(9);
+        D_ITEM(11);
+        D_ITEM(13);
+        D_ITEM(15);
+        D_ITEM(17);
+        D_ITEM(19);
+        D_ITEM(21);
+        D_ITEM(23);
+        D_ITEM(25);
+        D_ITEM(27);
+        D_ITEM(29);
+        D_ITEM(31); // MAX_PATCH_SIZE is 32, so we should be able to do 31...
+#undef D_ITEM
         gtk_widget_show(GTK_WIDGET(combo));
         gtk_table_attach(table, GTK_WIDGET(combo), 1, 2, 0, 1,
                           (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
@@ -926,21 +956,23 @@ void DoNewPatchDlg()
       }
       {
         GtkComboBox* combo = GTK_COMBO_BOX(gtk_combo_box_new_text());
-        gtk_combo_box_append_text(combo, "3");
-        gtk_combo_box_append_text(combo, "5");
-        gtk_combo_box_append_text(combo, "7");
-        gtk_combo_box_append_text(combo, "9");
-        gtk_combo_box_append_text(combo, "11");
-        gtk_combo_box_append_text(combo, "13");
-        gtk_combo_box_append_text(combo, "15");
-        gtk_combo_box_append_text(combo, "17");
-        gtk_combo_box_append_text(combo, "19");
-        gtk_combo_box_append_text(combo, "21");
-        gtk_combo_box_append_text(combo, "23");
-        gtk_combo_box_append_text(combo, "25");
-        gtk_combo_box_append_text(combo, "27");
-        gtk_combo_box_append_text(combo, "29");
-        gtk_combo_box_append_text(combo, "31"); // MAX_PATCH_SIZE is 32, so we should be able to do 31...
+#define D_ITEM(x) if(x >= minrows && (!maxrows || x <= maxrows)) gtk_combo_box_append_text(combo, #x)
+       D_ITEM(3);
+        D_ITEM(5);
+        D_ITEM(7);
+        D_ITEM(9);
+        D_ITEM(11);
+        D_ITEM(13);
+        D_ITEM(15);
+        D_ITEM(17);
+        D_ITEM(19);
+        D_ITEM(21);
+        D_ITEM(23);
+        D_ITEM(25);
+        D_ITEM(27);
+        D_ITEM(29);
+        D_ITEM(31); // MAX_PATCH_SIZE is 32, so we should be able to do 31...
+#undef D_ITEM
         gtk_widget_show(GTK_WIDGET(combo));
         gtk_table_attach(table, GTK_WIDGET(combo), 1, 2, 1, 2,
                           (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
@@ -969,15 +1001,15 @@ void DoNewPatchDlg()
   }
 
   // Initialize dialog
-  gtk_combo_box_set_active(width, 0);
-  gtk_combo_box_set_active(height, 0);
+  gtk_combo_box_set_active(width, (defcols - mincols) / 2);
+  gtk_combo_box_set_active(height, (defrows - minrows) / 2);
 
   if(modal_dialog_show(window, dialog) == eIDOK)
   {
-    int w = gtk_combo_box_get_active(width) * 2 + 3;
-    int h = gtk_combo_box_get_active(height) * 2 + 3;
+    int w = gtk_combo_box_get_active(width) * 2 + mincols;
+    int h = gtk_combo_box_get_active(height) * 2 + minrows;
 
-    Scene_PatchConstructPrefab(GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader(GlobalTextureBrowser()), ePlane, GlobalXYWnd_getCurrentViewType(), w, h);
+    Scene_PatchConstructPrefab(GlobalSceneGraph(), PatchCreator_getBounds(), TextureBrowser_GetSelectedShader(GlobalTextureBrowser()), prefab, GlobalXYWnd_getCurrentViewType(), w, h);
   }
 
   gtk_widget_destroy(GTK_WIDGET(window));
index 2f5596d13f23ba14d20860bc0d9d0845b6d61ef5..2ec1f7b6e4e561bb9c7fad719f3947ea2f4925e7 100644 (file)
@@ -1827,7 +1827,7 @@ void OpenGLState_apply(const OpenGLState& self, OpenGLState& current, unsigned i
   {
     glEnable(GL_LIGHTING);
     glEnable(GL_COLOR_MATERIAL);
-    //qglEnable(GL_RESCALE_NORMAL);
+    glEnable(GL_RESCALE_NORMAL);
     glEnableClientState(GL_NORMAL_ARRAY);
     GlobalOpenGL_debugAssertNoErrors();
     g_normalArray_enabled = true;
@@ -1836,7 +1836,7 @@ void OpenGLState_apply(const OpenGLState& self, OpenGLState& current, unsigned i
   {
     glDisable(GL_LIGHTING);
     glDisable(GL_COLOR_MATERIAL);
-    //qglDisable(GL_RESCALE_NORMAL);
+    glDisable(GL_RESCALE_NORMAL);
     glDisableClientState(GL_NORMAL_ARRAY);
     GlobalOpenGL_debugAssertNoErrors();
     g_normalArray_enabled = false;
index 7901979237dc0b8bfc7a676e15d33e3f26410dcd..54e14bf12f895f2e9bd1039bce48bbe249211757 100644 (file)
@@ -810,7 +810,7 @@ int BSPMain( int argc, char **argv )
                {
                        npDegrees = atof( argv[ i + 1 ] );
                        if( npDegrees < 0.0f )
-                               shadeAngleDegrees = 0.0f;
+                               npDegrees = 0.0f;
                        else if( npDegrees > 0.0f )
                                Sys_Printf( "Forcing nonplanar surfaces with a breaking angle of %f degrees\n", npDegrees );
                        i++;
@@ -856,6 +856,33 @@ int BSPMain( int argc, char **argv )
                        Sys_Printf( "Creating meta surfaces from brush faces\n" );
                        meta = qtrue;
                }
+               else if( !strcmp( argv[ i ], "-metaadequatescore" ) )
+               {
+                       metaAdequateScore = atoi( argv[ i + 1 ]);
+                       if( metaAdequateScore < 0 )
+                               metaAdequateScore = -1;
+                       i++;
+                       if( metaAdequateScore >= 0 )
+                               Sys_Printf( "Setting ADEQUATE meta score to %d (see surface_meta.c)\n", metaAdequateScore );
+               }
+               else if( !strcmp( argv[ i ], "-metagoodscore" ) )
+               {
+                       metaGoodScore = atoi( argv[ i + 1 ]);
+                       if( metaGoodScore < 0 )
+                               metaGoodScore = -1;
+                       i++;
+                       if( metaGoodScore >= 0 )
+                               Sys_Printf( "Setting GOOD meta score to %d (see surface_meta.c)\n", metaGoodScore );
+               }
+               else if( !strcmp( argv[ i ], "-metamaxbboxdistance" ) )
+               {
+                       metaMaxBBoxDistance = atof( argv[ i + 1 ]);
+                       if( metaMaxBBoxDistance < 0 )
+                               metaMaxBBoxDistance = -1;
+                       i++;
+                       if( metaMaxBBoxDistance >= 0 )
+                               Sys_Printf( "Setting meta maximum bounding box distance to %f\n", metaMaxBBoxDistance );
+               }
                else if( !strcmp( argv[ i ], "-patchmeta" ) )
                {
                        Sys_Printf( "Creating meta surfaces from patches\n" );
index 4b020fdd26641812414edbf297a91138b1bbd2e0..64494462e356e9dbfc3f175b2447730f2a52ee76 100644 (file)
@@ -2034,6 +2034,9 @@ Q_EXTERN qboolean                 debugPortals Q_ASSIGN( qfalse );
 Q_EXTERN qboolean           lightmapTriangleCheck Q_ASSIGN(qfalse);
 Q_EXTERN qboolean           lightmapExtraVisClusterNudge Q_ASSIGN(qfalse);
 Q_EXTERN qboolean           lightmapFill Q_ASSIGN(qfalse);
+Q_EXTERN int                           metaAdequateScore Q_ASSIGN( -1 );
+Q_EXTERN int                           metaGoodScore Q_ASSIGN( -1 );
+Q_EXTERN float                         metaMaxBBoxDistance Q_ASSIGN( -1 );
 
 #if Q3MAP2_EXPERIMENTAL_SNAP_NORMAL_FIX
 // Increasing the normalEpsilon to compensate for new logic in SnapNormal(), where
index 8a6848559b13a5e114ebf62e506407a097ed5781..7f7d0b74e148a0bb5d0ea5f06566a486ec6d54ba 100644 (file)
@@ -1388,17 +1388,20 @@ returns the score of the triangle added
 #define AXIS_SCORE                     100000
 #define AXIS_MIN                       100000
 #define VERT_SCORE                     10000
-#define SURFACE_SCORE          1000
+#define SURFACE_SCORE                  1000
 #define ST_SCORE                       50
 #define ST_SCORE2                      (2 * (ST_SCORE))
 
-#define ADEQUATE_SCORE         ((AXIS_MIN) + 1 * (VERT_SCORE))
-#define GOOD_SCORE                     ((AXIS_MIN) + 2 * (VERT_SCORE)                   + 4 * (ST_SCORE))
-#define PERFECT_SCORE          ((AXIS_MIN) + 3 * (VERT_SCORE) + (SURFACE_SCORE) + 4 * (ST_SCORE))
-//#define MAX_BBOX_DISTANCE   16
+#define DEFAULT_ADEQUATE_SCORE         ((AXIS_MIN) + 1 * (VERT_SCORE))
+#define DEFAULT_GOOD_SCORE             ((AXIS_MIN) + 2 * (VERT_SCORE)                   + 4 * (ST_SCORE))
+#define         PERFECT_SCORE          ((AXIS_MIN) + 3 * (VERT_SCORE) + (SURFACE_SCORE) + 4 * (ST_SCORE))
+
+#define ADEQUATE_SCORE                         (metaAdequateScore >= 0 ? metaAdequateScore : DEFAULT_ADEQUATE_SCORE)
+#define GOOD_SCORE                     (metaGoodScore     >= 0 ? metaGoodScore     : DEFAULT_GOOD_SCORE)
 
 static int AddMetaTriangleToSurface( mapDrawSurface_t *ds, metaTriangle_t *tri, qboolean testAdd )
 {
+       vec3_t                          p;
        int                                     i, score, coincident, ai, bi, ci, oldTexRange[ 2 ];
        float                           lmMax;
        vec3_t                          mins, maxs;
@@ -1433,31 +1436,37 @@ static int AddMetaTriangleToSurface( mapDrawSurface_t *ds, metaTriangle_t *tri,
                        return 0;
        }
 
-#if MAX_BBOX_DISTANCE > 0
-       VectorCopy( ds->mins, mins );
-       VectorCopy( ds->maxs, maxs );
-       mins[0] -= MAX_BBOX_DISTANCE;
-       mins[1] -= MAX_BBOX_DISTANCE;
-       mins[2] -= MAX_BBOX_DISTANCE;
-       maxs[0] += MAX_BBOX_DISTANCE;
-       maxs[1] += MAX_BBOX_DISTANCE;
-       maxs[2] += MAX_BBOX_DISTANCE;
-#define CHECK_1D(mins, v, maxs) ((mins) <= (v) && (v) <= (maxs))
-#define CHECK_3D(mins, v, maxs) (CHECK_1D((mins)[0], (v)[0], (maxs)[0]) && CHECK_1D((mins)[1], (v)[1], (maxs)[1]) && CHECK_1D((mins)[2], (v)[2], (maxs)[2]))
-       VectorCopy(metaVerts[ tri->indexes[ 0 ] ].xyz, p);
-       if(!CHECK_3D(mins, p, maxs))
+       
+
+       if(metaMaxBBoxDistance >= 0)
        {
-               VectorCopy(metaVerts[ tri->indexes[ 1 ] ].xyz, p);
-               if(!CHECK_3D(mins, p, maxs))
+               if(ds->numIndexes > 0)
                {
-                       VectorCopy(metaVerts[ tri->indexes[ 2 ] ].xyz, p);
+                       VectorCopy( ds->mins, mins );
+                       VectorCopy( ds->maxs, maxs );
+                       mins[0] -= metaMaxBBoxDistance;
+                       mins[1] -= metaMaxBBoxDistance;
+                       mins[2] -= metaMaxBBoxDistance;
+                       maxs[0] += metaMaxBBoxDistance;
+                       maxs[1] += metaMaxBBoxDistance;
+                       maxs[2] += metaMaxBBoxDistance;
+#define CHECK_1D(mins, v, maxs) ((mins) <= (v) && (v) <= (maxs))
+#define CHECK_3D(mins, v, maxs) (CHECK_1D((mins)[0], (v)[0], (maxs)[0]) && CHECK_1D((mins)[1], (v)[1], (maxs)[1]) && CHECK_1D((mins)[2], (v)[2], (maxs)[2]))
+                       VectorCopy(metaVerts[ tri->indexes[ 0 ] ].xyz, p);
                        if(!CHECK_3D(mins, p, maxs))
-                               return 0;
-               }
-       }
+                       {
+                               VectorCopy(metaVerts[ tri->indexes[ 1 ] ].xyz, p);
+                               if(!CHECK_3D(mins, p, maxs))
+                               {
+                                       VectorCopy(metaVerts[ tri->indexes[ 2 ] ].xyz, p);
+                                       if(!CHECK_3D(mins, p, maxs))
+                                               return 0;
+                               }
+                       }
 #undef CHECK_3D
 #undef CHECK_1D
-#endif
+               }
+       }
        
        /* set initial score */
        score = tri->surfaceNum == ds->surfaceNum ? SURFACE_SCORE : 0;