More predictable mesh normals generation

This commit is contained in:
Eugene 2022-03-21 19:15:52 +02:00 committed by Tim Angus
parent d77a7d4c90
commit 6d74896557
2 changed files with 4 additions and 4 deletions

View file

@ -182,7 +182,7 @@ static int neighbors[8][2] = {
break; // edge of patch
}
VectorSubtract( ctrl[y][x].xyz, base, temp );
if ( VectorNormalize2( temp, temp ) == 0 ) {
if ( VectorNormalize( temp ) < 0.001f ) {
continue; // degenerate edge, get more dist
} else {
good[k] = qtrue;
@ -198,7 +198,7 @@ static int neighbors[8][2] = {
continue; // didn't get two points
}
CrossProduct( around[(k+1)&7], around[k], normal );
if ( VectorNormalize2( normal, normal ) == 0 ) {
if ( VectorNormalize( normal ) < 0.001f ) {
continue;
}
VectorAdd( normal, sum, sum );

View file

@ -182,7 +182,7 @@ static int neighbors[8][2] = {
break; // edge of patch
}
VectorSubtract( ctrl[y][x].xyz, base, temp );
if ( VectorNormalize2( temp, temp ) == 0 ) {
if ( VectorNormalize( temp ) < 0.001f ) {
continue; // degenerate edge, get more dist
} else {
good[k] = qtrue;
@ -198,7 +198,7 @@ static int neighbors[8][2] = {
continue; // didn't get two points
}
CrossProduct( around[(k+1)&7], around[k], normal );
if ( VectorNormalize2( normal, normal ) == 0 ) {
if ( VectorNormalize( normal ) < 0.001f ) {
continue;
}
VectorAdd( normal, sum, sum );