::zerowing-base=422

This commit is contained in:
Rudolf Polzer
2011-01-11 14:39:55 +01:00
parent 6ce0c65e77
commit 94cb905da9
9 changed files with 1065 additions and 59 deletions

View File

@@ -1,18 +1,17 @@
Index: tools/quake3/q3map2/brush.c
===================================================================
--- tools/quake3/q3map2/brush.c (revision 371)
--- tools/quake3/q3map2/brush.c (revision 391)
+++ tools/quake3/q3map2/brush.c (working copy)
@@ -356,17 +356,29 @@
winding_t *w;
@@ -421,10 +421,16 @@
side_t *side;
plane_t *plane;
+
-
+ static int brushord = -1;
+ brushord++;
+
+ Sys_Printf("In CreateBrushWindings() for brush %i\n", brushord);
-
+
/* walk the list of brush sides */
for( i = 0; i < brush->numsides; i++ )
{
@@ -21,33 +20,46 @@ Index: tools/quake3/q3map2/brush.c
/* get side and plane */
side = &brush->sides[ i ];
plane = &mapplanes[ side->planenum ];
/* make huge winding */
@@ -435,7 +441,13 @@
#else
w = BaseWindingForPlane( plane->normal, plane->dist );
#endif
-
+
+ Sys_Printf(" Before clipping we have:\n");
+ int z;
+ for (z = 0; z < w->numpoints; z++) {
+ Sys_Printf(" (%.8f %.8f %.8f)\n", w->p[z][0], w->p[z][1], w->p[z][2]);
+ }
+
/* walk the list of brush sides */
for( j = 0; j < brush->numsides && w != NULL; j++ )
@@ -379,6 +391,11 @@
continue;
plane = &mapplanes[ brush->sides[ j ].planenum ^ 1 ];
{
@@ -451,7 +463,20 @@
#else
ChopWindingInPlace( &w, plane->normal, plane->dist, 0 ); // CLIP_EPSILON );
#endif
-
+
+ Sys_Printf(" After clipping w/ side %i we have:\n", j);
+ for (z = 0; z < w->numpoints; z++) {
+ Sys_Printf(" (%.8f %.8f %.8f)\n", w->p[z][0], w->p[z][1], w->p[z][2]);
+ if (w)
+ {
+ for (z = 0; z < w->numpoints; z++)
+ {
+ Sys_Printf(" (%.8f %.8f %.8f)\n", w->p[z][0], w->p[z][1], w->p[z][2]);
+ }
+ }
+ else
+ {
+ Sys_Printf(" winding is NULL\n");
+ }
+
/* ydnar: fix broken windings that would generate trifans */
FixWinding( w );
#if EXPERIMENTAL_HIGH_PRECISION_MATH_Q3MAP2_FIXES
FixWindingAccu(w);
Index: tools/quake3/q3map2/map.c
===================================================================
--- tools/quake3/q3map2/map.c (revision 371)
--- tools/quake3/q3map2/map.c (revision 391)
+++ tools/quake3/q3map2/map.c (working copy)
@@ -803,7 +803,11 @@
char shader[ MAX_QPATH ];
@@ -74,7 +86,7 @@ Index: tools/quake3/q3map2/map.c
if( !GetToken( qtrue ) )
break;
if( !strcmp( token, "}" ) )
@@ -917,6 +924,10 @@
@@ -917,7 +924,16 @@
}
/* find the plane number */
@@ -83,5 +95,11 @@ Index: tools/quake3/q3map2/map.c
+ Sys_Printf(" (%f %f %f)\n", planePoints[1][0], planePoints[1][1], planePoints[1][2]);
+ Sys_Printf(" (%f %f %f)\n", planePoints[2][0], planePoints[2][1], planePoints[2][2]);
planenum = MapPlaneFromPoints( planePoints );
+ Sys_Printf(" normal: (%.10f %.10f %.10f)\n",
+ mapplanes[planenum].normal[0],
+ mapplanes[planenum].normal[1],
+ mapplanes[planenum].normal[2]);
+ Sys_Printf(" dist: %.10f\n", mapplanes[planenum].dist);
side->planenum = planenum;
/* bp: get the texture mapping for this texturedef / plane combination */

View File

@@ -0,0 +1,36 @@
Random notes for Rambetter, don't expect to understand this:
============================================================
Brush 0 is the problem.
Side 0 is the problem (under surf tri).
Side 1 is the +y 4-face.
Side 2 is the -x 4-face.
Side 3 is the -y 4-face.
side 4 is the +z tri.
(6144, 16122) -> (6784, 16241)
x "climb" of side 1 is 6784 - 6144 = 640.
y "climb" of side 1 is 16241 - 16122 = 119.
x/y "climb rate" of side 1 is 640 / 119 = 5.378151261.
After clipping side 0 against side 1, we get
************
**** (-262144, -33762.8125) -> (262144, 63722)
************
The slope of that is (262144 + 262144) / (63722 + 33762.8125) = 5.378150571.
(-262144, y) -> (6784, 16241)
So (6784 + 262144) / (16241 - y) = 640 / 119
So y = 16241 - ((119 * (6784 + 262144)) / 640) = -33762.8
(6144, 16122) -> (262144, y)
So (262144 - 6144) / (y - 16122) = 640 / 119
So y = 16122 + ((119 * (262144 - 6144)) / 640) = 63722
After clipping side 0 against side 1 should have
************
**** (-262144, -33762.8) -> (262144, 63722)
************