diff --git a/reaction/Reaction-ChangeLog b/reaction/Reaction-ChangeLog index 147444ca..b7cf24ff 100644 --- a/reaction/Reaction-ChangeLog +++ b/reaction/Reaction-ChangeLog @@ -1,3 +1,4 @@ +- Fix a bug in new curves code - System menu makes a bit more sense now (removed irrelevant options, added new presets) - Change imagelist cmd to give more relevant information - Remove DiffuseRoughness shader param, add SpecularExponent shader param diff --git a/reaction/code/renderergl2/tr_curve.c b/reaction/code/renderergl2/tr_curve.c index 1f01a1d8..3d439257 100644 --- a/reaction/code/renderergl2/tr_curve.c +++ b/reaction/code/renderergl2/tr_curve.c @@ -537,7 +537,7 @@ srfGridMesh_t *R_SubdividePatchToGrid( int width, int height, consecutiveComplete = 0; // horizontal subdivisions - for ( j = 0 ; ; j = (j + 2) % (width - 2) ) { + for ( j = 0 ; ; j = (j + 2) % (width - 1) ) { // check subdivided midpoints against control points // FIXME: also check midpoints of adjacent patches against the control points @@ -579,9 +579,8 @@ srfGridMesh_t *R_SubdividePatchToGrid( int width, int height, // if all the points are on the lines, remove the entire columns if ( maxLen < 0.1f ) { errorTable[dir][j+1] = 999; - consecutiveComplete++; // if we go over the whole grid twice without adding any columns, stop - if (consecutiveComplete >= (width - 2)) + if (++consecutiveComplete >= width) break; continue; } @@ -594,17 +593,16 @@ srfGridMesh_t *R_SubdividePatchToGrid( int width, int height, if ( maxLen <= r_subdivisions->value ) { errorTable[dir][j+1] = 1.0f/maxLen; - consecutiveComplete++; // if we go over the whole grid twice without adding any columns, stop - if (consecutiveComplete >= (width - 2)) + if (++consecutiveComplete >= width) break; continue; // didn't need subdivision } - consecutiveComplete = 0; - errorTable[dir][j+2] = 1.0f/maxLen; + consecutiveComplete = 0; + // insert two columns and replace the peak width += 2; for ( i = 0 ; i < height ; i++ ) {