More predictable mesh normals generation
This commit is contained in:
parent
d77a7d4c90
commit
6d74896557
2 changed files with 4 additions and 4 deletions
|
@ -182,7 +182,7 @@ static int neighbors[8][2] = {
|
||||||
break; // edge of patch
|
break; // edge of patch
|
||||||
}
|
}
|
||||||
VectorSubtract( ctrl[y][x].xyz, base, temp );
|
VectorSubtract( ctrl[y][x].xyz, base, temp );
|
||||||
if ( VectorNormalize2( temp, temp ) == 0 ) {
|
if ( VectorNormalize( temp ) < 0.001f ) {
|
||||||
continue; // degenerate edge, get more dist
|
continue; // degenerate edge, get more dist
|
||||||
} else {
|
} else {
|
||||||
good[k] = qtrue;
|
good[k] = qtrue;
|
||||||
|
@ -198,7 +198,7 @@ static int neighbors[8][2] = {
|
||||||
continue; // didn't get two points
|
continue; // didn't get two points
|
||||||
}
|
}
|
||||||
CrossProduct( around[(k+1)&7], around[k], normal );
|
CrossProduct( around[(k+1)&7], around[k], normal );
|
||||||
if ( VectorNormalize2( normal, normal ) == 0 ) {
|
if ( VectorNormalize( normal ) < 0.001f ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
VectorAdd( normal, sum, sum );
|
VectorAdd( normal, sum, sum );
|
||||||
|
|
|
@ -182,7 +182,7 @@ static int neighbors[8][2] = {
|
||||||
break; // edge of patch
|
break; // edge of patch
|
||||||
}
|
}
|
||||||
VectorSubtract( ctrl[y][x].xyz, base, temp );
|
VectorSubtract( ctrl[y][x].xyz, base, temp );
|
||||||
if ( VectorNormalize2( temp, temp ) == 0 ) {
|
if ( VectorNormalize( temp ) < 0.001f ) {
|
||||||
continue; // degenerate edge, get more dist
|
continue; // degenerate edge, get more dist
|
||||||
} else {
|
} else {
|
||||||
good[k] = qtrue;
|
good[k] = qtrue;
|
||||||
|
@ -198,7 +198,7 @@ static int neighbors[8][2] = {
|
||||||
continue; // didn't get two points
|
continue; // didn't get two points
|
||||||
}
|
}
|
||||||
CrossProduct( around[(k+1)&7], around[k], normal );
|
CrossProduct( around[(k+1)&7], around[k], normal );
|
||||||
if ( VectorNormalize2( normal, normal ) == 0 ) {
|
if ( VectorNormalize( normal ) < 0.001f ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
VectorAdd( normal, sum, sum );
|
VectorAdd( normal, sum, sum );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue