mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-10 07:11:54 +00:00
Fixing a 45 degree model clipping problem.
Introducing Q3MAP2_EXPERIMENTAL_MODEL_CLIPPING_FIX to control the new code, current value is 1 (enable the fix). This code fixes the q3map2 regression test model_clipping_45_degrees. git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@429 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
parent
0475bf8f9c
commit
cb169716fe
2 changed files with 12 additions and 0 deletions
|
@ -431,6 +431,9 @@ void InsertModel( char *name, int frame, m4x4_t transform, remap_t *remap, shade
|
|||
|
||||
/* copy xyz */
|
||||
VectorCopy( dv->xyz, points[ j ] );
|
||||
#if ! Q3MAP2_EXPERIMENTAL_MODEL_CLIPPING_FIX
|
||||
// The code below is totally unneeded regardless of Q3MAP2_EXPERIMENTAL_MODEL_CLIPPING_FIX.
|
||||
// backs is reinitialized further below. However, the extra code does not hurt anything.
|
||||
VectorCopy( dv->xyz, backs[ j ] );
|
||||
|
||||
/* find nearest axial to normal and push back points opposite */
|
||||
|
@ -444,6 +447,7 @@ void InsertModel( char *name, int frame, m4x4_t transform, remap_t *remap, shade
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* make plane for triangle */
|
||||
|
@ -461,8 +465,15 @@ void InsertModel( char *name, int frame, m4x4_t transform, remap_t *remap, shade
|
|||
/* find nearest axial to plane normal and push back points opposite */
|
||||
for( k = 0; k < 3; k++ )
|
||||
{
|
||||
#if Q3MAP2_EXPERIMENTAL_MODEL_CLIPPING_FIX
|
||||
if( fabs( plane[ k ] ) >= fabs( plane[ (k + 1) % 3 ] ) &&
|
||||
fabs( plane[ k ] ) >= fabs( plane[ (k + 2) % 3 ] ) )
|
||||
#else
|
||||
// This code is broken for 45 degree angles where there
|
||||
// is no clear winner.
|
||||
if( fabs( plane[ k ] ) > fabs( plane[ (k + 1) % 3 ] ) &&
|
||||
fabs( plane[ k ] ) > fabs( plane[ (k + 2) % 3 ] ) )
|
||||
#endif
|
||||
{
|
||||
backs[ j ][ k ] += plane[ k ] < 0.0f ? 64.0f : -64.0f;
|
||||
break;
|
||||
|
|
|
@ -127,6 +127,7 @@ constants
|
|||
#define Q3MAP2_EXPERIMENTAL_HIGH_PRECISION_MATH_FIXES 1
|
||||
#define Q3MAP2_EXPERIMENTAL_SNAP_NORMAL_FIX 1
|
||||
#define Q3MAP2_EXPERIMENTAL_SNAP_PLANE_FIX 1
|
||||
#define Q3MAP2_EXPERIMENTAL_MODEL_CLIPPING_FIX 1
|
||||
|
||||
/* general */
|
||||
#define MAX_QPATH 64
|
||||
|
|
Loading…
Reference in a new issue