]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/q3map2.h
Importing code changes for q3map2 from Rambetter-math-fix-experiments branch
[xonotic/netradiant.git] / tools / quake3 / q3map2 / q3map2.h
index 9145037b1062fea7a62aeb35e5bcc9f18f4e2bdb..e3de7b7a0e05a57c40c586edda3ad8e2e96ae829 100644 (file)
@@ -122,6 +122,11 @@ constants
 
 ------------------------------------------------------------------------------- */
 
+/* temporary hacks and tests (please keep off in SVN to prevent anyone's legacy map from screwing up) */
+#define EXPERIMENTAL_HIGH_PRECISION_MATH_Q3MAP2_FIXES  0
+#define EXPERIMENTAL_SNAP_NORMAL_FIX                   0
+#define EXPERIMENTAL_SNAP_PLANE_FIX                    0
+
 /* general */
 #define MAX_QPATH                              64
 
@@ -1925,8 +1930,30 @@ Q_EXTERN qboolean                        debugSurfaces Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      debugInset Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      debugPortals Q_ASSIGN( qfalse );
 
+#if EXPERIMENTAL_SNAP_NORMAL_FIX
+// Increasing the normalEpsilon to compensate for new logic in SnapNormal(), where
+// this epsilon is now used to compare against 0 components instead of the 1 or -1
+// components.  Unfortunately, normalEpsilon is also used in PlaneEqual().  So changing
+// this will affect anything that calls PlaneEqual() as well (which are, at the time
+// of this writing, FindFloatPlane() and AddBrushBevels()).
+Q_EXTERN double                                normalEpsilon Q_ASSIGN(0.00005);
+#else
 Q_EXTERN double                                normalEpsilon Q_ASSIGN( 0.00001 );
+#endif
+
+#if EXPERIMENTAL_HIGH_PRECISION_MATH_Q3MAP2_FIXES
+// NOTE: This distanceEpsilon is too small if parts of the map are at maximum world
+// extents (in the range of plus or minus 2^16).  The smallest epsilon at values
+// close to 2^16 is about 0.007, which is greater than distanceEpsilon.  Therefore,
+// maps should be constrained to about 2^15, otherwise slightly undesirable effects
+// may result.  The 0.01 distanceEpsilon used previously is just too coarse in my
+// opinion.  The real fix for this problem is to have 64 bit distances and then make
+// this epsilon even smaller, or to constrain world coordinates to plus minus 2^15
+// (or even 2^14).
+Q_EXTERN double                                distanceEpsilon Q_ASSIGN(0.005);
+#else
 Q_EXTERN double                                distanceEpsilon Q_ASSIGN( 0.01 );
+#endif
 
 
 /* bsp */