Fixed normalMap() method so that it doesn't produce inverted bump maps.

This commit is contained in:
Chris Laurel 2001-09-07 21:59:13 +00:00
parent 85bfc2d23c
commit e6142070de

View file

@ -316,10 +316,8 @@ void CTexture::normalMap(float scale, bool wrap)
float rmag = 1.0f / mag;
int n = (i * width + j) * 4;
// npixels[n] = (unsigned char) (128 + 127 * dy * rmag);
// npixels[n + 1] = (unsigned char) (128 - 127 * dx * rmag);
npixels[n] = (unsigned char) (128 - 127 * dx * rmag);
npixels[n + 1] = (unsigned char) (128 + 127 * dy * rmag);
npixels[n] = (unsigned char) (128 + 127 * dy * rmag);
npixels[n + 1] = (unsigned char) (128 - 127 * dx * rmag);
npixels[n + 2] = (unsigned char) (128 + 127 * rmag);
npixels[n + 3] = 255;
}